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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 3779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3790 // Convert the object to an integer. | 3790 // Convert the object to an integer. |
3791 Label done_convert; | 3791 Label done_convert; |
3792 __ JumpIfSmi(v0, &done_convert); | 3792 __ JumpIfSmi(v0, &done_convert); |
3793 __ Push(v0); | 3793 __ Push(v0); |
3794 __ CallRuntime(Runtime::kToInteger, 1); | 3794 __ CallRuntime(Runtime::kToInteger, 1); |
3795 __ bind(&done_convert); | 3795 __ bind(&done_convert); |
3796 context()->Plug(v0); | 3796 context()->Plug(v0); |
3797 } | 3797 } |
3798 | 3798 |
3799 | 3799 |
3800 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | |
3801 ZoneList<Expression*>* args = expr->arguments(); | |
3802 DCHECK_EQ(args->length(), 1); | |
3803 | |
3804 // Load the argument into a0 and call the stub. | |
3805 VisitForAccumulatorValue(args->at(0)); | |
3806 __ mov(a0, result_register()); | |
3807 | |
3808 NumberToStringStub stub(isolate()); | |
3809 __ CallStub(&stub); | |
3810 context()->Plug(v0); | |
3811 } | |
3812 | |
3813 | |
3814 void FullCodeGenerator::EmitToLength(CallRuntime* expr) { | |
3815 ZoneList<Expression*>* args = expr->arguments(); | |
3816 DCHECK_EQ(1, args->length()); | |
3817 | |
3818 // Load the argument into a0 and convert it. | |
3819 VisitForAccumulatorValue(args->at(0)); | |
3820 __ mov(a0, result_register()); | |
3821 | |
3822 ToLengthStub stub(isolate()); | |
3823 __ CallStub(&stub); | |
3824 context()->Plug(v0); | |
3825 } | |
3826 | |
3827 | |
3828 void FullCodeGenerator::EmitToString(CallRuntime* expr) { | |
3829 ZoneList<Expression*>* args = expr->arguments(); | |
3830 DCHECK_EQ(1, args->length()); | |
3831 | |
3832 // Load the argument into a0 and convert it. | |
3833 VisitForAccumulatorValue(args->at(0)); | |
3834 __ mov(a0, result_register()); | |
3835 | |
3836 ToStringStub stub(isolate()); | |
3837 __ CallStub(&stub); | |
3838 context()->Plug(v0); | |
3839 } | |
3840 | |
3841 | |
3842 void FullCodeGenerator::EmitToNumber(CallRuntime* expr) { | |
3843 ZoneList<Expression*>* args = expr->arguments(); | |
3844 DCHECK_EQ(1, args->length()); | |
3845 | |
3846 // Load the argument into a0 and convert it. | |
3847 VisitForAccumulatorValue(args->at(0)); | |
3848 __ mov(a0, result_register()); | |
3849 | |
3850 ToNumberStub stub(isolate()); | |
3851 __ CallStub(&stub); | |
3852 context()->Plug(v0); | |
3853 } | |
3854 | |
3855 | |
3856 void FullCodeGenerator::EmitToName(CallRuntime* expr) { | 3800 void FullCodeGenerator::EmitToName(CallRuntime* expr) { |
3857 ZoneList<Expression*>* args = expr->arguments(); | 3801 ZoneList<Expression*>* args = expr->arguments(); |
3858 DCHECK_EQ(1, args->length()); | 3802 DCHECK_EQ(1, args->length()); |
3859 | 3803 |
3860 // Load the argument into v0 and convert it. | 3804 // Load the argument into v0 and convert it. |
3861 VisitForAccumulatorValue(args->at(0)); | 3805 VisitForAccumulatorValue(args->at(0)); |
3862 | 3806 |
3863 Label convert, done_convert; | 3807 Label convert, done_convert; |
3864 __ JumpIfSmi(v0, &convert); | 3808 __ JumpIfSmi(v0, &convert); |
3865 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 3809 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
3866 __ GetObjectType(v0, a1, a1); | 3810 __ GetObjectType(v0, a1, a1); |
3867 __ Branch(&done_convert, le, a1, Operand(LAST_NAME_TYPE)); | 3811 __ Branch(&done_convert, le, a1, Operand(LAST_NAME_TYPE)); |
3868 __ bind(&convert); | 3812 __ bind(&convert); |
3869 __ Push(v0); | 3813 __ Push(v0); |
3870 __ CallRuntime(Runtime::kToName, 1); | 3814 __ CallRuntime(Runtime::kToName, 1); |
3871 __ bind(&done_convert); | 3815 __ bind(&done_convert); |
3872 context()->Plug(v0); | 3816 context()->Plug(v0); |
3873 } | 3817 } |
3874 | 3818 |
3875 | 3819 |
3876 void FullCodeGenerator::EmitToObject(CallRuntime* expr) { | |
3877 ZoneList<Expression*>* args = expr->arguments(); | |
3878 DCHECK_EQ(1, args->length()); | |
3879 | |
3880 // Load the argument into a0 and convert it. | |
3881 VisitForAccumulatorValue(args->at(0)); | |
3882 __ mov(a0, result_register()); | |
3883 | |
3884 ToObjectStub stub(isolate()); | |
3885 __ CallStub(&stub); | |
3886 context()->Plug(v0); | |
3887 } | |
3888 | |
3889 | |
3890 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 3820 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
3891 ZoneList<Expression*>* args = expr->arguments(); | 3821 ZoneList<Expression*>* args = expr->arguments(); |
3892 DCHECK(args->length() == 1); | 3822 DCHECK(args->length() == 1); |
3893 | 3823 |
3894 VisitForAccumulatorValue(args->at(0)); | 3824 VisitForAccumulatorValue(args->at(0)); |
3895 | 3825 |
3896 Label done; | 3826 Label done; |
3897 StringCharFromCodeGenerator generator(v0, a1); | 3827 StringCharFromCodeGenerator generator(v0, a1); |
3898 generator.GenerateFast(masm_); | 3828 generator.GenerateFast(masm_); |
3899 __ jmp(&done); | 3829 __ jmp(&done); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4118 __ lw(a1, MemOperand(at, 0)); | 4048 __ lw(a1, MemOperand(at, 0)); |
4119 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | 4049 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
4120 | 4050 |
4121 // Restore context register. | 4051 // Restore context register. |
4122 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4052 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4123 | 4053 |
4124 context()->DropAndPlug(1, result_register()); | 4054 context()->DropAndPlug(1, result_register()); |
4125 } | 4055 } |
4126 | 4056 |
4127 | 4057 |
4128 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | |
4129 RegExpConstructResultStub stub(isolate()); | |
4130 ZoneList<Expression*>* args = expr->arguments(); | |
4131 DCHECK(args->length() == 3); | |
4132 VisitForStackValue(args->at(0)); | |
4133 VisitForStackValue(args->at(1)); | |
4134 VisitForAccumulatorValue(args->at(2)); | |
4135 __ mov(a0, result_register()); | |
4136 __ pop(a1); | |
4137 __ pop(a2); | |
4138 __ CallStub(&stub); | |
4139 context()->Plug(v0); | |
4140 } | |
4141 | |
4142 | |
4143 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4058 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
4144 ZoneList<Expression*>* args = expr->arguments(); | 4059 ZoneList<Expression*>* args = expr->arguments(); |
4145 VisitForAccumulatorValue(args->at(0)); | 4060 VisitForAccumulatorValue(args->at(0)); |
4146 | 4061 |
4147 Label materialize_true, materialize_false; | 4062 Label materialize_true, materialize_false; |
4148 Label* if_true = NULL; | 4063 Label* if_true = NULL; |
4149 Label* if_false = NULL; | 4064 Label* if_false = NULL; |
4150 Label* fall_through = NULL; | 4065 Label* fall_through = NULL; |
4151 context()->PrepareTest(&materialize_true, &materialize_false, | 4066 context()->PrepareTest(&materialize_true, &materialize_false, |
4152 &if_true, &if_false, &fall_through); | 4067 &if_true, &if_false, &fall_through); |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5274 reinterpret_cast<uint32_t>( | 5189 reinterpret_cast<uint32_t>( |
5275 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5190 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5276 return OSR_AFTER_STACK_CHECK; | 5191 return OSR_AFTER_STACK_CHECK; |
5277 } | 5192 } |
5278 | 5193 |
5279 | 5194 |
5280 } // namespace internal | 5195 } // namespace internal |
5281 } // namespace v8 | 5196 } // namespace v8 |
5282 | 5197 |
5283 #endif // V8_TARGET_ARCH_MIPS | 5198 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |