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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 3767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 // Convert the object to an integer. | 3778 // Convert the object to an integer. |
3779 Label done_convert; | 3779 Label done_convert; |
3780 __ JumpIfSmi(r0, &done_convert); | 3780 __ JumpIfSmi(r0, &done_convert); |
3781 __ Push(r0); | 3781 __ Push(r0); |
3782 __ CallRuntime(Runtime::kToInteger, 1); | 3782 __ CallRuntime(Runtime::kToInteger, 1); |
3783 __ bind(&done_convert); | 3783 __ bind(&done_convert); |
3784 context()->Plug(r0); | 3784 context()->Plug(r0); |
3785 } | 3785 } |
3786 | 3786 |
3787 | 3787 |
3788 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | |
3789 ZoneList<Expression*>* args = expr->arguments(); | |
3790 DCHECK_EQ(args->length(), 1); | |
3791 // Load the argument into r0 and call the stub. | |
3792 VisitForAccumulatorValue(args->at(0)); | |
3793 | |
3794 NumberToStringStub stub(isolate()); | |
3795 __ CallStub(&stub); | |
3796 context()->Plug(r0); | |
3797 } | |
3798 | |
3799 | |
3800 void FullCodeGenerator::EmitToLength(CallRuntime* expr) { | |
3801 ZoneList<Expression*>* args = expr->arguments(); | |
3802 DCHECK_EQ(1, args->length()); | |
3803 | |
3804 // Load the argument into r0 and convert it. | |
3805 VisitForAccumulatorValue(args->at(0)); | |
3806 | |
3807 ToLengthStub stub(isolate()); | |
3808 __ CallStub(&stub); | |
3809 context()->Plug(r0); | |
3810 } | |
3811 | |
3812 | |
3813 void FullCodeGenerator::EmitToString(CallRuntime* expr) { | |
3814 ZoneList<Expression*>* args = expr->arguments(); | |
3815 DCHECK_EQ(1, args->length()); | |
3816 | |
3817 // Load the argument into r0 and convert it. | |
3818 VisitForAccumulatorValue(args->at(0)); | |
3819 | |
3820 ToStringStub stub(isolate()); | |
3821 __ CallStub(&stub); | |
3822 context()->Plug(r0); | |
3823 } | |
3824 | |
3825 | |
3826 void FullCodeGenerator::EmitToNumber(CallRuntime* expr) { | |
3827 ZoneList<Expression*>* args = expr->arguments(); | |
3828 DCHECK_EQ(1, args->length()); | |
3829 | |
3830 // Load the argument into r0 and convert it. | |
3831 VisitForAccumulatorValue(args->at(0)); | |
3832 | |
3833 ToNumberStub stub(isolate()); | |
3834 __ CallStub(&stub); | |
3835 context()->Plug(r0); | |
3836 } | |
3837 | |
3838 | |
3839 void FullCodeGenerator::EmitToName(CallRuntime* expr) { | 3788 void FullCodeGenerator::EmitToName(CallRuntime* expr) { |
3840 ZoneList<Expression*>* args = expr->arguments(); | 3789 ZoneList<Expression*>* args = expr->arguments(); |
3841 DCHECK_EQ(1, args->length()); | 3790 DCHECK_EQ(1, args->length()); |
3842 | 3791 |
3843 // Load the argument into r0 and convert it. | 3792 // Load the argument into r0 and convert it. |
3844 VisitForAccumulatorValue(args->at(0)); | 3793 VisitForAccumulatorValue(args->at(0)); |
3845 | 3794 |
3846 Label convert, done_convert; | 3795 Label convert, done_convert; |
3847 __ JumpIfSmi(r0, &convert); | 3796 __ JumpIfSmi(r0, &convert); |
3848 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 3797 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
3849 __ CompareObjectType(r0, r1, r1, LAST_NAME_TYPE); | 3798 __ CompareObjectType(r0, r1, r1, LAST_NAME_TYPE); |
3850 __ b(ls, &done_convert); | 3799 __ b(ls, &done_convert); |
3851 __ bind(&convert); | 3800 __ bind(&convert); |
3852 __ Push(r0); | 3801 __ Push(r0); |
3853 __ CallRuntime(Runtime::kToName, 1); | 3802 __ CallRuntime(Runtime::kToName, 1); |
3854 __ bind(&done_convert); | 3803 __ bind(&done_convert); |
3855 context()->Plug(r0); | 3804 context()->Plug(r0); |
3856 } | 3805 } |
3857 | 3806 |
3858 | 3807 |
3859 void FullCodeGenerator::EmitToObject(CallRuntime* expr) { | |
3860 ZoneList<Expression*>* args = expr->arguments(); | |
3861 DCHECK_EQ(1, args->length()); | |
3862 | |
3863 // Load the argument into r0 and convert it. | |
3864 VisitForAccumulatorValue(args->at(0)); | |
3865 | |
3866 ToObjectStub stub(isolate()); | |
3867 __ CallStub(&stub); | |
3868 context()->Plug(r0); | |
3869 } | |
3870 | |
3871 | |
3872 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 3808 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
3873 ZoneList<Expression*>* args = expr->arguments(); | 3809 ZoneList<Expression*>* args = expr->arguments(); |
3874 DCHECK(args->length() == 1); | 3810 DCHECK(args->length() == 1); |
3875 VisitForAccumulatorValue(args->at(0)); | 3811 VisitForAccumulatorValue(args->at(0)); |
3876 | 3812 |
3877 Label done; | 3813 Label done; |
3878 StringCharFromCodeGenerator generator(r0, r1); | 3814 StringCharFromCodeGenerator generator(r0, r1); |
3879 generator.GenerateFast(masm_); | 3815 generator.GenerateFast(masm_); |
3880 __ jmp(&done); | 3816 __ jmp(&done); |
3881 | 3817 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4090 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 4026 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
4091 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | 4027 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
4092 | 4028 |
4093 // Restore context register. | 4029 // Restore context register. |
4094 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4030 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4095 | 4031 |
4096 context()->DropAndPlug(1, r0); | 4032 context()->DropAndPlug(1, r0); |
4097 } | 4033 } |
4098 | 4034 |
4099 | 4035 |
4100 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | |
4101 RegExpConstructResultStub stub(isolate()); | |
4102 ZoneList<Expression*>* args = expr->arguments(); | |
4103 DCHECK(args->length() == 3); | |
4104 VisitForStackValue(args->at(0)); | |
4105 VisitForStackValue(args->at(1)); | |
4106 VisitForAccumulatorValue(args->at(2)); | |
4107 __ pop(r1); | |
4108 __ pop(r2); | |
4109 __ CallStub(&stub); | |
4110 context()->Plug(r0); | |
4111 } | |
4112 | |
4113 | |
4114 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4036 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
4115 ZoneList<Expression*>* args = expr->arguments(); | 4037 ZoneList<Expression*>* args = expr->arguments(); |
4116 VisitForAccumulatorValue(args->at(0)); | 4038 VisitForAccumulatorValue(args->at(0)); |
4117 | 4039 |
4118 Label materialize_true, materialize_false; | 4040 Label materialize_true, materialize_false; |
4119 Label* if_true = NULL; | 4041 Label* if_true = NULL; |
4120 Label* if_false = NULL; | 4042 Label* if_false = NULL; |
4121 Label* fall_through = NULL; | 4043 Label* fall_through = NULL; |
4122 context()->PrepareTest(&materialize_true, &materialize_false, | 4044 context()->PrepareTest(&materialize_true, &materialize_false, |
4123 &if_true, &if_false, &fall_through); | 4045 &if_true, &if_false, &fall_through); |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5302 DCHECK(interrupt_address == | 5224 DCHECK(interrupt_address == |
5303 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5225 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5304 return OSR_AFTER_STACK_CHECK; | 5226 return OSR_AFTER_STACK_CHECK; |
5305 } | 5227 } |
5306 | 5228 |
5307 | 5229 |
5308 } // namespace internal | 5230 } // namespace internal |
5309 } // namespace v8 | 5231 } // namespace v8 |
5310 | 5232 |
5311 #endif // V8_TARGET_ARCH_ARM | 5233 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |