Changeset 157439 in webkit
- Timestamp:
- Oct 14, 2013, 8:03:45 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r157433 r157439 1 2013-10-14 Mark Lam <mark.lam@apple.com> 2 3 Transition *switch* and *scope* JITStubs to JIT operations. 4 https://bugs.webkit.org/show_bug.cgi?id=122757. 5 6 Reviewed by Geoffrey Garen. 7 8 Transitioning: 9 cti_op_switch_char 10 cti_op_switch_imm 11 cti_op_switch_string 12 cti_op_resolve_scope 13 cti_op_get_from_scope 14 cti_op_put_to_scope 15 16 * jit/JIT.h: 17 * jit/JITInlines.h: 18 (JSC::JIT::callOperation): 19 * jit/JITOpcodes.cpp: 20 (JSC::JIT::emit_op_switch_imm): 21 (JSC::JIT::emit_op_switch_char): 22 (JSC::JIT::emit_op_switch_string): 23 * jit/JITOpcodes32_64.cpp: 24 (JSC::JIT::emit_op_switch_imm): 25 (JSC::JIT::emit_op_switch_char): 26 (JSC::JIT::emit_op_switch_string): 27 * jit/JITOperations.cpp: 28 * jit/JITOperations.h: 29 * jit/JITPropertyAccess.cpp: 30 (JSC::JIT::emitSlow_op_resolve_scope): 31 (JSC::JIT::emitSlow_op_get_from_scope): 32 (JSC::JIT::emitSlow_op_put_to_scope): 33 * jit/JITPropertyAccess32_64.cpp: 34 (JSC::JIT::emitSlow_op_resolve_scope): 35 (JSC::JIT::emitSlow_op_get_from_scope): 36 (JSC::JIT::emitSlow_op_put_to_scope): 37 * jit/JITStubs.cpp: 38 * jit/JITStubs.h: 39 1 40 2013-10-14 Filip Pizlo <fpizlo@apple.com> 2 41 -
trunk/Source/JavaScriptCore/jit/JIT.h
r157411 r157439 868 868 MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg); 869 869 MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*); 870 MacroAssembler::Call callOperation(J_JITOperation_EPc, int, Instruction*); 871 MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t); 872 MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t); 870 873 MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID); 871 874 MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID); … … 877 880 MacroAssembler::Call callOperation(V_JITOperation_EJJI, RegisterID, RegisterID, RegisterID, RegisterID, StringImpl*); 878 881 #endif 882 MacroAssembler::Call callOperation(V_JITOperation_EPc, Instruction*); 879 883 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E); 880 884 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*); … … 886 890 MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, GPRReg, const Identifier*); 887 891 MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg); 892 MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, GPRReg, size_t); 888 893 MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID); 889 894 MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID); -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r157427 r157439 325 325 } 326 326 327 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EPc operation, int dst, Instruction* bytecodePC) 328 { 329 setupArgumentsWithExecState(TrustedImmPtr(bytecodePC)); 330 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 331 } 332 333 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EZ operation, int dst, int32_t arg) 334 { 335 setupArgumentsWithExecState(TrustedImm32(arg)); 336 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 337 } 338 339 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(P_JITOperation_EJS operation, GPRReg arg1, size_t arg2) 340 { 341 setupArgumentsWithExecState(arg1, TrustedImmPtr(arg2)); 342 return appendCallWithExceptionCheck(operation); 343 } 344 327 345 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_ECC operation, RegisterID regOp1, RegisterID regOp2) 328 346 { … … 346 364 { 347 365 setupArgumentsWithExecState(regOp1, regOp2); 366 return appendCallWithExceptionCheck(operation); 367 } 368 369 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EPc operation, Instruction* bytecodePC) 370 { 371 setupArgumentsWithExecState(TrustedImmPtr(bytecodePC)); 348 372 return appendCallWithExceptionCheck(operation); 349 373 } … … 413 437 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag); 414 438 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 439 } 440 441 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(P_JITOperation_EJS operation, GPRReg arg1Tag, GPRReg arg1Payload, size_t arg2) 442 { 443 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(arg2)); 444 return appendCallWithExceptionCheck(operation); 415 445 } 416 446 -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r157404 r157439 683 683 void JIT::emit_op_switch_imm(Instruction* currentInstruction) 684 684 { 685 unsignedtableIndex = currentInstruction[1].u.operand;685 size_t tableIndex = currentInstruction[1].u.operand; 686 686 unsigned defaultOffset = currentInstruction[2].u.operand; 687 687 unsigned scrutinee = currentInstruction[3].u.operand; … … 692 692 jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size()); 693 693 694 JITStubCall stubCall(this, cti_op_switch_imm); 695 stubCall.addArgument(scrutinee, regT2); 696 stubCall.addArgument(TrustedImm32(tableIndex)); 697 stubCall.call(); 698 jump(regT0); 694 emitGetVirtualRegister(scrutinee, regT0); 695 callOperation(operationSwitchImmWithUnknownKeyType, regT0, tableIndex); 696 jump(returnValueRegister); 699 697 } 700 698 701 699 void JIT::emit_op_switch_char(Instruction* currentInstruction) 702 700 { 703 unsignedtableIndex = currentInstruction[1].u.operand;701 size_t tableIndex = currentInstruction[1].u.operand; 704 702 unsigned defaultOffset = currentInstruction[2].u.operand; 705 703 unsigned scrutinee = currentInstruction[3].u.operand; … … 710 708 jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size()); 711 709 712 JITStubCall stubCall(this, cti_op_switch_char); 713 stubCall.addArgument(scrutinee, regT2); 714 stubCall.addArgument(TrustedImm32(tableIndex)); 715 stubCall.call(); 716 jump(regT0); 710 emitGetVirtualRegister(scrutinee, regT0); 711 callOperation(operationSwitchCharWithUnknownKeyType, regT0, tableIndex); 712 jump(returnValueRegister); 717 713 } 718 714 719 715 void JIT::emit_op_switch_string(Instruction* currentInstruction) 720 716 { 721 unsignedtableIndex = currentInstruction[1].u.operand;717 size_t tableIndex = currentInstruction[1].u.operand; 722 718 unsigned defaultOffset = currentInstruction[2].u.operand; 723 719 unsigned scrutinee = currentInstruction[3].u.operand; … … 727 723 m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset)); 728 724 729 JITStubCall stubCall(this, cti_op_switch_string); 730 stubCall.addArgument(scrutinee, regT2); 731 stubCall.addArgument(TrustedImm32(tableIndex)); 732 stubCall.call(); 733 jump(regT0); 725 emitGetVirtualRegister(scrutinee, regT0); 726 callOperation(operationSwitchStringWithUnknownKeyType, regT0, tableIndex); 727 jump(returnValueRegister); 734 728 } 735 729 -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r157404 r157439 995 995 void JIT::emit_op_switch_imm(Instruction* currentInstruction) 996 996 { 997 unsignedtableIndex = currentInstruction[1].u.operand;997 size_t tableIndex = currentInstruction[1].u.operand; 998 998 unsigned defaultOffset = currentInstruction[2].u.operand; 999 999 unsigned scrutinee = currentInstruction[3].u.operand; … … 1004 1004 jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size()); 1005 1005 1006 JITStubCall stubCall(this, cti_op_switch_imm); 1007 stubCall.addArgument(scrutinee); 1008 stubCall.addArgument(TrustedImm32(tableIndex)); 1009 stubCall.call(); 1010 jump(regT0); 1006 emitLoad(scrutinee, regT1, regT0); 1007 callOperation(operationSwitchImmWithUnknownKeyType, regT1, regT0, tableIndex); 1008 jump(returnValueRegister); 1011 1009 } 1012 1010 1013 1011 void JIT::emit_op_switch_char(Instruction* currentInstruction) 1014 1012 { 1015 unsignedtableIndex = currentInstruction[1].u.operand;1013 size_t tableIndex = currentInstruction[1].u.operand; 1016 1014 unsigned defaultOffset = currentInstruction[2].u.operand; 1017 1015 unsigned scrutinee = currentInstruction[3].u.operand; … … 1022 1020 jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size()); 1023 1021 1024 JITStubCall stubCall(this, cti_op_switch_char); 1025 stubCall.addArgument(scrutinee); 1026 stubCall.addArgument(TrustedImm32(tableIndex)); 1027 stubCall.call(); 1028 jump(regT0); 1022 emitLoad(scrutinee, regT1, regT0); 1023 callOperation(operationSwitchCharWithUnknownKeyType, regT1, regT0, tableIndex); 1024 jump(returnValueRegister); 1029 1025 } 1030 1026 1031 1027 void JIT::emit_op_switch_string(Instruction* currentInstruction) 1032 1028 { 1033 unsignedtableIndex = currentInstruction[1].u.operand;1029 size_t tableIndex = currentInstruction[1].u.operand; 1034 1030 unsigned defaultOffset = currentInstruction[2].u.operand; 1035 1031 unsigned scrutinee = currentInstruction[3].u.operand; … … 1039 1035 m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset)); 1040 1036 1041 JITStubCall stubCall(this, cti_op_switch_string); 1042 stubCall.addArgument(scrutinee); 1043 stubCall.addArgument(TrustedImm32(tableIndex)); 1044 stubCall.call(); 1045 jump(regT0); 1037 emitLoad(scrutinee, regT1, regT0); 1038 callOperation(operationSwitchStringWithUnknownKeyType, regT1, regT0, tableIndex); 1039 jump(returnValueRegister); 1046 1040 } 1047 1041 -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r157411 r157439 894 894 } 895 895 896 char* JIT_OPERATION operationSwitchCharWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex) 897 { 898 VM& vm = exec->vm(); 899 NativeCallFrameTracer tracer(&vm, exec); 900 JSValue key = JSValue::decode(encodedKey); 901 CodeBlock* codeBlock = exec->codeBlock(); 902 903 SimpleJumpTable& jumpTable = codeBlock->switchJumpTable(tableIndex); 904 void* result = jumpTable.ctiDefault.executableAddress(); 905 906 if (key.isString()) { 907 StringImpl* value = asString(key)->value(exec).impl(); 908 if (value->length() == 1) 909 result = jumpTable.ctiForValue((*value)[0]).executableAddress(); 910 } 911 912 return reinterpret_cast<char*>(result); 913 } 914 915 char* JIT_OPERATION operationSwitchImmWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex) 916 { 917 VM& vm = exec->vm(); 918 NativeCallFrameTracer tracer(&vm, exec); 919 JSValue key = JSValue::decode(encodedKey); 920 CodeBlock* codeBlock = exec->codeBlock(); 921 922 SimpleJumpTable& jumpTable = codeBlock->switchJumpTable(tableIndex); 923 void* result; 924 if (key.isInt32()) 925 result = jumpTable.ctiForValue(key.asInt32()).executableAddress(); 926 else if (key.isDouble() && key.asDouble() == static_cast<int32_t>(key.asDouble())) 927 result = jumpTable.ctiForValue(static_cast<int32_t>(key.asDouble())).executableAddress(); 928 else 929 result = jumpTable.ctiDefault.executableAddress(); 930 return reinterpret_cast<char*>(result); 931 } 932 933 char* JIT_OPERATION operationSwitchStringWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex) 934 { 935 VM& vm = exec->vm(); 936 NativeCallFrameTracer tracer(&vm, exec); 937 JSValue key = JSValue::decode(encodedKey); 938 CodeBlock* codeBlock = exec->codeBlock(); 939 940 void* result; 941 StringJumpTable& jumpTable = codeBlock->stringSwitchJumpTable(tableIndex); 942 943 if (key.isString()) { 944 StringImpl* value = asString(key)->value(exec).impl(); 945 result = jumpTable.ctiForValue(value).executableAddress(); 946 } else 947 result = jumpTable.ctiDefault.executableAddress(); 948 949 return reinterpret_cast<char*>(result); 950 } 951 952 EncodedJSValue JIT_OPERATION operationResolveScope(ExecState* exec, int32_t identifierIndex) 953 { 954 VM& vm = exec->vm(); 955 NativeCallFrameTracer tracer(&vm, exec); 956 const Identifier& ident = exec->codeBlock()->identifier(identifierIndex); 957 return JSValue::encode(JSScope::resolve(exec, exec->scope(), ident)); 958 } 959 960 EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState* exec, Instruction* bytecodePC) 961 { 962 VM& vm = exec->vm(); 963 NativeCallFrameTracer tracer(&vm, exec); 964 CodeBlock* codeBlock = exec->codeBlock(); 965 Instruction* pc = bytecodePC; 966 967 const Identifier& ident = codeBlock->identifier(pc[3].u.operand); 968 JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[2].u.operand).jsValue()); 969 ResolveModeAndType modeAndType(pc[4].u.operand); 970 971 PropertySlot slot(scope); 972 if (!scope->getPropertySlot(exec, ident, slot)) { 973 if (modeAndType.mode() == ThrowIfNotFound) 974 vm.throwException(exec, createUndefinedVariableError(exec, ident)); 975 return JSValue::encode(jsUndefined()); 976 } 977 978 // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time. 979 if (slot.isCacheableValue() && slot.slotBase() == scope && scope->structure()->propertyAccessesAreCacheable()) { 980 if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) { 981 ConcurrentJITLocker locker(codeBlock->m_lock); 982 pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure()); 983 pc[6].u.operand = slot.cachedOffset(); 984 } 985 } 986 987 return JSValue::encode(slot.getValue(exec, ident)); 988 } 989 990 void JIT_OPERATION operationPutToScope(ExecState* exec, Instruction* bytecodePC) 991 { 992 VM& vm = exec->vm(); 993 NativeCallFrameTracer tracer(&vm, exec); 994 Instruction* pc = bytecodePC; 995 996 CodeBlock* codeBlock = exec->codeBlock(); 997 const Identifier& ident = codeBlock->identifier(pc[2].u.operand); 998 JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[1].u.operand).jsValue()); 999 JSValue value = exec->r(pc[3].u.operand).jsValue(); 1000 ResolveModeAndType modeAndType = ResolveModeAndType(pc[4].u.operand); 1001 1002 if (modeAndType.mode() == ThrowIfNotFound && !scope->hasProperty(exec, ident)) { 1003 exec->vm().throwException(exec, createUndefinedVariableError(exec, ident)); 1004 return; 1005 } 1006 1007 PutPropertySlot slot(codeBlock->isStrictMode()); 1008 scope->methodTable()->put(scope, exec, ident, value, slot); 1009 1010 if (exec->vm().exception()) 1011 return; 1012 1013 // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time. 1014 if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) { 1015 if (slot.isCacheable() && slot.base() == scope && scope->structure()->propertyAccessesAreCacheable()) { 1016 ConcurrentJITLocker locker(codeBlock->m_lock); 1017 pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure()); 1018 pc[6].u.operand = slot.cachedOffset(); 1019 } 1020 } 1021 } 1022 896 1023 JITHandlerEncoded JIT_OPERATION lookupExceptionHandler(ExecState* exec) 897 1024 { -
trunk/Source/JavaScriptCore/jit/JITOperations.h
r157411 r157439 62 62 O: JSObject* 63 63 P: pointer (char*) 64 Pc: Instruction* i.e. bytecode PC 64 65 R: Register 65 66 S: size_t … … 91 92 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPP)(ExecState*, void*, void*); 92 93 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPS)(ExecState*, void*, size_t); 94 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPc)(ExecState*, Instruction*); 93 95 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_ESS)(ExecState*, size_t, size_t); 94 96 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EZ)(ExecState*, int32_t); … … 131 133 typedef void JIT_OPERATION (*V_JITOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue); 132 134 typedef void JIT_OPERATION (*V_JITOperation_EJPP)(ExecState*, EncodedJSValue, void*, void*); 135 typedef void JIT_OPERATION (*V_JITOperation_EPc)(ExecState*, Instruction*); 133 136 typedef void JIT_OPERATION (*V_JITOperation_EPZJ)(ExecState*, void*, int32_t, EncodedJSValue); 134 137 typedef void JIT_OPERATION (*V_JITOperation_W)(WatchpointSet*); … … 251 254 EncodedJSValue JIT_OPERATION operationToObject(ExecState*, EncodedJSValue) WTF_INTERNAL; 252 255 256 char* JIT_OPERATION operationSwitchCharWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL; 257 char* JIT_OPERATION operationSwitchImmWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL; 258 char* JIT_OPERATION operationSwitchStringWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL; 259 EncodedJSValue JIT_OPERATION operationResolveScope(ExecState*, int32_t identifierIndex) WTF_INTERNAL; 260 EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState*, Instruction* bytecodePC) WTF_INTERNAL; 261 void JIT_OPERATION operationPutToScope(ExecState*, Instruction* bytecodePC) WTF_INTERNAL; 262 253 263 } // extern "C" 254 264 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r157411 r157439 1177 1177 1178 1178 linkSlowCase(iter); 1179 1180 JITStubCall stubCall(this, cti_op_resolve_scope); 1181 stubCall.addArgument(TrustedImmPtr(currentInstruction)); 1182 stubCall.call(dst); 1179 int32_t indentifierIndex = currentInstruction[2].u.operand; 1180 callOperation(operationResolveScope, dst, indentifierIndex); 1183 1181 } 1184 1182 … … 1250 1248 1251 1249 linkSlowCase(iter); 1252 1253 JITStubCall stubCall(this, cti_op_get_from_scope); 1254 stubCall.addArgument(TrustedImmPtr(currentInstruction)); 1255 stubCall.call(dst); 1250 callOperation(operationGetFromScope, dst, currentInstruction); 1256 1251 emitValueProfilingSite(regT4); 1257 1252 } … … 1318 1313 1319 1314 linkSlowCase(iter); 1320 1321 JITStubCall stubCall(this, cti_op_put_to_scope); 1322 stubCall.addArgument(TrustedImmPtr(currentInstruction)); 1323 stubCall.call(); 1315 callOperation(operationPutToScope, currentInstruction); 1324 1316 } 1325 1317 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r157427 r157439 1201 1201 1202 1202 linkSlowCase(iter); 1203 1204 JITStubCall stubCall(this, cti_op_resolve_scope); 1205 stubCall.addArgument(TrustedImmPtr(currentInstruction)); 1206 stubCall.call(dst); 1203 int32_t indentifierIndex = currentInstruction[2].u.operand; 1204 callOperation(operationResolveScope, dst, indentifierIndex); 1207 1205 } 1208 1206 … … 1277 1275 1278 1276 linkSlowCase(iter); 1279 1280 JITStubCall stubCall(this, cti_op_get_from_scope); 1281 stubCall.addArgument(TrustedImmPtr(currentInstruction)); 1282 stubCall.call(dst); 1277 callOperation(operationGetFromScope, dst, currentInstruction); 1283 1278 emitValueProfilingSite(regT4); 1284 1279 } … … 1348 1343 1349 1344 linkSlowCase(iter); 1350 1351 JITStubCall stubCall(this, cti_op_put_to_scope); 1352 stubCall.addArgument(TrustedImmPtr(currentInstruction)); 1353 stubCall.call(); 1345 callOperation(operationPutToScope, currentInstruction); 1354 1346 } 1355 1347 -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r157424 r157439 1186 1186 } 1187 1187 1188 DEFINE_STUB_FUNCTION(void*, op_switch_imm)1189 {1190 STUB_INIT_STACK_FRAME(stackFrame);1191 1192 JSValue scrutinee = stackFrame.args[0].jsValue();1193 unsigned tableIndex = stackFrame.args[1].int32();1194 CallFrame* callFrame = stackFrame.callFrame;1195 CodeBlock* codeBlock = callFrame->codeBlock();1196 1197 if (scrutinee.isInt32())1198 return codeBlock->switchJumpTable(tableIndex).ctiForValue(scrutinee.asInt32()).executableAddress();1199 if (scrutinee.isDouble() && scrutinee.asDouble() == static_cast<int32_t>(scrutinee.asDouble()))1200 return codeBlock->switchJumpTable(tableIndex).ctiForValue(static_cast<int32_t>(scrutinee.asDouble())).executableAddress();1201 return codeBlock->switchJumpTable(tableIndex).ctiDefault.executableAddress();1202 }1203 1204 DEFINE_STUB_FUNCTION(void*, op_switch_char)1205 {1206 STUB_INIT_STACK_FRAME(stackFrame);1207 1208 JSValue scrutinee = stackFrame.args[0].jsValue();1209 unsigned tableIndex = stackFrame.args[1].int32();1210 CallFrame* callFrame = stackFrame.callFrame;1211 CodeBlock* codeBlock = callFrame->codeBlock();1212 1213 void* result = codeBlock->switchJumpTable(tableIndex).ctiDefault.executableAddress();1214 1215 if (scrutinee.isString()) {1216 StringImpl* value = asString(scrutinee)->value(callFrame).impl();1217 if (value->length() == 1)1218 result = codeBlock->switchJumpTable(tableIndex).ctiForValue((*value)[0]).executableAddress();1219 }1220 1221 CHECK_FOR_EXCEPTION_AT_END();1222 return result;1223 }1224 1225 DEFINE_STUB_FUNCTION(void*, op_switch_string)1226 {1227 STUB_INIT_STACK_FRAME(stackFrame);1228 1229 JSValue scrutinee = stackFrame.args[0].jsValue();1230 unsigned tableIndex = stackFrame.args[1].int32();1231 CallFrame* callFrame = stackFrame.callFrame;1232 CodeBlock* codeBlock = callFrame->codeBlock();1233 1234 void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault.executableAddress();1235 1236 if (scrutinee.isString()) {1237 StringImpl* value = asString(scrutinee)->value(callFrame).impl();1238 result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value).executableAddress();1239 }1240 1241 CHECK_FOR_EXCEPTION_AT_END();1242 return result;1243 }1244 1245 1188 DEFINE_STUB_FUNCTION(void, op_put_getter_setter) 1246 1189 { … … 1328 1271 #endif 1329 1272 1330 DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_scope)1331 {1332 STUB_INIT_STACK_FRAME(stackFrame);1333 ExecState* exec = stackFrame.callFrame;1334 Instruction* pc = stackFrame.args[0].pc();1335 1336 const Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);1337 return JSValue::encode(JSScope::resolve(exec, exec->scope(), ident));1338 }1339 1340 DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_from_scope)1341 {1342 STUB_INIT_STACK_FRAME(stackFrame);1343 ExecState* exec = stackFrame.callFrame;1344 Instruction* pc = stackFrame.args[0].pc();1345 1346 const Identifier& ident = exec->codeBlock()->identifier(pc[3].u.operand);1347 JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[2].u.operand).jsValue());1348 ResolveModeAndType modeAndType(pc[4].u.operand);1349 1350 PropertySlot slot(scope);1351 if (!scope->getPropertySlot(exec, ident, slot)) {1352 if (modeAndType.mode() == ThrowIfNotFound) {1353 exec->vm().throwException(exec, createUndefinedVariableError(exec, ident));1354 VM_THROW_EXCEPTION();1355 }1356 return JSValue::encode(jsUndefined());1357 }1358 1359 // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.1360 if (slot.isCacheableValue() && slot.slotBase() == scope && scope->structure()->propertyAccessesAreCacheable()) {1361 if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) {1362 CodeBlock* codeBlock = exec->codeBlock();1363 ConcurrentJITLocker locker(codeBlock->m_lock);1364 pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure());1365 pc[6].u.operand = slot.cachedOffset();1366 }1367 }1368 1369 return JSValue::encode(slot.getValue(exec, ident));1370 }1371 1372 DEFINE_STUB_FUNCTION(void, op_put_to_scope)1373 {1374 STUB_INIT_STACK_FRAME(stackFrame);1375 ExecState* exec = stackFrame.callFrame;1376 Instruction* pc = stackFrame.args[0].pc();1377 1378 CodeBlock* codeBlock = exec->codeBlock();1379 const Identifier& ident = codeBlock->identifier(pc[2].u.operand);1380 JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[1].u.operand).jsValue());1381 JSValue value = exec->r(pc[3].u.operand).jsValue();1382 ResolveModeAndType modeAndType = ResolveModeAndType(pc[4].u.operand);1383 1384 if (modeAndType.mode() == ThrowIfNotFound && !scope->hasProperty(exec, ident)) {1385 exec->vm().throwException(exec, createUndefinedVariableError(exec, ident));1386 VM_THROW_EXCEPTION_AT_END();1387 return;1388 }1389 1390 PutPropertySlot slot(codeBlock->isStrictMode());1391 scope->methodTable()->put(scope, exec, ident, value, slot);1392 1393 if (exec->vm().exception()) {1394 VM_THROW_EXCEPTION_AT_END();1395 return;1396 }1397 1398 // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.1399 if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) {1400 if (slot.isCacheable() && slot.base() == scope && scope->structure()->propertyAccessesAreCacheable()) {1401 ConcurrentJITLocker locker(codeBlock->m_lock);1402 pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure());1403 pc[6].u.operand = slot.cachedOffset();1404 }1405 }1406 }1407 1408 1273 } // namespace JSC 1409 1274 -
trunk/Source/JavaScriptCore/jit/JITStubs.h
r157411 r157439 361 361 void JIT_STUB cti_optimize(STUB_ARGS_DECLARATION) WTF_INTERNAL; 362 362 #endif 363 void* JIT_STUB cti_op_switch_char(STUB_ARGS_DECLARATION) WTF_INTERNAL;364 void* JIT_STUB cti_op_switch_imm(STUB_ARGS_DECLARATION) WTF_INTERNAL;365 void* JIT_STUB cti_op_switch_string(STUB_ARGS_DECLARATION) WTF_INTERNAL;366 363 void* JIT_STUB cti_op_throw(STUB_ARGS_DECLARATION) WTF_INTERNAL; 367 364 void* JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION) REFERENCED_FROM_ASM WTF_INTERNAL; 368 369 EncodedJSValue JIT_STUB cti_op_resolve_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;370 EncodedJSValue JIT_STUB cti_op_get_from_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;371 void JIT_STUB cti_op_put_to_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;372 365 373 366 #if USE(JSVALUE32_64)
Note:
See TracChangeset
for help on using the changeset viewer.