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 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3451 __ CallStub(&stub); | 3451 __ CallStub(&stub); |
3452 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 3452 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
3453 // The stub returns 0 for true. | 3453 // The stub returns 0 for true. |
3454 __ tst(r0, r0); | 3454 __ tst(r0, r0); |
3455 Split(eq, if_true, if_false, fall_through); | 3455 Split(eq, if_true, if_false, fall_through); |
3456 break; | 3456 break; |
3457 } | 3457 } |
3458 | 3458 |
3459 default: { | 3459 default: { |
3460 VisitForAccumulatorValue(expr->right()); | 3460 VisitForAccumulatorValue(expr->right()); |
3461 Condition cc = eq; | 3461 Condition cond = eq; |
3462 bool strict = false; | 3462 bool strict = false; |
3463 switch (op) { | 3463 switch (op) { |
3464 case Token::EQ_STRICT: | 3464 case Token::EQ_STRICT: |
3465 strict = true; | 3465 strict = true; |
3466 // Fall through | 3466 // Fall through |
3467 case Token::EQ: | 3467 case Token::EQ: |
3468 cc = eq; | 3468 cond = eq; |
3469 __ pop(r1); | 3469 __ pop(r1); |
3470 break; | 3470 break; |
3471 case Token::LT: | 3471 case Token::LT: |
3472 cc = lt; | 3472 cond = lt; |
3473 __ pop(r1); | 3473 __ pop(r1); |
3474 break; | 3474 break; |
3475 case Token::GT: | 3475 case Token::GT: |
3476 // Reverse left and right sides to obtain ECMA-262 conversion order. | 3476 // Reverse left and right sides to obtain ECMA-262 conversion order. |
3477 cc = lt; | 3477 cond = lt; |
3478 __ mov(r1, result_register()); | 3478 __ mov(r1, result_register()); |
3479 __ pop(r0); | 3479 __ pop(r0); |
3480 break; | 3480 break; |
3481 case Token::LTE: | 3481 case Token::LTE: |
3482 // Reverse left and right sides to obtain ECMA-262 conversion order. | 3482 // Reverse left and right sides to obtain ECMA-262 conversion order. |
3483 cc = ge; | 3483 cond = ge; |
3484 __ mov(r1, result_register()); | 3484 __ mov(r1, result_register()); |
3485 __ pop(r0); | 3485 __ pop(r0); |
3486 break; | 3486 break; |
3487 case Token::GTE: | 3487 case Token::GTE: |
3488 cc = ge; | 3488 cond = ge; |
3489 __ pop(r1); | 3489 __ pop(r1); |
3490 break; | 3490 break; |
3491 case Token::IN: | 3491 case Token::IN: |
3492 case Token::INSTANCEOF: | 3492 case Token::INSTANCEOF: |
3493 default: | 3493 default: |
3494 UNREACHABLE(); | 3494 UNREACHABLE(); |
3495 } | 3495 } |
3496 | 3496 |
3497 bool inline_smi_code = ShouldInlineSmiCase(op); | 3497 bool inline_smi_code = ShouldInlineSmiCase(op); |
3498 if (inline_smi_code) { | 3498 if (inline_smi_code) { |
3499 Label slow_case; | 3499 Label slow_case; |
3500 __ orr(r2, r0, Operand(r1)); | 3500 __ orr(r2, r0, Operand(r1)); |
3501 __ BranchOnNotSmi(r2, &slow_case); | 3501 __ BranchOnNotSmi(r2, &slow_case); |
3502 __ cmp(r1, r0); | 3502 __ cmp(r1, r0); |
3503 Split(cc, if_true, if_false, NULL); | 3503 Split(cond, if_true, if_false, NULL); |
3504 __ bind(&slow_case); | 3504 __ bind(&slow_case); |
3505 } | 3505 } |
3506 CompareFlags flags = inline_smi_code | 3506 CompareFlags flags = inline_smi_code |
3507 ? NO_SMI_COMPARE_IN_STUB | 3507 ? NO_SMI_COMPARE_IN_STUB |
3508 : NO_COMPARE_FLAGS; | 3508 : NO_COMPARE_FLAGS; |
3509 CompareStub stub(cc, strict, flags, r1, r0); | 3509 CompareStub stub(cond, strict, flags, r1, r0); |
3510 __ CallStub(&stub); | 3510 __ CallStub(&stub); |
3511 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 3511 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
3512 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 3512 __ cmp(r0, Operand(0, RelocInfo::NONE)); |
3513 Split(cc, if_true, if_false, fall_through); | 3513 Split(cond, if_true, if_false, fall_through); |
3514 } | 3514 } |
3515 } | 3515 } |
3516 | 3516 |
3517 // Convert the result of the comparison into one expected for this | 3517 // Convert the result of the comparison into one expected for this |
3518 // expression's context. | 3518 // expression's context. |
3519 context()->Plug(if_true, if_false); | 3519 context()->Plug(if_true, if_false); |
3520 } | 3520 } |
3521 | 3521 |
3522 | 3522 |
3523 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { | 3523 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3613 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3613 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
3614 __ add(pc, r1, Operand(masm_->CodeObject())); | 3614 __ add(pc, r1, Operand(masm_->CodeObject())); |
3615 } | 3615 } |
3616 | 3616 |
3617 | 3617 |
3618 #undef __ | 3618 #undef __ |
3619 | 3619 |
3620 } } // namespace v8::internal | 3620 } } // namespace v8::internal |
3621 | 3621 |
3622 #endif // V8_TARGET_ARCH_ARM | 3622 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |