Changeset 160186 in webkit for trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- Dec 5, 2013, 12:33:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r160094 r160186 861 861 return throwTerminatedExecutionException(callFrame); 862 862 863 // Push the call frame for this invocation:864 863 ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'. 865 #if ENABLE(LLINT_C_LOOP) 866 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0); 867 if (UNLIKELY(!newCallFrame)) 868 return checkedReturn(throwStackOverflowError(callFrame)); 869 870 // Set the arguments for the callee: 871 newCallFrame->setThisValue(thisObj); 872 #else 864 873 865 if (UNLIKELY(!m_stack.entryCheck(codeBlock, 1))) 874 866 return checkedReturn(throwStackOverflowError(callFrame)); … … 876 868 ProtoCallFrame protoCallFrame; 877 869 protoCallFrame.init(codeBlock, scope, 0, thisObj, 1); 878 #endif879 870 880 871 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 887 878 Watchdog::Scope watchdogScope(vm.watchdog); 888 879 889 #if ENABLE(LLINT_C_LOOP)890 result = LLInt::CLoop::execute(newCallFrame, llint_program_prologue);891 #elif ENABLE(JIT)892 880 result = program->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack()); 893 #endif // ENABLE(JIT)894 881 } 895 882 896 883 if (LegacyProfiler* profiler = vm.enabledProfiler()) 897 884 profiler->didExecute(callFrame, program->sourceURL(), program->lineNo()); 898 899 #if ENABLE(LLINT_C_LOOP)900 m_stack.popFrame(newCallFrame);901 #endif902 885 903 886 return checkedReturn(result); … … 943 926 return throwTerminatedExecutionException(callFrame); 944 927 945 #if ENABLE(LLINT_C_LOOP)946 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);947 if (UNLIKELY(!newCallFrame))948 return checkedReturn(throwStackOverflowError(callFrame));949 950 // Set the arguments for the callee:951 newCallFrame->setThisValue(thisValue);952 for (size_t i = 0; i < args.size(); ++i)953 newCallFrame->setArgument(i, args.at(i));954 #else955 928 if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount))) 956 929 return checkedReturn(throwStackOverflowError(callFrame)); … … 958 931 ProtoCallFrame protoCallFrame; 959 932 protoCallFrame.init(newCodeBlock, scope, function, thisValue, argsCount, args.data()); 960 #endif961 933 962 934 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 969 941 970 942 // Execute the code: 971 if (isJSCall) { 972 #if ENABLE(LLINT_C_LOOP) 973 result = LLInt::CLoop::execute(newCallFrame, llint_function_for_call_prologue); 974 #elif ENABLE(JIT) 943 if (isJSCall) 975 944 result = callData.js.functionExecutable->generatedJITCodeForCall()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack()); 976 #endif // ENABLE(JIT) 977 } else { 978 #if ENABLE(LLINT_C_LOOP) 979 result = JSValue::decode(callData.native.function(newCallFrame)); 980 #else 945 else 981 946 result = JSValue::decode(callToNativeFunction(reinterpret_cast<void*>(callData.native.function), &vm.topCallFrame, &protoCallFrame, m_stack.getTopOfStack())); 982 #endif983 }984 947 } 985 948 … … 987 950 profiler->didExecute(callFrame, function); 988 951 989 #if ENABLE(LLINT_C_LOOP)990 m_stack.popFrame(newCallFrame);991 #endif992 952 return checkedReturn(result); 993 953 } … … 1033 993 if (UNLIKELY(vm.watchdog.didFire(callFrame))) 1034 994 return throwTerminatedExecutionException(callFrame); 1035 #if ENABLE(LLINT_C_LOOP) 1036 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, constructor); 1037 if (UNLIKELY(!newCallFrame)) 1038 return checkedReturn(throwStackOverflowError(callFrame)); 1039 1040 // Set the arguments for the callee: 1041 newCallFrame->setThisValue(jsUndefined()); 1042 for (size_t i = 0; i < args.size(); ++i) 1043 newCallFrame->setArgument(i, args.at(i)); 1044 #else 995 1045 996 if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount))) 1046 997 return checkedReturn(throwStackOverflowError(callFrame)); … … 1048 999 ProtoCallFrame protoCallFrame; 1049 1000 protoCallFrame.init(newCodeBlock, scope, constructor, jsUndefined(), argsCount, args.data()); 1050 #endif1051 1001 1052 1002 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 1059 1009 1060 1010 // Execute the code. 1061 if (isJSConstruct) { 1062 #if ENABLE(LLINT_C_LOOP) 1063 result = LLInt::CLoop::execute(newCallFrame, llint_function_for_construct_prologue); 1064 #elif ENABLE(JIT) 1011 if (isJSConstruct) 1065 1012 result = constructData.js.functionExecutable->generatedJITCodeForConstruct()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack()); 1066 #endif // ENABLE(JIT) 1067 } else { 1068 #if ENABLE(LLINT_C_LOOP) 1069 result = JSValue::decode(constructData.native.function(newCallFrame)); 1070 #else 1013 else { 1071 1014 result = JSValue::decode(callToNativeFunction(reinterpret_cast<void*>(constructData.native.function), &vm.topCallFrame, &protoCallFrame, m_stack.getTopOfStack())); 1072 #endif 1015 1073 1016 if (!callFrame->hadException()) 1074 1017 RELEASE_ASSERT(result.isObject()); … … 1078 1021 if (LegacyProfiler* profiler = vm.enabledProfiler()) 1079 1022 profiler->didExecute(callFrame, constructor); 1080 1081 #if ENABLE(LLINT_C_LOOP)1082 m_stack.popFrame(newCallFrame);1083 #endif1084 1023 1085 1024 if (callFrame->hadException()) … … 1089 1028 } 1090 1029 1091 #if ENABLE(LLINT_C_LOOP)1092 CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope)1093 #else1094 1030 CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, ProtoCallFrame* protoCallFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope, JSValue* args) 1095 #endif1096 1031 { 1097 1032 VM& vm = *scope->vm(); … … 1112 1047 size_t argsCount = argumentCountIncludingThis; 1113 1048 1114 #if ENABLE(LLINT_C_LOOP)1115 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);1116 1117 if (UNLIKELY(!newCallFrame)) {1118 throwStackOverflowError(callFrame);1119 return CallFrameClosure();1120 }1121 1122 // Return the successful closure:1123 CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis };1124 #else1125 1049 if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount))) { 1126 1050 throwStackOverflowError(callFrame); … … 1131 1055 // Return the successful closure: 1132 1056 CallFrameClosure result = { callFrame, protoCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis }; 1133 #endif1134 1057 return result; 1135 1058 } … … 1145 1068 1146 1069 StackStats::CheckPoint stackCheckPoint; 1147 #if ENABLE(LLINT_C_LOOP)1148 m_stack.validateFence(closure.newCallFrame, "BEFORE");1149 #endif1150 1070 closure.resetCallFrame(); 1151 #if ENABLE(LLINT_C_LOOP)1152 m_stack.validateFence(closure.newCallFrame, "STEP 1");1153 #endif1154 1071 1155 1072 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 1159 1076 return throwTerminatedExecutionException(closure.oldCallFrame); 1160 1077 1161 // The code execution below may push more frames and point the topCallFrame1162 // to those newer frames, or it may pop to the top frame to the caller of1163 // the current repeat frame, or it may leave the top frame pointing to the1164 // current repeat frame.1165 //1166 // Hence, we need to preserve the topCallFrame here ourselves before1167 // repeating this call on a second callback function.1168 1169 #if ENABLE(LLINT_C_LOOP)1170 TopCallFrameSetter topCallFrame(vm, closure.newCallFrame);1171 #endif1172 1173 1078 // Execute the code: 1174 1079 JSValue result; … … 1177 1082 Watchdog::Scope watchdogScope(vm.watchdog); 1178 1083 1179 #if ENABLE(LLINT_C_LOOP) 1180 result = LLInt::CLoop::execute(closure.newCallFrame, llint_function_for_call_prologue); 1181 #elif ENABLE(JIT) 1182 result = closure.functionExecutable->generatedJITCodeForCall()->execute(&vm, closure.newCallFrame, m_stack.getTopOfStack()); 1183 #endif // ENABLE(JIT) 1084 result = closure.functionExecutable->generatedJITCodeForCall()->execute(&vm, closure.protoCallFrame, m_stack.getTopOfStack()); 1184 1085 } 1185 1086 … … 1187 1088 profiler->didExecute(closure.oldCallFrame, closure.function); 1188 1089 1189 #if ENABLE(LLINT_C_LOOP)1190 m_stack.validateFence(closure.newCallFrame, "AFTER");1191 #endif1192 1090 return checkedReturn(result); 1193 1091 } 1194 1195 #if ENABLE(LLINT_C_LOOP)1196 void Interpreter::endRepeatCall(CallFrameClosure& closure)1197 {1198 m_stack.popFrame(closure.newCallFrame);1199 }1200 #endif1201 1092 1202 1093 JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope) … … 1260 1151 return throwTerminatedExecutionException(callFrame); 1261 1152 1262 // Push the frame:1263 1153 ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'. 1264 #if ENABLE(LLINT_C_LOOP) 1265 CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0); 1266 if (UNLIKELY(!newCallFrame)) 1267 return checkedReturn(throwStackOverflowError(callFrame)); 1268 1269 // Set the arguments for the callee: 1270 newCallFrame->setThisValue(thisValue); 1271 #else 1154 1272 1155 if (UNLIKELY(!m_stack.entryCheck(codeBlock, 1))) 1273 1156 return checkedReturn(throwStackOverflowError(callFrame)); … … 1275 1158 ProtoCallFrame protoCallFrame; 1276 1159 protoCallFrame.init(codeBlock, scope, 0, thisValue, 1); 1277 #endif1278 1160 1279 1161 if (LegacyProfiler* profiler = vm.enabledProfiler()) … … 1286 1168 Watchdog::Scope watchdogScope(vm.watchdog); 1287 1169 1288 #if ENABLE(LLINT_C_LOOP)1289 result = LLInt::CLoop::execute(newCallFrame, llint_eval_prologue);1290 #elif ENABLE(JIT)1291 1170 result = eval->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack()); 1292 #endif // ENABLE(JIT)1293 1171 } 1294 1172 … … 1296 1174 profiler->didExecute(callFrame, eval->sourceURL(), eval->lineNo()); 1297 1175 1298 #if ENABLE(LLINT_C_LOOP)1299 m_stack.popFrame(newCallFrame);1300 #endif1301 1176 return checkedReturn(result); 1302 1177 }
Note:
See TracChangeset
for help on using the changeset viewer.