OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3788 // Convert the object to an integer. | 3788 // Convert the object to an integer. |
3789 Label done_convert; | 3789 Label done_convert; |
3790 __ JumpIfSmi(r3, &done_convert); | 3790 __ JumpIfSmi(r3, &done_convert); |
3791 __ Push(r3); | 3791 __ Push(r3); |
3792 __ CallRuntime(Runtime::kToInteger, 1); | 3792 __ CallRuntime(Runtime::kToInteger, 1); |
3793 __ bind(&done_convert); | 3793 __ bind(&done_convert); |
3794 context()->Plug(r3); | 3794 context()->Plug(r3); |
3795 } | 3795 } |
3796 | 3796 |
3797 | 3797 |
3798 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | |
3799 ZoneList<Expression*>* args = expr->arguments(); | |
3800 DCHECK_EQ(args->length(), 1); | |
3801 // Load the argument into r3 and call the stub. | |
3802 VisitForAccumulatorValue(args->at(0)); | |
3803 | |
3804 NumberToStringStub stub(isolate()); | |
3805 __ CallStub(&stub); | |
3806 context()->Plug(r3); | |
3807 } | |
3808 | |
3809 | |
3810 void FullCodeGenerator::EmitToString(CallRuntime* expr) { | |
3811 ZoneList<Expression*>* args = expr->arguments(); | |
3812 DCHECK_EQ(1, args->length()); | |
3813 | |
3814 // Load the argument into r3 and convert it. | |
3815 VisitForAccumulatorValue(args->at(0)); | |
3816 | |
3817 ToStringStub stub(isolate()); | |
3818 __ CallStub(&stub); | |
3819 context()->Plug(r3); | |
3820 } | |
3821 | |
3822 | |
3823 void FullCodeGenerator::EmitToNumber(CallRuntime* expr) { | |
3824 ZoneList<Expression*>* args = expr->arguments(); | |
3825 DCHECK_EQ(1, args->length()); | |
3826 | |
3827 // Load the argument into r3 and convert it. | |
3828 VisitForAccumulatorValue(args->at(0)); | |
3829 | |
3830 ToNumberStub stub(isolate()); | |
3831 __ CallStub(&stub); | |
3832 context()->Plug(r3); | |
3833 } | |
3834 | |
3835 | |
3836 void FullCodeGenerator::EmitToName(CallRuntime* expr) { | 3798 void FullCodeGenerator::EmitToName(CallRuntime* expr) { |
3837 ZoneList<Expression*>* args = expr->arguments(); | 3799 ZoneList<Expression*>* args = expr->arguments(); |
3838 DCHECK_EQ(1, args->length()); | 3800 DCHECK_EQ(1, args->length()); |
3839 | 3801 |
3840 // Load the argument into r3 and convert it. | 3802 // Load the argument into r3 and convert it. |
3841 VisitForAccumulatorValue(args->at(0)); | 3803 VisitForAccumulatorValue(args->at(0)); |
3842 | 3804 |
3843 Label convert, done_convert; | 3805 Label convert, done_convert; |
3844 __ JumpIfSmi(r3, &convert); | 3806 __ JumpIfSmi(r3, &convert); |
3845 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | 3807 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
3846 __ CompareObjectType(r3, r4, r4, LAST_NAME_TYPE); | 3808 __ CompareObjectType(r3, r4, r4, LAST_NAME_TYPE); |
3847 __ ble(&done_convert); | 3809 __ ble(&done_convert); |
3848 __ bind(&convert); | 3810 __ bind(&convert); |
3849 __ Push(r3); | 3811 __ Push(r3); |
3850 __ CallRuntime(Runtime::kToName, 1); | 3812 __ CallRuntime(Runtime::kToName, 1); |
3851 __ bind(&done_convert); | 3813 __ bind(&done_convert); |
3852 context()->Plug(r3); | 3814 context()->Plug(r3); |
3853 } | 3815 } |
3854 | 3816 |
3855 | 3817 |
3856 void FullCodeGenerator::EmitToObject(CallRuntime* expr) { | |
3857 ZoneList<Expression*>* args = expr->arguments(); | |
3858 DCHECK_EQ(1, args->length()); | |
3859 // Load the argument into r3 and convert it. | |
3860 VisitForAccumulatorValue(args->at(0)); | |
3861 | |
3862 ToObjectStub stub(isolate()); | |
3863 __ CallStub(&stub); | |
3864 context()->Plug(r3); | |
3865 } | |
3866 | |
3867 | |
3868 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 3818 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
3869 ZoneList<Expression*>* args = expr->arguments(); | 3819 ZoneList<Expression*>* args = expr->arguments(); |
3870 DCHECK(args->length() == 1); | 3820 DCHECK(args->length() == 1); |
3871 VisitForAccumulatorValue(args->at(0)); | 3821 VisitForAccumulatorValue(args->at(0)); |
3872 | 3822 |
3873 Label done; | 3823 Label done; |
3874 StringCharFromCodeGenerator generator(r3, r4); | 3824 StringCharFromCodeGenerator generator(r3, r4); |
3875 generator.GenerateFast(masm_); | 3825 generator.GenerateFast(masm_); |
3876 __ b(&done); | 3826 __ b(&done); |
3877 | 3827 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4080 __ bind(&args_set_up); | 4030 __ bind(&args_set_up); |
4081 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | 4031 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
4082 | 4032 |
4083 // Restore context register. | 4033 // Restore context register. |
4084 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4034 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4085 | 4035 |
4086 context()->DropAndPlug(1, r3); | 4036 context()->DropAndPlug(1, r3); |
4087 } | 4037 } |
4088 | 4038 |
4089 | 4039 |
4090 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | |
4091 RegExpConstructResultStub stub(isolate()); | |
4092 ZoneList<Expression*>* args = expr->arguments(); | |
4093 DCHECK(args->length() == 3); | |
4094 VisitForStackValue(args->at(0)); | |
4095 VisitForStackValue(args->at(1)); | |
4096 VisitForAccumulatorValue(args->at(2)); | |
4097 __ Pop(r5, r4); | |
4098 __ CallStub(&stub); | |
4099 context()->Plug(r3); | |
4100 } | |
4101 | |
4102 | |
4103 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 4040 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
4104 ZoneList<Expression*>* args = expr->arguments(); | 4041 ZoneList<Expression*>* args = expr->arguments(); |
4105 VisitForAccumulatorValue(args->at(0)); | 4042 VisitForAccumulatorValue(args->at(0)); |
4106 | 4043 |
4107 Label materialize_true, materialize_false; | 4044 Label materialize_true, materialize_false; |
4108 Label* if_true = NULL; | 4045 Label* if_true = NULL; |
4109 Label* if_false = NULL; | 4046 Label* if_false = NULL; |
4110 Label* fall_through = NULL; | 4047 Label* fall_through = NULL; |
4111 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 4048 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
4112 &if_false, &fall_through); | 4049 &if_false, &fall_through); |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5238 return ON_STACK_REPLACEMENT; | 5175 return ON_STACK_REPLACEMENT; |
5239 } | 5176 } |
5240 | 5177 |
5241 DCHECK(interrupt_address == | 5178 DCHECK(interrupt_address == |
5242 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5179 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5243 return OSR_AFTER_STACK_CHECK; | 5180 return OSR_AFTER_STACK_CHECK; |
5244 } | 5181 } |
5245 } // namespace internal | 5182 } // namespace internal |
5246 } // namespace v8 | 5183 } // namespace v8 |
5247 #endif // V8_TARGET_ARCH_PPC | 5184 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |