Changeset 37386 in webkit for trunk/JavaScriptCore/VM/CTI.cpp
- Timestamp:
- Oct 7, 2008, 1:27:50 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/CTI.cpp
r37381 r37386 31 31 #include "CodeBlock.h" 32 32 #include "JSArray.h" 33 #include "JSFunction.h" 33 34 #include "Machine.h" 34 35 #include "wrec/WREC.h" … … 83 84 "subl $0x24, %esp" "\n" 84 85 "movl $512, %esi" "\n" 86 "movl 0x38(%esp), %edi" "\n" // Ox38 = 0x0E * 4, 0x0E = CTI_ARGS_r 85 87 "call *0x30(%esp)" "\n" // Ox30 = 0x0C * 4, 0x0C = CTI_ARGS_code 86 88 "addl $0x24, %esp" "\n" … … 112 114 mov esi, 512; 113 115 mov [esp], esp; 116 mov edi, [esp + 0x38]; 114 117 call [esp + 0x30]; 115 118 add esp, 0x24; … … 363 366 } 364 367 368 ALWAYS_INLINE X86Assembler::JmpSrc CTI::emitCall(unsigned opcodeIndex, CTIHelper_2 helper) 369 { 370 #if ENABLE(SAMPLING_TOOL) 371 m_jit.movl_i32m(1, &inCalledCode); 372 #endif 373 m_jit.emitRestoreArgumentReference(); 374 X86Assembler::JmpSrc call = m_jit.emitCall(); 375 m_calls.append(CallRecord(call, helper, opcodeIndex)); 376 #if ENABLE(SAMPLING_TOOL) 377 m_jit.movl_i32m(0, &inCalledCode); 378 #endif 379 380 return call; 381 } 382 365 383 ALWAYS_INLINE void CTI::emitJumpSlowCaseIfNotJSCell(X86Assembler::RegisterID reg, unsigned opcodeIndex) 366 384 { … … 461 479 #endif 462 480 481 void CTI::compileOpCallInitializeCallFrame(unsigned callee, unsigned argCount) 482 { 483 emitGetArg(callee, X86::ecx); // Load callee JSFunction into ecx 484 m_jit.movl_rm(X86::eax, RegisterFile::CodeBlock * static_cast<int>(sizeof(Register)), X86::edx); // callee CodeBlock was returned in eax 485 m_jit.movl_i32m(reinterpret_cast<unsigned>(nullJSValue), RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register)), X86::edx); 486 m_jit.movl_rm(X86::ecx, RegisterFile::Callee * static_cast<int>(sizeof(Register)), X86::edx); 487 488 m_jit.movl_mr(OBJECT_OFFSET(JSFunction, m_scopeChain) + OBJECT_OFFSET(ScopeChain, m_node), X86::ecx, X86::ecx); // newScopeChain 489 m_jit.movl_i32m(argCount, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register)), X86::edx); 490 m_jit.movl_rm(X86::edi, RegisterFile::CallerRegisters * static_cast<int>(sizeof(Register)), X86::edx); 491 m_jit.movl_rm(X86::ecx, RegisterFile::ScopeChain * static_cast<int>(sizeof(Register)), X86::edx); 492 } 493 463 494 void CTI::compileOpCall(Instruction* instruction, unsigned i, CompileOpCallType type) 464 495 { 465 496 int dst = instruction[i + 1].u.operand; 497 int callee = instruction[i + 2].u.operand; 466 498 int firstArg = instruction[i + 4].u.operand; 467 499 int argCount = instruction[i + 5].u.operand; … … 494 526 X86Assembler::JmpSrc wasEval; 495 527 if (type == OpCallEval) { 496 emitGetPutArg( instruction[i + 2].u.operand, 0, X86::ecx);528 emitGetPutArg(callee, 0, X86::ecx); 497 529 emitCall(i, Machine::cti_op_call_eval); 498 499 emitGetCTIParam(CTI_ARGS_r, X86::edi); // edi := r500 530 501 531 m_jit.cmpl_i32r(reinterpret_cast<unsigned>(JSImmediate::impossibleValue()), X86::eax); … … 503 533 504 534 // this sets up the first arg to op_cti_call (func), and explicitly leaves the value in ecx (checked just below). 505 emitGetArg( instruction[i + 2].u.operand, X86::ecx);535 emitGetArg(callee, X86::ecx); 506 536 } else { 507 537 // this sets up the first arg to op_cti_call (func), and explicitly leaves the value in ecx (checked just below). 508 emitGetPutArg( instruction[i + 2].u.operand, 0, X86::ecx);538 emitGetPutArg(callee, 0, X86::ecx); 509 539 } 510 540 … … 523 553 524 554 // This handles JSFunctions 525 emitCall(i, ((type == OpConstruct) ? Machine::cti_op_construct_JSConstruct : Machine::cti_op_call_JSFunction)); 555 emitCall(i, (type == OpConstruct) ? Machine::cti_op_construct_JSConstruct : Machine::cti_op_call_JSFunction); 556 557 compileOpCallInitializeCallFrame(callee, argCount); 558 559 // load ctiCode from the new codeBlock. 560 m_jit.movl_mr(OBJECT_OFFSET(CodeBlock, ctiCode), X86::eax, X86::eax); 561 562 // Setup the new value of 'r' in edi, and on the stack, too. 563 emitPutCTIParam(X86::edx, CTI_ARGS_r); 564 m_jit.movl_rr(X86::edx, X86::edi); 526 565 527 566 // Check the ctiCode has been generated - if not, this is handled in a slow case. … … 1280 1319 emitCall(i, Machine::cti_op_resolve_func); 1281 1320 emitPutResult(instruction[i + 1].u.operand); 1282 emitGetCTIParam(CTI_ARGS_2ndResult, X86::eax); 1283 emitPutResult(instruction[i + 2].u.operand); 1321 emitPutResult(instruction[i + 2].u.operand, X86::edx); 1284 1322 i += 4; 1285 1323 break; … … 1565 1603 emitCall(i, Machine::cti_op_resolve_with_base); 1566 1604 emitPutResult(instruction[i + 1].u.operand); 1567 emitGetCTIParam(CTI_ARGS_2ndResult, X86::eax); 1568 emitPutResult(instruction[i + 2].u.operand); 1605 emitPutResult(instruction[i + 2].u.operand, X86::edx); 1569 1606 i += 4; 1570 1607 break; … … 2328 2365 emitCall(i, Machine::cti_op_post_inc); 2329 2366 emitPutResult(instruction[i + 1].u.operand); 2330 emitGetCTIParam(CTI_ARGS_2ndResult, X86::eax); 2331 emitPutResult(srcDst); 2367 emitPutResult(srcDst, X86::edx); 2332 2368 i += 3; 2333 2369 break; … … 2384 2420 emitCall(i, Machine::cti_op_post_dec); 2385 2421 emitPutResult(instruction[i + 1].u.operand); 2386 emitGetCTIParam(CTI_ARGS_2ndResult, X86::eax); 2387 emitPutResult(srcDst); 2422 emitPutResult(srcDst, X86::edx); 2388 2423 i += 3; 2389 2424 break; … … 2500 2535 // Could use a popl_m, but would need to offset the following instruction if so. 2501 2536 m_jit.popl_r(X86::ecx); 2502 emitGetCTIParam(CTI_ARGS_r, X86::edi); // edi := r2503 2537 emitPutToCallFrameHeader(X86::ecx, RegisterFile::ReturnPC); 2504 2538
Note:
See TracChangeset
for help on using the changeset viewer.