Changeset 203081 in webkit


Ignore:
Timestamp:
Jul 11, 2016, 1:48:15 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

Refactor JSStack to only be the stack data structure for the C Loop.
https://bugs.webkit.org/show_bug.cgi?id=159545

Reviewed by Geoffrey Garen.

Changes made:

  1. Renamed JSStack to CLoopStack.
  2. Made all of CLoopStack code to conditional on #if !ENABLE(JIT) i.e. they will only be in effect for the C Loop build.
  3. Changed clients of JSStack to use new equivalent VM APIs:
    1. JSStack::ensureCapacityFor() => VM::ensureStackCapacityFor()
    2. JSStack::committedByteCount() => VM::committedStackByteCount()
  4. Made VM::updateReservedZoneSize() call CLoopStack::setReservedZoneSize() instead of calling it from all the clients of VM::updateReservedZoneSize().
  5. Removed all unnecessary references to JSStack.
  • CMakeLists.txt:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • assembler/MaxFrameExtentForSlowPathCall.h:
  • bytecode/BytecodeConventions.h:
  • dfg/DFGGraph.h:
  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • ftl/FTLOSREntry.cpp:

(JSC::FTL::prepareOSREntry):

  • heap/Heap.cpp:

(JSC::Heap::finalizeUnconditionalFinalizers):
(JSC::Heap::willStartIterating):
(JSC::Heap::gatherJSStackRoots):
(JSC::Heap::stack): Deleted.

  • heap/Heap.h:
  • interpreter/CLoopStack.cpp: Copied from Source/JavaScriptCore/interpreter/JSStack.cpp.

(JSC::commitSize):
(JSC::CLoopStack::CLoopStack):
(JSC::CLoopStack::~CLoopStack):
(JSC::CLoopStack::grow):
(JSC::CLoopStack::gatherConservativeRoots):
(JSC::CLoopStack::sanitizeStack):
(JSC::CLoopStack::releaseExcessCapacity):
(JSC::CLoopStack::addToCommittedByteCount):
(JSC::CLoopStack::setReservedZoneSize):
(JSC::CLoopStack::committedByteCount):
(JSC::JSStack::JSStack): Deleted.
(JSC::JSStack::~JSStack): Deleted.
(JSC::JSStack::growSlowCase): Deleted.
(JSC::JSStack::gatherConservativeRoots): Deleted.
(JSC::JSStack::sanitizeStack): Deleted.
(JSC::JSStack::releaseExcessCapacity): Deleted.
(JSC::JSStack::addToCommittedByteCount): Deleted.
(JSC::JSStack::setReservedZoneSize): Deleted.
(JSC::JSStack::lowAddress): Deleted.
(JSC::JSStack::highAddress): Deleted.
(JSC::JSStack::committedByteCount): Deleted.

  • interpreter/CLoopStack.h: Copied from Source/JavaScriptCore/interpreter/JSStack.h.

(JSC::CLoopStack::containsAddress):
(JSC::CLoopStack::lowAddress):
(JSC::CLoopStack::highAddress):
(JSC::CLoopStack::reservationTop):
(JSC::JSStack::containsAddress): Deleted.
(JSC::JSStack::lowAddress): Deleted.
(JSC::JSStack::highAddress): Deleted.
(JSC::JSStack::reservationTop): Deleted.

  • interpreter/CLoopStackInlines.h: Copied from Source/JavaScriptCore/interpreter/JSStackInlines.h.

(JSC::CLoopStack::ensureCapacityFor):
(JSC::CLoopStack::topOfFrameFor):
(JSC::CLoopStack::topOfStack):
(JSC::CLoopStack::shrink):
(JSC::CLoopStack::setCLoopStackLimit):
(JSC::JSStack::ensureCapacityFor): Deleted.
(JSC::JSStack::topOfFrameFor): Deleted.
(JSC::JSStack::topOfStack): Deleted.
(JSC::JSStack::shrink): Deleted.
(JSC::JSStack::grow): Deleted.
(JSC::JSStack::setCLoopStackLimit): Deleted.

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::unsafeCallSiteIndex):
(JSC::CallFrame::currentVPC):
(JSC::CallFrame::stack): Deleted.

  • interpreter/CallFrame.h:

(JSC::ExecState::callerFrameAndPC):
(JSC::ExecState::unsafeCallerFrameAndPC):

  • interpreter/Interpreter.cpp:

(JSC::sizeOfVarargs):
(JSC::sizeFrameForForwardArguments):
(JSC::sizeFrameForVarargs):
(JSC::Interpreter::Interpreter):

  • interpreter/Interpreter.h:

(JSC::Interpreter::cloopStack):
(JSC::Interpreter::getOpcode):
(JSC::Interpreter::isCallBytecode):
(JSC::Interpreter::stack): Deleted.

  • interpreter/JSStack.cpp: Removed.
  • interpreter/JSStack.h: Removed.
  • interpreter/JSStackInlines.h: Removed.
  • interpreter/StackVisitor.cpp:

(JSC::StackVisitor::Frame::dump):

  • jit/JIT.h:
  • jit/JITOperations.cpp:
  • jit/JSInterfaceJIT.h:
  • jit/SpecializedThunkJIT.h:
  • jit/ThunkGenerators.cpp:
  • llint/LLIntOffsetsExtractor.cpp:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::llint_stack_check_at_vm_entry):

  • llint/LLIntThunks.cpp:
  • llint/LowLevelInterpreter.cpp:

(JSC::CLoop::execute):

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/CommonSlowPaths.h:

(JSC::CommonSlowPaths::arityCheckFor):

  • runtime/ErrorHandlingScope.cpp:

(JSC::ErrorHandlingScope::ErrorHandlingScope):
(JSC::ErrorHandlingScope::~ErrorHandlingScope):

  • runtime/JSGlobalObject.h:
  • runtime/MemoryStatistics.cpp:

(JSC::globalMemoryStatistics):

  • runtime/StackAlignment.h:
  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::VM::updateReservedZoneSize):
(JSC::sanitizeStackForVM):
(JSC::VM::committedStackByteCount):

  • runtime/VM.h:

(JSC::VM::reservedZoneSize):
(JSC::VM::osStackLimitWithReserve):
(JSC::VM::addressOfOSStackLimitWithReserve):

  • runtime/VMInlines.h:

(JSC::VM::ensureStackCapacityFor):
(JSC::VM::shouldTriggerTermination):

Location:
trunk/Source/JavaScriptCore
Files:
33 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r202987 r203081  
    508508
    509509    interpreter/AbstractPC.cpp
     510    interpreter/CLoopStack.cpp
    510511    interpreter/CallFrame.cpp
    511512    interpreter/Interpreter.cpp
    512     interpreter/JSStack.cpp
    513513    interpreter/ProtoCallFrame.cpp
    514514    interpreter/ShadowChicken.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r203076 r203081  
     12016-07-11  Mark Lam  <mark.lam@apple.com>
     2
     3        Refactor JSStack to only be the stack data structure for the C Loop.
     4        https://bugs.webkit.org/show_bug.cgi?id=159545
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Changes made:
     9        1. Renamed JSStack to CLoopStack.
     10        2. Made all of CLoopStack code to conditional on #if !ENABLE(JIT) i.e. they will
     11           only be in effect for the C Loop build.
     12        3. Changed clients of JSStack to use new equivalent VM APIs:
     13            a. JSStack::ensureCapacityFor() => VM::ensureStackCapacityFor()
     14            b. JSStack::committedByteCount() => VM::committedStackByteCount()
     15        4. Made VM::updateReservedZoneSize() call CLoopStack::setReservedZoneSize()
     16           instead of calling it from all the clients of VM::updateReservedZoneSize().
     17        5. Removed all unnecessary references to JSStack.
     18
     19        * CMakeLists.txt:
     20        * JavaScriptCore.xcodeproj/project.pbxproj:
     21        * assembler/MaxFrameExtentForSlowPathCall.h:
     22        * bytecode/BytecodeConventions.h:
     23        * dfg/DFGGraph.h:
     24        * dfg/DFGOSREntry.cpp:
     25        (JSC::DFG::prepareOSREntry):
     26        * ftl/FTLOSREntry.cpp:
     27        (JSC::FTL::prepareOSREntry):
     28        * heap/Heap.cpp:
     29        (JSC::Heap::finalizeUnconditionalFinalizers):
     30        (JSC::Heap::willStartIterating):
     31        (JSC::Heap::gatherJSStackRoots):
     32        (JSC::Heap::stack): Deleted.
     33        * heap/Heap.h:
     34        * interpreter/CLoopStack.cpp: Copied from Source/JavaScriptCore/interpreter/JSStack.cpp.
     35        (JSC::commitSize):
     36        (JSC::CLoopStack::CLoopStack):
     37        (JSC::CLoopStack::~CLoopStack):
     38        (JSC::CLoopStack::grow):
     39        (JSC::CLoopStack::gatherConservativeRoots):
     40        (JSC::CLoopStack::sanitizeStack):
     41        (JSC::CLoopStack::releaseExcessCapacity):
     42        (JSC::CLoopStack::addToCommittedByteCount):
     43        (JSC::CLoopStack::setReservedZoneSize):
     44        (JSC::CLoopStack::committedByteCount):
     45        (JSC::JSStack::JSStack): Deleted.
     46        (JSC::JSStack::~JSStack): Deleted.
     47        (JSC::JSStack::growSlowCase): Deleted.
     48        (JSC::JSStack::gatherConservativeRoots): Deleted.
     49        (JSC::JSStack::sanitizeStack): Deleted.
     50        (JSC::JSStack::releaseExcessCapacity): Deleted.
     51        (JSC::JSStack::addToCommittedByteCount): Deleted.
     52        (JSC::JSStack::setReservedZoneSize): Deleted.
     53        (JSC::JSStack::lowAddress): Deleted.
     54        (JSC::JSStack::highAddress): Deleted.
     55        (JSC::JSStack::committedByteCount): Deleted.
     56        * interpreter/CLoopStack.h: Copied from Source/JavaScriptCore/interpreter/JSStack.h.
     57        (JSC::CLoopStack::containsAddress):
     58        (JSC::CLoopStack::lowAddress):
     59        (JSC::CLoopStack::highAddress):
     60        (JSC::CLoopStack::reservationTop):
     61        (JSC::JSStack::containsAddress): Deleted.
     62        (JSC::JSStack::lowAddress): Deleted.
     63        (JSC::JSStack::highAddress): Deleted.
     64        (JSC::JSStack::reservationTop): Deleted.
     65        * interpreter/CLoopStackInlines.h: Copied from Source/JavaScriptCore/interpreter/JSStackInlines.h.
     66        (JSC::CLoopStack::ensureCapacityFor):
     67        (JSC::CLoopStack::topOfFrameFor):
     68        (JSC::CLoopStack::topOfStack):
     69        (JSC::CLoopStack::shrink):
     70        (JSC::CLoopStack::setCLoopStackLimit):
     71        (JSC::JSStack::ensureCapacityFor): Deleted.
     72        (JSC::JSStack::topOfFrameFor): Deleted.
     73        (JSC::JSStack::topOfStack): Deleted.
     74        (JSC::JSStack::shrink): Deleted.
     75        (JSC::JSStack::grow): Deleted.
     76        (JSC::JSStack::setCLoopStackLimit): Deleted.
     77        * interpreter/CallFrame.cpp:
     78        (JSC::CallFrame::unsafeCallSiteIndex):
     79        (JSC::CallFrame::currentVPC):
     80        (JSC::CallFrame::stack): Deleted.
     81        * interpreter/CallFrame.h:
     82        (JSC::ExecState::callerFrameAndPC):
     83        (JSC::ExecState::unsafeCallerFrameAndPC):
     84        * interpreter/Interpreter.cpp:
     85        (JSC::sizeOfVarargs):
     86        (JSC::sizeFrameForForwardArguments):
     87        (JSC::sizeFrameForVarargs):
     88        (JSC::Interpreter::Interpreter):
     89        * interpreter/Interpreter.h:
     90        (JSC::Interpreter::cloopStack):
     91        (JSC::Interpreter::getOpcode):
     92        (JSC::Interpreter::isCallBytecode):
     93        (JSC::Interpreter::stack): Deleted.
     94        * interpreter/JSStack.cpp: Removed.
     95        * interpreter/JSStack.h: Removed.
     96        * interpreter/JSStackInlines.h: Removed.
     97        * interpreter/StackVisitor.cpp:
     98        (JSC::StackVisitor::Frame::dump):
     99        * jit/JIT.h:
     100        * jit/JITOperations.cpp:
     101        * jit/JSInterfaceJIT.h:
     102        * jit/SpecializedThunkJIT.h:
     103        * jit/ThunkGenerators.cpp:
     104        * llint/LLIntOffsetsExtractor.cpp:
     105        * llint/LLIntSlowPaths.cpp:
     106        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     107        (JSC::LLInt::llint_stack_check_at_vm_entry):
     108        * llint/LLIntThunks.cpp:
     109        * llint/LowLevelInterpreter.cpp:
     110        (JSC::CLoop::execute):
     111        * runtime/CommonSlowPaths.cpp:
     112        (JSC::SLOW_PATH_DECL):
     113        * runtime/CommonSlowPaths.h:
     114        (JSC::CommonSlowPaths::arityCheckFor):
     115        * runtime/ErrorHandlingScope.cpp:
     116        (JSC::ErrorHandlingScope::ErrorHandlingScope):
     117        (JSC::ErrorHandlingScope::~ErrorHandlingScope):
     118        * runtime/JSGlobalObject.h:
     119        * runtime/MemoryStatistics.cpp:
     120        (JSC::globalMemoryStatistics):
     121        * runtime/StackAlignment.h:
     122        * runtime/VM.cpp:
     123        (JSC::VM::VM):
     124        (JSC::VM::updateReservedZoneSize):
     125        (JSC::sanitizeStackForVM):
     126        (JSC::VM::committedStackByteCount):
     127        * runtime/VM.h:
     128        (JSC::VM::reservedZoneSize):
     129        (JSC::VM::osStackLimitWithReserve):
     130        (JSC::VM::addressOfOSStackLimitWithReserve):
     131        * runtime/VMInlines.h:
     132        (JSC::VM::ensureStackCapacityFor):
     133        (JSC::VM::shouldTriggerTermination):
     134
    11352016-07-11  Keith Miller  <keith_miller@apple.com>
    2136
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r202975 r203081  
    974974                1428082D107EC0570013E7B2 /* CallData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA62DFE0E2826230004F30D /* CallData.cpp */; };
    975975                1428082E107EC0570013E7B2 /* ConstructData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA62DFF0E2826310004F30D /* ConstructData.cpp */; };
    976                 1428083A107EC0750013E7B2 /* JSStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D85B0ED218E900B89619 /* JSStack.cpp */; };
     976                1428083A107EC0750013E7B2 /* CLoopStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1429D85B0ED218E900B89619 /* CLoopStack.cpp */; };
    977977                14280841107EC0930013E7B2 /* RegExp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A87D0255597D01FF60F7 /* RegExp.cpp */; };
    978978                14280842107EC0930013E7B2 /* RegExpConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD202BD0E1706A7002C7E82 /* RegExpConstructor.cpp */; };
     
    11411141                2AF7382D18BBBF92008A5A37 /* StructureIDTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AF7382B18BBBF92008A5A37 /* StructureIDTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11421142                371D842D17C98B6E00ECF994 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 371D842C17C98B6E00ECF994 /* libz.dylib */; };
     1143                412952771D2CF6BC00E78B89 /* builtins_generate_internals_wrapper_header.py in Headers */ = {isa = PBXBuildFile; fileRef = 412952731D2CF6AC00E78B89 /* builtins_generate_internals_wrapper_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
     1144                412952781D2CF6BC00E78B89 /* builtins_generate_internals_wrapper_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = 412952741D2CF6AC00E78B89 /* builtins_generate_internals_wrapper_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
     1145                412952791D2CF6BC00E78B89 /* builtins_generate_wrapper_header.py in Headers */ = {isa = PBXBuildFile; fileRef = 412952751D2CF6AC00E78B89 /* builtins_generate_wrapper_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
     1146                4129527A1D2CF6BC00E78B89 /* builtins_generate_wrapper_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = 412952761D2CF6AC00E78B89 /* builtins_generate_wrapper_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
    11431147                41359CF30FDD89AD00206180 /* DateConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = D21202290AD4310C00ED79B6 /* DateConversion.h */; };
    11441148                41DEA1321B9F3163006D65DD /* BuiltinUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DEA1311B9F3154006D65DD /* BuiltinUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    14751479                99DA00A91BD5993100F4575C /* builtins_generate_separate_header.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00A01BD5992700F4575C /* builtins_generate_separate_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
    14761480                99DA00AA1BD5993100F4575C /* builtins_generate_separate_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00A11BD5992700F4575C /* builtins_generate_separate_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
    1477                 412952771D2CF6BC00E78B89 /* builtins_generate_internals_wrapper_header.py in Resources */ = {isa = PBXBuildFile; fileRef = 412952731D2CF6AC00E78B89 /* builtins_generate_internals_wrapper_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
    1478                 412952781D2CF6BC00E78B89 /* builtins_generate_internals_wrapper_implementation.py in Resources */ = {isa = PBXBuildFile; fileRef = 412952741D2CF6AC00E78B89 /* builtins_generate_internals_wrapper_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
    1479                 412952791D2CF6BC00E78B89 /* builtins_generate_wrapper_header.py in Resources */ = {isa = PBXBuildFile; fileRef = 412952751D2CF6AC00E78B89 /* builtins_generate_wrapper_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
    1480                 4129527A1D2CF6BC00E78B89 /* builtins_generate_wrapper_implementation.py in Resources */ = {isa = PBXBuildFile; fileRef = 412952761D2CF6AC00E78B89 /* builtins_generate_wrapper_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
    14811481                99DA00AF1BD5994E00F4575C /* generate-js-builtins.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00AC1BD5993E00F4575C /* generate-js-builtins.py */; settings = {ATTRIBUTES = (Private, ); }; };
    14821482                99DA00B01BD5994E00F4575C /* lazywriter.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA00AD1BD5993E00F4575C /* lazywriter.py */; settings = {ATTRIBUTES = (Private, ); }; };
     
    17771777                A7C0C4AD1681067E0017011D /* JSScriptRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C0C4AA167C08CD0017011D /* JSScriptRef.cpp */; };
    17781778                A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */; };
    1779                 A7C1EAF017987AB600299DB2 /* JSStackInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */; };
     1779                A7C1EAF017987AB600299DB2 /* CLoopStackInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAEB17987AB600299DB2 /* CLoopStackInlines.h */; };
    17801780                A7C1EAF117987AB600299DB2 /* StackVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1EAEC17987AB600299DB2 /* StackVisitor.cpp */; };
    17811781                A7C1EAF217987AB600299DB2 /* StackVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAED17987AB600299DB2 /* StackVisitor.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    18991899                BC18C45B0E16F5CD00B34460 /* RegExpObject.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A87C0255597D01FF60F7 /* RegExpObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
    19001900                BC18C45D0E16F5CD00B34460 /* Register.h in Headers */ = {isa = PBXBuildFile; fileRef = 149B24FF0D8AF6D1009CB8C7 /* Register.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1901                 BC18C45E0E16F5CD00B34460 /* JSStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D792640DAA03FB001A9F05 /* JSStack.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1901                BC18C45E0E16F5CD00B34460 /* CLoopStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D792640DAA03FB001A9F05 /* CLoopStack.h */; settings = {ATTRIBUTES = (Private, ); }; };
    19021902                BC18C4630E16F5CD00B34460 /* SourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E866ED0DD59AFA00A2B2A1 /* SourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
    19031903                BC18C4640E16F5CD00B34460 /* SourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E866EE0DD59AFA00A2B2A1 /* SourceCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    31513151                1429D77B0ED20D7300B89619 /* Interpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Interpreter.h; sourceTree = "<group>"; };
    31523152                1429D7D30ED2128200B89619 /* Interpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Interpreter.cpp; sourceTree = "<group>"; };
    3153                 1429D85B0ED218E900B89619 /* JSStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStack.cpp; sourceTree = "<group>"; };
     3153                1429D85B0ED218E900B89619 /* CLoopStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CLoopStack.cpp; sourceTree = "<group>"; };
    31543154                1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionHelpers.cpp; sourceTree = "<group>"; };
    31553155                1429D8DB0ED2205B00B89619 /* CallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallFrame.cpp; sourceTree = "<group>"; };
     
    32333233                14D2F3D8139F4BE200491031 /* MarkedSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedSpace.cpp; sourceTree = "<group>"; };
    32343234                14D2F3D9139F4BE200491031 /* MarkedSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedSpace.h; sourceTree = "<group>"; };
    3235                 14D792640DAA03FB001A9F05 /* JSStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStack.h; sourceTree = "<group>"; };
     3235                14D792640DAA03FB001A9F05 /* CLoopStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLoopStack.h; sourceTree = "<group>"; };
    32363236                14D844A216AA2C7000A65AF0 /* PrototypeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrototypeMap.cpp; sourceTree = "<group>"; };
    32373237                14D844A316AA2C7000A65AF0 /* PrototypeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrototypeMap.h; sourceTree = "<group>"; };
     
    40084008                A7C0C4AB167C08CD0017011D /* JSScriptRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptRefPrivate.h; sourceTree = "<group>"; };
    40094009                A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess32_64.cpp; sourceTree = "<group>"; };
    4010                 A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStackInlines.h; sourceTree = "<group>"; };
     4010                A7C1EAEB17987AB600299DB2 /* CLoopStackInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLoopStackInlines.h; sourceTree = "<group>"; };
    40114011                A7C1EAEC17987AB600299DB2 /* StackVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = StackVisitor.cpp; sourceTree = "<group>"; };
    40124012                A7C1EAED17987AB600299DB2 /* StackVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackVisitor.h; sourceTree = "<group>"; };
     
    50015001                                0F55F0F114D1063600AC7649 /* AbstractPC.cpp */,
    50025002                                0F55F0F214D1063600AC7649 /* AbstractPC.h */,
     5003                                1429D85B0ED218E900B89619 /* CLoopStack.cpp */,
     5004                                14D792640DAA03FB001A9F05 /* CLoopStack.h */,
     5005                                A7C1EAEB17987AB600299DB2 /* CLoopStackInlines.h */,
    50035006                                A7F8690E0F9584A100558697 /* CachedCall.h */,
    50045007                                1429D8DB0ED2205B00B89619 /* CallFrame.cpp */,
     
    50075010                                1429D7D30ED2128200B89619 /* Interpreter.cpp */,
    50085011                                1429D77B0ED20D7300B89619 /* Interpreter.h */,
    5009                                 1429D85B0ED218E900B89619 /* JSStack.cpp */,
    5010                                 14D792640DAA03FB001A9F05 /* JSStack.h */,
    5011                                 A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */,
    50125012                                65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */,
    50135013                                65FB5115184EE8F800C12B70 /* ProtoCallFrame.h */,
     
    78067806                                A7299D9E17D12837005F5FF9 /* JSSet.h in Headers */,
    78077807                                A790DD70182F499700588807 /* JSSetIterator.h in Headers */,
    7808                                 BC18C45E0E16F5CD00B34460 /* JSStack.h in Headers */,
    7809                                 A7C1EAF017987AB600299DB2 /* JSStackInlines.h in Headers */,
     7808                                BC18C45E0E16F5CD00B34460 /* CLoopStack.h in Headers */,
     7809                                A7C1EAF017987AB600299DB2 /* CLoopStackInlines.h in Headers */,
    78107810                                BC18C4270E16F5CD00B34460 /* JSString.h in Headers */,
    78117811                                86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */,
     
    92199219                                A7299D9D17D12837005F5FF9 /* JSSet.cpp in Sources */,
    92209220                                A790DD6F182F499700588807 /* JSSetIterator.cpp in Sources */,
    9221                                 1428083A107EC0750013E7B2 /* JSStack.cpp in Sources */,
     9221                                1428083A107EC0750013E7B2 /* CLoopStack.cpp in Sources */,
    92229222                                147F39D5107EC37600427A48 /* JSString.cpp in Sources */,
    92239223                                70EC0EC21AA0D7DA00B6AAFA /* JSStringIterator.cpp in Sources */,
  • trunk/Source/JavaScriptCore/assembler/MaxFrameExtentForSlowPathCall.h

    r170147 r203081  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#define MaxFrameExtentForSlowPathCall_h
    2828
    29 #include "JSStack.h"
    3029#include "Register.h"
    3130#include "StackAlignment.h"
  • trunk/Source/JavaScriptCore/bytecode/BytecodeConventions.h

    r130726 r203081  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929// Register numbers used in bytecode operations have different meaning according to their ranges:
    30 //      0x80000000-0xFFFFFFFF  Negative indices from the CallFrame pointer are entries in the call frame, see JSStack.h.
     30//      0x80000000-0xFFFFFFFF  Negative indices from the CallFrame pointer are entries in the call frame.
    3131//      0x00000000-0x3FFFFFFF  Forwards indices from the CallFrame pointer are local vars and temporaries with the function's callframe.
    3232//      0x40000000-0x7FFFFFFF  Positive indices from 0x40000000 specify entries in the constant pool on the CodeBlock.
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.h

    r203006 r203081  
    11/*
    2  * Copyright (C) 2011-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4242#include "DFGScannable.h"
    4343#include "FullBytecodeLiveness.h"
    44 #include "JSStack.h"
    4544#include "MethodOfGettingAValueProfile.h"
    4645#include <unordered_map>
  • trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp

    r203006 r203081  
    3434#include "DFGNode.h"
    3535#include "JIT.h"
    36 #include "JSStackInlines.h"
    3736#include "JSCInlines.h"
     37#include "VMInlines.h"
    3838#include <wtf/CommaPrinter.h>
    3939
     
    245245   
    246246    unsigned frameSizeForCheck = jitCode->common.requiredRegisterCountForExecutionAndExit();
    247     if (!vm->interpreter->stack().ensureCapacityFor(&exec->registers()[virtualRegisterForLocal(frameSizeForCheck - 1).offset()])) {
     247    if (UNLIKELY(!vm->ensureStackCapacityFor(&exec->registers()[virtualRegisterForLocal(frameSizeForCheck - 1).offset()]))) {
    248248        if (Options::verboseOSR())
    249249            dataLogF("    OSR failed because stack growth failed.\n");
  • trunk/Source/JavaScriptCore/ftl/FTLOSREntry.cpp

    r192937 r203081  
    11/*
    2  * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2014, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#include "DFGJITCode.h"
    3232#include "FTLForOSREntryJITCode.h"
    33 #include "JSStackInlines.h"
    3433#include "OperandsInlines.h"
    3534#include "JSCInlines.h"
     35#include "VMInlines.h"
    3636
    3737#if ENABLE(FTL_JIT)
     
    9393   
    9494    int stackFrameSize = entryCode->common.requiredRegisterCountForExecutionAndExit();
    95     if (!vm.interpreter->stack().ensureCapacityFor(&exec->registers()[virtualRegisterForLocal(stackFrameSize - 1).offset()])) {
     95    if (UNLIKELY(!vm.ensureStackCapacityFor(&exec->registers()[virtualRegisterForLocal(stackFrameSize - 1).offset()]))) {
    9696        if (Options::verboseOSR())
    9797            dataLog("    OSR failed because stack growth failed.\n");
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r203000 r203081  
    487487}
    488488
    489 inline JSStack& Heap::stack()
    490 {
    491     return m_vm->interpreter->stack();
    492 }
    493 
    494489void Heap::willStartIterating()
    495490{
     
    682677#if !ENABLE(JIT)
    683678    GCPHASE(GatherJSStackRoots);
    684     stack().gatherConservativeRoots(roots, m_jitStubRoutines, m_codeBlocks);
     679    m_vm->interpreter->cloopStack().gatherConservativeRoots(roots, m_jitStubRoutines, m_codeBlocks);
    685680#else
    686681    UNUSED_PARAM(roots);
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r202827 r203081  
    6767class JITStubRoutine;
    6868class JSCell;
    69 class JSStack;
    7069class JSValue;
    7170class LLIntOffsetsExtractor;
     
    356355    bool shouldDoFullCollection(HeapOperation requestedCollectionType) const;
    357356
    358     JSStack& stack();
    359    
    360357    void incrementDeferralDepth();
    361358    void decrementDeferralDepth();
  • trunk/Source/JavaScriptCore/interpreter/CLoopStack.cpp

    r203080 r203081  
    2828
    2929#include "config.h"
    30 #include "JSStackInlines.h"
     30#include "CLoopStack.h"
    3131
     32#if !ENABLE(JIT)
     33
     34#include "CLoopStackInlines.h"
    3235#include "ConservativeRoots.h"
    3336#include "Interpreter.h"
     
    3841namespace JSC {
    3942
    40 #if !ENABLE(JIT)
    4143static size_t committedBytesCount = 0;
    4244
     
    4850
    4951static StaticLock stackStatisticsMutex;
    50 #endif // !ENABLE(JIT)
    5152
    52 JSStack::JSStack(VM& vm)
     53CLoopStack::CLoopStack(VM& vm)
    5354    : m_vm(vm)
    5455    , m_topCallFrame(vm.topCallFrame)
    55 #if !ENABLE(JIT)
    5656    , m_end(0)
    5757    , m_reservedZoneSizeInRegisters(0)
    58 #endif
    5958{
    60 #if !ENABLE(JIT)
    6159    size_t capacity = Options::maxPerThreadStackUsage();
    6260    ASSERT(capacity && isPageAligned(capacity));
     
    6765   
    6866    m_lastStackTop = baseOfStack();
    69 #endif // !ENABLE(JIT)
    7067
    7168    m_topCallFrame = 0;
    7269}
    7370
    74 #if !ENABLE(JIT)
    75 JSStack::~JSStack()
     71CLoopStack::~CLoopStack()
    7672{
    7773    ptrdiff_t sizeToDecommit = reinterpret_cast<char*>(highAddress()) - reinterpret_cast<char*>(m_commitTop);
     
    8177}
    8278
    83 bool JSStack::growSlowCase(Register* newTopOfStack)
     79bool CLoopStack::grow(Register* newTopOfStack)
    8480{
    8581    Register* newTopOfStackWithReservedZone = newTopOfStack - m_reservedZoneSizeInRegisters;
     
    109105}
    110106
    111 void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks)
     107void CLoopStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks)
    112108{
    113109    conservativeRoots.add(topOfStack() + 1, highAddress(), jitStubRoutines, codeBlocks);
    114110}
    115111
    116 void JSStack::sanitizeStack()
     112void CLoopStack::sanitizeStack()
    117113{
    118114#if !ASAN_ENABLED
     
    129125}
    130126
    131 void JSStack::releaseExcessCapacity()
     127void CLoopStack::releaseExcessCapacity()
    132128{
    133129    Register* highAddressWithReservedZone = highAddress() - m_reservedZoneSizeInRegisters;
     
    138134}
    139135
    140 void JSStack::addToCommittedByteCount(long byteCount)
     136void CLoopStack::addToCommittedByteCount(long byteCount)
    141137{
    142138    LockHolder locker(stackStatisticsMutex);
     
    145141}
    146142
    147 void JSStack::setReservedZoneSize(size_t reservedZoneSize)
     143void CLoopStack::setReservedZoneSize(size_t reservedZoneSize)
    148144{
    149145    m_reservedZoneSizeInRegisters = reservedZoneSize / sizeof(Register);
    150146    if (m_commitTop >= (m_end + 1) - m_reservedZoneSizeInRegisters)
    151         growSlowCase(m_end + 1);
    152 }
    153 #endif // !ENABLE(JIT)
    154 
    155 #if ENABLE(JIT)
    156 Register* JSStack::lowAddress() const
    157 {
    158     ASSERT(wtfThreadData().stack().isGrowingDownward());
    159     return reinterpret_cast<Register*>(m_vm.osStackLimitWithReserve());
     147        grow(m_end + 1);
    160148}
    161149
    162 Register* JSStack::highAddress() const
     150size_t CLoopStack::committedByteCount()
    163151{
    164     ASSERT(wtfThreadData().stack().isGrowingDownward());
    165     return reinterpret_cast<Register*>(wtfThreadData().stack().origin());
    166 }
    167 #endif // ENABLE(JIT)
    168 
    169 size_t JSStack::committedByteCount()
    170 {
    171 #if !ENABLE(JIT)
    172152    LockHolder locker(stackStatisticsMutex);
    173153    return committedBytesCount;
    174 #else
    175     // When using the C stack, we don't know how many stack pages are actually
    176     // committed. So, we use the current stack usage as an estimate.
    177     ASSERT(wtfThreadData().stack().isGrowingDownward());
    178     int8_t* current = reinterpret_cast<int8_t*>(&current);
    179     int8_t* high = reinterpret_cast<int8_t*>(wtfThreadData().stack().origin());
    180     return high - current;
    181 #endif
    182154}
    183155
    184156} // namespace JSC
     157
     158#endif // !ENABLE(JIT)
  • trunk/Source/JavaScriptCore/interpreter/CLoopStack.h

    r203080 r203081  
    2727 */
    2828
    29 #ifndef JSStack_h
    30 #define JSStack_h
     29#pragma once
     30
     31#if !ENABLE(JIT)
    3132
    3233#include "Register.h"
     
    4344    class LLIntOffsetsExtractor;
    4445
    45     class JSStack {
    46         WTF_MAKE_NONCOPYABLE(JSStack);
     46    class CLoopStack {
     47        WTF_MAKE_NONCOPYABLE(CLoopStack);
    4748    public:
    4849        // Allow 8k of excess registers before we start trying to reap the stack
    4950        static const ptrdiff_t maxExcessCapacity = 8 * 1024;
    5051
    51         JSStack(VM&);
     52        CLoopStack(VM&);
     53        ~CLoopStack();
    5254       
    5355        bool ensureCapacityFor(Register* newTopOfStack);
     
    5557        bool containsAddress(Register* address) { return (lowAddress() <= address && address < highAddress()); }
    5658        static size_t committedByteCount();
    57 
    58 #if !ENABLE(JIT)
    59         ~JSStack();
    6059
    6160        void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&);
     
    7271
    7372        inline Register* topOfStack();
    74 #endif // ENABLE(JIT)
    7573
    7674    private:
    7775
    78 #if !ENABLE(JIT)
    7976        Register* lowAddress() const
    8077        {
     
    8683            return reinterpret_cast_ptr<Register*>(static_cast<char*>(m_reservation.base()) + m_reservation.size());
    8784        }
    88 #else
    89         Register* lowAddress() const;
    90         Register* highAddress() const;
    91 #endif // !ENABLE(JIT)
    9285
    93 #if !ENABLE(JIT)
    9486        inline Register* topOfFrameFor(CallFrame*);
    9587
     
    10193
    10294        bool grow(Register* newTopOfStack);
    103         bool growSlowCase(Register* newTopOfStack);
    10495        void shrink(Register* newTopOfStack);
    10596        void releaseExcessCapacity();
     
    10798
    10899        void setCLoopStackLimit(Register* newTopOfStack);
    109 #endif // !ENABLE(JIT)
    110100
    111101        VM& m_vm;
    112102        CallFrame*& m_topCallFrame;
    113 #if !ENABLE(JIT)
    114103        Register* m_end;
    115104        Register* m_commitTop;
     
    117106        Register* m_lastStackTop;
    118107        ptrdiff_t m_reservedZoneSizeInRegisters;
    119 #endif // !ENABLE(JIT)
    120108
    121109        friend class LLIntOffsetsExtractor;
     
    124112} // namespace JSC
    125113
    126 #endif // JSStack_h
     114#endif // !ENABLE(JIT)
  • trunk/Source/JavaScriptCore/interpreter/CLoopStackInlines.h

    r203080 r203081  
    2424 */
    2525
    26 #ifndef JSStackInlines_h
    27 #define JSStackInlines_h
     26#pragma once
    2827
     28#if !ENABLE(JIT)
     29
     30#include "CLoopStack.h"
    2931#include "CallFrame.h"
    3032#include "CodeBlock.h"
    31 #include "JSStack.h"
    3233#include "VM.h"
    3334
    3435namespace JSC {
    3536
    36 inline bool JSStack::ensureCapacityFor(Register* newTopOfStack)
     37inline bool CLoopStack::ensureCapacityFor(Register* newTopOfStack)
    3738{
    38 #if !ENABLE(JIT)
     39    Register* newEnd = newTopOfStack - 1;
     40    if (newEnd >= m_end)
     41        return true;
    3942    return grow(newTopOfStack);
    40 #else
    41     ASSERT(wtfThreadData().stack().isGrowingDownward());
    42     return newTopOfStack >= m_vm.osStackLimitWithReserve();
    43 #endif
    4443}
    4544
    46 #if !ENABLE(JIT)
    47 
    48 inline Register* JSStack::topOfFrameFor(CallFrame* frame)
     45inline Register* CLoopStack::topOfFrameFor(CallFrame* frame)
    4946{
    5047    if (UNLIKELY(!frame))
     
    5350}
    5451
    55 inline Register* JSStack::topOfStack()
     52inline Register* CLoopStack::topOfStack()
    5653{
    5754    return topOfFrameFor(m_topCallFrame);
    5855}
    5956
    60 inline void JSStack::shrink(Register* newTopOfStack)
     57inline void CLoopStack::shrink(Register* newTopOfStack)
    6158{
    6259    Register* newEnd = newTopOfStack - 1;
     
    6764    // invoke std::max() with it as an argument. To work around this, we first
    6865    // assign the constant to a local variable, and use the local instead.
    69     ptrdiff_t maxExcessCapacity = JSStack::maxExcessCapacity;
     66    ptrdiff_t maxExcessCapacity = CLoopStack::maxExcessCapacity;
    7067    ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_reservedZoneSizeInRegisters);
    7168    if (m_end == baseOfStack() && (highAddress() - m_commitTop) >= maxExcessInRegisters)
     
    7370}
    7471
    75 inline bool JSStack::grow(Register* newTopOfStack)
    76 {
    77     Register* newEnd = newTopOfStack - 1;
    78     if (newEnd >= m_end)
    79         return true;
    80     return growSlowCase(newTopOfStack);
    81 }
    82 
    83 inline void JSStack::setCLoopStackLimit(Register* newTopOfStack)
     72inline void CLoopStack::setCLoopStackLimit(Register* newTopOfStack)
    8473{
    8574    Register* newEnd = newTopOfStack - 1;
     
    8877}
    8978
    90 #endif // !ENABLE(JIT)
    91 
    9279} // namespace JSC
    9380
    94 #endif // JSStackInlines_h
     81#endif // !ENABLE(JIT)
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp

    r203006 r203081  
    11/*
    2  * Copyright (C) 2008, 2013, 2014 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2008, 2013-2014, 2016 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    104104}
    105105
    106 #ifndef NDEBUG
    107 JSStack* CallFrame::stack()
    108 {
    109     return &interpreter()->stack();
    110 }
    111 
    112 #endif
    113 
    114106#if USE(JSVALUE32_64)
    115107Instruction* CallFrame::currentVPC() const
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r203006 r203081  
    271271    private:
    272272
    273 #ifndef NDEBUG
    274         JSStack* stack();
    275 #endif
    276273        ExecState();
    277274        ~ExecState();
     
    302299        const CallerFrameAndPC& callerFrameAndPC() const { return *reinterpret_cast<const CallerFrameAndPC*>(this); }
    303300        SUPPRESS_ASAN const CallerFrameAndPC& unsafeCallerFrameAndPC() const { return *reinterpret_cast<const CallerFrameAndPC*>(this); }
    304 
    305 #if !ENABLE(JIT)
    306         friend class JSStack;
    307 #endif
    308301    };
    309302
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r203006 r203081  
    4949#include "JSLexicalEnvironment.h"
    5050#include "JSModuleEnvironment.h"
    51 #include "JSStackInlines.h"
    5251#include "JSString.h"
    5352#include "JSWithScope.h"
     
    236235}
    237236
    238 unsigned sizeFrameForForwardArguments(CallFrame* callFrame, JSStack* stack, unsigned numUsedStackSlots)
     237unsigned sizeFrameForForwardArguments(CallFrame* callFrame, VM& vm, unsigned numUsedStackSlots)
    239238{
    240239    unsigned length = callFrame->argumentCount();
    241240    CallFrame* calleeFrame = calleeFrameForVarargs(callFrame, numUsedStackSlots, length + 1);
    242     if (!stack->ensureCapacityFor(calleeFrame->registers()))
     241    if (UNLIKELY(!vm.ensureStackCapacityFor(calleeFrame->registers())))
    243242        throwStackOverflowError(callFrame);
    244243
     
    246245}
    247246
    248 unsigned sizeFrameForVarargs(CallFrame* callFrame, JSStack* stack, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset)
     247unsigned sizeFrameForVarargs(CallFrame* callFrame, VM& vm, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset)
    249248{
    250249    unsigned length = sizeOfVarargs(callFrame, arguments, firstVarArgOffset);
    251250   
    252251    CallFrame* calleeFrame = calleeFrameForVarargs(callFrame, numUsedStackSlots, length + 1);
    253     if (length > maxArguments || !stack->ensureCapacityFor(calleeFrame->registers())) {
     252    if (UNLIKELY(length > maxArguments || !vm.ensureStackCapacityFor(calleeFrame->registers()))) {
    254253        throwStackOverflowError(callFrame);
    255254        return 0;
     
    324323Interpreter::Interpreter(VM& vm)
    325324    : m_vm(vm)
    326     , m_stack(vm)
     325#if !ENABLE(JIT)
     326    , m_cloopStack(vm)
     327#endif
    327328    , m_errorHandlingModeReentry(0)
    328329#if !ASSERT_DISABLED
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.h

    r203006 r203081  
    3535#include "JSCell.h"
    3636#include "JSObject.h"
    37 #include "JSStack.h"
    3837#include "Opcode.h"
    3938#include "SourceProvider.h"
     
    4241#include <wtf/HashMap.h>
    4342#include <wtf/text/StringBuilder.h>
     43
     44#if !ENABLE(JIT)
     45#include "CLoopStack.h"
     46#endif
     47
    4448
    4549namespace JSC {
     
    181185        void initialize();
    182186
    183         JSStack& stack() { return m_stack; }
     187#if !ENABLE(JIT)
     188        CLoopStack& cloopStack() { return m_cloopStack; }
     189#endif
    184190       
    185191        Opcode getOpcode(OpcodeID id)
     
    242248
    243249        VM& m_vm;
    244         JSStack m_stack;
     250#if !ENABLE(JIT)
     251        CLoopStack m_cloopStack;
     252#endif
    245253        int m_errorHandlingModeReentry;
    246254       
     
    274282    unsigned sizeOfVarargs(CallFrame* exec, JSValue arguments, uint32_t firstVarArgOffset);
    275283    static const unsigned maxArguments = 0x10000;
    276     unsigned sizeFrameForVarargs(CallFrame* exec, JSStack*, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset);
    277     unsigned sizeFrameForForwardArguments(CallFrame* exec, JSStack*, unsigned numUsedStackSlots);
     284    unsigned sizeFrameForVarargs(CallFrame* exec, VM&, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset);
     285    unsigned sizeFrameForForwardArguments(CallFrame* exec, VM&, unsigned numUsedStackSlots);
    278286    void loadVarargs(CallFrame* execCaller, VirtualRegister firstElementDest, JSValue source, uint32_t offset, uint32_t length);
    279287    void setupVarargsFrame(CallFrame* execCaller, CallFrame* execCallee, JSValue arguments, uint32_t firstVarArgOffset, uint32_t length);
  • trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp

    r202847 r203081  
    425425            indent--;
    426426        }
     427        out.print(indent, "vmEntryFrame: ", RawPointer(vmEntryFrame()), "\n");
    427428        indent--;
    428429    }
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r203006 r203081  
    6060    class Interpreter;
    6161    class JSScope;
    62     class JSStack;
    6362    class MarkedAllocator;
    6463    class Register;
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r202890 r203081  
    5252#include "JSLexicalEnvironment.h"
    5353#include "JSPropertyNameEnumerator.h"
    54 #include "JSStackInlines.h"
    5554#include "JSWithScope.h"
    5655#include "ObjectConstructor.h"
     
    130129{
    131130    VM* vm = &exec->vm();
    132     JSStack& stack = vm->interpreter->stack();
    133 
    134     int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, &stack, CodeForCall);
     131
     132    int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, *vm, CodeForCall);
    135133    if (missingArgCount < 0) {
    136134        VMEntryFrame* vmEntryFrame = vm->topVMEntryFrame;
     
    146144{
    147145    VM* vm = &exec->vm();
    148     JSStack& stack = vm->interpreter->stack();
    149 
    150     int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, &stack, CodeForConstruct);
     146
     147    int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, *vm, CodeForConstruct);
    151148    if (missingArgCount < 0) {
    152149        VMEntryFrame* vmEntryFrame = vm->topVMEntryFrame;
     
    19251922    VM& vm = exec->vm();
    19261923    NativeCallFrameTracer tracer(&vm, exec);
    1927     JSStack* stack = &exec->interpreter()->stack();
    1928     return sizeFrameForForwardArguments(exec, stack, numUsedStackSlots);
     1924    return sizeFrameForForwardArguments(exec, vm, numUsedStackSlots);
    19291925}
    19301926
     
    19331929    VM& vm = exec->vm();
    19341930    NativeCallFrameTracer tracer(&vm, exec);
    1935     JSStack* stack = &exec->interpreter()->stack();
    19361931    JSValue arguments = JSValue::decode(encodedArguments);
    1937     return sizeFrameForVarargs(exec, stack, arguments, numUsedStackSlots, firstVarArgOffset);
     1932    return sizeFrameForVarargs(exec, vm, arguments, numUsedStackSlots, firstVarArgOffset);
    19381933}
    19391934
  • trunk/Source/JavaScriptCore/jit/JSInterfaceJIT.h

    r203006 r203081  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3434#include "JITOperations.h"
    3535#include "JSCJSValue.h"
    36 #include "JSStack.h"
    3736#include "JSString.h"
    3837#include "MacroAssembler.h"
  • trunk/Source/JavaScriptCore/jit/SpecializedThunkJIT.h

    r203006 r203081  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333#include "JITInlines.h"
    3434#include "JSInterfaceJIT.h"
    35 #include "JSStack.h"
    3635#include "LinkBuffer.h"
    3736
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp

    r203006 r203081  
    11/*
    2  * Copyright (C) 2010, 2012, 2013, 2014, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2012-2014, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232#include "JSArray.h"
    3333#include "JSBoundFunction.h"
    34 #include "JSStack.h"
    3534#include "MathCommon.h"
    3635#include "MaxFrameExtentForSlowPathCall.h"
  • trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp

    r201335 r203081  
    4343#include "JSModuleRecord.h"
    4444#include "JSObject.h"
    45 #include "JSStack.h"
    4645#include "JSString.h"
    4746#include "JSTypeInfo.h"
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r203006 r203081  
    4747#include "JSGeneratorFunction.h"
    4848#include "JSGlobalObjectFunctions.h"
    49 #include "JSStackInlines.h"
    5049#include "JSString.h"
    5150#include "JSWithScope.h"
     
    499498    // throw the StackOverflowError unconditionally.
    500499#if !ENABLE(JIT)
    501     ASSERT(!vm.interpreter->stack().containsAddress(exec->topOfFrame()));
    502     if (LIKELY(vm.interpreter->stack().ensureCapacityFor(exec->topOfFrame())))
     500    ASSERT(!vm.interpreter->cloopStack().containsAddress(exec->topOfFrame()));
     501    if (LIKELY(vm.ensureStackCapacityFor(exec->topOfFrame())))
    503502        LLINT_RETURN_TWO(pc, 0);
    504503#endif
     
    13531352   
    13541353    unsigned numUsedStackSlots = -pc[5].u.operand;
    1355     unsigned length = sizeFrameForVarargs(exec, &vm.interpreter->stack(),
     1354    unsigned length = sizeFrameForVarargs(exec, vm,
    13561355        LLINT_OP_C(4).jsValue(), numUsedStackSlots, pc[6].u.operand);
    13571356    LLINT_CALL_CHECK_EXCEPTION(exec, exec);
     
    13721371    unsigned numUsedStackSlots = -pc[5].u.operand;
    13731372
    1374     unsigned arguments = sizeFrameForForwardArguments(exec, &vm.interpreter->stack(), numUsedStackSlots);
     1373    unsigned arguments = sizeFrameForForwardArguments(exec, vm, numUsedStackSlots);
    13751374    LLINT_CALL_CHECK_EXCEPTION(exec, exec);
    13761375
     
    16301629extern "C" SlowPathReturnType llint_stack_check_at_vm_entry(VM* vm, Register* newTopOfStack)
    16311630{
    1632     bool success = vm->interpreter->stack().ensureCapacityFor(newTopOfStack);
     1631    bool success = vm->ensureStackCapacityFor(newTopOfStack);
    16331632    return encodeResult(reinterpret_cast<void*>(success), 0);
    16341633}
  • trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp

    r200879 r203081  
    11/*
    2  * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2013, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333#include "JSInterfaceJIT.h"
    3434#include "JSObject.h"
    35 #include "JSStackInlines.h"
    3635#include "LLIntCLoop.h"
    3736#include "LinkBuffer.h"
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp

    r186277 r203081  
    11/*
    2  * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2014, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    331331
    332332    lr.opcode = getOpcode(llint_return_to_host);
    333     sp.vp = vm->interpreter->stack().topOfStack() + 1;
     333    sp.vp = vm->interpreter->cloopStack().topOfStack() + 1;
    334334    cfr.callFrame = vm->topCallFrame;
    335335#ifndef NDEBUG
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

    r202680 r203081  
    179179{
    180180    BEGIN();
    181     int slotsToAdd = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForCall);
     181    int slotsToAdd = CommonSlowPaths::arityCheckFor(exec, vm, CodeForCall);
    182182    if (slotsToAdd < 0) {
    183183        exec = exec->callerFrame();
     
    192192{
    193193    BEGIN();
    194     int slotsToAdd = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForConstruct);
     194    int slotsToAdd = CommonSlowPaths::arityCheckFor(exec, vm, CodeForConstruct);
    195195    if (slotsToAdd < 0) {
    196196        exec = exec->callerFrame();
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h

    r203006 r203081  
    11/*
    2  * Copyright (C) 2011-2013, 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2013, 2015-2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#include "CodeSpecializationKind.h"
    3131#include "ExceptionHelpers.h"
    32 #include "JSStackInlines.h"
    3332#include "SlowPathReturnType.h"
    3433#include "StackAlignment.h"
    3534#include "Symbol.h"
    36 #include "VM.h"
     35#include "VMInlines.h"
    3736#include <wtf/StdLibExtras.h>
    3837
     
    5352};
    5453
    55 ALWAYS_INLINE int arityCheckFor(ExecState* exec, JSStack* stack, CodeSpecializationKind kind)
     54ALWAYS_INLINE int arityCheckFor(ExecState* exec, VM& vm, CodeSpecializationKind kind)
    5655{
    5756    JSFunction* callee = jsCast<JSFunction*>(exec->callee());
     
    6665    int paddedStackSpace = alignedFrameSizeForParameters - frameSize;
    6766
    68     if (!stack->ensureCapacityFor(exec->registers() - paddedStackSpace % stackAlignmentRegisters()))
     67    if (UNLIKELY(!vm.ensureStackCapacityFor(exec->registers() - paddedStackSpace % stackAlignmentRegisters())))
    6968        return -1;
    7069    return paddedStackSpace;
  • trunk/Source/JavaScriptCore/runtime/ErrorHandlingScope.cpp

    r170147 r203081  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#include "ErrorHandlingScope.h"
    2828
    29 #include "Interpreter.h"
    3029#include "Options.h"
    3130#include "VM.h"
     
    3938    size_t newReservedZoneSize = Options::errorModeReservedZoneSize();
    4039    m_savedReservedZoneSize = m_vm.updateReservedZoneSize(newReservedZoneSize);
    41 #if !ENABLE(JIT)
    42     m_vm.interpreter->stack().setReservedZoneSize(newReservedZoneSize);
    43 #endif
    4440}
    4541
     
    4844    RELEASE_ASSERT(m_vm.stackPointerAtVMEntry());
    4945    m_vm.updateReservedZoneSize(m_savedReservedZoneSize);
    50 #if !ENABLE(JIT)
    51     m_vm.interpreter->stack().setReservedZoneSize(m_savedReservedZoneSize);
    52 #endif
    5346}
    5447
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r203006 r203081  
    7878class JSPromiseConstructor;
    7979class JSPromisePrototype;
    80 class JSStack;
    8180class JSTypedArrayViewConstructor;
    8281class JSTypedArrayViewPrototype;
  • trunk/Source/JavaScriptCore/runtime/MemoryStatistics.cpp

    r192626 r203081  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "ExecutableAllocator.h"
    3030#include "VM.h"
    31 #include "JSStack.h"
    3231
    3332namespace JSC {
     
    3736    GlobalMemoryStatistics stats;
    3837
    39     stats.stackBytes = JSStack::committedByteCount();
     38    stats.stackBytes = VM::committedStackByteCount();
    4039#if ENABLE(ASSEMBLER)
    4140    stats.JITBytes = ExecutableAllocator::committedByteCount();
  • trunk/Source/JavaScriptCore/runtime/StackAlignment.h

    r203006 r203081  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929#include "JSCJSValue.h"
    30 #include "JSStack.h"
    3130#include <wtf/MathExtras.h>
    3231
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r202992 r203081  
    107107#include <wtf/text/SymbolRegistry.h>
    108108
     109#if !ENABLE(JIT)
     110#include "CLoopStack.h"
     111#endif
     112
    109113#if ENABLE(DFG_JIT)
    110114#include "ConservativeRoots.h"
     
    195199    StackBounds stack = wtfThreadData().stack();
    196200    updateReservedZoneSize(Options::reservedZoneSize());
    197 #if !ENABLE(JIT)
    198     interpreter->stack().setReservedZoneSize(Options::reservedZoneSize());
    199 #endif
    200201    setLastStackTop(stack.origin());
    201202
     
    617618    size_t oldReservedZoneSize = m_reservedZoneSize;
    618619    m_reservedZoneSize = reservedZoneSize;
     620#if !ENABLE(JIT)
     621    interpreter->cloopStack().setReservedZoneSize(reservedZoneSize);
     622#endif
    619623
    620624    updateStackLimit();
     
    840844    logSanitizeStack(vm);
    841845#if !ENABLE(JIT)
    842     vm->interpreter->stack().sanitizeStack();
     846    vm->interpreter->cloopStack().sanitizeStack();
    843847#else
    844848    sanitizeStackForVMImpl(vm);
     
    846850}
    847851
     852size_t VM::committedStackByteCount()
     853{
     854#if ENABLE(JIT)
     855    // When using the C stack, we don't know how many stack pages are actually
     856    // committed. So, we use the current stack usage as an estimate.
     857    ASSERT(wtfThreadData().stack().isGrowingDownward());
     858    int8_t* current = reinterpret_cast<int8_t*>(&current);
     859    int8_t* high = reinterpret_cast<int8_t*>(wtfThreadData().stack().origin());
     860    return high - current;
     861#else
     862    return CLoopStack::committedByteCount();
     863#endif
     864}
     865
    848866} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r202992 r203081  
    9595class NativeExecutable;
    9696class RegExpCache;
     97class Register;
    9798class RegisterAtOffsetList;
    9899#if ENABLE(SAMPLING_PROFILER)
     
    462463    size_t updateReservedZoneSize(size_t reservedZoneSize);
    463464
     465    static size_t committedStackByteCount();
     466    inline bool ensureStackCapacityFor(Register* newTopOfStack);
     467
    464468    void* osStackLimitWithReserve() { return m_osStackLimitWithReserve; }
    465469    void** addressOfOSStackLimitWithReserve() { return &m_osStackLimitWithReserve; }
  • trunk/Source/JavaScriptCore/runtime/VMInlines.h

    r200658 r203081  
    3131#include "Watchdog.h"
    3232
     33#if !ENABLE(JIT)
     34#include "CLoopStackInlines.h"
     35#endif
     36
    3337namespace JSC {
    3438   
     39bool VM::ensureStackCapacityFor(Register* newTopOfStack)
     40{
     41#if ENABLE(JIT)
     42    ASSERT(wtfThreadData().stack().isGrowingDownward());
     43    return newTopOfStack >= m_osStackLimitWithReserve;
     44#else
     45    return interpreter->cloopStack().ensureCapacityFor(newTopOfStack);
     46#endif
     47   
     48}
     49
    3550bool VM::shouldTriggerTermination(ExecState* exec)
    3651{
Note: See TracChangeset for help on using the changeset viewer.