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