Changeset 160094 in webkit
- Timestamp:
- Dec 4, 2013 8:40:17 AM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r159605 r160094 218 218 interpreter/Interpreter.cpp 219 219 interpreter/JSStack.cpp 220 interpreter/ProtoCallFrame.cpp 220 221 interpreter/StackVisitor.cpp 221 222 interpreter/VMInspector.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r160092 r160094 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 80 2013-12-04 László Langó <lango@inf.u-szeged.hu> 2 81 -
trunk/Source/JavaScriptCore/GNUmakefile.list.am
r159943 r160094 623 623 Source/JavaScriptCore/interpreter/JSStack.h \ 624 624 Source/JavaScriptCore/interpreter/JSStackInlines.h \ 625 Source/JavaScriptCore/interpreter/ProtoCallFrame.cpp \ 626 Source/JavaScriptCore/interpreter/ProtoCallFrame.h \ 625 627 Source/JavaScriptCore/interpreter/Register.h \ 626 628 Source/JavaScriptCore/interpreter/StackVisitor.cpp \ -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r160062 r160094 460 460 <ClCompile Include="..\interpreter\Interpreter.cpp" /> 461 461 <ClCompile Include="..\interpreter\JSStack.cpp" /> 462 <ClCompile Include="..\interpreter\ProtoCallFrame.cpp" /> 462 463 <ClCompile Include="..\interpreter\StackVisitor.cpp" /> 463 464 <ClCompile Include="..\interpreter\VMInspector.cpp" /> … … 1004 1005 <ClInclude Include="..\interpreter\JSStack.h" /> 1005 1006 <ClInclude Include="..\interpreter\JSStackInlines.h" /> 1007 <ClInclude Include="..\interpreter\ProtoCallFrame.h" /> 1006 1008 <ClInclude Include="..\interpreter\Register.h" /> 1007 1009 <ClInclude Include="..\interpreter\StackVisitor.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r160062 r160094 289 289 <Filter>interpreter</Filter> 290 290 </ClCompile> 291 <ClCompile Include="..\interpreter\ProtoCallFrame.cpp"> 292 <Filter>interpreter</Filter> 293 </ClCompile> 291 294 <ClCompile Include="..\interpreter\StackVisitor.cpp"> 292 295 <Filter>interpreter</Filter> … … 1726 1729 </ClInclude> 1727 1730 <ClInclude Include="..\interpreter\JSStackInlines.h"> 1731 <Filter>interpreter</Filter> 1732 </ClInclude> 1733 <ClInclude Include="..\interpreter\ProtoCallFrame.h"> 1728 1734 <Filter>interpreter</Filter> 1729 1735 </ClInclude> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r159943 r160094 736 736 65C0285C1717966800351E35 /* ARMv7DOpcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C0285A1717966800351E35 /* ARMv7DOpcode.cpp */; }; 737 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 739 7C15F65D17C199CE00794D40 /* JSPromiseCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C15F65B17C199CE00794D40 /* JSPromiseCallback.cpp */; }; 739 740 7C15F65E17C199CE00794D40 /* JSPromiseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C15F65C17C199CE00794D40 /* JSPromiseCallback.h */; }; … … 2016 2017 65EA73620BAE35D1001BB560 /* CommonIdentifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CommonIdentifiers.cpp; sourceTree = "<group>"; }; 2017 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 2021 704FD35305697E6D003DBED9 /* BooleanObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BooleanObject.h; sourceTree = "<group>"; tabWidth = 8; }; 2019 2022 7C15F65B17C199CE00794D40 /* JSPromiseCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPromiseCallback.cpp; sourceTree = "<group>"; }; … … 2919 2922 isa = PBXGroup; 2920 2923 children = ( 2924 65FB5116184EE9BC00C12B70 /* ProtoCallFrame.cpp */, 2925 65FB5115184EE8F800C12B70 /* ProtoCallFrame.h */, 2921 2926 0F55F0F114D1063600AC7649 /* AbstractPC.cpp */, 2922 2927 0F55F0F214D1063600AC7649 /* AbstractPC.h */, … … 5278 5283 buildActionMask = 2147483647; 5279 5284 files = ( 5285 65FB5117184EEE7000C12B70 /* ProtoCallFrame.cpp in Sources */, 5280 5286 0FFA549716B8835000B3A982 /* A64DOpcode.cpp in Sources */, 5281 5287 0F55F0F414D1063900AC7649 /* AbstractPC.cpp in Sources */, -
trunk/Source/JavaScriptCore/interpreter/CachedCall.h
r159605 r160094 32 32 #include "JSGlobalObject.h" 33 33 #include "Interpreter.h" 34 #include "ProtoCallFrame.h" 34 35 #include "VMEntryScope.h" 35 36 … … 44 45 { 45 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 52 m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argumentCount + 1, function->scope()); 48 else 53 #endif 54 } else 49 55 throwStackOverflowError(callFrame); 50 56 m_valid = !callFrame->hadException(); … … 56 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 68 void setThis(JSValue v) { m_closure.setThis(v); } 59 69 void setArgument(int n, JSValue v) { m_closure.setArgument(n, v); } … … 71 81 m_interpreter->endRepeatCall(m_closure); 72 82 } 73 83 #endif 84 74 85 private: 75 86 bool m_valid; 76 87 Interpreter* m_interpreter; 77 88 VMEntryScope m_entryScope; 89 #if !ENABLE(LLINT_C_LOOP) 90 ProtoCallFrame m_protoCallFrame; 91 Vector<JSValue> m_arguments; 92 #endif 78 93 CallFrameClosure m_closure; 79 94 }; -
trunk/Source/JavaScriptCore/interpreter/CallFrameClosure.h
r148696 r160094 27 27 #define CallFrameClosure_h 28 28 29 #include "ProtoCallFrame.h" 30 29 31 namespace JSC { 30 32 31 33 struct CallFrameClosure { 32 34 CallFrame* oldCallFrame; 35 #if ENABLE(LLINT_C_LOOP) 33 36 CallFrame* newCallFrame; 37 #else 38 ProtoCallFrame* newCallFrame; 39 #endif 34 40 JSFunction* function; 35 41 FunctionExecutable* functionExecutable; … … 52 58 { 53 59 newCallFrame->setScope(scope); 60 #if ENABLE(LLINT_C_LOOP) 54 61 // setArgument() takes an arg index that starts from 0 for the first 55 62 // argument after the 'this' value. Since both argumentCountIncludingThis 56 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 65 for (int i = argumentCountIncludingThis-1; i < parameterCountIncludingThis-1; ++i) 59 66 newCallFrame->setArgument(i, jsUndefined()); 67 #endif 60 68 } 61 69 }; -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r159605 r160094 54 54 #include "JSWithScope.h" 55 55 #include "LLIntCLoop.h" 56 #include "LLIntThunks.h" 56 57 #include "LegacyProfiler.h" 57 58 #include "LiteralParser.h" … … 60 61 #include "Operations.h" 61 62 #include "Parser.h" 63 #include "ProtoCallFrame.h" 62 64 #include "RegExpObject.h" 63 65 #include "RegExpPrototype.h" … … 861 863 // Push the call frame for this invocation: 862 864 ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'. 865 #if ENABLE(LLINT_C_LOOP) 863 866 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0); 864 867 if (UNLIKELY(!newCallFrame)) … … 867 870 // Set the arguments for the callee: 868 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 880 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 880 890 result = LLInt::CLoop::execute(newCallFrame, llint_program_prologue); 881 891 #elif ENABLE(JIT) 882 result = program->generatedJITCode()->execute(& m_stack, newCallFrame, &vm);892 result = program->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack()); 883 893 #endif // ENABLE(JIT) 884 894 } … … 887 897 profiler->didExecute(callFrame, program->sourceURL(), program->lineNo()); 888 898 899 #if ENABLE(LLINT_C_LOOP) 889 900 m_stack.popFrame(newCallFrame); 901 #endif 890 902 891 903 return checkedReturn(result); … … 931 943 return throwTerminatedExecutionException(callFrame); 932 944 945 #if ENABLE(LLINT_C_LOOP) 933 946 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function); 934 947 if (UNLIKELY(!newCallFrame)) … … 939 952 for (size_t i = 0; i < args.size(); ++i) 940 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 962 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 953 973 result = LLInt::CLoop::execute(newCallFrame, llint_function_for_call_prologue); 954 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 976 #endif // ENABLE(JIT) 957 } else 977 } else { 978 #if ENABLE(LLINT_C_LOOP) 958 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 … … 962 987 profiler->didExecute(callFrame, function); 963 988 989 #if ENABLE(LLINT_C_LOOP) 964 990 m_stack.popFrame(newCallFrame); 991 #endif 965 992 return checkedReturn(result); 966 993 } … … 1006 1033 if (UNLIKELY(vm.watchdog.didFire(callFrame))) 1007 1034 return throwTerminatedExecutionException(callFrame); 1008 1035 #if ENABLE(LLINT_C_LOOP) 1009 1036 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, constructor); 1010 1037 if (UNLIKELY(!newCallFrame)) … … 1015 1042 for (size_t i = 0; i < args.size(); ++i) 1016 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 1052 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 1029 1063 result = LLInt::CLoop::execute(newCallFrame, llint_function_for_construct_prologue); 1030 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 1066 #endif // ENABLE(JIT) 1033 1067 } else { 1068 #if ENABLE(LLINT_C_LOOP) 1034 1069 result = JSValue::decode(constructData.native.function(newCallFrame)); 1035 if (!callFrame->hadException()) { 1036 ASSERT_WITH_MESSAGE(result.isObject(), "Host constructor returned non object.");1037 if (!result.isObject()) 1038 throwTypeError(newCallFrame);1039 }1070 #else 1071 result = JSValue::decode(callToNativeFunction(reinterpret_cast<void*>(constructData.native.function), &vm.topCallFrame, &protoCallFrame, m_stack.getTopOfStack())); 1072 #endif 1073 if (!callFrame->hadException()) 1074 RELEASE_ASSERT(result.isObject()); 1040 1075 } 1041 1076 } … … 1044 1079 profiler->didExecute(callFrame, constructor); 1045 1080 1081 #if ENABLE(LLINT_C_LOOP) 1046 1082 m_stack.popFrame(newCallFrame); 1083 #endif 1047 1084 1048 1085 if (callFrame->hadException()) … … 1052 1089 } 1053 1090 1091 #if ENABLE(LLINT_C_LOOP) 1054 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 1097 VM& vm = *scope->vm(); … … 1071 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 1117 if (UNLIKELY(!newCallFrame)) { 1075 1118 throwStackOverflowError(callFrame); … … 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 1126 throwStackOverflowError(callFrame); 1081 1127 return CallFrameClosure(); 1082 1128 } 1083 1129 1130 protoCallFrame->init(newCodeBlock, scope, function, jsUndefined(), argsCount, args); 1084 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 1134 return result; 1087 1135 } … … 1097 1145 1098 1146 StackStats::CheckPoint stackCheckPoint; 1147 #if ENABLE(LLINT_C_LOOP) 1099 1148 m_stack.validateFence(closure.newCallFrame, "BEFORE"); 1149 #endif 1100 1150 closure.resetCallFrame(); 1151 #if ENABLE(LLINT_C_LOOP) 1101 1152 m_stack.validateFence(closure.newCallFrame, "STEP 1"); 1153 #endif 1102 1154 1103 1155 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 1115 1167 // repeating this call on a second callback function. 1116 1168 1169 #if ENABLE(LLINT_C_LOOP) 1117 1170 TopCallFrameSetter topCallFrame(vm, closure.newCallFrame); 1171 #endif 1118 1172 1119 1173 // Execute the code: … … 1126 1180 result = LLInt::CLoop::execute(closure.newCallFrame, llint_function_for_call_prologue); 1127 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 1183 #endif // ENABLE(JIT) 1130 1184 } … … 1133 1187 profiler->didExecute(closure.oldCallFrame, closure.function); 1134 1188 1189 #if ENABLE(LLINT_C_LOOP) 1135 1190 m_stack.validateFence(closure.newCallFrame, "AFTER"); 1191 #endif 1136 1192 return checkedReturn(result); 1137 1193 } 1138 1194 1195 #if ENABLE(LLINT_C_LOOP) 1139 1196 void Interpreter::endRepeatCall(CallFrameClosure& closure) 1140 1197 { 1141 1198 m_stack.popFrame(closure.newCallFrame); 1142 1199 } 1200 #endif 1143 1201 1144 1202 JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope) … … 1204 1262 // Push the frame: 1205 1263 ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'. 1264 #if ENABLE(LLINT_C_LOOP) 1206 1265 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0); 1207 1266 if (UNLIKELY(!newCallFrame)) … … 1210 1269 // Set the arguments for the callee: 1211 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 1279 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 1223 1289 result = LLInt::CLoop::execute(newCallFrame, llint_eval_prologue); 1224 1290 #elif ENABLE(JIT) 1225 result = eval->generatedJITCode()->execute(& m_stack, newCallFrame, &vm);1291 result = eval->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack()); 1226 1292 #endif // ENABLE(JIT) 1227 1293 } … … 1230 1296 profiler->didExecute(callFrame, eval->sourceURL(), eval->lineNo()); 1231 1297 1298 #if ENABLE(LLINT_C_LOOP) 1232 1299 m_stack.popFrame(newCallFrame); 1300 #endif 1233 1301 return checkedReturn(result); 1234 1302 } -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r158586 r160094 60 60 struct HandlerInfo; 61 61 struct Instruction; 62 62 struct ProtoCallFrame; 63 63 64 enum DebugHookID { 64 65 WillExecuteProgram, … … 257 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 263 CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*); 260 264 void endRepeatCall(CallFrameClosure&); 265 #endif 261 266 JSValue execute(CallFrameClosure&); 262 267 -
trunk/Source/JavaScriptCore/interpreter/JSStack.h
r159826 r160094 36 36 #include <wtf/VMTags.h> 37 37 38 #define ENABLE_DEBUG_JSSTACK 0 38 39 #if !defined(NDEBUG) && !defined(ENABLE_DEBUG_JSSTACK) 39 40 #define ENABLE_DEBUG_JSSTACK 1 … … 99 100 Register* getStartOfFrame(CallFrame*); 100 101 Register* getTopOfStack(); 102 103 bool entryCheck(class CodeBlock*, int); 101 104 102 105 CallFrame* pushFrame(CallFrame* callerFrame, class CodeBlock*, -
trunk/Source/JavaScriptCore/interpreter/JSStackInlines.h
r159721 r160094 52 52 } 53 53 54 inline CallFrame* JSStack::pushFrame(CallFrame* callerFrame, 55 class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee) 56 { 57 ASSERT(!!scope); 54 inline bool JSStack::entryCheck(class CodeBlock* codeBlock, int argsCount) 55 { 58 56 Register* oldEnd = getTopOfStack(); 59 57 … … 78 76 // Ensure that we have the needed stack capacity to push the new frame: 79 77 if (!grow(newEnd)) 78 return false; 79 80 return true; 81 } 82 83 inline CallFrame* JSStack::pushFrame(CallFrame* callerFrame, 84 class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee) 85 { 86 ASSERT(!!scope); 87 Register* oldEnd = getTopOfStack(); 88 89 // Ensure that we have enough space for the parameters: 90 size_t paddedArgsCount = argsCount; 91 if (codeBlock) { 92 size_t numParameters = codeBlock->numParameters(); 93 if (paddedArgsCount < numParameters) 94 paddedArgsCount = numParameters; 95 } 96 97 Register* newCallFrameSlot = oldEnd - paddedArgsCount - (2 * JSStack::CallFrameHeaderSize) + 1; 98 99 #if ENABLE(DEBUG_JSSTACK) 100 newCallFrameSlot -= JSStack::FenceSize; 101 #endif 102 103 Register* newEnd = newCallFrameSlot; 104 if (!!codeBlock) 105 newEnd += virtualRegisterForLocal(codeBlock->frameRegisterCount()).offset(); 106 107 // Ensure that we have the needed stack capacity to push the new frame: 108 if (!grow(newEnd)) 80 109 return 0; 81 110 82 // Compute the address of the new VM sentin al frame for this invocation:83 CallFrame* newVMEntrySentin alFrame = CallFrame::create(newCallFrameSlot + paddedArgsCount + JSStack::CallFrameHeaderSize);84 ASSERT(!!newVMEntrySentin alFrame);111 // Compute the address of the new VM sentinel frame for this invocation: 112 CallFrame* newVMEntrySentinelFrame = CallFrame::create(newCallFrameSlot + paddedArgsCount + JSStack::CallFrameHeaderSize); 113 ASSERT(!!newVMEntrySentinelFrame); 85 114 86 115 // Compute the address of the new frame for this invocation: … … 93 122 callerFrame = m_topCallFrame; 94 123 95 // Initialize the VM sentin al frame header:96 newVMEntrySentin alFrame->initializeVMEntrySentinelFrame(callerFrame);124 // Initialize the VM sentinel frame header: 125 newVMEntrySentinelFrame->initializeVMEntrySentinelFrame(callerFrame); 97 126 98 127 // Initialize the callee frame header: 99 newCallFrame->init(codeBlock, 0, scope, newVMEntrySentin alFrame, argsCount, callee);128 newCallFrame->init(codeBlock, 0, scope, newVMEntrySentinelFrame, argsCount, callee); 100 129 101 130 ASSERT(!!newCallFrame->scope()); … … 121 150 validateFence(frame, __FUNCTION__, __LINE__); 122 151 123 // Pop off the callee frame and the sentin al frame.152 // Pop off the callee frame and the sentinel frame. 124 153 CallFrame* callerFrame = frame->callerFrame()->vmEntrySentinelCallerFrame(); 125 154 … … 184 213 // | *** the Fence *** | 185 214 // |--------------------------------------| 186 // | VM entry sentin al frame header |215 // | VM entry sentinel frame header | 187 216 // |--------------------------------------| 188 217 // | Args of new frame | -
trunk/Source/JavaScriptCore/jit/JITCode.cpp
r159276 r160094 43 43 44 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 50 return vm->exception() ? jsNull() : result; 51 51 } -
trunk/Source/JavaScriptCore/jit/JITCode.h
r157044 r160094 50 50 class VM; 51 51 class JSStack; 52 struct ProtoCallFrame; 52 53 #endif 53 54 … … 178 179 virtual FTL::ForOSREntryJITCode* ftlForOSREntry(); 179 180 180 JSValue execute( JSStack*, CallFrame*, VM*);181 JSValue execute(VM*, ProtoCallFrame*, Register*); 181 182 182 183 void* start() { return dataAddressAtOffset(0); } -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r159721 r160094 77 77 VM* vm = codeBlock->vm(); 78 78 CallFrame* callerFrame = exec->callerFrameSkippingVMEntrySentinel(); 79 if (!callerFrame) 80 callerFrame = exec; 81 79 82 NativeCallFrameTracer tracer(vm, callerFrame); 80 83 -
trunk/Source/JavaScriptCore/jit/JITStubs.h
r159276 r160094 39 39 #if OS(WINDOWS) 40 40 class ExecState; 41 class Register; 42 struct ProtoCallFrame; 41 43 42 44 extern "C" { 43 EncodedJSValue callToJavaScript(void*, ExecState* );45 EncodedJSValue callToJavaScript(void*, ExecState**, ProtoCallFrame*, Register*); 44 46 void returnFromJavaScript(); 47 EncodedJSValue callToNativeFunction(void*, ExecState**, ProtoCallFrame*, Register*); 45 48 } 46 49 #endif -
trunk/Source/JavaScriptCore/jit/JITStubsMSVC64.asm
r159376 r160094 33 33 34 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 39 mov r10, qword ptr[rsp] 36 40 push rbp … … 50 54 ; an additional 28h bytes. 51 55 sub rsp, 28h 52 mov rbp, rdx 53 mov r11, qword ptr[rbp] ; Put the previous frame pointer in the sentinel call frame above us 54 mov qword ptr[r11], rax 55 mov qword ptr[r11 + 8], r10 56 57 mov rbp, r9 58 sub rbp, 40 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 111 mov r14, 0FFFF000000000000h 57 112 mov r15, 0FFFF000000000002h 58 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 122 add rsp, 28h 60 123 pop rdi … … 68 131 ret 69 132 callToJavaScript ENDP 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 70 237 71 238 returnFromJavaScript PROC -
trunk/Source/JavaScriptCore/jit/JITStubsX86.h
r159346 r160094 207 207 // FIXME: Since Windows doesn't use the LLInt, we have inline stubs here. 208 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 211 __asm { … … 218 218 push ebx; 219 219 sub esp, 0x1c; 220 mov ebp, [esp + 0x34]; 221 mov ebx, [ebp]; 222 mov [ebx], eax; 223 mov 4[ebx], edx 224 call [esp + 0x30]; 220 mov ecx, dword ptr[esp + 0x34]; 221 mov esi, dword ptr[esp + 0x38]; 222 mov ebp, dword ptr[esp + 0x3c]; 223 sub ebp, 0x20; 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 300 add esp, 0x1c; 226 301 pop ebx; … … 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 -
trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
r157746 r160094 47 47 #include "LLIntOfflineAsmConfig.h" 48 48 #include "MarkedSpace.h" 49 49 #include "ProtoCallFrame.h" 50 50 #include "Structure.h" 51 51 #include "StructureChain.h" -
trunk/Source/JavaScriptCore/llint/LLIntThunks.h
r159276 r160094 36 36 37 37 class ExecState; 38 class Register; 38 39 class VM; 40 struct ProtoCallFrame; 39 41 40 42 extern "C" { 41 EncodedJSValue callToJavaScript(void*, ExecState* );43 EncodedJSValue callToJavaScript(void*, ExecState**, ProtoCallFrame*, Register*); 42 44 void returnFromJavaScript(); 45 EncodedJSValue callToNativeFunction(void*, ExecState**, ProtoCallFrame*, Register*); 43 46 } 44 47 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r160082 r160094 424 424 if C_LOOP 425 425 else 426 # stub to call into JavaScript 427 # EncodedJSValue callToJavaScript(void* code, Register* topOfStack) 428 # Note, if this stub or one of it's related macros is changed, make the 426 # stub to call into JavaScript or Native functions 427 # EncodedJSValue callToJavaScript(void* code, ExecState** vm, ProtoCallFrame* protoFrame, Register* topOfStack) 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 430 # equivalent changes in jit/JITStubsX86.h and/or jit/JITStubsMSVC64.asm 430 431 _callToJavaScript: 431 doCallToJavaScript() 432 doCallToJavaScript(makeJavaScriptCall, doReturnFromJavaScript) 433 434 _callToNativeFunction: 435 doCallToJavaScript(makeHostFunctionCall, doReturnFromHostFunction) 432 436 end 433 437 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r159943 r160094 171 171 end 172 172 173 macro doCallToJavaScript( )173 macro doCallToJavaScript(makeCall, doReturn) 174 174 if X86 175 const entry = t5 176 const vmTopCallFrame = t2 177 const protoCallFrame = t4 178 175 179 const extraStackSpace = 28 176 180 const previousCFR = t0 177 181 const previousPC = t1 178 const entry = t5 179 const newCallFrame = t4 182 const temp1 = t0 # Same as previousCFR 183 const temp2 = t1 # Same as previousPC 184 const temp3 = t2 # same as vmTopCallFrame 185 const temp4 = t3 180 186 elsif ARM or ARMv7_TRADITIONAL 187 const entry = a0 188 const vmTopCallFrame = a1 189 const protoCallFrame = a2 190 const topOfStack = a3 191 181 192 const extraStackSpace = 16 182 const previousCFR = t3 193 const previousCFR = t3 183 194 const previousPC = lr 195 const temp1 = t3 # Same as previousCFR 196 const temp2 = a3 # Same as topOfStack 197 const temp3 = t4 198 const temp4 = t5 199 elsif ARMv7 184 200 const entry = a0 185 const newCallFrame = a1 186 elsif ARMv7 201 const vmTopCallFrame = a1 202 const protoCallFrame = a2 203 const topOfStack = a3 204 187 205 const extraStackSpace = 28 188 const previousCFR = t3 206 const previousCFR = t3 189 207 const previousPC = lr 208 const temp1 = t3 # Same as previousCFR 209 const temp2 = a3 # Same as topOfStack 210 const temp3 = t4 211 const temp4 = t5 212 elsif MIPS 190 213 const entry = a0 191 const newCallFrame = a1 192 elsif MIPS 214 const vmTopCallFrame = a1 215 const protoCallFrame = a2 216 const topOfStack = a3 217 193 218 const extraStackSpace = 36 194 219 const previousCFR = t2 195 220 const previousPC = lr 221 const temp1 = t3 222 const temp2 = t4 223 const temp3 = t5 224 const temp4 = t6 225 elsif SH4 196 226 const entry = a0 197 const newCallFrame = a1 198 elsif SH4 227 const vmTopCallFrame = a1 228 const protoCallFrame = a2 229 const topOfStack = a3 230 199 231 const extraStackSpace = 20 200 const previousCFR = t3 232 const previousCFR = t3 201 233 const previousPC = lr 202 const entry = a0 203 const newCallFrame = a1 234 const temp1 = t3 # Same as previousCFR 235 const temp2 = a3 # Same as topOfStack 236 const temp3 = t4 237 const temp4 = t5 204 238 end 205 239 … … 211 245 if X86 212 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 250 else 215 251 move cfr, previousCFR 252 move topOfStack, cfr 216 253 end 217 254 218 move newCallFrame, cfr 219 loadp [cfr], newCallFrame 220 storep previousCFR, [newCallFrame] 221 storep previousPC, 4[newCallFrame] 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 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] 326 327 doReturn(extraStackSpace) 328 end 329 330 macro makeJavaScriptCall(entry, temp) 222 331 call entry 223 332 end 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 347 _returnFromJavaScript: 348 functionEpilogue(extraStackSpace) 349 ret 350 end 351 352 macro doReturnFromHostFunction(extraStackSpace) 225 353 functionEpilogue(extraStackSpace) 226 354 ret -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r159943 r160094 114 114 end 115 115 116 macro doCallToJavaScript( )116 macro doCallToJavaScript(makeCall, doReturn) 117 117 if X86_64 118 const entry = t5 119 const vmTopCallFrame = t4 120 const protoCallFrame = t1 121 const topOfStack = t2 122 118 123 const extraStackSpace = 8 119 124 const previousCFR = t0 120 125 const previousPC = t6 121 const entry = t5 122 const newCallFrame = t4 126 const temp1 = t0 127 const temp2 = t3 128 const temp3 = t6 123 129 elsif ARM64 130 const entry = a0 131 const vmTopCallFrame = a1 132 const protoCallFrame = a2 133 const topOfStack = a3 134 124 135 const extraStackSpace = 0 125 136 const previousCFR = t4 126 137 const previousPC = lr 127 const entry = a0 128 const newCallFrame = a1 129 elsif C_LOOP 130 const extraStackSpace = 0 131 const previousCFR = t4 132 const previousPC = lr 133 const entry = a0 134 const newCallFrame = a1 138 const temp1 = t3 139 const temp2 = t5 140 const temp3 = t6 135 141 end 136 142 … … 141 147 functionPrologue(extraStackSpace) 142 148 143 move newCallFrame, cfr 144 loadp [cfr], newCallFrame 145 storep previousCFR, [newCallFrame] 146 storep previousPC, 8[newCallFrame] 149 move topOfStack, cfr 150 subp (CallFrameHeaderSlots-1)*8, cfr 151 storep 0, ArgumentCount[cfr] 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 199 move 0xffff000000000000, csr1 148 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 216 call entry 150 217 end 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 230 _returnFromJavaScript: 231 functionEpilogue(extraStackSpace) 232 ret 233 end 234 235 macro doReturnFromHostFunction(extraStackSpace) 152 236 functionEpilogue(extraStackSpace) 153 237 ret -
trunk/Source/JavaScriptCore/runtime/ArgList.h
r155711 r160094 140 140 141 141 class ArgList { 142 friend class Interpreter; 142 143 friend class JIT; 143 144 public: … … 173 174 174 175 private: 176 JSValue* data() const { return m_args; } 177 175 178 JSValue* m_args; 176 179 int m_argCount; -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r156214 r160094 1321 1321 m_cachedCall->setArgument(0, va); 1322 1322 m_cachedCall->setArgument(1, vb); 1323 #if ENABLE(LLINT_C_LOOP) 1323 1324 compareResult = m_cachedCall->call().toNumber(m_cachedCall->newCallFrame(m_exec)); 1325 #else 1326 compareResult = m_cachedCall->call().toNumber(m_exec); 1327 #endif 1324 1328 } else { 1325 1329 MarkedArgumentBuffer arguments; -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r156620 r160094 505 505 cachedCall.setThis(jsUndefined()); 506 506 JSValue jsResult = cachedCall.call(); 507 #if ENABLE(LLINT_C_LOOP) 507 508 replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec)); 509 #else 510 replacements.append(jsResult.toString(exec)->value(exec)); 511 #endif 508 512 if (exec->hadException()) 509 513 break; … … 544 548 cachedCall.setThis(jsUndefined()); 545 549 JSValue jsResult = cachedCall.call(); 550 #if ENABLE(LLINT_C_LOOP) 546 551 replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec)); 552 #else 553 replacements.append(jsResult.toString(exec)->value(exec)); 554 #endif 547 555 if (exec->hadException()) 548 556 break;
Note: See TracChangeset
for help on using the changeset viewer.