Changeset 36805 in webkit for trunk/JavaScriptCore/VM/CTI.cpp
- Timestamp:
- Sep 23, 2008, 6:20:23 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/CTI.cpp
r36764 r36805 523 523 } 524 524 525 void CTI::compileOpStrictEq(Instruction* instruction, unsigned i, CompileOpStrictEqType type) 526 { 527 bool negated = (type == OpNStrictEq); 528 529 unsigned dst = instruction[i + 1].u.operand; 530 unsigned src1 = instruction[i + 2].u.operand; 531 unsigned src2 = instruction[i + 3].u.operand; 532 533 emitGetArg(src1, X86::eax); 534 emitGetArg(src2, X86::edx); 535 536 m_jit.testl_i32r(JSImmediate::TagMask, X86::eax); 537 X86Assembler::JmpSrc firstNotImmediate = m_jit.emitUnlinkedJe(); 538 m_jit.testl_i32r(JSImmediate::TagMask, X86::edx); 539 X86Assembler::JmpSrc secondNotImmediate = m_jit.emitUnlinkedJe(); 540 541 m_jit.cmpl_rr(X86::edx, X86::eax); 542 if (negated) 543 m_jit.setne_r(X86::eax); 544 else 545 m_jit.sete_r(X86::eax); 546 m_jit.movzbl_rr(X86::eax, X86::eax); 547 emitTagAsBoolImmediate(X86::eax); 548 549 X86Assembler::JmpSrc bothWereImmediates = m_jit.emitUnlinkedJmp(); 550 551 m_jit.link(firstNotImmediate, m_jit.label()); 552 553 // check that edx is immediate but not the zero immediate 554 m_jit.testl_i32r(JSImmediate::TagMask, X86::edx); 555 m_jit.setz_r(X86::ecx); 556 m_jit.movzbl_rr(X86::ecx, X86::ecx); // ecx is now 1 if edx was nonimmediate 557 m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::edx); 558 m_jit.sete_r(X86::edx); 559 m_jit.movzbl_rr(X86::edx, X86::edx); // edx is now 1 if edx was the 0 immediate 560 m_jit.orl_rr(X86::ecx, X86::edx); 561 562 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJnz(), i)); 563 564 m_jit.movl_i32r(reinterpret_cast<uint32_t>(jsBoolean(negated)), X86::eax); 565 566 X86Assembler::JmpSrc firstWasNotImmediate = m_jit.emitUnlinkedJmp(); 567 568 m_jit.link(secondNotImmediate, m_jit.label()); 569 // check that eax is not the zero immediate (we know it must be immediate) 570 m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::eax); 571 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJe(), i)); 572 573 m_jit.movl_i32r(reinterpret_cast<uint32_t>(jsBoolean(negated)), X86::eax); 574 575 m_jit.link(bothWereImmediates, m_jit.label()); 576 m_jit.link(firstWasNotImmediate, m_jit.label()); 577 578 emitPutResult(dst); 579 } 580 525 581 void CTI::emitSlowScriptCheck(unsigned opcodeIndex) 526 582 { … … 1392 1448 CTI_COMPILE_UNARY_OP(op_is_object) 1393 1449 CTI_COMPILE_UNARY_OP(op_is_function) 1394 CTI_COMPILE_BINARY_OP(op_nstricteq)1395 1450 case op_stricteq: { 1396 unsigned dst = instruction[i + 1].u.operand; 1397 unsigned src1 = instruction[i + 2].u.operand; 1398 unsigned src2 = instruction[i + 3].u.operand; 1399 1400 emitGetArg(src1, X86::eax); 1401 emitGetArg(src2, X86::edx); 1402 1403 m_jit.testl_i32r(JSImmediate::TagMask, X86::eax); 1404 X86Assembler::JmpSrc firstNotImmediate = m_jit.emitUnlinkedJe(); 1405 m_jit.testl_i32r(JSImmediate::TagMask, X86::edx); 1406 X86Assembler::JmpSrc secondNotImmediate = m_jit.emitUnlinkedJe(); 1407 1408 m_jit.cmpl_rr(X86::edx, X86::eax); 1409 m_jit.sete_r(X86::eax); 1410 m_jit.movzbl_rr(X86::eax, X86::eax); 1411 emitTagAsBoolImmediate(X86::eax); 1412 1413 X86Assembler::JmpSrc bothWereImmediates = m_jit.emitUnlinkedJmp(); 1414 1415 m_jit.link(firstNotImmediate, m_jit.label()); 1416 1417 // check that edx is immediate but not the zero immediate 1418 1419 m_jit.testl_i32r(JSImmediate::TagMask, X86::edx); 1420 m_jit.setz_r(X86::ecx); 1421 m_jit.movzbl_rr(X86::ecx, X86::ecx); // ecx is now 1 if edx was nonimmediate 1422 m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::edx); 1423 m_jit.sete_r(X86::edx); 1424 m_jit.movzbl_rr(X86::edx, X86::edx); // edx is now 1 if edx was the 0 immediate 1425 m_jit.orl_rr(X86::ecx, X86::edx); 1426 1427 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJnz(), i)); 1428 1429 m_jit.movl_i32r(reinterpret_cast<uint32_t>(jsBoolean(false)), X86::eax); 1430 1431 X86Assembler::JmpSrc firstWasNotImmediate = m_jit.emitUnlinkedJmp(); 1432 1433 m_jit.link(secondNotImmediate, m_jit.label()); 1434 // check that eax is not the zero immediate (we know it must be immediate) 1435 m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::eax); 1436 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJe(), i)); 1437 1438 m_jit.movl_i32r(reinterpret_cast<uint32_t>(jsBoolean(false)), X86::eax); 1439 1440 m_jit.link(bothWereImmediates, m_jit.label()); 1441 m_jit.link(firstWasNotImmediate, m_jit.label()); 1442 1443 emitPutResult(dst); 1444 1451 compileOpStrictEq(instruction, i, OpStrictEq); 1452 i += 4; 1453 break; 1454 } 1455 case op_nstricteq: { 1456 compileOpStrictEq(instruction, i, OpNStrictEq); 1445 1457 i += 4; 1446 1458 break;
Note:
See TracChangeset
for help on using the changeset viewer.