| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 3664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3675 // Convert the object to an integer. | 3675 // Convert the object to an integer. |
| 3676 Label done_convert; | 3676 Label done_convert; |
| 3677 __ JumpIfSmi(eax, &done_convert, Label::kNear); | 3677 __ JumpIfSmi(eax, &done_convert, Label::kNear); |
| 3678 __ Push(eax); | 3678 __ Push(eax); |
| 3679 __ CallRuntime(Runtime::kToInteger, 1); | 3679 __ CallRuntime(Runtime::kToInteger, 1); |
| 3680 __ bind(&done_convert); | 3680 __ bind(&done_convert); |
| 3681 context()->Plug(eax); | 3681 context()->Plug(eax); |
| 3682 } | 3682 } |
| 3683 | 3683 |
| 3684 | 3684 |
| 3685 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | |
| 3686 ZoneList<Expression*>* args = expr->arguments(); | |
| 3687 DCHECK_EQ(args->length(), 1); | |
| 3688 | |
| 3689 // Load the argument into eax and call the stub. | |
| 3690 VisitForAccumulatorValue(args->at(0)); | |
| 3691 | |
| 3692 NumberToStringStub stub(isolate()); | |
| 3693 __ CallStub(&stub); | |
| 3694 context()->Plug(eax); | |
| 3695 } | |
| 3696 | |
| 3697 | |
| 3698 void FullCodeGenerator::EmitToLength(CallRuntime* expr) { | |
| 3699 ZoneList<Expression*>* args = expr->arguments(); | |
| 3700 DCHECK_EQ(1, args->length()); | |
| 3701 | |
| 3702 // Load the argument into eax and convert it. | |
| 3703 VisitForAccumulatorValue(args->at(0)); | |
| 3704 | |
| 3705 ToLengthStub stub(isolate()); | |
| 3706 __ CallStub(&stub); | |
| 3707 context()->Plug(eax); | |
| 3708 } | |
| 3709 | |
| 3710 | |
| 3711 void FullCodeGenerator::EmitToString(CallRuntime* expr) { | |
| 3712 ZoneList<Expression*>* args = expr->arguments(); | |
| 3713 DCHECK_EQ(1, args->length()); | |
| 3714 | |
| 3715 // Load the argument into eax and convert it. | |
| 3716 VisitForAccumulatorValue(args->at(0)); | |
| 3717 | |
| 3718 ToStringStub stub(isolate()); | |
| 3719 __ CallStub(&stub); | |
| 3720 context()->Plug(eax); | |
| 3721 } | |
| 3722 | |
| 3723 | |
| 3724 void FullCodeGenerator::EmitToNumber(CallRuntime* expr) { | |
| 3725 ZoneList<Expression*>* args = expr->arguments(); | |
| 3726 DCHECK_EQ(1, args->length()); | |
| 3727 | |
| 3728 // Load the argument into eax and convert it. | |
| 3729 VisitForAccumulatorValue(args->at(0)); | |
| 3730 | |
| 3731 ToNumberStub stub(isolate()); | |
| 3732 __ CallStub(&stub); | |
| 3733 context()->Plug(eax); | |
| 3734 } | |
| 3735 | |
| 3736 | |
| 3737 void FullCodeGenerator::EmitToName(CallRuntime* expr) { | 3685 void FullCodeGenerator::EmitToName(CallRuntime* expr) { |
| 3738 ZoneList<Expression*>* args = expr->arguments(); | 3686 ZoneList<Expression*>* args = expr->arguments(); |
| 3739 DCHECK_EQ(1, args->length()); | 3687 DCHECK_EQ(1, args->length()); |
| 3740 | 3688 |
| 3741 // Load the argument into eax and convert it. | 3689 // Load the argument into eax and convert it. |
| 3742 VisitForAccumulatorValue(args->at(0)); | 3690 VisitForAccumulatorValue(args->at(0)); |
| 3743 | 3691 |
| 3744 // Convert the object to a name. | 3692 // Convert the object to a name. |
| 3745 Label convert, done_convert; | 3693 Label convert, done_convert; |
| 3746 __ JumpIfSmi(eax, &convert, Label::kNear); | 3694 __ JumpIfSmi(eax, &convert, Label::kNear); |
| 3747 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 3695 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
| 3748 __ CmpObjectType(eax, LAST_NAME_TYPE, ecx); | 3696 __ CmpObjectType(eax, LAST_NAME_TYPE, ecx); |
| 3749 __ j(below_equal, &done_convert, Label::kNear); | 3697 __ j(below_equal, &done_convert, Label::kNear); |
| 3750 __ bind(&convert); | 3698 __ bind(&convert); |
| 3751 __ Push(eax); | 3699 __ Push(eax); |
| 3752 __ CallRuntime(Runtime::kToName, 1); | 3700 __ CallRuntime(Runtime::kToName, 1); |
| 3753 __ bind(&done_convert); | 3701 __ bind(&done_convert); |
| 3754 context()->Plug(eax); | 3702 context()->Plug(eax); |
| 3755 } | 3703 } |
| 3756 | 3704 |
| 3757 | 3705 |
| 3758 void FullCodeGenerator::EmitToObject(CallRuntime* expr) { | |
| 3759 ZoneList<Expression*>* args = expr->arguments(); | |
| 3760 DCHECK_EQ(1, args->length()); | |
| 3761 | |
| 3762 // Load the argument into eax and convert it. | |
| 3763 VisitForAccumulatorValue(args->at(0)); | |
| 3764 | |
| 3765 ToObjectStub stub(isolate()); | |
| 3766 __ CallStub(&stub); | |
| 3767 context()->Plug(eax); | |
| 3768 } | |
| 3769 | |
| 3770 | |
| 3771 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 3706 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
| 3772 ZoneList<Expression*>* args = expr->arguments(); | 3707 ZoneList<Expression*>* args = expr->arguments(); |
| 3773 DCHECK(args->length() == 1); | 3708 DCHECK(args->length() == 1); |
| 3774 | 3709 |
| 3775 VisitForAccumulatorValue(args->at(0)); | 3710 VisitForAccumulatorValue(args->at(0)); |
| 3776 | 3711 |
| 3777 Label done; | 3712 Label done; |
| 3778 StringCharFromCodeGenerator generator(eax, ebx); | 3713 StringCharFromCodeGenerator generator(eax, ebx); |
| 3779 generator.GenerateFast(masm_); | 3714 generator.GenerateFast(masm_); |
| 3780 __ jmp(&done); | 3715 __ jmp(&done); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3987 __ mov(edi, Operand(esp, eax, times_pointer_size, 0 * kPointerSize)); | 3922 __ mov(edi, Operand(esp, eax, times_pointer_size, 0 * kPointerSize)); |
| 3988 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | 3923 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
| 3989 | 3924 |
| 3990 // Restore context register. | 3925 // Restore context register. |
| 3991 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3926 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3992 | 3927 |
| 3993 context()->DropAndPlug(1, eax); | 3928 context()->DropAndPlug(1, eax); |
| 3994 } | 3929 } |
| 3995 | 3930 |
| 3996 | 3931 |
| 3997 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | |
| 3998 // Load the arguments on the stack and call the stub. | |
| 3999 RegExpConstructResultStub stub(isolate()); | |
| 4000 ZoneList<Expression*>* args = expr->arguments(); | |
| 4001 DCHECK(args->length() == 3); | |
| 4002 VisitForStackValue(args->at(0)); | |
| 4003 VisitForStackValue(args->at(1)); | |
| 4004 VisitForAccumulatorValue(args->at(2)); | |
| 4005 __ pop(ebx); | |
| 4006 __ pop(ecx); | |
| 4007 __ CallStub(&stub); | |
| 4008 context()->Plug(eax); | |
| 4009 } | |
| 4010 | |
| 4011 | |
| 4012 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3932 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
| 4013 ZoneList<Expression*>* args = expr->arguments(); | 3933 ZoneList<Expression*>* args = expr->arguments(); |
| 4014 DCHECK(args->length() == 1); | 3934 DCHECK(args->length() == 1); |
| 4015 | 3935 |
| 4016 VisitForAccumulatorValue(args->at(0)); | 3936 VisitForAccumulatorValue(args->at(0)); |
| 4017 | 3937 |
| 4018 __ AssertString(eax); | 3938 __ AssertString(eax); |
| 4019 | 3939 |
| 4020 Label materialize_true, materialize_false; | 3940 Label materialize_true, materialize_false; |
| 4021 Label* if_true = NULL; | 3941 Label* if_true = NULL; |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5175 Assembler::target_address_at(call_target_address, | 5095 Assembler::target_address_at(call_target_address, |
| 5176 unoptimized_code)); | 5096 unoptimized_code)); |
| 5177 return OSR_AFTER_STACK_CHECK; | 5097 return OSR_AFTER_STACK_CHECK; |
| 5178 } | 5098 } |
| 5179 | 5099 |
| 5180 | 5100 |
| 5181 } // namespace internal | 5101 } // namespace internal |
| 5182 } // namespace v8 | 5102 } // namespace v8 |
| 5183 | 5103 |
| 5184 #endif // V8_TARGET_ARCH_IA32 | 5104 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |