| Differences between
and this patch
- Source/JavaScriptCore/ChangeLog +79 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2013-12-04  Michael Saboff  <msaboff@apple.com>
2
3
        Move the setting up of callee's callFrame from pushFrame to callToJavaScript thunk
4
        https://bugs.webkit.org/show_bug.cgi?id=123999
5
6
        Reviewed by Filip Pizlo.
7
8
        Changed LLInt and/or JIT enabled ports to allocate the stack frame in the
9
        callToJavaScript stub.  Added an additional stub, callToNativeFunction that
10
        allocates a stack frame in a similar way for calling native entry points
11
        that take a single ExecState* argument.  These stubs are implemented
12
        using common macros in LowLevelInterpreter{32_64,64}.asm.  There are also
13
        Windows X86 and X86-64 versions in the corresponding JitStubsXX.h.
14
        The stubs allocate and create a sentinel frame, then create the callee's
15
        frame, populating  the header and arguments from the passed in ProtoCallFrame*.
16
        It is assumed that the caller of either stub does a check for enough stack space
17
        via JSStack::entryCheck().
18
19
        For ports using the C-Loop interpreter, the prior method for allocating stack
20
        frame and invoking functions is used, namely with JSStack::pushFrame() and
21
        ::popFrame().
22
23
        Made spelling changes "sentinal" -> "sentinel".
24
25
        * CMakeLists.txt:
26
        * GNUmakefile.list.am:
27
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
28
        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
29
        * JavaScriptCore.xcodeproj/project.pbxproj:
30
        * interpreter/CachedCall.h:
31
        (JSC::CachedCall::CachedCall):
32
        (JSC::CachedCall::setThis):
33
        (JSC::CachedCall::setArgument):
34
        * interpreter/CallFrameClosure.h:
35
        (JSC::CallFrameClosure::resetCallFrame):
36
        * interpreter/Interpreter.cpp:
37
        (JSC::Interpreter::execute):
38
        (JSC::Interpreter::executeCall):
39
        (JSC::Interpreter::executeConstruct):
40
        (JSC::Interpreter::prepareForRepeatCall):
41
        * interpreter/Interpreter.h:
42
        * interpreter/JSStack.h:
43
        * interpreter/JSStackInlines.h:
44
        (JSC::JSStack::entryCheck):
45
        (JSC::JSStack::pushFrame):
46
        (JSC::JSStack::popFrame):
47
        * interpreter/ProtoCallFrame.cpp: Added.
48
        (JSC::ProtoCallFrame::init):
49
        * interpreter/ProtoCallFrame.h: Added.
50
        (JSC::ProtoCallFrame::codeBlock):
51
        (JSC::ProtoCallFrame::setCodeBlock):
52
        (JSC::ProtoCallFrame::setScope):
53
        (JSC::ProtoCallFrame::setCallee):
54
        (JSC::ProtoCallFrame::argumentCountIncludingThis):
55
        (JSC::ProtoCallFrame::argumentCount):
56
        (JSC::ProtoCallFrame::setArgumentCountIncludingThis):
57
        (JSC::ProtoCallFrame::setPaddedArgsCount):
58
        (JSC::ProtoCallFrame::clearCurrentVPC):
59
        (JSC::ProtoCallFrame::setThisValue):
60
        (JSC::ProtoCallFrame::setArgument):
61
        * jit/JITCode.cpp:
62
        (JSC::JITCode::execute):
63
        * jit/JITCode.h:
64
        * jit/JITOperations.cpp:
65
        * jit/JITStubs.h:
66
        * jit/JITStubsMSVC64.asm:
67
        * jit/JITStubsX86.h:
68
        * llint/LLIntOffsetsExtractor.cpp:
69
        * llint/LLIntThunks.h:
70
        * llint/LowLevelInterpreter.asm:
71
        * llint/LowLevelInterpreter32_64.asm:
72
        * llint/LowLevelInterpreter64.asm:
73
        * runtime/ArgList.h:
74
        (JSC::ArgList::data):
75
        * runtime/JSArray.cpp:
76
        (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
77
        * runtime/StringPrototype.cpp:
78
        (JSC::replaceUsingRegExpSearch):
79
1
2013-12-04  Peter Molnar  <pmolnar.u-szeged@partner.samsung.com>
80
2013-12-04  Peter Molnar  <pmolnar.u-szeged@partner.samsung.com>
2
81
3
        Fix !ENABLE(JAVASCRIPT_DEBUGGER) build.
82
        Fix !ENABLE(JAVASCRIPT_DEBUGGER) build.
- Source/JavaScriptCore/CMakeLists.txt +1 lines
Lines 217-222 set(JavaScriptCore_SOURCES Source/JavaScriptCore/CMakeLists.txt_sec1
217
    interpreter/CallFrame.cpp
217
    interpreter/CallFrame.cpp
218
    interpreter/Interpreter.cpp
218
    interpreter/Interpreter.cpp
219
    interpreter/JSStack.cpp
219
    interpreter/JSStack.cpp
220
    interpreter/ProtoCallFrame.cpp
220
    interpreter/StackVisitor.cpp
221
    interpreter/StackVisitor.cpp
221
    interpreter/VMInspector.cpp
222
    interpreter/VMInspector.cpp
222
223
- Source/JavaScriptCore/GNUmakefile.list.am +2 lines
Lines 622-627 javascriptcore_sources += \ Source/JavaScriptCore/GNUmakefile.list.am_sec1
622
	Source/JavaScriptCore/interpreter/JSStack.cpp \
622
	Source/JavaScriptCore/interpreter/JSStack.cpp \
623
	Source/JavaScriptCore/interpreter/JSStack.h \
623
	Source/JavaScriptCore/interpreter/JSStack.h \
624
	Source/JavaScriptCore/interpreter/JSStackInlines.h \
624
	Source/JavaScriptCore/interpreter/JSStackInlines.h \
625
	Source/JavaScriptCore/interpreter/ProtoCallFrame.cpp \
626
	Source/JavaScriptCore/interpreter/ProtoCallFrame.h \
625
	Source/JavaScriptCore/interpreter/Register.h \
627
	Source/JavaScriptCore/interpreter/Register.h \
626
	Source/JavaScriptCore/interpreter/StackVisitor.cpp \
628
	Source/JavaScriptCore/interpreter/StackVisitor.cpp \
627
	Source/JavaScriptCore/interpreter/StackVisitor.h \
629
	Source/JavaScriptCore/interpreter/StackVisitor.h \
- Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj +2 lines
Lines 459-464 Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj_sec1
459
    <ClCompile Include="..\interpreter\CallFrame.cpp" />
459
    <ClCompile Include="..\interpreter\CallFrame.cpp" />
460
    <ClCompile Include="..\interpreter\Interpreter.cpp" />
460
    <ClCompile Include="..\interpreter\Interpreter.cpp" />
461
    <ClCompile Include="..\interpreter\JSStack.cpp" />
461
    <ClCompile Include="..\interpreter\JSStack.cpp" />
462
    <ClCompile Include="..\interpreter\ProtoCallFrame.cpp" />
462
    <ClCompile Include="..\interpreter\StackVisitor.cpp" />
463
    <ClCompile Include="..\interpreter\StackVisitor.cpp" />
463
    <ClCompile Include="..\interpreter\VMInspector.cpp" />
464
    <ClCompile Include="..\interpreter\VMInspector.cpp" />
464
    <ClCompile Include="..\jit\AssemblyHelpers.cpp" />
465
    <ClCompile Include="..\jit\AssemblyHelpers.cpp" />
Lines 1003-1008 Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj_sec2
1003
    <ClInclude Include="..\interpreter\Interpreter.h" />
1004
    <ClInclude Include="..\interpreter\Interpreter.h" />
1004
    <ClInclude Include="..\interpreter\JSStack.h" />
1005
    <ClInclude Include="..\interpreter\JSStack.h" />
1005
    <ClInclude Include="..\interpreter\JSStackInlines.h" />
1006
    <ClInclude Include="..\interpreter\JSStackInlines.h" />
1007
    <ClInclude Include="..\interpreter\ProtoCallFrame.h" />
1006
    <ClInclude Include="..\interpreter\Register.h" />
1008
    <ClInclude Include="..\interpreter\Register.h" />
1007
    <ClInclude Include="..\interpreter\StackVisitor.h" />
1009
    <ClInclude Include="..\interpreter\StackVisitor.h" />
1008
    <ClInclude Include="..\interpreter\VMInspector.h" />
1010
    <ClInclude Include="..\interpreter\VMInspector.h" />
- Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters +6 lines
Lines 288-293 Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters_sec1
288
    <ClCompile Include="..\interpreter\JSStack.cpp">
288
    <ClCompile Include="..\interpreter\JSStack.cpp">
289
      <Filter>interpreter</Filter>
289
      <Filter>interpreter</Filter>
290
    </ClCompile>
290
    </ClCompile>
291
    <ClCompile Include="..\interpreter\ProtoCallFrame.cpp">
292
      <Filter>interpreter</Filter>
293
    </ClCompile>
291
    <ClCompile Include="..\interpreter\StackVisitor.cpp">
294
    <ClCompile Include="..\interpreter\StackVisitor.cpp">
292
      <Filter>interpreter</Filter>
295
      <Filter>interpreter</Filter>
293
    </ClCompile>
296
    </ClCompile>
Lines 1727-1732 Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters_sec2
1727
    <ClInclude Include="..\interpreter\JSStackInlines.h">
1730
    <ClInclude Include="..\interpreter\JSStackInlines.h">
1728
      <Filter>interpreter</Filter>
1731
      <Filter>interpreter</Filter>
1729
    </ClInclude>
1732
    </ClInclude>
1733
    <ClInclude Include="..\interpreter\ProtoCallFrame.h">
1734
      <Filter>interpreter</Filter>
1735
    </ClInclude>
1730
    <ClInclude Include="..\interpreter\Register.h">
1736
    <ClInclude Include="..\interpreter\Register.h">
1731
      <Filter>interpreter</Filter>
1737
      <Filter>interpreter</Filter>
1732
    </ClInclude>
1738
    </ClInclude>
- Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +6 lines
Lines 735-740 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec1
735
		65C02850171795E200351E35 /* ARMv7Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C0284F171795E200351E35 /* ARMv7Disassembler.cpp */; };
735
		65C02850171795E200351E35 /* ARMv7Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C0284F171795E200351E35 /* ARMv7Disassembler.cpp */; };
736
		65C0285C1717966800351E35 /* ARMv7DOpcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C0285A1717966800351E35 /* ARMv7DOpcode.cpp */; };
736
		65C0285C1717966800351E35 /* ARMv7DOpcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C0285A1717966800351E35 /* ARMv7DOpcode.cpp */; };
737
		65C0285D1717966800351E35 /* ARMv7DOpcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C0285B1717966800351E35 /* ARMv7DOpcode.h */; };
737
		65C0285D1717966800351E35 /* ARMv7DOpcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C0285B1717966800351E35 /* ARMv7DOpcode.h */; };
738
		65FB5117184EEE7000C12B70 /* ProtoCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */; };
738
		7C15F65D17C199CE00794D40 /* JSPromiseCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C15F65B17C199CE00794D40 /* JSPromiseCallback.cpp */; };
739
		7C15F65D17C199CE00794D40 /* JSPromiseCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C15F65B17C199CE00794D40 /* JSPromiseCallback.cpp */; };
739
		7C15F65E17C199CE00794D40 /* JSPromiseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C15F65C17C199CE00794D40 /* JSPromiseCallback.h */; };
740
		7C15F65E17C199CE00794D40 /* JSPromiseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C15F65C17C199CE00794D40 /* JSPromiseCallback.h */; };
740
		7C184E1A17BEDBD3007CB63A /* JSPromise.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C184E1817BEDBD3007CB63A /* JSPromise.cpp */; };
741
		7C184E1A17BEDBD3007CB63A /* JSPromise.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C184E1817BEDBD3007CB63A /* JSPromise.cpp */; };
Lines 2015-2020 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec2
2015
		65EA4C9A092AF9E20093D800 /* JSLock.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSLock.h; sourceTree = "<group>"; tabWidth = 8; };
2016
		65EA4C9A092AF9E20093D800 /* JSLock.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSLock.h; sourceTree = "<group>"; tabWidth = 8; };
2016
		65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommonIdentifiers.cpp; sourceTree = "<group>"; };
2017
		65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommonIdentifiers.cpp; sourceTree = "<group>"; };
2017
		65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonIdentifiers.h; sourceTree = "<group>"; };
2018
		65EA73630BAE35D1001BB560 /* CommonIdentifiers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CommonIdentifiers.h; sourceTree = "<group>"; };
2019
		65FB5115184EE8F800C12B70 /* ProtoCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtoCallFrame.h; sourceTree = "<group>"; };
2020
		65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtoCallFrame.cpp; sourceTree = "<group>"; };
2018
		704FD35305697E6D003DBED9 /* BooleanObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BooleanObject.h; sourceTree = "<group>"; tabWidth = 8; };
2021
		704FD35305697E6D003DBED9 /* BooleanObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BooleanObject.h; sourceTree = "<group>"; tabWidth = 8; };
2019
		7C15F65B17C199CE00794D40 /* JSPromiseCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPromiseCallback.cpp; sourceTree = "<group>"; };
2022
		7C15F65B17C199CE00794D40 /* JSPromiseCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPromiseCallback.cpp; sourceTree = "<group>"; };
2020
		7C15F65C17C199CE00794D40 /* JSPromiseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPromiseCallback.h; sourceTree = "<group>"; };
2023
		7C15F65C17C199CE00794D40 /* JSPromiseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPromiseCallback.h; sourceTree = "<group>"; };
Lines 2918-2923 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec3
2918
		1429D77A0ED20D7300B89619 /* interpreter */ = {
2921
		1429D77A0ED20D7300B89619 /* interpreter */ = {
2919
			isa = PBXGroup;
2922
			isa = PBXGroup;
2920
			children = (
2923
			children = (
2924
				65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */,
2925
				65FB5115184EE8F800C12B70 /* ProtoCallFrame.h */,
2921
				0F55F0F114D1063600AC7649 /* AbstractPC.cpp */,
2926
				0F55F0F114D1063600AC7649 /* AbstractPC.cpp */,
2922
				0F55F0F214D1063600AC7649 /* AbstractPC.h */,
2927
				0F55F0F214D1063600AC7649 /* AbstractPC.h */,
2923
				A7F8690E0F9584A100558697 /* CachedCall.h */,
2928
				A7F8690E0F9584A100558697 /* CachedCall.h */,
Lines 5277-5282 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec4
5277
			isa = PBXSourcesBuildPhase;
5282
			isa = PBXSourcesBuildPhase;
5278
			buildActionMask = 2147483647;
5283
			buildActionMask = 2147483647;
5279
			files = (
5284
			files = (
5285
				65FB5117184EEE7000C12B70 /* ProtoCallFrame.cpp in Sources */,
5280
				0FFA549716B8835000B3A982 /* A64DOpcode.cpp in Sources */,
5286
				0FFA549716B8835000B3A982 /* A64DOpcode.cpp in Sources */,
5281
				0F55F0F414D1063900AC7649 /* AbstractPC.cpp in Sources */,
5287
				0F55F0F414D1063900AC7649 /* AbstractPC.cpp in Sources */,
5282
				147F39BD107EC37600427A48 /* ArgList.cpp in Sources */,
5288
				147F39BD107EC37600427A48 /* ArgList.cpp in Sources */,
- Source/JavaScriptCore/interpreter/CachedCall.h -3 / +18 lines
Lines 31-36 Source/JavaScriptCore/interpreter/CachedCall.h_sec1
31
#include "JSFunction.h"
31
#include "JSFunction.h"
32
#include "JSGlobalObject.h"
32
#include "JSGlobalObject.h"
33
#include "Interpreter.h"
33
#include "Interpreter.h"
34
#include "ProtoCallFrame.h"
34
#include "VMEntryScope.h"
35
#include "VMEntryScope.h"
35
36
36
namespace JSC {
37
namespace JSC {
Lines 43-51 namespace JSC { Source/JavaScriptCore/interpreter/CachedCall.h_sec2
43
            , m_entryScope(callFrame->vm(), function->scope()->globalObject())
44
            , m_entryScope(callFrame->vm(), function->scope()->globalObject())
44
        {
45
        {
45
            ASSERT(!function->isHostFunction());
46
            ASSERT(!function->isHostFunction());
46
            if (callFrame->vm().isSafeToRecurse())
47
            if (callFrame->vm().isSafeToRecurse()) {
48
#if !ENABLE(LLINT_C_LOOP)
49
                m_arguments.resize(argumentCount);
50
                m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, &m_protoCallFrame, function, argumentCount + 1, function->scope(), m_arguments.data());
51
#else
47
                m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argumentCount + 1, function->scope());
52
                m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argumentCount + 1, function->scope());
48
            else
53
#endif
54
            } else
49
                throwStackOverflowError(callFrame);
55
                throwStackOverflowError(callFrame);
50
            m_valid = !callFrame->hadException();
56
            m_valid = !callFrame->hadException();
51
        }
57
        }
Lines 55-60 namespace JSC { Source/JavaScriptCore/interpreter/CachedCall.h_sec3
55
            ASSERT(m_valid);
61
            ASSERT(m_valid);
56
            return m_interpreter->execute(m_closure);
62
            return m_interpreter->execute(m_closure);
57
        }
63
        }
64
#if !ENABLE(LLINT_C_LOOP)
65
        void setThis(JSValue v) { m_protoCallFrame.setThisValue(v); }
66
        void setArgument(int n, JSValue v) { m_protoCallFrame.setArgument(n, v); }
67
#else
58
        void setThis(JSValue v) { m_closure.setThis(v); }
68
        void setThis(JSValue v) { m_closure.setThis(v); }
59
        void setArgument(int n, JSValue v) { m_closure.setArgument(n, v); }
69
        void setArgument(int n, JSValue v) { m_closure.setArgument(n, v); }
60
70
Lines 70-80 namespace JSC { Source/JavaScriptCore/interpreter/CachedCall.h_sec4
70
            if (m_valid)
80
            if (m_valid)
71
                m_interpreter->endRepeatCall(m_closure);
81
                m_interpreter->endRepeatCall(m_closure);
72
        }
82
        }
73
        
83
#endif
84
74
    private:
85
    private:
75
        bool m_valid;
86
        bool m_valid;
76
        Interpreter* m_interpreter;
87
        Interpreter* m_interpreter;
77
        VMEntryScope m_entryScope;
88
        VMEntryScope m_entryScope;
89
#if !ENABLE(LLINT_C_LOOP)
90
        ProtoCallFrame m_protoCallFrame;
91
        Vector<JSValue> m_arguments;
92
#endif
78
        CallFrameClosure m_closure;
93
        CallFrameClosure m_closure;
79
    };
94
    };
80
}
95
}
- Source/JavaScriptCore/interpreter/CallFrameClosure.h -1 / +9 lines
Lines 26-36 Source/JavaScriptCore/interpreter/CallFrameClosure.h_sec1
26
#ifndef CallFrameClosure_h
26
#ifndef CallFrameClosure_h
27
#define CallFrameClosure_h
27
#define CallFrameClosure_h
28
28
29
#include "ProtoCallFrame.h"
30
29
namespace JSC {
31
namespace JSC {
30
32
31
struct CallFrameClosure {
33
struct CallFrameClosure {
32
    CallFrame* oldCallFrame;
34
    CallFrame* oldCallFrame;
35
#if ENABLE(LLINT_C_LOOP)
33
    CallFrame* newCallFrame;
36
    CallFrame* newCallFrame;
37
#else
38
    ProtoCallFrame* newCallFrame;
39
#endif
34
    JSFunction* function;
40
    JSFunction* function;
35
    FunctionExecutable* functionExecutable;
41
    FunctionExecutable* functionExecutable;
36
    VM* vm;
42
    VM* vm;
Lines 51-62 struct CallFrameClosure { Source/JavaScriptCore/interpreter/CallFrameClosure.h_sec2
51
    void resetCallFrame()
57
    void resetCallFrame()
52
    {
58
    {
53
        newCallFrame->setScope(scope);
59
        newCallFrame->setScope(scope);
60
#if ENABLE(LLINT_C_LOOP)
54
        // setArgument() takes an arg index that starts from 0 for the first
61
        // setArgument() takes an arg index that starts from 0 for the first
55
        // argument after the 'this' value. Since both argumentCountIncludingThis
62
        // argument after the 'this' value. Since both argumentCountIncludingThis
56
        // and parameterCountIncludingThis includes the 'this' value, we need to
63
        // and parameterCountIncludingThis includes the 'this' value, we need to
57
        // subtract 1 from them to make i a valid argument index for setArgument().
64
        // subtract 1 from them to make it a valid argument index for setArgument().
58
        for (int i = argumentCountIncludingThis-1; i < parameterCountIncludingThis-1; ++i)
65
        for (int i = argumentCountIncludingThis-1; i < parameterCountIncludingThis-1; ++i)
59
            newCallFrame->setArgument(i, jsUndefined());
66
            newCallFrame->setArgument(i, jsUndefined());
67
#endif
60
    }
68
    }
61
};
69
};
62
70
- Source/JavaScriptCore/interpreter/Interpreter.cpp -15 / +83 lines
Lines 53-64 Source/JavaScriptCore/interpreter/Interpreter.cpp_sec1
53
#include "JSString.h"
53
#include "JSString.h"
54
#include "JSWithScope.h"
54
#include "JSWithScope.h"
55
#include "LLIntCLoop.h"
55
#include "LLIntCLoop.h"
56
#include "LLIntThunks.h"
56
#include "LegacyProfiler.h"
57
#include "LegacyProfiler.h"
57
#include "LiteralParser.h"
58
#include "LiteralParser.h"
58
#include "NameInstance.h"
59
#include "NameInstance.h"
59
#include "ObjectPrototype.h"
60
#include "ObjectPrototype.h"
60
#include "Operations.h"
61
#include "Operations.h"
61
#include "Parser.h"
62
#include "Parser.h"
63
#include "ProtoCallFrame.h"
62
#include "RegExpObject.h"
64
#include "RegExpObject.h"
63
#include "RegExpPrototype.h"
65
#include "RegExpPrototype.h"
64
#include "Register.h"
66
#include "Register.h"
Lines 860-871 failedJSONP: Source/JavaScriptCore/interpreter/Interpreter.cpp_sec2
860
862
861
    // Push the call frame for this invocation:
863
    // Push the call frame for this invocation:
862
    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
864
    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
865
#if ENABLE(LLINT_C_LOOP)
863
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0);
866
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0);
864
    if (UNLIKELY(!newCallFrame))
867
    if (UNLIKELY(!newCallFrame))
865
        return checkedReturn(throwStackOverflowError(callFrame));
868
        return checkedReturn(throwStackOverflowError(callFrame));
866
869
867
    // Set the arguments for the callee:
870
    // Set the arguments for the callee:
868
    newCallFrame->setThisValue(thisObj);
871
    newCallFrame->setThisValue(thisObj);
872
#else
873
    if (UNLIKELY(!m_stack.entryCheck(codeBlock, 1)))
874
        return checkedReturn(throwStackOverflowError(callFrame));
875
876
    ProtoCallFrame protoCallFrame;
877
    protoCallFrame.init(codeBlock, scope, 0, thisObj, 1);
878
#endif
869
879
870
    if (LegacyProfiler* profiler = vm.enabledProfiler())
880
    if (LegacyProfiler* profiler = vm.enabledProfiler())
871
        profiler->willExecute(callFrame, program->sourceURL(), program->lineNo());
881
        profiler->willExecute(callFrame, program->sourceURL(), program->lineNo());
Lines 879-892 failedJSONP: Source/JavaScriptCore/interpreter/Interpreter.cpp_sec3
879
#if ENABLE(LLINT_C_LOOP)
889
#if ENABLE(LLINT_C_LOOP)
880
        result = LLInt::CLoop::execute(newCallFrame, llint_program_prologue);
890
        result = LLInt::CLoop::execute(newCallFrame, llint_program_prologue);
881
#elif ENABLE(JIT)
891
#elif ENABLE(JIT)
882
        result = program->generatedJITCode()->execute(&m_stack, newCallFrame, &vm);
892
        result = program->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
883
#endif // ENABLE(JIT)
893
#endif // ENABLE(JIT)
884
    }
894
    }
885
895
886
    if (LegacyProfiler* profiler = vm.enabledProfiler())
896
    if (LegacyProfiler* profiler = vm.enabledProfiler())
887
        profiler->didExecute(callFrame, program->sourceURL(), program->lineNo());
897
        profiler->didExecute(callFrame, program->sourceURL(), program->lineNo());
888
898
899
#if ENABLE(LLINT_C_LOOP)
889
    m_stack.popFrame(newCallFrame);
900
    m_stack.popFrame(newCallFrame);
901
#endif
890
902
891
    return checkedReturn(result);
903
    return checkedReturn(result);
892
}
904
}
Lines 930-935 JSValue Interpreter::executeCall(CallFra Source/JavaScriptCore/interpreter/Interpreter.cpp_sec4
930
    if (UNLIKELY(vm.watchdog.didFire(callFrame)))
942
    if (UNLIKELY(vm.watchdog.didFire(callFrame)))
931
        return throwTerminatedExecutionException(callFrame);
943
        return throwTerminatedExecutionException(callFrame);
932
944
945
#if ENABLE(LLINT_C_LOOP)
933
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);
946
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);
934
    if (UNLIKELY(!newCallFrame))
947
    if (UNLIKELY(!newCallFrame))
935
        return checkedReturn(throwStackOverflowError(callFrame));
948
        return checkedReturn(throwStackOverflowError(callFrame));
Lines 938-943 JSValue Interpreter::executeCall(CallFra Source/JavaScriptCore/interpreter/Interpreter.cpp_sec5
938
    newCallFrame->setThisValue(thisValue);
951
    newCallFrame->setThisValue(thisValue);
939
    for (size_t i = 0; i < args.size(); ++i)
952
    for (size_t i = 0; i < args.size(); ++i)
940
        newCallFrame->setArgument(i, args.at(i));
953
        newCallFrame->setArgument(i, args.at(i));
954
#else
955
    if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount)))
956
        return checkedReturn(throwStackOverflowError(callFrame));
957
958
    ProtoCallFrame protoCallFrame;
959
    protoCallFrame.init(newCodeBlock, scope, function, thisValue, argsCount, args.data());
960
#endif
941
961
942
    if (LegacyProfiler* profiler = vm.enabledProfiler())
962
    if (LegacyProfiler* profiler = vm.enabledProfiler())
943
        profiler->willExecute(callFrame, function);
963
        profiler->willExecute(callFrame, function);
Lines 952-967 JSValue Interpreter::executeCall(CallFra Source/JavaScriptCore/interpreter/Interpreter.cpp_sec6
952
#if ENABLE(LLINT_C_LOOP)
972
#if ENABLE(LLINT_C_LOOP)
953
            result = LLInt::CLoop::execute(newCallFrame, llint_function_for_call_prologue);
973
            result = LLInt::CLoop::execute(newCallFrame, llint_function_for_call_prologue);
954
#elif ENABLE(JIT)
974
#elif ENABLE(JIT)
955
            result = callData.js.functionExecutable->generatedJITCodeForCall()->execute(&m_stack, newCallFrame, &vm);
975
            result = callData.js.functionExecutable->generatedJITCodeForCall()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
956
#endif // ENABLE(JIT)
976
#endif // ENABLE(JIT)
957
        } else
977
        } else {
978
#if ENABLE(LLINT_C_LOOP)
958
            result = JSValue::decode(callData.native.function(newCallFrame));
979
            result = JSValue::decode(callData.native.function(newCallFrame));
980
#else
981
            result = JSValue::decode(callToNativeFunction(reinterpret_cast<void*>(callData.native.function), &vm.topCallFrame, &protoCallFrame, m_stack.getTopOfStack()));
982
#endif
983
        }
959
    }
984
    }
960
985
961
    if (LegacyProfiler* profiler = vm.enabledProfiler())
986
    if (LegacyProfiler* profiler = vm.enabledProfiler())
962
        profiler->didExecute(callFrame, function);
987
        profiler->didExecute(callFrame, function);
963
988
989
#if ENABLE(LLINT_C_LOOP)
964
    m_stack.popFrame(newCallFrame);
990
    m_stack.popFrame(newCallFrame);
991
#endif
965
    return checkedReturn(result);
992
    return checkedReturn(result);
966
}
993
}
967
994
Lines 1005-1011 JSObject* Interpreter::executeConstruct( Source/JavaScriptCore/interpreter/Interpreter.cpp_sec7
1005
1032
1006
    if (UNLIKELY(vm.watchdog.didFire(callFrame)))
1033
    if (UNLIKELY(vm.watchdog.didFire(callFrame)))
1007
        return throwTerminatedExecutionException(callFrame);
1034
        return throwTerminatedExecutionException(callFrame);
1008
1035
#if ENABLE(LLINT_C_LOOP)
1009
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, constructor);
1036
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, constructor);
1010
    if (UNLIKELY(!newCallFrame))
1037
    if (UNLIKELY(!newCallFrame))
1011
        return checkedReturn(throwStackOverflowError(callFrame));
1038
        return checkedReturn(throwStackOverflowError(callFrame));
Lines 1014-1019 JSObject* Interpreter::executeConstruct( Source/JavaScriptCore/interpreter/Interpreter.cpp_sec8
1014
    newCallFrame->setThisValue(jsUndefined());
1041
    newCallFrame->setThisValue(jsUndefined());
1015
    for (size_t i = 0; i < args.size(); ++i)
1042
    for (size_t i = 0; i < args.size(); ++i)
1016
        newCallFrame->setArgument(i, args.at(i));
1043
        newCallFrame->setArgument(i, args.at(i));
1044
#else
1045
    if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount)))
1046
        return checkedReturn(throwStackOverflowError(callFrame));
1047
1048
    ProtoCallFrame protoCallFrame;
1049
    protoCallFrame.init(newCodeBlock, scope, constructor, jsUndefined(), argsCount, args.data());
1050
#endif
1017
1051
1018
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1052
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1019
        profiler->willExecute(callFrame, constructor);
1053
        profiler->willExecute(callFrame, constructor);
Lines 1028-1049 JSObject* Interpreter::executeConstruct( Source/JavaScriptCore/interpreter/Interpreter.cpp_sec9
1028
#if ENABLE(LLINT_C_LOOP)
1062
#if ENABLE(LLINT_C_LOOP)
1029
            result = LLInt::CLoop::execute(newCallFrame, llint_function_for_construct_prologue);
1063
            result = LLInt::CLoop::execute(newCallFrame, llint_function_for_construct_prologue);
1030
#elif ENABLE(JIT)
1064
#elif ENABLE(JIT)
1031
            result = constructData.js.functionExecutable->generatedJITCodeForConstruct()->execute(&m_stack, newCallFrame, &vm);
1065
            result = constructData.js.functionExecutable->generatedJITCodeForConstruct()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
1032
#endif // ENABLE(JIT)
1066
#endif // ENABLE(JIT)
1033
        } else {
1067
        } else {
1068
#if ENABLE(LLINT_C_LOOP)
1034
            result = JSValue::decode(constructData.native.function(newCallFrame));
1069
            result = JSValue::decode(constructData.native.function(newCallFrame));
1035
            if (!callFrame->hadException()) {
1070
#else
1036
                ASSERT_WITH_MESSAGE(result.isObject(), "Host constructor returned non object.");
1071
            result = JSValue::decode(callToNativeFunction(reinterpret_cast<void*>(constructData.native.function), &vm.topCallFrame, &protoCallFrame, m_stack.getTopOfStack()));
1037
                if (!result.isObject())
1072
#endif
1038
                    throwTypeError(newCallFrame);
1073
            if (!callFrame->hadException())
1039
            }
1074
                RELEASE_ASSERT(result.isObject());
1040
        }
1075
        }
1041
    }
1076
    }
1042
1077
1043
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1078
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1044
        profiler->didExecute(callFrame, constructor);
1079
        profiler->didExecute(callFrame, constructor);
1045
1080
1081
#if ENABLE(LLINT_C_LOOP)
1046
    m_stack.popFrame(newCallFrame);
1082
    m_stack.popFrame(newCallFrame);
1083
#endif
1047
1084
1048
    if (callFrame->hadException())
1085
    if (callFrame->hadException())
1049
        return 0;
1086
        return 0;
Lines 1051-1057 JSObject* Interpreter::executeConstruct( Source/JavaScriptCore/interpreter/Interpreter.cpp_sec10
1051
    return checkedReturn(asObject(result));
1088
    return checkedReturn(asObject(result));
1052
}
1089
}
1053
1090
1091
#if ENABLE(LLINT_C_LOOP)
1054
CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope)
1092
CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope)
1093
#else
1094
CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, ProtoCallFrame* protoCallFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope, JSValue* args)
1095
#endif
1055
{
1096
{
1056
    VM& vm = *scope->vm();
1097
    VM& vm = *scope->vm();
1057
    ASSERT(!vm.exception());
1098
    ASSERT(!vm.exception());
Lines 1070-1088 CallFrameClosure Interpreter::prepareFor Source/JavaScriptCore/interpreter/Interpreter.cpp_sec11
1070
1111
1071
    size_t argsCount = argumentCountIncludingThis;
1112
    size_t argsCount = argumentCountIncludingThis;
1072
1113
1073
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);  
1114
#if ENABLE(LLINT_C_LOOP)
1115
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);
1116
1074
    if (UNLIKELY(!newCallFrame)) {
1117
    if (UNLIKELY(!newCallFrame)) {
1075
        throwStackOverflowError(callFrame);
1118
        throwStackOverflowError(callFrame);
1076
        return CallFrameClosure();
1119
        return CallFrameClosure();
1077
    }
1120
    }
1078
1121
1079
    if (UNLIKELY(!newCallFrame)) {
1122
    // Return the successful closure:
1123
    CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis };
1124
#else
1125
    if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount))) {
1080
        throwStackOverflowError(callFrame);
1126
        throwStackOverflowError(callFrame);
1081
        return CallFrameClosure();
1127
        return CallFrameClosure();
1082
    }
1128
    }
1083
1129
1130
    protoCallFrame->init(newCodeBlock, scope, function, jsUndefined(), argsCount, args);
1084
    // Return the successful closure:
1131
    // Return the successful closure:
1085
    CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis };
1132
    CallFrameClosure result = { callFrame, protoCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis };
1133
#endif
1086
    return result;
1134
    return result;
1087
}
1135
}
1088
1136
Lines 1096-1104 JSValue Interpreter::execute(CallFrameCl Source/JavaScriptCore/interpreter/Interpreter.cpp_sec12
1096
        return jsNull();
1144
        return jsNull();
1097
1145
1098
    StackStats::CheckPoint stackCheckPoint;
1146
    StackStats::CheckPoint stackCheckPoint;
1147
#if ENABLE(LLINT_C_LOOP)
1099
    m_stack.validateFence(closure.newCallFrame, "BEFORE");
1148
    m_stack.validateFence(closure.newCallFrame, "BEFORE");
1149
#endif
1100
    closure.resetCallFrame();
1150
    closure.resetCallFrame();
1151
#if ENABLE(LLINT_C_LOOP)
1101
    m_stack.validateFence(closure.newCallFrame, "STEP 1");
1152
    m_stack.validateFence(closure.newCallFrame, "STEP 1");
1153
#endif
1102
1154
1103
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1155
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1104
        profiler->willExecute(closure.oldCallFrame, closure.function);
1156
        profiler->willExecute(closure.oldCallFrame, closure.function);
Lines 1114-1120 JSValue Interpreter::execute(CallFrameCl Source/JavaScriptCore/interpreter/Interpreter.cpp_sec13
1114
    // Hence, we need to preserve the topCallFrame here ourselves before
1166
    // Hence, we need to preserve the topCallFrame here ourselves before
1115
    // repeating this call on a second callback function.
1167
    // repeating this call on a second callback function.
1116
1168
1169
#if ENABLE(LLINT_C_LOOP)
1117
    TopCallFrameSetter topCallFrame(vm, closure.newCallFrame);
1170
    TopCallFrameSetter topCallFrame(vm, closure.newCallFrame);
1171
#endif
1118
1172
1119
    // Execute the code:
1173
    // Execute the code:
1120
    JSValue result;
1174
    JSValue result;
Lines 1125-1145 JSValue Interpreter::execute(CallFrameCl Source/JavaScriptCore/interpreter/Interpreter.cpp_sec14
1125
#if ENABLE(LLINT_C_LOOP)
1179
#if ENABLE(LLINT_C_LOOP)
1126
        result = LLInt::CLoop::execute(closure.newCallFrame, llint_function_for_call_prologue);
1180
        result = LLInt::CLoop::execute(closure.newCallFrame, llint_function_for_call_prologue);
1127
#elif ENABLE(JIT)
1181
#elif ENABLE(JIT)
1128
        result = closure.functionExecutable->generatedJITCodeForCall()->execute(&m_stack, closure.newCallFrame, &vm);
1182
        result = closure.functionExecutable->generatedJITCodeForCall()->execute(&vm, closure.newCallFrame, m_stack.getTopOfStack());
1129
#endif // ENABLE(JIT)
1183
#endif // ENABLE(JIT)
1130
    }
1184
    }
1131
1185
1132
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1186
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1133
        profiler->didExecute(closure.oldCallFrame, closure.function);
1187
        profiler->didExecute(closure.oldCallFrame, closure.function);
1134
1188
1189
#if ENABLE(LLINT_C_LOOP)
1135
    m_stack.validateFence(closure.newCallFrame, "AFTER");
1190
    m_stack.validateFence(closure.newCallFrame, "AFTER");
1191
#endif
1136
    return checkedReturn(result);
1192
    return checkedReturn(result);
1137
}
1193
}
1138
1194
1195
#if ENABLE(LLINT_C_LOOP)
1139
void Interpreter::endRepeatCall(CallFrameClosure& closure)
1196
void Interpreter::endRepeatCall(CallFrameClosure& closure)
1140
{
1197
{
1141
    m_stack.popFrame(closure.newCallFrame);
1198
    m_stack.popFrame(closure.newCallFrame);
1142
}
1199
}
1200
#endif
1143
1201
1144
JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope)
1202
JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope)
1145
{
1203
{
Lines 1203-1214 JSValue Interpreter::execute(EvalExecuta Source/JavaScriptCore/interpreter/Interpreter.cpp_sec15
1203
1261
1204
    // Push the frame:
1262
    // Push the frame:
1205
    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
1263
    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
1264
#if ENABLE(LLINT_C_LOOP)
1206
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0);
1265
    CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0);
1207
    if (UNLIKELY(!newCallFrame))
1266
    if (UNLIKELY(!newCallFrame))
1208
        return checkedReturn(throwStackOverflowError(callFrame));
1267
        return checkedReturn(throwStackOverflowError(callFrame));
1209
1268
1210
    // Set the arguments for the callee:
1269
    // Set the arguments for the callee:
1211
    newCallFrame->setThisValue(thisValue);
1270
    newCallFrame->setThisValue(thisValue);
1271
#else
1272
    if (UNLIKELY(!m_stack.entryCheck(codeBlock, 1)))
1273
        return checkedReturn(throwStackOverflowError(callFrame));
1274
1275
    ProtoCallFrame protoCallFrame;
1276
    protoCallFrame.init(codeBlock, scope, 0, thisValue, 1);
1277
#endif
1212
1278
1213
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1279
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1214
        profiler->willExecute(callFrame, eval->sourceURL(), eval->lineNo());
1280
        profiler->willExecute(callFrame, eval->sourceURL(), eval->lineNo());
Lines 1222-1235 JSValue Interpreter::execute(EvalExecuta Source/JavaScriptCore/interpreter/Interpreter.cpp_sec16
1222
#if ENABLE(LLINT_C_LOOP)
1288
#if ENABLE(LLINT_C_LOOP)
1223
        result = LLInt::CLoop::execute(newCallFrame, llint_eval_prologue);
1289
        result = LLInt::CLoop::execute(newCallFrame, llint_eval_prologue);
1224
#elif ENABLE(JIT)
1290
#elif ENABLE(JIT)
1225
        result = eval->generatedJITCode()->execute(&m_stack, newCallFrame, &vm);
1291
        result = eval->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
1226
#endif // ENABLE(JIT)
1292
#endif // ENABLE(JIT)
1227
    }
1293
    }
1228
1294
1229
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1295
    if (LegacyProfiler* profiler = vm.enabledProfiler())
1230
        profiler->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
1296
        profiler->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
1231
1297
1298
#if ENABLE(LLINT_C_LOOP)
1232
    m_stack.popFrame(newCallFrame);
1299
    m_stack.popFrame(newCallFrame);
1300
#endif
1233
    return checkedReturn(result);
1301
    return checkedReturn(result);
1234
}
1302
}
1235
1303
- Source/JavaScriptCore/interpreter/Interpreter.h -1 / +6 lines
Lines 59-65 namespace JSC { Source/JavaScriptCore/interpreter/Interpreter.h_sec1
59
    struct CallFrameClosure;
59
    struct CallFrameClosure;
60
    struct HandlerInfo;
60
    struct HandlerInfo;
61
    struct Instruction;
61
    struct Instruction;
62
    
62
    struct ProtoCallFrame;
63
63
    enum DebugHookID {
64
    enum DebugHookID {
64
        WillExecuteProgram,
65
        WillExecuteProgram,
65
        DidExecuteProgram,
66
        DidExecuteProgram,
Lines 256-263 namespace JSC { Source/JavaScriptCore/interpreter/Interpreter.h_sec2
256
    private:
257
    private:
257
        enum ExecutionFlag { Normal, InitializeAndReturn };
258
        enum ExecutionFlag { Normal, InitializeAndReturn };
258
259
260
#if !ENABLE(LLINT_C_LOOP)
261
        CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, ProtoCallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*, JSValue*);
262
#else
259
        CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*);
263
        CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*);
260
        void endRepeatCall(CallFrameClosure&);
264
        void endRepeatCall(CallFrameClosure&);
265
#endif
261
        JSValue execute(CallFrameClosure&);
266
        JSValue execute(CallFrameClosure&);
262
267
263
        void getStackTrace(Vector<StackFrame>& results, size_t maxStackSize = std::numeric_limits<size_t>::max());
268
        void getStackTrace(Vector<StackFrame>& results, size_t maxStackSize = std::numeric_limits<size_t>::max());
- Source/JavaScriptCore/interpreter/JSStack.h +3 lines
Lines 35-40 Source/JavaScriptCore/interpreter/JSStack.h_sec1
35
#include <wtf/PageReservation.h>
35
#include <wtf/PageReservation.h>
36
#include <wtf/VMTags.h>
36
#include <wtf/VMTags.h>
37
37
38
#define ENABLE_DEBUG_JSSTACK 0
38
#if !defined(NDEBUG) && !defined(ENABLE_DEBUG_JSSTACK)
39
#if !defined(NDEBUG) && !defined(ENABLE_DEBUG_JSSTACK)
39
#define ENABLE_DEBUG_JSSTACK 1
40
#define ENABLE_DEBUG_JSSTACK 1
40
#endif
41
#endif
Lines 99-104 namespace JSC { Source/JavaScriptCore/interpreter/JSStack.h_sec2
99
        Register* getStartOfFrame(CallFrame*);
100
        Register* getStartOfFrame(CallFrame*);
100
        Register* getTopOfStack();
101
        Register* getTopOfStack();
101
102
103
        bool entryCheck(class CodeBlock*, int);
104
102
        CallFrame* pushFrame(CallFrame* callerFrame, class CodeBlock*,
105
        CallFrame* pushFrame(CallFrame* callerFrame, class CodeBlock*,
103
            JSScope*, int argsCount, JSObject* callee);
106
            JSScope*, int argsCount, JSObject* callee);
104
107
- Source/JavaScriptCore/interpreter/JSStackInlines.h -8 / +37 lines
Lines 51-56 inline Register* JSStack::getStartOfFram Source/JavaScriptCore/interpreter/JSStackInlines.h_sec1
51
    return getTopOfFrame(callerFrame);
51
    return getTopOfFrame(callerFrame);
52
}
52
}
53
53
54
inline bool JSStack::entryCheck(class CodeBlock* codeBlock, int argsCount)
55
{
56
    Register* oldEnd = getTopOfStack();
57
58
    // Ensure that we have enough space for the parameters:
59
    size_t paddedArgsCount = argsCount;
60
    if (codeBlock) {
61
        size_t numParameters = codeBlock->numParameters();
62
        if (paddedArgsCount < numParameters)
63
            paddedArgsCount = numParameters;
64
    }
65
66
    Register* newCallFrameSlot = oldEnd - paddedArgsCount - (2 * JSStack::CallFrameHeaderSize) + 1;
67
68
#if ENABLE(DEBUG_JSSTACK)
69
    newCallFrameSlot -= JSStack::FenceSize;
70
#endif
71
72
    Register* newEnd = newCallFrameSlot;
73
    if (!!codeBlock)
74
        newEnd += virtualRegisterForLocal(codeBlock->frameRegisterCount()).offset();
75
76
    // Ensure that we have the needed stack capacity to push the new frame:
77
    if (!grow(newEnd))
78
        return false;
79
80
    return true;
81
}
82
54
inline CallFrame* JSStack::pushFrame(CallFrame* callerFrame,
83
inline CallFrame* JSStack::pushFrame(CallFrame* callerFrame,
55
    class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee)
84
    class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee)
56
{
85
{
Lines 79-87 inline CallFrame* JSStack::pushFrame(Cal Source/JavaScriptCore/interpreter/JSStackInlines.h_sec2
79
    if (!grow(newEnd))
108
    if (!grow(newEnd))
80
        return 0;
109
        return 0;
81
110
82
    // Compute the address of the new VM sentinal frame for this invocation:
111
    // Compute the address of the new VM sentinel frame for this invocation:
83
    CallFrame* newVMEntrySentinalFrame = CallFrame::create(newCallFrameSlot + paddedArgsCount + JSStack::CallFrameHeaderSize);
112
    CallFrame* newVMEntrySentinelFrame = CallFrame::create(newCallFrameSlot + paddedArgsCount + JSStack::CallFrameHeaderSize);
84
    ASSERT(!!newVMEntrySentinalFrame);
113
    ASSERT(!!newVMEntrySentinelFrame);
85
114
86
    // Compute the address of the new frame for this invocation:
115
    // Compute the address of the new frame for this invocation:
87
    CallFrame* newCallFrame = CallFrame::create(newCallFrameSlot);
116
    CallFrame* newCallFrame = CallFrame::create(newCallFrameSlot);
Lines 92-102 inline CallFrame* JSStack::pushFrame(Cal Source/JavaScriptCore/interpreter/JSStackInlines.h_sec3
92
    // the top frame on the stack.
121
    // the top frame on the stack.
93
    callerFrame = m_topCallFrame;
122
    callerFrame = m_topCallFrame;
94
123
95
    // Initialize the VM sentinal frame header:
124
    // Initialize the VM sentinel frame header:
96
    newVMEntrySentinalFrame->initializeVMEntrySentinelFrame(callerFrame);
125
    newVMEntrySentinelFrame->initializeVMEntrySentinelFrame(callerFrame);
97
126
98
    // Initialize the callee frame header:
127
    // Initialize the callee frame header:
99
    newCallFrame->init(codeBlock, 0, scope, newVMEntrySentinalFrame, argsCount, callee);
128
    newCallFrame->init(codeBlock, 0, scope, newVMEntrySentinelFrame, argsCount, callee);
100
129
101
    ASSERT(!!newCallFrame->scope());
130
    ASSERT(!!newCallFrame->scope());
102
131
Lines 120-126 inline void JSStack::popFrame(CallFrame* Source/JavaScriptCore/interpreter/JSStackInlines.h_sec4
120
{
149
{
121
    validateFence(frame, __FUNCTION__, __LINE__);
150
    validateFence(frame, __FUNCTION__, __LINE__);
122
151
123
    // Pop off the callee frame and the sentinal frame.
152
    // Pop off the callee frame and the sentinel frame.
124
    CallFrame* callerFrame = frame->callerFrame()->vmEntrySentinelCallerFrame();
153
    CallFrame* callerFrame = frame->callerFrame()->vmEntrySentinelCallerFrame();
125
154
126
    // Pop to the caller:
155
    // Pop to the caller:
Lines 183-189 inline JSValue JSStack::generateFenceVal Source/JavaScriptCore/interpreter/JSStackInlines.h_sec5
183
//                     |--------------------------------------|
212
//                     |--------------------------------------|
184
//                     | *** the Fence ***                    |
213
//                     | *** the Fence ***                    |
185
//                     |--------------------------------------|
214
//                     |--------------------------------------|
186
//                     | VM entry sentinal frame header       |
215
//                     | VM entry sentinel frame header       |
187
//                     |--------------------------------------|
216
//                     |--------------------------------------|
188
//                     | Args of new frame                    |
217
//                     | Args of new frame                    |
189
//                     |--------------------------------------|
218
//                     |--------------------------------------|
- Source/JavaScriptCore/interpreter/ProtoCallFrame.cpp +51 lines
Line 0 Source/JavaScriptCore/interpreter/ProtoCallFrame.cpp_sec1
1
/*
2
 * Copyright (C) 2013 Apple Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 */
25
26
#include "config.h"
27
#include "ProtoCallFrame.h"
28
29
#include "CodeBlock.h"
30
31
namespace JSC {
32
33
void ProtoCallFrame::init(CodeBlock* codeBlock, JSScope* scope, JSObject* callee, JSValue thisValue, int argCountIncludingThis, JSValue* otherArgs)
34
{
35
    this->args = otherArgs;
36
    this->setCodeBlock(codeBlock);
37
    this->setScope(scope);
38
    this->setCallee(callee);
39
    this->setArgumentCountIncludingThis(argCountIncludingThis);
40
    size_t paddedArgsCount = argCountIncludingThis;
41
    if (codeBlock) {
42
        size_t numParameters = codeBlock->numParameters();
43
        if (paddedArgsCount < numParameters)
44
            paddedArgsCount = numParameters;
45
    }
46
    this->setPaddedArgsCount(paddedArgsCount);
47
    this->clearCurrentVPC();
48
    this->setThisValue(thisValue);
49
}
50
51
} // namespace JSC
- Source/JavaScriptCore/interpreter/ProtoCallFrame.h +63 lines
Line 0 Source/JavaScriptCore/interpreter/ProtoCallFrame.h_sec1
1
/*
2
 * Copyright (C) 2013 Apple Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef ProtoCallFrame_h
27
#define ProtoCallFrame_h
28
29
#include "Register.h"
30
31
namespace JSC {
32
33
struct ProtoCallFrame {
34
    Register codeBlockValue;
35
    Register scopeChainValue;
36
    Register calleeValue;
37
    Register argCountAndCodeOriginValue;
38
    Register thisArg;
39
    size_t paddedArgCount;
40
    JSValue *args;
41
42
    void init(CodeBlock*, JSScope*, JSObject*, JSValue, int, JSValue* otherArgs = 0);
43
    CodeBlock* codeBlock() const { return codeBlockValue.Register::codeBlock(); }
44
    void setCodeBlock(CodeBlock* codeBlock) { codeBlockValue = codeBlock; }
45
    void setScope(JSScope* scope) { scopeChainValue = scope; }
46
    void setCallee(JSObject* callee) { calleeValue = Register::withCallee(callee); }
47
    int argumentCountIncludingThis() const { return argCountAndCodeOriginValue.payload(); }
48
    int argumentCount() const { return argumentCountIncludingThis() - 1; }
49
    void setArgumentCountIncludingThis(int count) { argCountAndCodeOriginValue.payload() = count; }
50
    void setPaddedArgsCount(size_t argCount) { paddedArgCount = argCount; }
51
52
    void clearCurrentVPC() { argCountAndCodeOriginValue.tag() = 0; }
53
    void setThisValue(JSValue value) { thisArg = value; }
54
    void setArgument(size_t argument, JSValue value)
55
    {
56
        ASSERT(static_cast<int>(argument) < argumentCount());
57
        args[argument] = value;
58
    }
59
};
60
61
} // namespace JSC
62
63
#endif // ProtoCallFrame_h
- Source/JavaScriptCore/jit/JITCode.cpp -3 / +3 lines
Lines 42-52 JITCode::~JITCode() Source/JavaScriptCore/jit/JITCode.cpp_sec1
42
}
42
}
43
43
44
#if ENABLE(JIT)
44
#if ENABLE(JIT)
45
JSValue JITCode::execute(JSStack* stack, CallFrame* callFrame, VM* vm)
45
JSValue JITCode::execute(VM* vm, ProtoCallFrame* protoCallFrame, Register* topOfStack)
46
{
46
{
47
    UNUSED_PARAM(stack);
47
    ASSERT(!vm->topCallFrame || ((Register*)(vm->topCallFrame) >= topOfStack));
48
48
49
    JSValue result = JSValue::decode(callToJavaScript(executableAddress(), callFrame));
49
    JSValue result = JSValue::decode(callToJavaScript(executableAddress(), &vm->topCallFrame, protoCallFrame, topOfStack));
50
    return vm->exception() ? jsNull() : result;
50
    return vm->exception() ? jsNull() : result;
51
}
51
}
52
#endif
52
#endif
- Source/JavaScriptCore/jit/JITCode.h -1 / +2 lines
Lines 49-54 class JITCode; Source/JavaScriptCore/jit/JITCode.h_sec1
49
#if ENABLE(JIT)
49
#if ENABLE(JIT)
50
class VM;
50
class VM;
51
class JSStack;
51
class JSStack;
52
struct ProtoCallFrame;
52
#endif
53
#endif
53
54
54
class JITCode : public ThreadSafeRefCounted<JITCode> {
55
class JITCode : public ThreadSafeRefCounted<JITCode> {
Lines 177-183 public: Source/JavaScriptCore/jit/JITCode.h_sec2
177
    virtual FTL::JITCode* ftl();
178
    virtual FTL::JITCode* ftl();
178
    virtual FTL::ForOSREntryJITCode* ftlForOSREntry();
179
    virtual FTL::ForOSREntryJITCode* ftlForOSREntry();
179
    
180
    
180
    JSValue execute(JSStack*, CallFrame*, VM*);
181
    JSValue execute(VM*, ProtoCallFrame*, Register*);
181
    
182
    
182
    void* start() { return dataAddressAtOffset(0); }
183
    void* start() { return dataAddressAtOffset(0); }
183
    virtual size_t size() = 0;
184
    virtual size_t size() = 0;
- Source/JavaScriptCore/jit/JITOperations.cpp +3 lines
Lines 76-81 void JIT_OPERATION operationStackCheck(E Source/JavaScriptCore/jit/JITOperations.cpp_sec1
76
    // We pass in our own code block, because the callframe hasn't been populated.
76
    // We pass in our own code block, because the callframe hasn't been populated.
77
    VM* vm = codeBlock->vm();
77
    VM* vm = codeBlock->vm();
78
    CallFrame* callerFrame = exec->callerFrameSkippingVMEntrySentinel();
78
    CallFrame* callerFrame = exec->callerFrameSkippingVMEntrySentinel();
79
    if (!callerFrame)
80
        callerFrame = exec;
81
79
    NativeCallFrameTracer tracer(vm, callerFrame);
82
    NativeCallFrameTracer tracer(vm, callerFrame);
80
83
81
    JSStack& stack = vm->interpreter->stack();
84
    JSStack& stack = vm->interpreter->stack();
- Source/JavaScriptCore/jit/JITStubs.h -1 / +4 lines
Lines 38-47 namespace JSC { Source/JavaScriptCore/jit/JITStubs.h_sec1
38
38
39
#if OS(WINDOWS)
39
#if OS(WINDOWS)
40
class ExecState;
40
class ExecState;
41
class Register;
42
struct ProtoCallFrame;
41
43
42
extern "C" {
44
extern "C" {
43
    EncodedJSValue callToJavaScript(void*, ExecState*);
45
    EncodedJSValue callToJavaScript(void*, ExecState**, ProtoCallFrame*, Register*);
44
    void returnFromJavaScript();
46
    void returnFromJavaScript();
47
    EncodedJSValue callToNativeFunction(void*, ExecState**, ProtoCallFrame*, Register*);
45
}
48
}
46
#endif
49
#endif
47
50
- Source/JavaScriptCore/jit/JITStubsMSVC64.asm -4 / +171 lines
Lines 32-37 PUBLIC getHostCallReturnValue Source/JavaScriptCore/jit/JITStubsMSVC64.asm_sec1
32
_TEXT   SEGMENT
32
_TEXT   SEGMENT
33
33
34
callToJavaScript PROC
34
callToJavaScript PROC
35
    ;; FIXME: This function has not been tested as the Win 64 port doesn't currently use the JIT.
36
    ;; It is believed to be an accurate adaptation of the assembly created by the llint stub of the
37
    ;; same name with changes for agrument register differences.
38
    int 3
35
    mov r10, qword ptr[rsp]
39
    mov r10, qword ptr[rsp]
36
    push rbp
40
    push rbp
37
    mov rax, rbp ; Save previous frame pointer
41
    mov rax, rbp ; Save previous frame pointer
Lines 49-61 callToJavaScript PROC Source/JavaScriptCore/jit/JITStubsMSVC64.asm_sec2
49
    ; requirement is 32 bytes. Based on these factors, we need to pad the stack
53
    ; requirement is 32 bytes. Based on these factors, we need to pad the stack
50
    ; an additional 28h bytes.
54
    ; an additional 28h bytes.
51
    sub rsp, 28h
55
    sub rsp, 28h
52
    mov rbp, rdx
56
53
    mov r11, qword ptr[rbp] ; Put the previous frame pointer in the sentinel call frame above us
57
    mov rbp, r9
54
    mov qword ptr[r11], rax
58
    sub rbp, 40
55
    mov qword ptr[r11 + 8], r10
59
    mov qword ptr[rbp + 40], 0
60
    mov qword ptr[rbp + 32], rdx
61
62
    mov rax, qword ptr[rdx]
63
    mov qword ptr[rbp + 24], rax
64
    mov qword ptr[rbp + 16], 1
65
    mov qword ptr[rbp + 8], r10
66
    mov qword ptr[rbp], rax
67
    mov rax, rbp
68
69
    mov ebx, dword ptr[r8 + 40]
70
    add rbx, 6
71
    sal rbx, 3
72
    sub rbp, rbx
73
    mov qword ptr[rbp], rax
74
75
    mov rax, 5
76
77
copyHeaderLoop:
78
    sub rax, 1
79
    mov r10, qword ptr[r8 + rax * 8]
80
    mov qword ptr[rbp + rax * 8 + 16], r10
81
    test rax, rax
82
    jnz copyHeaderLoop
83
84
    mov ebx, dword ptr[r8 + 24]
85
    sub rbx, 1
86
    mov r10d, dword ptr[r8 + 40]
87
    sub r10, 1
88
    cmp rbx, r10
89
    je copyArgs
90
    mov rax, 0ah
91
92
fillExtraArgsLoop:
93
    sub r10, 1
94
    mov qword ptr[rbp + r10 * 8 + 56], rax
95
    cmp rbx, r10
96
    jne fillExtraArgsLoop
97
98
copyArgs:
99
    mov rax, qword ptr[r8 + 48]
100
101
copyArgsLoop:
102
    test ebx, ebx
103
    jz copyArgsDone
104
    sub ebx, 1
105
    mov r10, qword ptr[rax + rbx * 8]
106
    mov qword ptr[rbp + rbx * 8 + 56], r10
107
    jmp copyArgsLoop
108
109
copyArgsDone:
110
    mov qword ptr[rdx], rbp
56
    mov r14, 0FFFF000000000000h
111
    mov r14, 0FFFF000000000000h
57
    mov r15, 0FFFF000000000002h
112
    mov r15, 0FFFF000000000002h
58
    call rcx
113
    call rcx
114
    cmp qword ptr[rbp + 16], 1
115
    je calleeFramePopped
116
    mov rbp, qword ptr[rbp]
117
118
calleeFramePopped:
119
    mov rbx, qword ptr[rbp + 32] ; VM.topCallFrame
120
    mov r10, qword ptr[rbp + 24]
121
    mov qword ptr[rbx], r10
59
    add rsp, 28h
122
    add rsp, 28h
60
    pop rdi
123
    pop rdi
61
    pop rsi
124
    pop rsi
Lines 68-73 callToJavaScript PROC Source/JavaScriptCore/jit/JITStubsMSVC64.asm_sec3
68
    ret
131
    ret
69
callToJavaScript ENDP
132
callToJavaScript ENDP
70
133
134
callToNativeFunction PROC
135
    ;; FIXME: This function has not been tested as the Win 64 port doesn't currently use the JIT.
136
    ;; It is believed to be an accurate adaptation of the assembly created by the llint stub of the
137
    ;; same name with changes for agrument register differences.
138
    int 3
139
    mov r10, qword ptr[rsp]
140
    push rbp
141
    mov rax, rbp ; Save previous frame pointer
142
    mov rbp, rsp
143
    push r12
144
    push r13
145
    push r14
146
    push r15
147
    push rbx
148
    push rsi
149
    push rdi
150
151
    ; JIT operations can use up to 6 args (4 in registers and 2 on the stack).
152
    ; In addition, X86_64 ABI specifies that the worse case stack alignment
153
    ; requirement is 32 bytes. Based on these factors, we need to pad the stack
154
    ; an additional 28h bytes.
155
    sub rsp, 28h
156
157
    mov rbp, r9
158
    sub rbp, 40
159
    mov qword ptr[rbp + 40], 0
160
    mov qword ptr[rbp + 32], rdx
161
162
    mov rax, qword ptr[rdx]
163
    mov qword ptr[rbp + 24], rax
164
    mov qword ptr[rbp + 16], 1
165
    mov qword ptr[rbp + 8], r10
166
    mov qword ptr[rbp], rax
167
    mov rax, rbp
168
169
    mov ebx, dword ptr[r8 + 40]
170
    add rbx, 6
171
    sal rbx, 3
172
    sub rbp, rbx
173
    mov qword ptr[rbp], rax
174
175
    mov rax, 5
176
177
copyHeaderLoop:
178
    sub rax, 1
179
    mov r10, qword ptr[r8 + rax * 8]
180
    mov qword ptr[rbp + rax * 8 + 16], r10
181
    test rax, rax
182
    jnz copyHeaderLoop
183
184
    mov ebx, dword ptr[r8 + 24]
185
    sub rbx, 1
186
    mov r10d, dword ptr[r8 + 40]
187
    sub r10, 1
188
    cmp rbx, r10
189
    je copyArgs
190
    mov rax, 0ah
191
192
fillExtraArgsLoop:
193
    sub r10, 1
194
    mov qword ptr[rbp + r10 * 8 + 56], rax
195
    cmp rbx, r10
196
    jne fillExtraArgsLoop
197
198
copyArgs:
199
    mov rax, qword ptr[r8 + 48]
200
201
copyArgsLoop:
202
    test rbx, rbx
203
    jz copyArgsDone
204
    sub rbx, 1
205
    mov r10, qword ptr[rax + rbx * 8]
206
    mov qword ptr[rbp + rbx * 8 + 56], r10
207
    jmp copyArgsLoop
208
209
copyArgsDone:
210
    mov qword ptr[rdx], rbp
211
    mov r14, 0FFFF000000000000h
212
    mov r15, 0FFFF000000000002h
213
214
    mov rax, rcx
215
    mov rcx, rbp
216
    call rax
217
218
    cmp qword ptr[rbp + 16], 1
219
    je calleeFramePopped
220
    mov rbp, qword ptr[rbp]
221
222
calleeFramePopped:
223
    mov rbx, qword ptr[rbp + 32] ; VM.topCallFrame
224
    mov r10, qword ptr[rbp + 24]
225
    mov qword ptr[rbx], r10
226
    add rsp, 28h
227
    pop rdi
228
    pop rsi
229
    pop rbx
230
    pop r15
231
    pop r14
232
    pop r13
233
    pop r12
234
    pop rbp
235
    ret
236
callToNativeFunction ENDP
237
71
returnFromJavaScript PROC
238
returnFromJavaScript PROC
72
    add rsp, 28h
239
    add rsp, 28h
73
    pop rdi
240
    pop rdi
- Source/JavaScriptCore/jit/JITStubsX86.h -6 / +184 lines
Lines 206-212 extern "C" { Source/JavaScriptCore/jit/JITStubsX86.h_sec1
206
206
207
    // FIXME: Since Windows doesn't use the LLInt, we have inline stubs here.
207
    // FIXME: Since Windows doesn't use the LLInt, we have inline stubs here.
208
    // Until the LLInt is changed to support Windows, these stub needs to be updated.
208
    // Until the LLInt is changed to support Windows, these stub needs to be updated.
209
    __declspec(naked) EncodedJSValue callToJavaScript(void* code, ExecState*)
209
    __declspec(naked) EncodedJSValue callToJavaScript(void* code, ExecState**, ProtoCallFrame*, Register*)
210
    {
210
    {
211
        __asm {
211
        __asm {
212
            mov edx, [esp]
212
            mov edx, [esp]
Lines 217-227 extern "C" { Source/JavaScriptCore/jit/JITStubsX86.h_sec2
217
            push edi;
217
            push edi;
218
            push ebx;
218
            push ebx;
219
            sub esp, 0x1c;
219
            sub esp, 0x1c;
220
            mov ebp, [esp + 0x34];
220
            mov ecx, dword ptr[esp + 0x34];
221
            mov ebx, [ebp];
221
            mov esi, dword ptr[esp + 0x38];
222
            mov [ebx], eax;
222
            mov ebp, dword ptr[esp + 0x3c];
223
            mov 4[ebx], edx
223
            sub ebp, 0x20;
224
            call [esp + 0x30];
224
            mov dword ptr[ebp + 0x24], 0;
225
            mov dword ptr[ebp + 0x20], 0;
226
            mov dword ptr[ebp + 0x1c], 0;
227
            mov dword ptr[ebp + 0x18], ecx;
228
            mov ebx, [ecx];
229
            mov dword ptr[ebp + 0x14], 0;
230
            mov dword ptr[ebp + 0x10], ebx;
231
            mov dword ptr[ebp + 0xc], 0;
232
            mov dword ptr[ebp + 0x8], 1;
233
            mov dword ptr[ebp + 0x4], edx;
234
            mov dword ptr[ebp], eax;
235
            mov eax, ebp;
236
237
            mov edx, dword ptr[esi + 0x28];
238
            add edx, 5;
239
            sal edx, 3;
240
            sub ebp, edx;
241
            mov dword ptr[ebp], eax;
242
243
            mov eax, 5;
244
245
        copyHeaderLoop:
246
            sub eax, 1;
247
            mov ecx, dword ptr[esi + eax * 8];
248
            mov dword ptr 8[ebp + eax * 8], ecx;
249
            mov ecx, dword ptr 4[esi + eax * 8];
250
            mov dword ptr 12[ebp + eax * 8], ecx;
251
            test eax, eax;
252
            jnz copyHeaderLoop;
253
254
            mov edx, dword ptr[esi + 0x18];
255
            sub edx, 1;
256
            mov ecx, dword ptr[esi + 0x28];
257
            sub ecx, 1;
258
259
            cmp edx, ecx;
260
            je copyArgs;
261
262
            xor eax, eax;
263
            mov ebx, -4;
264
265
        fillExtraArgsLoop:
266
            sub ecx, 1;
267
            mov dword ptr 0x30[ebp + ecx * 8], eax;            
268
            mov dword ptr 0x34[ebp + ecx * 8], ebx;
269
            cmp edx, ecx;
270
            jne fillExtraArgsLoop;
271
272
        copyArgs:
273
            mov eax, dword ptr[esi + 0x2c];
274
275
        copyArgsLoop:
276
            test edx, edx;
277
            jz copyArgsDone;
278
            sub edx, 1;
279
            mov ecx, dword ptr 0[eax + edx * 8];
280
            mov ebx, dword ptr 4[eax + edx * 8];
281
            mov dword ptr 0x30[ebp + edx * 8], ecx;
282
            mov dword ptr 0x34[ebp + edx * 8], ebx;
283
            jmp copyArgsLoop;
284
285
        copyArgsDone:
286
            mov ecx, dword ptr[esp + 0x34];
287
            mov dword ptr[ecx], ebp;
288
289
            call dword ptr[esp + 0x30];
290
291
            cmp dword ptr[ebp + 8], 1;
292
            je calleeFramePopped;
293
            mov ebp, dword ptr[ebp];
294
295
        calleeFramePopped:
296
            mov ecx, dword ptr[ebp + 0x18];
297
            mov ebx, dword ptr[ebp + 0x10];
298
            mov dword ptr[ecx], ebx;
299
225
            add esp, 0x1c;
300
            add esp, 0x1c;
226
            pop ebx;
301
            pop ebx;
227
            pop edi;
302
            pop edi;
Lines 242-247 extern "C" { Source/JavaScriptCore/jit/JITStubsX86.h_sec3
242
            ret;
317
            ret;
243
        }
318
        }
244
    }
319
    }
320
321
    __declspec(naked) EncodedJSValue callToNativeFunction(void* code, ExecState**, ProtoCallFrame*, Register*)
322
    {
323
        __asm {
324
            mov edx, [esp]
325
            push ebp;
326
            mov eax, ebp;
327
            mov ebp, esp;
328
            push esi;
329
            push edi;
330
            push ebx;
331
            sub esp, 0x1c;
332
            mov ecx, [esp + 0x34];
333
            mov esi, [esp + 0x38];
334
            mov ebp, [esp + 0x3c];
335
            sub ebp, 0x20;
336
            mov dword ptr[ebp + 0x24], 0;
337
            mov dword ptr[ebp + 0x20], 0;
338
            mov dword ptr[ebp + 0x1c], 0;
339
            mov dword ptr[ebp + 0x18], ecx;
340
            mov ebx, [ecx];
341
            mov dword ptr[ebp + 0x14], 0;
342
            mov dword ptr[ebp + 0x10], ebx;
343
            mov dword ptr[ebp + 0xc], 0;
344
            mov dword ptr[ebp + 0x8], 1;
345
            mov dword ptr[ebp + 0x4], edx;
346
            mov dword ptr[ebp], eax;
347
            mov eax, ebp;
348
349
            mov edx, dword ptr[esi + 0x28];
350
            add edx, 5;
351
            sal edx, 3;
352
            sub ebp, edx;
353
            mov dword ptr[ebp], eax;
354
355
            mov eax, 5;
356
357
        copyHeaderLoop:
358
            sub eax, 1;
359
            mov ecx, dword ptr[esi + eax * 8];
360
            mov dword ptr 8[ebp + eax * 8], ecx;
361
            mov ecx, dword ptr 4[esi + eax * 8];
362
            mov dword ptr 12[ebp + eax * 8], ecx;
363
            test eax, eax;
364
            jnz copyHeaderLoop;
365
366
            mov edx, dword ptr[esi + 0x18];
367
            sub edx, 1;
368
            mov ecx, dword ptr[esi + 0x28];
369
            sub ecx, 1;
370
371
            cmp edx, ecx;
372
            je copyArgs;
373
374
            xor eax, eax;
375
            mov ebx, -4;
376
377
        fillExtraArgsLoop:
378
            sub ecx, 1;
379
            mov dword ptr 0x30[ebp + ecx * 8], eax;            
380
            mov dword ptr 0x34[ebp + ecx * 8], ebx;
381
            cmp edx, ecx;
382
            jne fillExtraArgsLoop;
383
384
        copyArgs:
385
            mov eax, dword ptr[esi + 0x2c];
386
387
        copyArgsLoop:
388
            test edx, edx;
389
            jz copyArgsDone;
390
            sub edx, 1;
391
            mov ecx, dword ptr 0[eax + edx * 8];
392
            mov ebx, dword ptr 4[eax + edx * 8];
393
            mov dword ptr 0x30[ebp + edx * 8], ecx;
394
            mov dword ptr 0x34[ebp + edx * 8], ebx;
395
            jmp copyArgsLoop;
396
397
        copyArgsDone:
398
            mov ecx, dword ptr[esp + 0x34];
399
            mov dword ptr[ecx], ebp;
400
401
            mov edi, dword ptr[esp + 0x30];
402
            mov dword ptr[esp + 0x30], ebp;
403
            mov ecx, ebp;
404
            call edi;
405
406
            cmp dword ptr[ebp + 8], 1;
407
            je calleeFramePopped;
408
            mov ebp, dword ptr[ebp];
409
410
        calleeFramePopped:
411
            mov ecx, dword ptr[ebp + 0x18];
412
            mov ebx, dword ptr[ebp + 0x10];
413
            mov dword ptr[ecx], ebx;
414
415
            add esp, 0x1c;
416
            pop ebx;
417
            pop edi;
418
            pop esi;
419
            pop ebp;
420
            ret;
421
        }
422
    }
245
}
423
}
246
424
247
#endif // COMPILER(MSVC)
425
#endif // COMPILER(MSVC)
- Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp -1 / +1 lines
Lines 46-52 Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp_sec1
46
#include "JumpTable.h"
46
#include "JumpTable.h"
47
#include "LLIntOfflineAsmConfig.h"
47
#include "LLIntOfflineAsmConfig.h"
48
#include "MarkedSpace.h"
48
#include "MarkedSpace.h"
49
49
#include "ProtoCallFrame.h"
50
#include "Structure.h"
50
#include "Structure.h"
51
#include "StructureChain.h"
51
#include "StructureChain.h"
52
#include "ValueProfile.h"
52
#include "ValueProfile.h"
- Source/JavaScriptCore/llint/LLIntThunks.h -1 / +4 lines
Lines 35-45 Source/JavaScriptCore/llint/LLIntThunks.h_sec1
35
namespace JSC {
35
namespace JSC {
36
36
37
class ExecState;
37
class ExecState;
38
class Register;
38
class VM;
39
class VM;
40
struct ProtoCallFrame;
39
41
40
extern "C" {
42
extern "C" {
41
    EncodedJSValue callToJavaScript(void*, ExecState*);
43
    EncodedJSValue callToJavaScript(void*, ExecState**, ProtoCallFrame*, Register*);
42
    void returnFromJavaScript();
44
    void returnFromJavaScript();
45
    EncodedJSValue callToNativeFunction(void*, ExecState**, ProtoCallFrame*, Register*);
43
}
46
}
44
47
45
namespace LLInt {
48
namespace LLInt {
- Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm -19 / +147 lines
Lines 170-206 macro functionEpilogue(extraStackSpace) Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm_sec1
170
    end
170
    end
171
end
171
end
172
172
173
macro doCallToJavaScript()
173
macro doCallToJavaScript(makeCall, doReturn)
174
    if X86
174
    if X86
175
        const entry = t5
176
        const vmTopCallFrame = t2
177
        const protoCallFrame = t4
178
175
        const extraStackSpace = 28
179
        const extraStackSpace = 28
176
        const previousCFR = t0
180
        const previousCFR = t0
177
        const previousPC = t1
181
        const previousPC = t1
178
        const entry = t5
182
        const temp1 = t0 # Same as previousCFR
179
        const newCallFrame = t4
183
        const temp2 = t1 # Same as previousPC
184
        const temp3 = t2 # same as vmTopCallFrame
185
        const temp4 = t3
180
    elsif ARM or ARMv7_TRADITIONAL
186
    elsif ARM or ARMv7_TRADITIONAL
187
        const entry = a0
188
        const vmTopCallFrame = a1
189
        const protoCallFrame = a2
190
        const topOfStack = a3
191
181
        const extraStackSpace = 16
192
        const extraStackSpace = 16
182
        const previousCFR = t3  
193
        const previousCFR = t3
183
        const previousPC = lr
194
        const previousPC = lr
184
        const entry = a0
195
        const temp1 = t3 # Same as previousCFR
185
        const newCallFrame = a1
196
        const temp2 = a3 # Same as topOfStack
197
        const temp3 = t4
198
        const temp4 = t5
186
    elsif ARMv7
199
    elsif ARMv7
200
        const entry = a0
201
        const vmTopCallFrame = a1
202
        const protoCallFrame = a2
203
        const topOfStack = a3
204
187
        const extraStackSpace = 28
205
        const extraStackSpace = 28
188
        const previousCFR = t3  
206
        const previousCFR = t3
189
        const previousPC = lr
207
        const previousPC = lr
190
        const entry = a0
208
        const temp1 = t3 # Same as previousCFR
191
        const newCallFrame = a1
209
        const temp2 = a3 # Same as topOfStack
210
        const temp3 = t4
211
        const temp4 = t5
192
    elsif MIPS
212
    elsif MIPS
213
        const entry = a0
214
        const vmTopCallFrame = a1
215
        const protoCallFrame = a2
216
        const topOfStack = a3
217
193
        const extraStackSpace = 36
218
        const extraStackSpace = 36
194
        const previousCFR = t2
219
        const previousCFR = t2
195
        const previousPC = lr
220
        const previousPC = lr
196
        const entry = a0
221
        const temp1 = t3
197
        const newCallFrame = a1
222
        const temp2 = t4
223
        const temp3 = t5
224
        const temp4 = t6
198
    elsif SH4
225
    elsif SH4
226
        const entry = a0
227
        const vmTopCallFrame = a1
228
        const protoCallFrame = a2
229
        const topOfStack = a3
230
199
        const extraStackSpace = 20
231
        const extraStackSpace = 20
200
        const previousCFR = t3  
232
        const previousCFR = t3
201
        const previousPC = lr
233
        const previousPC = lr
202
        const entry = a0
234
        const temp1 = t3 # Same as previousCFR
203
        const newCallFrame = a1
235
        const temp2 = a3 # Same as topOfStack
236
        const temp3 = t4
237
        const temp4 = t5
204
    end
238
    end
205
239
206
    if X86
240
    if X86
Lines 210-231 macro doCallToJavaScript() Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm_sec2
210
    functionPrologue(extraStackSpace)
244
    functionPrologue(extraStackSpace)
211
    if X86
245
    if X86
212
        loadp extraStackSpace+20[sp], entry
246
        loadp extraStackSpace+20[sp], entry
213
        loadp extraStackSpace+24[sp], newCallFrame
247
        loadp extraStackSpace+24[sp], vmTopCallFrame
248
        loadp extraStackSpace+28[sp], protoCallFrame
249
        loadp extraStackSpace+32[sp], cfr
214
    else
250
    else
215
        move cfr, previousCFR
251
        move cfr, previousCFR
252
        move topOfStack, cfr
253
    end
254
255
    subp (CallFrameHeaderSlots-1)*8, cfr
256
    storep 0, ArgumentCount+4[cfr]
257
    storep 0, ArgumentCount[cfr]
258
    storep 0, Callee+4[cfr]
259
    storep vmTopCallFrame, Callee[cfr]
260
    loadp [vmTopCallFrame], temp4
261
    storep 0, ScopeChain+4[cfr]
262
    storep temp4, ScopeChain[cfr]
263
    storep 0, CodeBlock+4[cfr]
264
    storep 1, CodeBlock[cfr]
265
    storep previousPC, ReturnPC[cfr]
266
    storep previousCFR, CallerFrame[cfr]
267
    move cfr, temp1
268
269
    loadi ProtoCallFrame::paddedArgCount[protoCallFrame], temp2
270
    addp CallFrameHeaderSlots, temp2, temp2
271
    lshiftp 3, temp2
272
    subp temp2, cfr
273
    storep temp1, CallerFrame[cfr]
274
275
    move 5, temp1
276
277
.copyHeaderLoop:
278
    subi 1, temp1
279
    loadp [protoCallFrame, temp1, 8], temp3
280
    storep temp3, CodeBlock[cfr, temp1, 8]
281
    loadp 4[protoCallFrame, temp1, 8], temp3
282
    storep temp3, CodeBlock+4[cfr, temp1, 8]
283
    btinz temp1, .copyHeaderLoop
284
285
    loadi ProtoCallFrame::argCountAndCodeOriginValue[protoCallFrame], temp2
286
    subi 1, temp2
287
    loadi ProtoCallFrame::paddedArgCount[protoCallFrame], temp3
288
    subi 1, temp3
289
290
    bieq temp2, temp3, .copyArgs
291
    move 0, temp1
292
    move UndefinedTag, temp4
293
.fillExtraArgsLoop:
294
    subi 1, temp3
295
    storep temp1, ThisArgumentOffset+8+PayloadOffset[cfr, temp3, 8]
296
    storep temp4, ThisArgumentOffset+8+TagOffset[cfr, temp3, 8]
297
    bineq temp2, temp3, .fillExtraArgsLoop
298
299
.copyArgs:
300
    loadp ProtoCallFrame::args[protoCallFrame], temp1
301
302
.copyArgsLoop:
303
    btiz temp2, .copyArgsDone
304
    subi 1, temp2
305
    loadp PayloadOffset[temp1, temp2, 8], temp3
306
    loadp TagOffset[temp1, temp2, 8], temp4
307
    storep temp3, ThisArgumentOffset+8+PayloadOffset[cfr, temp2, 8]
308
    storep temp4, ThisArgumentOffset+8+TagOffset[cfr, temp2, 8]
309
    jmp .copyArgsLoop
310
311
.copyArgsDone:
312
    if X86
313
        loadp extraStackSpace+24[sp], vmTopCallFrame
216
    end
314
    end
315
    storep cfr, [vmTopCallFrame]
316
317
    makeCall(entry, temp1)
318
319
    bpeq CodeBlock[cfr], 1, .calleeFramePopped
320
    loadp CallerFrame[cfr], cfr
321
322
.calleeFramePopped:
323
    loadp Callee[cfr], temp3 # VM.topCallFrame
324
    loadp ScopeChain[cfr], temp4
325
    storep temp4, [temp3]
217
326
218
    move newCallFrame, cfr
327
    doReturn(extraStackSpace)
219
    loadp [cfr], newCallFrame
328
end
220
    storep previousCFR, [newCallFrame]
329
221
    storep previousPC, 4[newCallFrame]
330
macro makeJavaScriptCall(entry, temp)
222
    call entry
331
    call entry
332
end
223
333
334
macro makeHostFunctionCall(entry, temp)
335
    move entry, temp
336
    if X86
337
        # Put cfr on stack as arg0, also put it in ecx for "fastcall" targets
338
        poke cfr, 0
339
        move cfr, t2
340
    else
341
        move cfr, a0
342
    end
343
    call temp
344
end
345
346
macro doReturnFromJavaScript(extraStackSpace)
224
_returnFromJavaScript:
347
_returnFromJavaScript:
225
    functionEpilogue(extraStackSpace)
348
    functionEpilogue(extraStackSpace)
226
    ret
349
    ret
227
end
350
end
228
351
352
macro doReturnFromHostFunction(extraStackSpace)
353
    functionEpilogue(extraStackSpace)
354
    ret
355
end
356
229
# Debugging operation if you'd like to print an operand in the instruction stream. fromWhere
357
# Debugging operation if you'd like to print an operand in the instruction stream. fromWhere
230
# should be an immediate integer - any integer you like; use it to identify the place you're
358
# should be an immediate integer - any integer you like; use it to identify the place you're
231
# debugging from. operand should likewise be an immediate, and should identify the operand
359
# debugging from. operand should likewise be an immediate, and should identify the operand
- Source/JavaScriptCore/llint/LowLevelInterpreter64.asm -15 / +99 lines
Lines 113-137 macro functionEpilogue(extraStackSpace) Source/JavaScriptCore/llint/LowLevelInterpreter64.asm_sec1
113
    end
113
    end
114
end
114
end
115
115
116
macro doCallToJavaScript()
116
macro doCallToJavaScript(makeCall, doReturn)
117
    if X86_64
117
    if X86_64
118
        const entry = t5
119
        const vmTopCallFrame = t4
120
        const protoCallFrame = t1
121
        const topOfStack = t2
122
118
        const extraStackSpace = 8
123
        const extraStackSpace = 8
119
        const previousCFR = t0
124
        const previousCFR = t0
120
        const previousPC = t6
125
        const previousPC = t6
121
        const entry = t5
126
        const temp1 = t0
122
        const newCallFrame = t4
127
        const temp2 = t3
128
        const temp3 = t6
123
    elsif ARM64
129
    elsif ARM64
124
        const extraStackSpace = 0
125
        const previousCFR = t4
126
        const previousPC = lr
127
        const entry = a0
130
        const entry = a0
128
        const newCallFrame = a1
131
        const vmTopCallFrame = a1
129
    elsif C_LOOP
132
        const protoCallFrame = a2
133
        const topOfStack = a3
134
130
        const extraStackSpace = 0
135
        const extraStackSpace = 0
131
        const previousCFR = t4  
136
        const previousCFR = t4
132
        const previousPC = lr
137
        const previousPC = lr
133
        const entry = a0
138
        const temp1 = t3
134
        const newCallFrame = a1
139
        const temp2 = t5
140
        const temp3 = t6
135
    end
141
    end
136
142
137
    if X86_64
143
    if X86_64
Lines 140-158 macro doCallToJavaScript() Source/JavaScriptCore/llint/LowLevelInterpreter64.asm_sec2
140
    move cfr, previousCFR
146
    move cfr, previousCFR
141
    functionPrologue(extraStackSpace)
147
    functionPrologue(extraStackSpace)
142
148
143
    move newCallFrame, cfr
149
    move topOfStack, cfr
144
    loadp [cfr], newCallFrame
150
    subp (CallFrameHeaderSlots-1)*8, cfr
145
    storep previousCFR, [newCallFrame]
151
    storep 0, ArgumentCount[cfr]
146
    storep previousPC, 8[newCallFrame]
152
    storep vmTopCallFrame, Callee[cfr]
153
    loadp [vmTopCallFrame], temp1
154
    storep temp1, ScopeChain[cfr]
155
    storep 1, CodeBlock[cfr]
156
    storep previousPC, ReturnPC[cfr]
157
    storep previousCFR, CallerFrame[cfr]
158
    move cfr, temp1
159
160
    loadi ProtoCallFrame::paddedArgCount[protoCallFrame], temp2
161
    addp CallFrameHeaderSlots, temp2, temp2
162
    lshiftp 3, temp2
163
    subp temp2, cfr
164
    storep temp1, CallerFrame[cfr]
165
166
    move 5, temp1
167
168
.copyHeaderLoop:
169
    subi 1, temp1
170
    loadp [protoCallFrame, temp1, 8], temp3
171
    storep temp3, CodeBlock[cfr, temp1, 8]
172
    btinz temp1, .copyHeaderLoop
173
174
    loadi ProtoCallFrame::argCountAndCodeOriginValue[protoCallFrame], temp2
175
    subi 1, temp2
176
    loadi ProtoCallFrame::paddedArgCount[protoCallFrame], temp3
177
    subi 1, temp3
178
179
    bieq temp2, temp3, .copyArgs
180
    move ValueUndefined, temp1
181
.fillExtraArgsLoop:
182
    subi 1, temp3
183
    storep temp1, ThisArgumentOffset+8[cfr, temp3, 8]
184
    bineq temp2, temp3, .fillExtraArgsLoop
185
186
.copyArgs:
187
    loadp ProtoCallFrame::args[protoCallFrame], temp1
188
189
.copyArgsLoop:
190
    btiz temp2, .copyArgsDone
191
    subi 1, temp2
192
    loadp [temp1, temp2, 8], temp3
193
    storep temp3, ThisArgumentOffset+8[cfr, temp2, 8]
194
    jmp .copyArgsLoop
195
196
.copyArgsDone:
197
    storep cfr, [vmTopCallFrame]
198
147
    move 0xffff000000000000, csr1
199
    move 0xffff000000000000, csr1
148
    addp 2, csr1, csr2
200
    addp 2, csr1, csr2
201
202
    makeCall(entry, temp1)
203
204
    bpeq CodeBlock[cfr], 1, .calleeFramePopped
205
    loadp CallerFrame[cfr], cfr
206
207
.calleeFramePopped:
208
    loadp Callee[cfr], temp2 # VM.topCallFrame
209
    loadp ScopeChain[cfr], temp3
210
    storep temp3, [temp2]
211
212
    doReturn(extraStackSpace)
213
end
214
215
macro makeJavaScriptCall(entry, temp)
149
    call entry
216
    call entry
217
end
150
218
219
macro makeHostFunctionCall(entry, temp)
220
    move entry, temp
221
    if X86_64
222
        move cfr, t5
223
    elsif ARM64 or C_LOOP
224
        move cfr, a0
225
    end
226
    call temp
227
end
228
229
macro doReturnFromJavaScript(extraStackSpace)
151
_returnFromJavaScript:
230
_returnFromJavaScript:
152
    functionEpilogue(extraStackSpace)
231
    functionEpilogue(extraStackSpace)
153
    ret
232
    ret
154
end
233
end
155
234
235
macro doReturnFromHostFunction(extraStackSpace)
236
    functionEpilogue(extraStackSpace)
237
    ret
238
end
239
156
macro prepareStateForCCall()
240
macro prepareStateForCCall()
157
    leap [PB, PC, 8], PC
241
    leap [PB, PC, 8], PC
158
    move PB, t3
242
    move PB, t3
- Source/JavaScriptCore/llint/LowLevelInterpreter.asm -4 / +8 lines
Lines 423-434 end Source/JavaScriptCore/llint/LowLevelInterpreter.asm_sec1
423
423
424
if C_LOOP
424
if C_LOOP
425
else
425
else
426
# stub to call into JavaScript
426
# stub to call into JavaScript or Native functions
427
# EncodedJSValue callToJavaScript(void* code, Register* topOfStack)
427
# EncodedJSValue callToJavaScript(void* code, ExecState** vm, ProtoCallFrame* protoFrame, Register* topOfStack)
428
# Note, if this stub or one of it's related macros is changed, make the
428
# EncodedJSValue callToNativeFunction(void* code, ExecState** vm, ProtoCallFrame* protoFrame, Register* topOfStack)
429
# Note, if these stubs or one of their related macros are changed, make the
429
# equivalent changes in jit/JITStubsX86.h and/or jit/JITStubsMSVC64.asm
430
# equivalent changes in jit/JITStubsX86.h and/or jit/JITStubsMSVC64.asm
430
_callToJavaScript:
431
_callToJavaScript:
431
    doCallToJavaScript()
432
    doCallToJavaScript(makeJavaScriptCall, doReturnFromJavaScript)
433
434
_callToNativeFunction:
435
    doCallToJavaScript(makeHostFunctionCall, doReturnFromHostFunction)
432
end
436
end
433
437
434
# Indicate the beginning of LLInt.
438
# Indicate the beginning of LLInt.
- Source/JavaScriptCore/runtime/ArgList.h +3 lines
Lines 139-144 private: Source/JavaScriptCore/runtime/ArgList.h_sec1
139
};
139
};
140
140
141
class ArgList {
141
class ArgList {
142
    friend class Interpreter;
142
    friend class JIT;
143
    friend class JIT;
143
public:
144
public:
144
    ArgList()
145
    ArgList()
Lines 172-177 public: Source/JavaScriptCore/runtime/ArgList.h_sec2
172
    JS_EXPORT_PRIVATE void getSlice(int startIndex, ArgList& result) const;
173
    JS_EXPORT_PRIVATE void getSlice(int startIndex, ArgList& result) const;
173
174
174
private:
175
private:
176
    JSValue* data() const { return m_args; }
177
175
    JSValue* m_args;
178
    JSValue* m_args;
176
    int m_argCount;
179
    int m_argCount;
177
};
180
};
- Source/JavaScriptCore/runtime/JSArray.cpp +4 lines
Lines 1320-1326 struct AVLTreeAbstractorForArrayCompare Source/JavaScriptCore/runtime/JSArray.cpp_sec1
1320
            m_cachedCall->setThis(jsUndefined());
1320
            m_cachedCall->setThis(jsUndefined());
1321
            m_cachedCall->setArgument(0, va);
1321
            m_cachedCall->setArgument(0, va);
1322
            m_cachedCall->setArgument(1, vb);
1322
            m_cachedCall->setArgument(1, vb);
1323
#if ENABLE(LLINT_C_LOOP)
1323
            compareResult = m_cachedCall->call().toNumber(m_cachedCall->newCallFrame(m_exec));
1324
            compareResult = m_cachedCall->call().toNumber(m_cachedCall->newCallFrame(m_exec));
1325
#else
1326
            compareResult = m_cachedCall->call().toNumber(m_exec);
1327
#endif
1324
        } else {
1328
        } else {
1325
            MarkedArgumentBuffer arguments;
1329
            MarkedArgumentBuffer arguments;
1326
            arguments.append(va);
1330
            arguments.append(va);
- Source/JavaScriptCore/runtime/StringPrototype.cpp +8 lines
Lines 504-510 static NEVER_INLINE EncodedJSValue repla Source/JavaScriptCore/runtime/StringPrototype.cpp_sec1
504
504
505
                cachedCall.setThis(jsUndefined());
505
                cachedCall.setThis(jsUndefined());
506
                JSValue jsResult = cachedCall.call();
506
                JSValue jsResult = cachedCall.call();
507
#if ENABLE(LLINT_C_LOOP)
507
                replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec));
508
                replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec));
509
#else
510
                replacements.append(jsResult.toString(exec)->value(exec));
511
#endif
508
                if (exec->hadException())
512
                if (exec->hadException())
509
                    break;
513
                    break;
510
514
Lines 543-549 static NEVER_INLINE EncodedJSValue repla Source/JavaScriptCore/runtime/StringPrototype.cpp_sec2
543
547
544
                cachedCall.setThis(jsUndefined());
548
                cachedCall.setThis(jsUndefined());
545
                JSValue jsResult = cachedCall.call();
549
                JSValue jsResult = cachedCall.call();
550
#if ENABLE(LLINT_C_LOOP)
546
                replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec));
551
                replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec));
552
#else
553
                replacements.append(jsResult.toString(exec)->value(exec));
554
#endif
547
                if (exec->hadException())
555
                if (exec->hadException())
548
                    break;
556
                    break;
549
557

Return to Bug 123999