OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 } | 629 } |
630 } | 630 } |
631 | 631 |
632 | 632 |
633 void FullCodeGenerator::DoTest(Expression* condition, | 633 void FullCodeGenerator::DoTest(Expression* condition, |
634 Label* if_true, | 634 Label* if_true, |
635 Label* if_false, | 635 Label* if_false, |
636 Label* fall_through) { | 636 Label* fall_through) { |
637 Handle<Code> ic = ToBooleanStub::GetUninitialized(isolate()); | 637 Handle<Code> ic = ToBooleanStub::GetUninitialized(isolate()); |
638 CallIC(ic, condition->test_id()); | 638 CallIC(ic, condition->test_id()); |
639 __ testp(result_register(), result_register()); | 639 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); |
640 // The stub returns nonzero for true. | 640 Split(equal, if_true, if_false, fall_through); |
641 Split(not_zero, if_true, if_false, fall_through); | |
642 } | 641 } |
643 | 642 |
644 | 643 |
645 void FullCodeGenerator::Split(Condition cc, | 644 void FullCodeGenerator::Split(Condition cc, |
646 Label* if_true, | 645 Label* if_true, |
647 Label* if_false, | 646 Label* if_false, |
648 Label* fall_through) { | 647 Label* fall_through) { |
649 if (if_false == fall_through) { | 648 if (if_false == fall_through) { |
650 __ j(cc, if_true); | 649 __ j(cc, if_true); |
651 } else if (if_true == fall_through) { | 650 } else if (if_true == fall_through) { |
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 // if (!result.done) goto l_try; | 1999 // if (!result.done) goto l_try; |
2001 __ bind(&l_loop); | 2000 __ bind(&l_loop); |
2002 __ Move(load_receiver, rax); | 2001 __ Move(load_receiver, rax); |
2003 __ Push(load_receiver); // save result | 2002 __ Push(load_receiver); // save result |
2004 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2003 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
2005 __ Move(LoadDescriptor::SlotRegister(), | 2004 __ Move(LoadDescriptor::SlotRegister(), |
2006 SmiFromSlot(expr->DoneFeedbackSlot())); | 2005 SmiFromSlot(expr->DoneFeedbackSlot())); |
2007 CallLoadIC(NOT_INSIDE_TYPEOF); // rax=result.done | 2006 CallLoadIC(NOT_INSIDE_TYPEOF); // rax=result.done |
2008 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2007 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2009 CallIC(bool_ic); | 2008 CallIC(bool_ic); |
2010 __ testp(result_register(), result_register()); | 2009 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); |
2011 __ j(zero, &l_try); | 2010 __ j(not_equal, &l_try); |
2012 | 2011 |
2013 // result.value | 2012 // result.value |
2014 __ Pop(load_receiver); // result | 2013 __ Pop(load_receiver); // result |
2015 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 2014 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
2016 __ Move(LoadDescriptor::SlotRegister(), | 2015 __ Move(LoadDescriptor::SlotRegister(), |
2017 SmiFromSlot(expr->ValueFeedbackSlot())); | 2016 SmiFromSlot(expr->ValueFeedbackSlot())); |
2018 CallLoadIC(NOT_INSIDE_TYPEOF); // result.value in rax | 2017 CallLoadIC(NOT_INSIDE_TYPEOF); // result.value in rax |
2019 context()->DropAndPlug(2, rax); // drop iter and g | 2018 context()->DropAndPlug(2, rax); // drop iter and g |
2020 break; | 2019 break; |
2021 } | 2020 } |
(...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4848 Assembler::target_address_at(call_target_address, | 4847 Assembler::target_address_at(call_target_address, |
4849 unoptimized_code)); | 4848 unoptimized_code)); |
4850 return OSR_AFTER_STACK_CHECK; | 4849 return OSR_AFTER_STACK_CHECK; |
4851 } | 4850 } |
4852 | 4851 |
4853 | 4852 |
4854 } // namespace internal | 4853 } // namespace internal |
4855 } // namespace v8 | 4854 } // namespace v8 |
4856 | 4855 |
4857 #endif // V8_TARGET_ARCH_X64 | 4856 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |