Changeset 157404 in webkit
- Timestamp:
- Oct 14, 2013, 9:42:22 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r157382 r157404 1 2013-10-13 Mark Lam <mark.lam@apple.com> 2 3 Transition misc cti_op_* JITStubs to JIT operations. 4 https://bugs.webkit.org/show_bug.cgi?id=122645. 5 6 Reviewed by Michael Saboff. 7 8 Stubs converted: 9 cti_op_check_has_instance 10 cti_op_create_arguments 11 cti_op_del_by_id 12 cti_op_instanceof 13 cti_to_object 14 cti_op_push_activation 15 cti_op_get_pnames 16 cti_op_load_varargs 17 18 * dfg/DFGOperations.cpp: 19 * dfg/DFGOperations.h: 20 * jit/CCallHelpers.h: 21 (JSC::CCallHelpers::setupArgumentsWithExecState): 22 * jit/JIT.h: 23 (JSC::JIT::emitStoreCell): 24 * jit/JITCall.cpp: 25 (JSC::JIT::compileLoadVarargs): 26 * jit/JITCall32_64.cpp: 27 (JSC::JIT::compileLoadVarargs): 28 * jit/JITInlines.h: 29 (JSC::JIT::callOperation): 30 * jit/JITOpcodes.cpp: 31 (JSC::JIT::emit_op_get_pnames): 32 (JSC::JIT::emit_op_create_activation): 33 (JSC::JIT::emit_op_create_arguments): 34 (JSC::JIT::emitSlow_op_check_has_instance): 35 (JSC::JIT::emitSlow_op_instanceof): 36 (JSC::JIT::emitSlow_op_get_argument_by_val): 37 * jit/JITOpcodes32_64.cpp: 38 (JSC::JIT::emitSlow_op_check_has_instance): 39 (JSC::JIT::emitSlow_op_instanceof): 40 (JSC::JIT::emit_op_get_pnames): 41 (JSC::JIT::emit_op_create_activation): 42 (JSC::JIT::emit_op_create_arguments): 43 (JSC::JIT::emitSlow_op_get_argument_by_val): 44 * jit/JITOperations.cpp: 45 * jit/JITOperations.h: 46 * jit/JITPropertyAccess.cpp: 47 (JSC::JIT::emit_op_del_by_id): 48 * jit/JITPropertyAccess32_64.cpp: 49 (JSC::JIT::emit_op_del_by_id): 50 * jit/JITStubs.cpp: 51 * jit/JITStubs.h: 52 1 53 2013-10-13 Filip Pizlo <fpizlo@apple.com> 2 54 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r157313 r157404 681 681 } 682 682 683 JSCell* JIT_OPERATION operationCreateActivation(ExecState* exec, int32_t offset)684 {685 VM& vm = exec->vm();686 NativeCallFrameTracer tracer(&vm, exec);687 JSActivation* activation = JSActivation::create(vm, exec, exec->registers() + offset, exec->codeBlock());688 exec->setScope(activation);689 return activation;690 }691 692 JSCell* JIT_OPERATION operationCreateArguments(ExecState* exec)693 {694 VM& vm = exec->vm();695 NativeCallFrameTracer tracer(&vm, exec);696 // NB: This needs to be exceedingly careful with top call frame tracking, since it697 // may be called from OSR exit, while the state of the call stack is bizarre.698 Arguments* result = Arguments::create(vm, exec);699 ASSERT(!vm.exception());700 return result;701 }702 703 683 JSCell* JIT_OPERATION operationCreateInlinedArguments( 704 684 ExecState* exec, InlineCallFrame* inlineCallFrame) -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r157313 r157404 91 91 size_t JIT_OPERATION operationCompareStrictEqCell(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; 92 92 size_t JIT_OPERATION operationCompareStrictEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL; 93 JSCell* JIT_OPERATION operationCreateActivation(ExecState*, int32_t offset) WTF_INTERNAL;94 JSCell* JIT_OPERATION operationCreateArguments(ExecState*) WTF_INTERNAL;95 93 JSCell* JIT_OPERATION operationCreateInlinedArguments(ExecState*, InlineCallFrame*) WTF_INTERNAL; 96 94 void JIT_OPERATION operationTearOffArguments(ExecState*, JSCell*, JSCell*) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/jit/CCallHelpers.h
r157339 r157404 374 374 } 375 375 376 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5) 377 { 378 resetCallArguments(); 379 addCallArgument(GPRInfo::callFrameRegister); 380 addCallArgument(arg1); 381 addCallArgument(arg2); 382 addCallArgument(arg3); 383 addCallArgument(arg4); 384 addCallArgument(arg5); 385 } 386 376 387 ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) 377 388 { … … 950 961 ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3) 951 962 { 952 move(arg2, GPRInfo::argumentGPR2); 963 move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1. 953 964 move(arg1, GPRInfo::argumentGPR1); 954 965 move(arg3, GPRInfo::argumentGPR3); … … 1036 1047 1037 1048 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) 1049 { 1050 poke(arg5, POKE_ARGUMENT_OFFSET + 1); 1051 poke(arg4, POKE_ARGUMENT_OFFSET); 1052 setupArgumentsWithExecState(arg1, arg2, arg3); 1053 } 1054 1055 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5) 1038 1056 { 1039 1057 poke(arg5, POKE_ARGUMENT_OFFSET + 1); -
trunk/Source/JavaScriptCore/jit/JIT.h
r157313 r157404 57 57 class JIT; 58 58 class JSPropertyNameIterator; 59 class Identifier; 59 60 class Interpreter; 60 61 class JSScope; … … 616 617 void emitPutVirtualRegister(VirtualRegister dst, RegisterID from = regT0); 617 618 void emitStoreCell(int dst, RegisterID payload, bool /* only used in JSValue32_64 */ = false) 619 { 620 emitPutVirtualRegister(dst, payload); 621 } 622 void emitStoreCell(VirtualRegister dst, RegisterID payload) 618 623 { 619 624 emitPutVirtualRegister(dst, payload); … … 868 873 MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&); 869 874 MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int); 875 MacroAssembler::Call callOperation(C_JITOperation_E); 876 MacroAssembler::Call callOperation(C_JITOperation_EO, GPRReg); 870 877 MacroAssembler::Call callOperation(C_JITOperation_ESt, Structure*); 878 MacroAssembler::Call callOperation(C_JITOperation_EZ, int32_t); 879 MacroAssembler::Call callOperation(F_JITOperation_EJJZ, GPRReg, GPRReg, int32_t); 871 880 MacroAssembler::Call callOperation(J_JITOperation_E, int); 872 #if USE(JSVALUE64)873 881 MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg); 874 #else875 MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg);876 #endif877 882 MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, GPRReg, int32_t); 878 883 MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, const JSValue*, int32_t); 879 884 MacroAssembler::Call callOperation(J_JITOperation_EC, int, JSCell*); 885 MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg); 886 MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, const Identifier*); 887 MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg); 880 888 MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*); 881 889 MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID); … … 887 895 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E); 888 896 #if USE(JSVALUE32_64) 897 MacroAssembler::Call callOperation(F_JITOperation_EJJZ, GPRReg, GPRReg, GPRReg, GPRReg, int32_t); 898 MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg); 899 MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg, GPRReg); 900 MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, GPRReg, const Identifier*); 901 MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg); 889 902 MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID); 890 903 MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID); -
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r157164 r157404 120 120 slowCase.link(this); 121 121 122 JITStubCall stubCall(this, cti_op_load_varargs); 123 stubCall.addArgument(thisValue, regT0); 124 stubCall.addArgument(arguments, regT0); 125 stubCall.addArgument(Imm32(firstFreeRegister)); 126 stubCall.call(regT1); 122 emitGetVirtualRegister(thisValue, regT0); 123 emitGetVirtualRegister(arguments, regT1); 124 callOperation(operationLoadVarargs, regT0, regT1, firstFreeRegister); 125 move(returnValueRegister, regT1); 127 126 128 127 if (canOptimize) -
trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp
r157164 r157404 191 191 slowCase.link(this); 192 192 193 JITStubCall stubCall(this, cti_op_load_varargs); 194 stubCall.addArgument(thisValue); 195 stubCall.addArgument(arguments); 196 stubCall.addArgument(Imm32(firstFreeRegister)); 197 stubCall.call(regT3); 193 emitLoad(thisValue, regT1, regT0); 194 emitLoad(arguments, regT3, regT2); 195 callOperation(operationLoadVarargs, regT1, regT0, regT3, regT2, firstFreeRegister); 196 move(returnValueRegister, regT3); 198 197 199 198 if (canOptimize) -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r157313 r157404 232 232 } 233 233 234 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_E operation) 235 { 236 setupArgumentsExecState(); 237 return appendCallWithExceptionCheck(operation); 238 } 239 240 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_EO operation, GPRReg arg) 241 { 242 setupArgumentsWithExecState(arg); 243 return appendCallWithExceptionCheck(operation); 244 } 245 234 246 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_ESt operation, Structure* structure) 235 247 { … … 238 250 } 239 251 252 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_EZ operation, int32_t arg) 253 { 254 setupArgumentsWithExecState(TrustedImm32(arg)); 255 return appendCallWithExceptionCheck(operation); 256 } 257 258 259 #if USE(JSVALUE64) 260 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EJJZ operation, GPRReg arg1, GPRReg arg2, int32_t arg3) 261 { 262 setupArgumentsWithExecState(arg1, arg2, TrustedImm32(arg3)); 263 return appendCallWithExceptionCheck(operation); 264 } 265 #endif 266 240 267 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_E operation, int dst) 241 268 { … … 244 271 } 245 272 273 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2) 274 { 275 setupArgumentsWithExecState(TrustedImmPtr(arg1), arg2); 276 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 277 } 278 246 279 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJcpZ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2, int32_t arg3) 247 280 { … … 259 292 { 260 293 setupArgumentsWithExecState(TrustedImmPtr(cell)); 294 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 295 } 296 297 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJ operation, int dst, GPRReg arg1) 298 { 299 setupArgumentsWithExecState(arg1); 300 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 301 } 302 303 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJIdc operation, int dst, GPRReg arg1, const Identifier* arg2) 304 { 305 setupArgumentsWithExecState(arg1, TrustedImmPtr(arg2)); 306 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 307 } 308 309 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJJ operation, int dst, GPRReg arg1, GPRReg arg2) 310 { 311 setupArgumentsWithExecState(arg1, arg2); 261 312 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 262 313 } … … 328 379 #endif 329 380 381 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EJJZ operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, int32_t arg3) 382 { 383 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag, TrustedImm32(arg3)); 384 return appendCallWithExceptionCheck(operation); 385 } 386 330 387 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2Tag, GPRReg arg2Payload) 331 388 { 332 389 setupArgumentsWithExecState(TrustedImmPtr(arg1), EABI_32BIT_DUMMY_ARG arg2Payload, arg2Tag); 390 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 391 } 392 393 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJ operation, int dst, GPRReg arg1Tag, GPRReg arg1Payload) 394 { 395 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag); 396 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 397 } 398 399 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJIdc operation, int dst, GPRReg arg1Tag, GPRReg arg1Payload, const Identifier* arg2) 400 { 401 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(arg2)); 402 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 403 } 404 405 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJJ operation, int dst, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload) 406 { 407 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag); 333 408 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 334 409 } … … 348 423 #undef EABI_32BIT_DUMMY_ARG 349 424 #undef SH4_32BIT_DUMMY_ARG 350 351 #else // USE(JSVALUE32_64)352 353 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2)354 {355 setupArgumentsWithExecState(TrustedImmPtr(arg1), arg2);356 return appendCallWithExceptionCheckSetJSValueResult(operation, dst);357 }358 425 359 426 #endif // USE(JSVALUE32_64) -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r157313 r157404 518 518 // this call doesn't seem to be hot. 519 519 Label isObject(this); 520 JITStubCall getPnamesStubCall(this, cti_op_get_pnames); 521 getPnamesStubCall.addArgument(regT0); 522 getPnamesStubCall.call(dst); 520 callOperation(operationGetPNames, regT0); 521 emitStoreCell(dst, returnValueRegister); 523 522 load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3); 524 523 store64(tagTypeNumberRegister, addressFor(i)); … … 531 530 and32(TrustedImm32(~TagBitUndefined), regT1); 532 531 addJump(branch32(Equal, regT1, TrustedImm32(ValueNull)), breakTarget); 533 534 JITStubCall toObjectStubCall(this, cti_to_object); 535 toObjectStubCall.addArgument(regT0); 536 toObjectStubCall.call(base); 532 callOperation(operationToObject, base, regT0); 537 533 jump().linkTo(isObject, this); 538 534 … … 841 837 842 838 Jump activationCreated = branchTest64(NonZero, Address(callFrameRegister, sizeof(Register) * dst)); 843 JITStubCall(this, cti_op_push_activation).call(dst); 839 callOperation(operationCreateActivation, 0); 840 emitStoreCell(dst, returnValueRegister); 844 841 activationCreated.link(this); 845 842 } … … 850 847 851 848 Jump argsCreated = branchTest64(NonZero, Address(callFrameRegister, sizeof(Register) * dst)); 852 JITStubCall(this, cti_op_create_arguments).call(); 853 emitPutVirtualRegister(dst); 854 emitPutVirtualRegister(unmodifiedArgumentsRegister(VirtualRegister(dst))); 849 850 callOperation(operationCreateArguments); 851 emitStoreCell(dst, returnValueRegister); 852 emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(dst)), returnValueRegister); 853 855 854 argsCreated.link(this); 856 855 } … … 1046 1045 linkSlowCaseIfNotJSCell(iter, baseVal); 1047 1046 linkSlowCase(iter); 1048 JITStubCall stubCall(this, cti_op_check_has_instance); 1049 stubCall.addArgument(value, regT2); 1050 stubCall.addArgument(baseVal, regT2); 1051 stubCall.call(dst); 1047 emitGetVirtualRegister(value, regT0); 1048 emitGetVirtualRegister(baseVal, regT1); 1049 callOperation(operationCheckHasInstance, dst, regT0, regT1); 1052 1050 1053 1051 emitJumpSlowToHot(jump(), currentInstruction[4].u.operand); … … 1063 1061 linkSlowCaseIfNotJSCell(iter, proto); 1064 1062 linkSlowCase(iter); 1065 JITStubCall stubCall(this, cti_op_instanceof); 1066 stubCall.addArgument(value, regT2); 1067 stubCall.addArgument(proto, regT2); 1068 stubCall.call(dst); 1063 emitGetVirtualRegister(value, regT0); 1064 emitGetVirtualRegister(proto, regT1); 1065 callOperation(operationInstanceOf, dst, regT0, regT1); 1069 1066 } 1070 1067 … … 1133 1130 linkSlowCase(iter); 1134 1131 linkSlowCase(iter); 1135 JITStubCall(this, cti_op_create_arguments).call();1136 emit PutVirtualRegister(arguments);1137 emit PutVirtualRegister(unmodifiedArgumentsRegister(VirtualRegister(arguments)));1132 callOperation(operationCreateArguments); 1133 emitStoreCell(arguments, returnValueRegister); 1134 emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(arguments)), returnValueRegister); 1138 1135 1139 1136 skipArgumentsCreation.link(this); -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r157313 r157404 297 297 linkSlowCase(iter); 298 298 299 JITStubCall stubCall(this, cti_op_check_has_instance); 300 stubCall.addArgument(value); 301 stubCall.addArgument(baseVal); 302 stubCall.call(dst); 299 emitLoad(value, regT1, regT0); 300 emitLoad(baseVal, regT3, regT2); 301 callOperation(operationCheckHasInstance, dst, regT1, regT0, regT3, regT2); 303 302 304 303 emitJumpSlowToHot(jump(), currentInstruction[4].u.operand); … … 315 314 linkSlowCase(iter); 316 315 317 JITStubCall stubCall(this, cti_op_instanceof); 318 stubCall.addArgument(value); 319 stubCall.addArgument(proto); 320 stubCall.call(dst); 316 emitLoad(value, regT1, regT0); 317 emitLoad(proto, regT3, regT2); 318 callOperation(operationInstanceOf, dst, regT1, regT0, regT3, regT2); 321 319 } 322 320 … … 850 848 // this call doesn't seem to be hot. 851 849 Label isObject(this); 852 JITStubCall getPnamesStubCall(this, cti_op_get_pnames); 853 getPnamesStubCall.addArgument(regT0); 854 getPnamesStubCall.call(dst); 850 callOperation(operationGetPNames, regT0); 851 emitStoreCell(dst, returnValueRegister); 855 852 load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3); 856 853 store32(TrustedImm32(Int32Tag), intTagFor(i)); … … 863 860 addJump(branch32(Equal, regT1, TrustedImm32(JSValue::NullTag)), breakTarget); 864 861 addJump(branch32(Equal, regT1, TrustedImm32(JSValue::UndefinedTag)), breakTarget); 865 JITStubCall toObjectStubCall(this, cti_to_object); 866 toObjectStubCall.addArgument(regT1, regT0); 867 toObjectStubCall.call(base); 862 callOperation(operationToObject, base, regT1, regT0); 868 863 jump().linkTo(isObject, this); 869 864 … … 1090 1085 1091 1086 Jump activationCreated = branch32(NotEqual, tagFor(activation), TrustedImm32(JSValue::EmptyValueTag)); 1092 JITStubCall(this, cti_op_push_activation).call(activation); 1087 callOperation(operationCreateActivation, 0); 1088 emitStoreCell(activation, returnValueRegister); 1093 1089 activationCreated.link(this); 1094 1090 } … … 1099 1095 1100 1096 Jump argsCreated = branch32(NotEqual, tagFor(dst), TrustedImm32(JSValue::EmptyValueTag)); 1101 1102 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_create_arguments); 1103 slowPathCall.call(); 1104 1097 callOperation(operationCreateArguments); 1098 emitStoreCell(dst, returnValueRegister); 1099 emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(dst)).offset(), returnValueRegister); 1105 1100 argsCreated.link(this); 1106 1101 } … … 1257 1252 linkSlowCase(iter); 1258 1253 1259 JITStubCall(this, cti_op_create_arguments).call();1260 emitStore (arguments, regT1, regT0);1261 emitStore (unmodifiedArgumentsRegister(VirtualRegister(arguments)).offset(), regT1, regT0);1254 callOperation(operationCreateArguments); 1255 emitStoreCell(arguments, returnValueRegister); 1256 emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(arguments)).offset(), returnValueRegister); 1262 1257 1263 1258 skipArgumentsCreation.link(this); -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r157313 r157404 28 28 #include "JITOperations.h" 29 29 30 #include "Arguments.h" 30 31 #include "ArrayConstructor.h" 31 32 #include "CommonSlowPaths.h" … … 35 36 #include "JITOperationWrappers.h" 36 37 #include "JSGlobalObjectFunctions.h" 38 #include "JSPropertyNameIterator.h" 37 39 #include "ObjectConstructor.h" 38 40 #include "Operations.h" … … 797 799 } 798 800 801 EncodedJSValue JIT_OPERATION operationCheckHasInstance(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBaseVal) 802 { 803 VM* vm = &exec->vm(); 804 NativeCallFrameTracer tracer(vm, exec); 805 806 JSValue value = JSValue::decode(encodedValue); 807 JSValue baseVal = JSValue::decode(encodedBaseVal); 808 809 if (baseVal.isObject()) { 810 JSObject* baseObject = asObject(baseVal); 811 ASSERT(!baseObject->structure()->typeInfo().implementsDefaultHasInstance()); 812 if (baseObject->structure()->typeInfo().implementsHasInstance()) { 813 bool result = baseObject->methodTable()->customHasInstance(baseObject, exec, value); 814 return JSValue::encode(jsBoolean(result)); 815 } 816 } 817 818 vm->throwException(exec, createInvalidParameterError(exec, "instanceof", baseVal)); 819 return JSValue::encode(JSValue()); 820 } 821 822 JSCell* JIT_OPERATION operationCreateActivation(ExecState* exec, int32_t offset) 823 { 824 VM& vm = exec->vm(); 825 NativeCallFrameTracer tracer(&vm, exec); 826 JSActivation* activation = JSActivation::create(vm, exec, exec->registers() + offset, exec->codeBlock()); 827 exec->setScope(activation); 828 return activation; 829 } 830 831 JSCell* JIT_OPERATION operationCreateArguments(ExecState* exec) 832 { 833 VM& vm = exec->vm(); 834 NativeCallFrameTracer tracer(&vm, exec); 835 // NB: This needs to be exceedingly careful with top call frame tracking, since it 836 // may be called from OSR exit, while the state of the call stack is bizarre. 837 Arguments* result = Arguments::create(vm, exec); 838 ASSERT(!vm.exception()); 839 return result; 840 } 841 842 EncodedJSValue JIT_OPERATION operationDeleteById(ExecState* exec, EncodedJSValue encodedBase, const Identifier* identifier) 843 { 844 VM& vm = exec->vm(); 845 NativeCallFrameTracer tracer(&vm, exec); 846 847 JSObject* baseObj = JSValue::decode(encodedBase).toObject(exec); 848 bool couldDelete = baseObj->methodTable()->deleteProperty(baseObj, exec, *identifier); 849 JSValue result = jsBoolean(couldDelete); 850 if (!couldDelete && exec->codeBlock()->isStrictMode()) 851 vm.throwException(exec, createTypeError(exec, "Unable to delete property.")); 852 return JSValue::encode(result); 853 } 854 855 JSCell* JIT_OPERATION operationGetPNames(ExecState* exec, JSObject* obj) 856 { 857 VM& vm = exec->vm(); 858 NativeCallFrameTracer tracer(&vm, exec); 859 860 Structure* structure = obj->structure(); 861 JSPropertyNameIterator* jsPropertyNameIterator = structure->enumerationCache(); 862 if (!jsPropertyNameIterator || jsPropertyNameIterator->cachedPrototypeChain() != structure->prototypeChain(exec)) 863 jsPropertyNameIterator = JSPropertyNameIterator::create(exec, obj); 864 return jsPropertyNameIterator; 865 } 866 867 EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedProto) 868 { 869 VM& vm = exec->vm(); 870 NativeCallFrameTracer tracer(&vm, exec); 871 JSValue value = JSValue::decode(encodedValue); 872 JSValue proto = JSValue::decode(encodedProto); 873 874 ASSERT(!value.isObject() || !proto.isObject()); 875 876 bool result = JSObject::defaultHasInstance(exec, value, proto); 877 return JSValue::encode(jsBoolean(result)); 878 } 879 880 CallFrame* JIT_OPERATION operationLoadVarargs(ExecState* exec, EncodedJSValue encodedThis, EncodedJSValue encodedArguments, int32_t firstFreeRegister) 881 { 882 VM& vm = exec->vm(); 883 NativeCallFrameTracer tracer(&vm, exec); 884 JSStack* stack = &exec->interpreter()->stack(); 885 JSValue thisValue = JSValue::decode(encodedThis); 886 JSValue arguments = JSValue::decode(encodedArguments); 887 CallFrame* newCallFrame = loadVarargs(exec, stack, thisValue, arguments, firstFreeRegister); 888 return newCallFrame; 889 } 890 891 EncodedJSValue JIT_OPERATION operationToObject(ExecState* exec, EncodedJSValue value) 892 { 893 VM& vm = exec->vm(); 894 NativeCallFrameTracer tracer(&vm, exec); 895 return JSValue::encode(JSValue::decode(value).toObject(exec)); 896 } 897 799 898 JITHandlerEncoded JIT_OPERATION lookupExceptionHandler(ExecState* exec) 800 899 { -
trunk/Source/JavaScriptCore/jit/JITOperations.h
r157313 r157404 53 53 D: double 54 54 E: ExecState* 55 F: CallFrame* 55 56 I: StringImpl* 56 57 Icf: InlineCalLFrame* 58 Idc: const Identifier* 57 59 J: EncodedJSValue 58 60 Jcp: const JSValue* 59 61 Jss: JSString* 60 62 O: JSObject* 61 P: pointer ( void*)63 P: pointer (char*) 62 64 R: Register 63 65 S: size_t … … 67 69 Z: int32_t 68 70 */ 71 typedef CallFrame* JIT_OPERATION (*F_JITOperation_EJJZ)(ExecState*, EncodedJSValue, EncodedJSValue, int32_t); 69 72 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_E)(ExecState*); 70 73 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EA)(ExecState*, JSArray*); 71 74 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAZ)(ExecState*, JSArray*, int32_t); 75 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJ)(ExecState*, ArrayAllocationProfile*, EncodedJSValue); 76 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJcpZ)(ExecState*, ArrayAllocationProfile*, const JSValue*, int32_t); 72 77 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EC)(ExecState*, JSCell*); 73 78 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_ECC)(ExecState*, JSCell*, JSCell*); … … 79 84 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJA)(ExecState*, EncodedJSValue, JSArray*); 80 85 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJI)(ExecState*, EncodedJSValue, StringImpl*); 86 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJIdc)(ExecState*, EncodedJSValue, const Identifier*); 81 87 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue); 82 88 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJssZ)(ExecState*, JSString*, int32_t); 83 89 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJP)(ExecState*, EncodedJSValue, void*); 84 90 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EP)(ExecState*, void*); 85 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJ)(ExecState*, ArrayAllocationProfile*, EncodedJSValue);86 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJcpZ)(ExecState*, ArrayAllocationProfile*, const JSValue*, int32_t);87 91 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPP)(ExecState*, void*, void*); 88 92 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPS)(ExecState*, void*, size_t); … … 100 104 typedef JSCell* JIT_OPERATION (*C_JITOperation_EJssJss)(ExecState*, JSString*, JSString*); 101 105 typedef JSCell* JIT_OPERATION (*C_JITOperation_EJssJssJss)(ExecState*, JSString*, JSString*, JSString*); 106 typedef JSCell* JIT_OPERATION (*C_JITOperation_EO)(ExecState*, JSObject*); 102 107 typedef JSCell* JIT_OPERATION (*C_JITOperation_EOZ)(ExecState*, JSObject*, int32_t); 103 108 typedef JSCell* JIT_OPERATION (*C_JITOperation_ESt)(ExecState*, Structure*); … … 237 242 EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState*, void*) WTF_INTERNAL; 238 243 239 } 244 EncodedJSValue JIT_OPERATION operationCheckHasInstance(ExecState*, EncodedJSValue, EncodedJSValue baseVal) WTF_INTERNAL; 245 JSCell* JIT_OPERATION operationCreateActivation(ExecState*, int32_t offset) WTF_INTERNAL; 246 JSCell* JIT_OPERATION operationCreateArguments(ExecState*) WTF_INTERNAL; 247 EncodedJSValue JIT_OPERATION operationDeleteById(ExecState*, EncodedJSValue base, const Identifier*) WTF_INTERNAL; 248 JSCell* JIT_OPERATION operationGetPNames(ExecState*, JSObject*) WTF_INTERNAL; 249 EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState*, EncodedJSValue, EncodedJSValue proto) WTF_INTERNAL; 250 CallFrame* JIT_OPERATION operationLoadVarargs(ExecState*, EncodedJSValue thisValue, EncodedJSValue arguments, int32_t firstFreeRegister) WTF_INTERNAL; 251 EncodedJSValue JIT_OPERATION operationToObject(ExecState*, EncodedJSValue) WTF_INTERNAL; 252 253 } // extern "C" 240 254 241 255 } // namespace JSC -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r156184 r157404 509 509 void JIT::emit_op_del_by_id(Instruction* currentInstruction) 510 510 { 511 JITStubCall stubCall(this, cti_op_del_by_id); 512 stubCall.addArgument(currentInstruction[2].u.operand, regT2); 513 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand))); 514 stubCall.call(currentInstruction[1].u.operand); 511 int dst = currentInstruction[1].u.operand; 512 int base = currentInstruction[2].u.operand; 513 int property = currentInstruction[3].u.operand; 514 emitGetVirtualRegister(base, regT0); 515 callOperation(operationDeleteById, dst, regT0, &m_codeBlock->identifier(property)); 515 516 } 516 517 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r156511 r157404 86 86 int base = currentInstruction[2].u.operand; 87 87 int property = currentInstruction[3].u.operand; 88 89 JITStubCall stubCall(this, cti_op_del_by_id); 90 stubCall.addArgument(base); 91 stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(property))); 92 stubCall.call(dst); 88 emitLoad(base, regT1, regT0); 89 callOperation(operationDeleteById, dst, regT1, regT0, &m_codeBlock->identifier(property)); 93 90 } 94 91 -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r157313 r157404 842 842 } 843 843 844 DEFINE_STUB_FUNCTION(EncodedJSValue, op_check_has_instance)845 {846 STUB_INIT_STACK_FRAME(stackFrame);847 848 CallFrame* callFrame = stackFrame.callFrame;849 JSValue value = stackFrame.args[0].jsValue();850 JSValue baseVal = stackFrame.args[1].jsValue();851 852 if (baseVal.isObject()) {853 JSObject* baseObject = asObject(baseVal);854 ASSERT(!baseObject->structure()->typeInfo().implementsDefaultHasInstance());855 if (baseObject->structure()->typeInfo().implementsHasInstance()) {856 bool result = baseObject->methodTable()->customHasInstance(baseObject, callFrame, value);857 CHECK_FOR_EXCEPTION_AT_END();858 return JSValue::encode(jsBoolean(result));859 }860 }861 862 stackFrame.vm->throwException(callFrame, createInvalidParameterError(callFrame, "instanceof", baseVal));863 VM_THROW_EXCEPTION_AT_END();864 return JSValue::encode(JSValue());865 }866 867 844 #if ENABLE(DFG_JIT) 868 845 DEFINE_STUB_FUNCTION(void, optimize) … … 1101 1078 #endif // ENABLE(DFG_JIT) 1102 1079 1103 DEFINE_STUB_FUNCTION(EncodedJSValue, op_instanceof)1104 {1105 STUB_INIT_STACK_FRAME(stackFrame);1106 1107 CallFrame* callFrame = stackFrame.callFrame;1108 JSValue value = stackFrame.args[0].jsValue();1109 JSValue proto = stackFrame.args[1].jsValue();1110 1111 ASSERT(!value.isObject() || !proto.isObject());1112 1113 bool result = JSObject::defaultHasInstance(callFrame, value, proto);1114 CHECK_FOR_EXCEPTION_AT_END();1115 return JSValue::encode(jsBoolean(result));1116 }1117 1118 DEFINE_STUB_FUNCTION(EncodedJSValue, op_del_by_id)1119 {1120 STUB_INIT_STACK_FRAME(stackFrame);1121 1122 CallFrame* callFrame = stackFrame.callFrame;1123 1124 JSObject* baseObj = stackFrame.args[0].jsValue().toObject(callFrame);1125 1126 bool couldDelete = baseObj->methodTable()->deleteProperty(baseObj, callFrame, stackFrame.args[1].identifier());1127 JSValue result = jsBoolean(couldDelete);1128 if (!couldDelete && callFrame->codeBlock()->isStrictMode())1129 stackFrame.vm->throwException(stackFrame.callFrame, createTypeError(stackFrame.callFrame, "Unable to delete property."));1130 1131 CHECK_FOR_EXCEPTION_AT_END();1132 return JSValue::encode(result);1133 }1134 1135 DEFINE_STUB_FUNCTION(JSObject*, op_push_activation)1136 {1137 STUB_INIT_STACK_FRAME(stackFrame);1138 1139 JSActivation* activation = JSActivation::create(stackFrame.callFrame->vm(), stackFrame.callFrame, stackFrame.callFrame->codeBlock());1140 stackFrame.callFrame->setScope(activation);1141 return activation;1142 }1143 1144 DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_arguments)1145 {1146 STUB_INIT_STACK_FRAME(stackFrame);1147 1148 Arguments* arguments = Arguments::create(*stackFrame.vm, stackFrame.callFrame);1149 return JSValue::encode(JSValue(arguments));1150 }1151 1152 1080 DEFINE_STUB_FUNCTION(void, op_tear_off_activation) 1153 1081 { … … 1393 1321 } 1394 1322 1395 DEFINE_STUB_FUNCTION(void*, op_load_varargs)1396 {1397 STUB_INIT_STACK_FRAME(stackFrame);1398 1399 CallFrame* callFrame = stackFrame.callFrame;1400 JSStack* stack = stackFrame.stack;1401 JSValue thisValue = stackFrame.args[0].jsValue();1402 JSValue arguments = stackFrame.args[1].jsValue();1403 int firstFreeRegister = stackFrame.args[2].int32();1404 1405 CallFrame* newCallFrame = loadVarargs(callFrame, stack, thisValue, arguments, firstFreeRegister);1406 if (!newCallFrame)1407 VM_THROW_EXCEPTION();1408 return newCallFrame;1409 }1410 1411 1323 DEFINE_STUB_FUNCTION(void*, op_throw) 1412 1324 { … … 1416 1328 STUB_SET_RETURN_ADDRESS(handler.catchRoutine); 1417 1329 return handler.callFrame; 1418 }1419 1420 DEFINE_STUB_FUNCTION(JSPropertyNameIterator*, op_get_pnames)1421 {1422 STUB_INIT_STACK_FRAME(stackFrame);1423 1424 CallFrame* callFrame = stackFrame.callFrame;1425 JSObject* o = stackFrame.args[0].jsObject();1426 Structure* structure = o->structure();1427 JSPropertyNameIterator* jsPropertyNameIterator = structure->enumerationCache();1428 if (!jsPropertyNameIterator || jsPropertyNameIterator->cachedPrototypeChain() != structure->prototypeChain(callFrame))1429 jsPropertyNameIterator = JSPropertyNameIterator::create(callFrame, o);1430 return jsPropertyNameIterator;1431 1330 } 1432 1331 … … 1610 1509 } 1611 1510 #endif 1612 1613 DEFINE_STUB_FUNCTION(EncodedJSValue, to_object)1614 {1615 STUB_INIT_STACK_FRAME(stackFrame);1616 1617 CallFrame* callFrame = stackFrame.callFrame;1618 return JSValue::encode(stackFrame.args[0].jsValue().toObject(callFrame));1619 }1620 1511 1621 1512 DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_scope) -
trunk/Source/JavaScriptCore/jit/JITStubs.h
r157313 r157404 331 331 332 332 extern "C" { 333 EncodedJSValue JIT_STUB cti_op_check_has_instance(STUB_ARGS_DECLARATION) WTF_INTERNAL;334 EncodedJSValue JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION) WTF_INTERNAL;335 EncodedJSValue JIT_STUB cti_op_del_by_id(STUB_ARGS_DECLARATION) WTF_INTERNAL;336 333 EncodedJSValue JIT_STUB cti_op_get_by_id(STUB_ARGS_DECLARATION) WTF_INTERNAL; 337 334 EncodedJSValue JIT_STUB cti_op_get_by_id_array_fail(STUB_ARGS_DECLARATION) WTF_INTERNAL; … … 347 344 EncodedJSValue JIT_STUB cti_op_get_by_val_generic(STUB_ARGS_DECLARATION) WTF_INTERNAL; 348 345 EncodedJSValue JIT_STUB cti_op_get_by_val_string(STUB_ARGS_DECLARATION) WTF_INTERNAL; 349 EncodedJSValue JIT_STUB cti_op_instanceof(STUB_ARGS_DECLARATION) WTF_INTERNAL;350 EncodedJSValue JIT_STUB cti_to_object(STUB_ARGS_DECLARATION) WTF_INTERNAL;351 JSObject* JIT_STUB cti_op_push_activation(STUB_ARGS_DECLARATION) WTF_INTERNAL;352 346 void JIT_STUB cti_op_push_name_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL; 353 347 void JIT_STUB cti_op_push_with_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL; 354 348 JSObject* JIT_STUB cti_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION) WTF_INTERNAL; 355 JSPropertyNameIterator* JIT_STUB cti_op_get_pnames(STUB_ARGS_DECLARATION) WTF_INTERNAL;356 void* JIT_STUB cti_op_load_varargs(STUB_ARGS_DECLARATION) WTF_INTERNAL;357 349 void JIT_STUB cti_handle_watchdog_timer(STUB_ARGS_DECLARATION) WTF_INTERNAL; 358 350 void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION) WTF_INTERNAL;
Note:
See TracChangeset
for help on using the changeset viewer.