haikuwebkit/Source/WTF/wtf/Nonmovable.h

32 lines
1.4 KiB
C
Raw Permalink Normal View History

[JSC] LLIntPrototypeLoadAdaptiveStructureWatchpoint does not require Bag<> https://bugs.webkit.org/show_bug.cgi?id=197645 Reviewed by Saam Barati. Source/JavaScriptCore: We are using HashMap<std::tuple<Structure*, const Instruction*>, Bag<LLIntPrototypeLoadAdaptiveStructureWatchpoint>> for LLIntPrototypeLoadAdaptiveStructureWatchpoint, but this has several memory inefficiency. 1. Structure* and Instruction* are too large. We can just use StructureID and bytecodeOffset (unsigned). 2. While we are using Bag<>, we do not add a new LLIntPrototypeLoadAdaptiveStructureWatchpoint after constructing this Bag first. So we can use Vector<LLIntPrototypeLoadAdaptiveStructureWatchpoint> instead. We ensure that new entry won't be added to this Vector by making Watchpoint non-movable. 3. Instead of having OpGetById::Metadata&, we just hold `unsigned` bytecodeOffset, and get Metadata& from the owner CodeBlock when needed. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecode/CodeBlock.h: * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h: * bytecode/Watchpoint.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setupGetByIdPrototypeCache): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Nonmovable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * wtf/Vector.h: (WTF::minCapacity>::uncheckedConstructAndAppend): Canonical link: https://commits.webkit.org/211829@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-08 04:35:36 +00:00
/*
* Copyright (C) 2019 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#define WTF_MAKE_NONMOVABLE(ClassName) \
ClassName(ClassName&&) = delete; \
ClassName& operator=(ClassName&&) = delete; \
[JSC] LLIntPrototypeLoadAdaptiveStructureWatchpoint does not require Bag<> https://bugs.webkit.org/show_bug.cgi?id=197645 Reviewed by Saam Barati. Source/JavaScriptCore: We are using HashMap<std::tuple<Structure*, const Instruction*>, Bag<LLIntPrototypeLoadAdaptiveStructureWatchpoint>> for LLIntPrototypeLoadAdaptiveStructureWatchpoint, but this has several memory inefficiency. 1. Structure* and Instruction* are too large. We can just use StructureID and bytecodeOffset (unsigned). 2. While we are using Bag<>, we do not add a new LLIntPrototypeLoadAdaptiveStructureWatchpoint after constructing this Bag first. So we can use Vector<LLIntPrototypeLoadAdaptiveStructureWatchpoint> instead. We ensure that new entry won't be added to this Vector by making Watchpoint non-movable. 3. Instead of having OpGetById::Metadata&, we just hold `unsigned` bytecodeOffset, and get Metadata& from the owner CodeBlock when needed. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecode/CodeBlock.h: * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h: * bytecode/Watchpoint.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setupGetByIdPrototypeCache): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Nonmovable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * wtf/Vector.h: (WTF::minCapacity>::uncheckedConstructAndAppend): Canonical link: https://commits.webkit.org/211829@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-08 04:35:36 +00:00