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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 } else { | 634 } else { |
635 if (false_label_ != fall_through_) __ jmp(false_label_); | 635 if (false_label_ != fall_through_) __ jmp(false_label_); |
636 } | 636 } |
637 } | 637 } |
638 | 638 |
639 | 639 |
640 void FullCodeGenerator::DoTest(Expression* condition, | 640 void FullCodeGenerator::DoTest(Expression* condition, |
641 Label* if_true, | 641 Label* if_true, |
642 Label* if_false, | 642 Label* if_false, |
643 Label* fall_through) { | 643 Label* fall_through) { |
644 ToBooleanStub stub(result_register()); | 644 Handle<Code> ic = ToBooleanStub::GetUninitialized(isolate()); |
645 __ push(result_register()); | 645 CallIC(ic, RelocInfo::CODE_TARGET, condition->test_id()); |
646 __ CallStub(&stub, condition->test_id()); | |
647 __ test(result_register(), result_register()); | 646 __ test(result_register(), result_register()); |
648 // The stub returns nonzero for true. | 647 // The stub returns nonzero for true. |
649 Split(not_zero, if_true, if_false, fall_through); | 648 Split(not_zero, if_true, if_false, fall_through); |
650 } | 649 } |
651 | 650 |
652 | 651 |
653 void FullCodeGenerator::Split(Condition cc, | 652 void FullCodeGenerator::Split(Condition cc, |
654 Label* if_true, | 653 Label* if_true, |
655 Label* if_false, | 654 Label* if_false, |
656 Label* fall_through) { | 655 Label* fall_through) { |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 __ mov(edx, eax); // result | 1995 __ mov(edx, eax); // result |
1997 __ mov(ecx, isolate()->factory()->value_string()); // "value" | 1996 __ mov(ecx, isolate()->factory()->value_string()); // "value" |
1998 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); | 1997 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); |
1999 CallIC(value_ic); // result.value in eax | 1998 CallIC(value_ic); // result.value in eax |
2000 __ pop(ebx); // result | 1999 __ pop(ebx); // result |
2001 __ push(eax); // result.value | 2000 __ push(eax); // result.value |
2002 __ mov(edx, ebx); // result | 2001 __ mov(edx, ebx); // result |
2003 __ mov(ecx, isolate()->factory()->done_string()); // "done" | 2002 __ mov(ecx, isolate()->factory()->done_string()); // "done" |
2004 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); | 2003 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); |
2005 CallIC(done_ic); // result.done in eax | 2004 CallIC(done_ic); // result.done in eax |
2006 ToBooleanStub stub(eax); | 2005 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2007 __ push(eax); | 2006 CallIC(bool_ic); |
2008 __ CallStub(&stub); | |
2009 __ test(eax, eax); | 2007 __ test(eax, eax); |
2010 __ j(zero, &l_try); | 2008 __ j(zero, &l_try); |
2011 | 2009 |
2012 // result.value | 2010 // result.value |
2013 __ pop(eax); // result.value | 2011 __ pop(eax); // result.value |
2014 context()->DropAndPlug(2, eax); // drop iter and g | 2012 context()->DropAndPlug(2, eax); // drop iter and g |
2015 break; | 2013 break; |
2016 } | 2014 } |
2017 } | 2015 } |
2018 } | 2016 } |
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4871 *stack_depth = 0; | 4869 *stack_depth = 0; |
4872 *context_length = 0; | 4870 *context_length = 0; |
4873 return previous_; | 4871 return previous_; |
4874 } | 4872 } |
4875 | 4873 |
4876 #undef __ | 4874 #undef __ |
4877 | 4875 |
4878 } } // namespace v8::internal | 4876 } } // namespace v8::internal |
4879 | 4877 |
4880 #endif // V8_TARGET_ARCH_IA32 | 4878 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |