OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // Call the runtime to find the boolean value of the source and then | 510 // Call the runtime to find the boolean value of the source and then |
511 // translate it into control flow to the pair of labels. | 511 // translate it into control flow to the pair of labels. |
512 __ push(result_register()); | 512 __ push(result_register()); |
513 __ CallRuntime(Runtime::kToBool, 1); | 513 __ CallRuntime(Runtime::kToBool, 1); |
514 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 514 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
515 __ cmp(r0, ip); | 515 __ cmp(r0, ip); |
516 Split(eq, if_true, if_false, fall_through); | 516 Split(eq, if_true, if_false, fall_through); |
517 } | 517 } |
518 | 518 |
519 | 519 |
520 void FullCodeGenerator::Split(Condition cc, | 520 void FullCodeGenerator::Split(Condition cond, |
521 Label* if_true, | 521 Label* if_true, |
522 Label* if_false, | 522 Label* if_false, |
523 Label* fall_through) { | 523 Label* fall_through) { |
524 if (if_false == fall_through) { | 524 if (if_false == fall_through) { |
525 __ b(cc, if_true); | 525 __ b(cond, if_true); |
526 } else if (if_true == fall_through) { | 526 } else if (if_true == fall_through) { |
527 __ b(NegateCondition(cc), if_false); | 527 __ b(NegateCondition(cond), if_false); |
528 } else { | 528 } else { |
529 __ b(cc, if_true); | 529 __ b(cond, if_true); |
530 __ b(if_false); | 530 __ b(if_false); |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 | 534 |
535 MemOperand FullCodeGenerator::EmitSlotSearch(Slot* slot, Register scratch) { | 535 MemOperand FullCodeGenerator::EmitSlotSearch(Slot* slot, Register scratch) { |
536 switch (slot->type()) { | 536 switch (slot->type()) { |
537 case Slot::PARAMETER: | 537 case Slot::PARAMETER: |
538 case Slot::LOCAL: | 538 case Slot::LOCAL: |
539 return MemOperand(fp, SlotOffset(slot)); | 539 return MemOperand(fp, SlotOffset(slot)); |
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3454 __ CallStub(&stub); | 3454 __ CallStub(&stub); |
3455 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 3455 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
3456 // The stub returns 0 for true. | 3456 // The stub returns 0 for true. |
3457 __ tst(r0, r0); | 3457 __ tst(r0, r0); |
3458 Split(eq, if_true, if_false, fall_through); | 3458 Split(eq, if_true, if_false, fall_through); |
3459 break; | 3459 break; |
3460 } | 3460 } |
3461 | 3461 |
3462 default: { | 3462 default: { |
3463 VisitForAccumulatorValue(expr->right()); | 3463 VisitForAccumulatorValue(expr->right()); |
3464 Condition cc = eq; | 3464 Condition cond = eq; |
3465 bool strict = false; | 3465 bool strict = false; |
3466 switch (op) { | 3466 switch (op) { |
3467 case Token::EQ_STRICT: | 3467 case Token::EQ_STRICT: |
3468 strict = true; | 3468 strict = true; |
3469 // Fall through | 3469 // Fall through |
3470 case Token::EQ: | 3470 case Token::EQ: |
3471 cc = eq; | 3471 cond = eq; |
3472 __ pop(r1); | 3472 __ pop(r1); |
3473 break; | 3473 break; |
3474 case Token::LT: | 3474 case Token::LT: |
3475 cc = lt; | 3475 cond = lt; |
3476 __ pop(r1); | 3476 __ pop(r1); |
3477 break; | 3477 break; |
3478 case Token::GT: | 3478 case Token::GT: |
3479 // Reverse left and right sides to obtain ECMA-262 conversion order. | 3479 // Reverse left and right sides to obtain ECMA-262 conversion order. |
3480 cc = lt; | 3480 cond = lt; |
3481 __ mov(r1, result_register()); | 3481 __ mov(r1, result_register()); |
3482 __ pop(r0); | 3482 __ pop(r0); |
3483 break; | 3483 break; |
3484 case Token::LTE: | 3484 case Token::LTE: |
3485 // Reverse left and right sides to obtain ECMA-262 conversion order. | 3485 // Reverse left and right sides to obtain ECMA-262 conversion order. |
3486 cc = ge; | 3486 cond = ge; |
3487 __ mov(r1, result_register()); | 3487 __ mov(r1, result_register()); |
3488 __ pop(r0); | 3488 __ pop(r0); |
3489 break; | 3489 break; |
3490 case Token::GTE: | 3490 case Token::GTE: |
3491 cc = ge; | 3491 cond = ge; |
3492 __ pop(r1); | 3492 __ pop(r1); |
3493 break; | 3493 break; |
3494 case Token::IN: | 3494 case Token::IN: |
3495 case Token::INSTANCEOF: | 3495 case Token::INSTANCEOF: |
3496 default: | 3496 default: |
3497 UNREACHABLE(); | 3497 UNREACHABLE(); |
3498 } | 3498 } |
3499 | 3499 |
3500 bool inline_smi_code = ShouldInlineSmiCase(op); | 3500 bool inline_smi_code = ShouldInlineSmiCase(op); |
3501 if (inline_smi_code) { | 3501 if (inline_smi_code) { |
3502 Label slow_case; | 3502 Label slow_case; |
3503 __ orr(r2, r0, Operand(r1)); | 3503 __ orr(r2, r0, Operand(r1)); |
3504 __ BranchOnNotSmi(r2, &slow_case); | 3504 __ BranchOnNotSmi(r2, &slow_case); |
3505 __ cmp(r1, r0); | 3505 __ cmp(r1, r0); |
3506 Split(cc, if_true, if_false, NULL); | 3506 Split(cond, if_true, if_false, NULL); |
3507 __ bind(&slow_case); | 3507 __ bind(&slow_case); |
3508 } | 3508 } |
3509 CompareFlags flags = inline_smi_code | 3509 CompareFlags flags = inline_smi_code |
3510 ? NO_SMI_COMPARE_IN_STUB | 3510 ? NO_SMI_COMPARE_IN_STUB |
3511 : NO_COMPARE_FLAGS; | 3511 : NO_COMPARE_FLAGS; |
3512 CompareStub stub(cc, strict, flags, r1, r0); | 3512 CompareStub stub(cond, strict, flags, r1, r0); |
3513 __ CallStub(&stub); | 3513 __ CallStub(&stub); |
3514 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 3514 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
3515 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 3515 __ cmp(r0, Operand(0, RelocInfo::NONE)); |
3516 Split(cc, if_true, if_false, fall_through); | 3516 Split(cond, if_true, if_false, fall_through); |
3517 } | 3517 } |
3518 } | 3518 } |
3519 | 3519 |
3520 // Convert the result of the comparison into one expected for this | 3520 // Convert the result of the comparison into one expected for this |
3521 // expression's context. | 3521 // expression's context. |
3522 context()->Plug(if_true, if_false); | 3522 context()->Plug(if_true, if_false); |
3523 } | 3523 } |
3524 | 3524 |
3525 | 3525 |
3526 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { | 3526 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3616 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3616 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
3617 __ add(pc, r1, Operand(masm_->CodeObject())); | 3617 __ add(pc, r1, Operand(masm_->CodeObject())); |
3618 } | 3618 } |
3619 | 3619 |
3620 | 3620 |
3621 #undef __ | 3621 #undef __ |
3622 | 3622 |
3623 } } // namespace v8::internal | 3623 } } // namespace v8::internal |
3624 | 3624 |
3625 #endif // V8_TARGET_ARCH_ARM | 3625 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |