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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 3649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3660 // Convert the object to an integer. | 3660 // Convert the object to an integer. |
3661 Label done_convert; | 3661 Label done_convert; |
3662 __ JumpIfSmi(eax, &done_convert, Label::kNear); | 3662 __ JumpIfSmi(eax, &done_convert, Label::kNear); |
3663 __ Push(eax); | 3663 __ Push(eax); |
3664 __ CallRuntime(Runtime::kToInteger, 1); | 3664 __ CallRuntime(Runtime::kToInteger, 1); |
3665 __ bind(&done_convert); | 3665 __ bind(&done_convert); |
3666 context()->Plug(eax); | 3666 context()->Plug(eax); |
3667 } | 3667 } |
3668 | 3668 |
3669 | 3669 |
3670 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | |
3671 ZoneList<Expression*>* args = expr->arguments(); | |
3672 DCHECK_EQ(args->length(), 1); | |
3673 | |
3674 // Load the argument into eax and call the stub. | |
3675 VisitForAccumulatorValue(args->at(0)); | |
3676 | |
3677 NumberToStringStub stub(isolate()); | |
3678 __ CallStub(&stub); | |
3679 context()->Plug(eax); | |
3680 } | |
3681 | |
3682 | |
3683 void FullCodeGenerator::EmitToString(CallRuntime* expr) { | |
3684 ZoneList<Expression*>* args = expr->arguments(); | |
3685 DCHECK_EQ(1, args->length()); | |
3686 | |
3687 // Load the argument into eax and convert it. | |
3688 VisitForAccumulatorValue(args->at(0)); | |
3689 | |
3690 ToStringStub stub(isolate()); | |
3691 __ CallStub(&stub); | |
3692 context()->Plug(eax); | |
3693 } | |
3694 | |
3695 | |
3696 void FullCodeGenerator::EmitToNumber(CallRuntime* expr) { | |
3697 ZoneList<Expression*>* args = expr->arguments(); | |
3698 DCHECK_EQ(1, args->length()); | |
3699 | |
3700 // Load the argument into eax and convert it. | |
3701 VisitForAccumulatorValue(args->at(0)); | |
3702 | |
3703 ToNumberStub stub(isolate()); | |
3704 __ CallStub(&stub); | |
3705 context()->Plug(eax); | |
3706 } | |
3707 | |
3708 | |
3709 void FullCodeGenerator::EmitToName(CallRuntime* expr) { | 3670 void FullCodeGenerator::EmitToName(CallRuntime* expr) { |
3710 ZoneList<Expression*>* args = expr->arguments(); | 3671 ZoneList<Expression*>* args = expr->arguments(); |
3711 DCHECK_EQ(1, args->length()); | 3672 DCHECK_EQ(1, args->length()); |
3712 | 3673 |
3713 // Load the argument into eax and convert it. | 3674 // Load the argument into eax and convert it. |
3714 VisitForAccumulatorValue(args->at(0)); | 3675 VisitForAccumulatorValue(args->at(0)); |
3715 | 3676 |
3716 // Convert the object to a name. | 3677 // Convert the object to a name. |
3717 Label convert, done_convert; | 3678 Label convert, done_convert; |
3718 __ JumpIfSmi(eax, &convert, Label::kNear); | 3679 __ JumpIfSmi(eax, &convert, Label::kNear); |
3719 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 3680 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
3720 __ CmpObjectType(eax, LAST_NAME_TYPE, ecx); | 3681 __ CmpObjectType(eax, LAST_NAME_TYPE, ecx); |
3721 __ j(below_equal, &done_convert, Label::kNear); | 3682 __ j(below_equal, &done_convert, Label::kNear); |
3722 __ bind(&convert); | 3683 __ bind(&convert); |
3723 __ Push(eax); | 3684 __ Push(eax); |
3724 __ CallRuntime(Runtime::kToName, 1); | 3685 __ CallRuntime(Runtime::kToName, 1); |
3725 __ bind(&done_convert); | 3686 __ bind(&done_convert); |
3726 context()->Plug(eax); | 3687 context()->Plug(eax); |
3727 } | 3688 } |
3728 | 3689 |
3729 | 3690 |
3730 void FullCodeGenerator::EmitToObject(CallRuntime* expr) { | |
3731 ZoneList<Expression*>* args = expr->arguments(); | |
3732 DCHECK_EQ(1, args->length()); | |
3733 | |
3734 // Load the argument into eax and convert it. | |
3735 VisitForAccumulatorValue(args->at(0)); | |
3736 | |
3737 ToObjectStub stub(isolate()); | |
3738 __ CallStub(&stub); | |
3739 context()->Plug(eax); | |
3740 } | |
3741 | |
3742 | |
3743 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 3691 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
3744 ZoneList<Expression*>* args = expr->arguments(); | 3692 ZoneList<Expression*>* args = expr->arguments(); |
3745 DCHECK(args->length() == 1); | 3693 DCHECK(args->length() == 1); |
3746 | 3694 |
3747 VisitForAccumulatorValue(args->at(0)); | 3695 VisitForAccumulatorValue(args->at(0)); |
3748 | 3696 |
3749 Label done; | 3697 Label done; |
3750 StringCharFromCodeGenerator generator(eax, ebx); | 3698 StringCharFromCodeGenerator generator(eax, ebx); |
3751 generator.GenerateFast(masm_); | 3699 generator.GenerateFast(masm_); |
3752 __ jmp(&done); | 3700 __ jmp(&done); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3959 __ mov(edi, Operand(esp, eax, times_pointer_size, 0 * kPointerSize)); | 3907 __ mov(edi, Operand(esp, eax, times_pointer_size, 0 * kPointerSize)); |
3960 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | 3908 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
3961 | 3909 |
3962 // Restore context register. | 3910 // Restore context register. |
3963 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3911 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
3964 | 3912 |
3965 context()->DropAndPlug(1, eax); | 3913 context()->DropAndPlug(1, eax); |
3966 } | 3914 } |
3967 | 3915 |
3968 | 3916 |
3969 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | |
3970 // Load the arguments on the stack and call the stub. | |
3971 RegExpConstructResultStub stub(isolate()); | |
3972 ZoneList<Expression*>* args = expr->arguments(); | |
3973 DCHECK(args->length() == 3); | |
3974 VisitForStackValue(args->at(0)); | |
3975 VisitForStackValue(args->at(1)); | |
3976 VisitForAccumulatorValue(args->at(2)); | |
3977 __ pop(ebx); | |
3978 __ pop(ecx); | |
3979 __ CallStub(&stub); | |
3980 context()->Plug(eax); | |
3981 } | |
3982 | |
3983 | |
3984 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3917 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
3985 ZoneList<Expression*>* args = expr->arguments(); | 3918 ZoneList<Expression*>* args = expr->arguments(); |
3986 DCHECK(args->length() == 1); | 3919 DCHECK(args->length() == 1); |
3987 | 3920 |
3988 VisitForAccumulatorValue(args->at(0)); | 3921 VisitForAccumulatorValue(args->at(0)); |
3989 | 3922 |
3990 __ AssertString(eax); | 3923 __ AssertString(eax); |
3991 | 3924 |
3992 Label materialize_true, materialize_false; | 3925 Label materialize_true, materialize_false; |
3993 Label* if_true = NULL; | 3926 Label* if_true = NULL; |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5142 Assembler::target_address_at(call_target_address, | 5075 Assembler::target_address_at(call_target_address, |
5143 unoptimized_code)); | 5076 unoptimized_code)); |
5144 return OSR_AFTER_STACK_CHECK; | 5077 return OSR_AFTER_STACK_CHECK; |
5145 } | 5078 } |
5146 | 5079 |
5147 | 5080 |
5148 } // namespace internal | 5081 } // namespace internal |
5149 } // namespace v8 | 5082 } // namespace v8 |
5150 | 5083 |
5151 #endif // V8_TARGET_ARCH_X87 | 5084 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |