| 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 if (true_label_ != fall_through_) __ jmp(true_label_); | 546 if (true_label_ != fall_through_) __ jmp(true_label_); |
| 547 } else { | 547 } else { |
| 548 if (false_label_ != fall_through_) __ jmp(false_label_); | 548 if (false_label_ != fall_through_) __ jmp(false_label_); |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 | 552 |
| 553 void FullCodeGenerator::DoTest(Label* if_true, | 553 void FullCodeGenerator::DoTest(Label* if_true, |
| 554 Label* if_false, | 554 Label* if_false, |
| 555 Label* fall_through) { | 555 Label* fall_through) { |
| 556 // Emit the inlined tests assumed by the stub. | |
| 557 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); | |
| 558 __ j(equal, if_false); | |
| 559 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); | |
| 560 __ j(equal, if_true); | |
| 561 __ CompareRoot(result_register(), Heap::kFalseValueRootIndex); | |
| 562 __ j(equal, if_false); | |
| 563 STATIC_ASSERT(kSmiTag == 0); | |
| 564 __ Cmp(result_register(), Smi::FromInt(0)); | |
| 565 __ j(equal, if_false); | |
| 566 Condition is_smi = masm_->CheckSmi(result_register()); | |
| 567 __ j(is_smi, if_true); | |
| 568 | |
| 569 // Call the ToBoolean stub for all other cases. | |
| 570 ToBooleanStub stub; | 556 ToBooleanStub stub; |
| 571 __ push(result_register()); | 557 __ push(result_register()); |
| 572 __ CallStub(&stub); | 558 __ CallStub(&stub); |
| 573 __ testq(rax, rax); | 559 __ testq(rax, rax); |
| 574 | |
| 575 // The stub returns nonzero for true. | 560 // The stub returns nonzero for true. |
| 576 Split(not_zero, if_true, if_false, fall_through); | 561 Split(not_zero, if_true, if_false, fall_through); |
| 577 } | 562 } |
| 578 | 563 |
| 579 | 564 |
| 580 void FullCodeGenerator::Split(Condition cc, | 565 void FullCodeGenerator::Split(Condition cc, |
| 581 Label* if_true, | 566 Label* if_true, |
| 582 Label* if_false, | 567 Label* if_false, |
| 583 Label* fall_through) { | 568 Label* fall_through) { |
| 584 if (if_false == fall_through) { | 569 if (if_false == fall_through) { |
| (...skipping 3722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4307 __ ret(0); | 4292 __ ret(0); |
| 4308 } | 4293 } |
| 4309 | 4294 |
| 4310 | 4295 |
| 4311 #undef __ | 4296 #undef __ |
| 4312 | 4297 |
| 4313 | 4298 |
| 4314 } } // namespace v8::internal | 4299 } } // namespace v8::internal |
| 4315 | 4300 |
| 4316 #endif // V8_TARGET_ARCH_X64 | 4301 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |