OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 } else { | 645 } else { |
646 if (false_label_ != fall_through_) __ jmp(false_label_); | 646 if (false_label_ != fall_through_) __ jmp(false_label_); |
647 } | 647 } |
648 } | 648 } |
649 | 649 |
650 | 650 |
651 void FullCodeGenerator::DoTest(Expression* condition, | 651 void FullCodeGenerator::DoTest(Expression* condition, |
652 Label* if_true, | 652 Label* if_true, |
653 Label* if_false, | 653 Label* if_false, |
654 Label* fall_through) { | 654 Label* fall_through) { |
655 ToBooleanStub stub(result_register()); | 655 Handle<Code> ic = ToBooleanStub::GetUninitialized(isolate()); |
656 __ push(result_register()); | 656 CallIC(ic, RelocInfo::CODE_TARGET, condition->test_id()); |
657 __ CallStub(&stub, condition->test_id()); | |
658 __ testq(result_register(), result_register()); | 657 __ testq(result_register(), result_register()); |
659 // The stub returns nonzero for true. | 658 // The stub returns nonzero for true. |
660 Split(not_zero, if_true, if_false, fall_through); | 659 Split(not_zero, if_true, if_false, fall_through); |
661 } | 660 } |
662 | 661 |
663 | 662 |
664 void FullCodeGenerator::Split(Condition cc, | 663 void FullCodeGenerator::Split(Condition cc, |
665 Label* if_true, | 664 Label* if_true, |
666 Label* if_false, | 665 Label* if_false, |
667 Label* fall_through) { | 666 Label* fall_through) { |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 __ push(rax); // save result | 2020 __ push(rax); // save result |
2022 __ LoadRoot(rcx, Heap::kvalue_stringRootIndex); // "value" | 2021 __ LoadRoot(rcx, Heap::kvalue_stringRootIndex); // "value" |
2023 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); | 2022 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); |
2024 CallIC(value_ic); // result.value in rax | 2023 CallIC(value_ic); // result.value in rax |
2025 __ pop(rbx); // result | 2024 __ pop(rbx); // result |
2026 __ push(rax); // result.value | 2025 __ push(rax); // result.value |
2027 __ movq(rax, rbx); // result | 2026 __ movq(rax, rbx); // result |
2028 __ LoadRoot(rcx, Heap::kdone_stringRootIndex); // "done" | 2027 __ LoadRoot(rcx, Heap::kdone_stringRootIndex); // "done" |
2029 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); | 2028 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); |
2030 CallIC(done_ic); // result.done in rax | 2029 CallIC(done_ic); // result.done in rax |
2031 ToBooleanStub stub(rax); | 2030 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2032 __ push(rax); | 2031 CallIC(bool_ic); |
2033 __ CallStub(&stub); | 2032 __ testq(result_register(), result_register()); |
2034 __ testq(rax, rax); | |
2035 __ j(zero, &l_try); | 2033 __ j(zero, &l_try); |
2036 | 2034 |
2037 // result.value | 2035 // result.value |
2038 __ pop(rax); // result.value | 2036 __ pop(rax); // result.value |
2039 context()->DropAndPlug(2, rax); // drop iter and g | 2037 context()->DropAndPlug(2, rax); // drop iter and g |
2040 break; | 2038 break; |
2041 } | 2039 } |
2042 } | 2040 } |
2043 } | 2041 } |
2044 | 2042 |
(...skipping 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4861 *context_length = 0; | 4859 *context_length = 0; |
4862 return previous_; | 4860 return previous_; |
4863 } | 4861 } |
4864 | 4862 |
4865 | 4863 |
4866 #undef __ | 4864 #undef __ |
4867 | 4865 |
4868 } } // namespace v8::internal | 4866 } } // namespace v8::internal |
4869 | 4867 |
4870 #endif // V8_TARGET_ARCH_X64 | 4868 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |