| 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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 if (true_label_ != fall_through_) __ jmp(true_label_); | 541 if (true_label_ != fall_through_) __ jmp(true_label_); |
| 542 } else { | 542 } else { |
| 543 if (false_label_ != fall_through_) __ jmp(false_label_); | 543 if (false_label_ != fall_through_) __ jmp(false_label_); |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 | 546 |
| 547 | 547 |
| 548 void FullCodeGenerator::DoTest(Label* if_true, | 548 void FullCodeGenerator::DoTest(Label* if_true, |
| 549 Label* if_false, | 549 Label* if_false, |
| 550 Label* fall_through) { | 550 Label* fall_through) { |
| 551 // Emit the inlined tests assumed by the stub. | |
| 552 __ cmp(result_register(), isolate()->factory()->undefined_value()); | |
| 553 __ j(equal, if_false); | |
| 554 __ cmp(result_register(), isolate()->factory()->true_value()); | |
| 555 __ j(equal, if_true); | |
| 556 __ cmp(result_register(), isolate()->factory()->false_value()); | |
| 557 __ j(equal, if_false); | |
| 558 STATIC_ASSERT(kSmiTag == 0); | |
| 559 __ test(result_register(), Operand(result_register())); | |
| 560 __ j(zero, if_false); | |
| 561 __ test(result_register(), Immediate(kSmiTagMask)); | |
| 562 __ j(zero, if_true); | |
| 563 | |
| 564 // Call the ToBoolean stub for all other cases. | |
| 565 ToBooleanStub stub; | 551 ToBooleanStub stub; |
| 566 __ push(result_register()); | 552 __ push(result_register()); |
| 567 __ CallStub(&stub); | 553 __ CallStub(&stub); |
| 568 __ test(eax, Operand(eax)); | 554 __ test(eax, Operand(eax)); |
| 569 | |
| 570 // The stub returns nonzero for true. | 555 // The stub returns nonzero for true. |
| 571 Split(not_zero, if_true, if_false, fall_through); | 556 Split(not_zero, if_true, if_false, fall_through); |
| 572 } | 557 } |
| 573 | 558 |
| 574 | 559 |
| 575 void FullCodeGenerator::Split(Condition cc, | 560 void FullCodeGenerator::Split(Condition cc, |
| 576 Label* if_true, | 561 Label* if_true, |
| 577 Label* if_false, | 562 Label* if_false, |
| 578 Label* fall_through) { | 563 Label* fall_through) { |
| 579 if (if_false == fall_through) { | 564 if (if_false == fall_through) { |
| (...skipping 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4330 // And return. | 4315 // And return. |
| 4331 __ ret(0); | 4316 __ ret(0); |
| 4332 } | 4317 } |
| 4333 | 4318 |
| 4334 | 4319 |
| 4335 #undef __ | 4320 #undef __ |
| 4336 | 4321 |
| 4337 } } // namespace v8::internal | 4322 } } // namespace v8::internal |
| 4338 | 4323 |
| 4339 #endif // V8_TARGET_ARCH_IA32 | 4324 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |