Changeset 160094 in webkit for trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- Dec 4, 2013, 8:40:17 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.