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/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 4038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4049 VisitForStackValue(args->at(0)); | 4049 VisitForStackValue(args->at(0)); |
4050 VisitForAccumulatorValue(args->at(1)); | 4050 VisitForAccumulatorValue(args->at(1)); |
4051 | 4051 |
4052 __ pop(r4); | 4052 __ pop(r4); |
4053 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); | 4053 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); |
4054 __ CallStub(&stub); | 4054 __ CallStub(&stub); |
4055 context()->Plug(r3); | 4055 context()->Plug(r3); |
4056 } | 4056 } |
4057 | 4057 |
4058 | 4058 |
| 4059 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 4060 ZoneList<Expression*>* args = expr->arguments(); |
| 4061 DCHECK_LE(2, args->length()); |
| 4062 // Push target, receiver and arguments onto the stack. |
| 4063 for (Expression* const arg : *args) { |
| 4064 VisitForStackValue(arg); |
| 4065 } |
| 4066 // Move target to r4. |
| 4067 int const argc = args->length() - 2; |
| 4068 __ LoadP(r4, MemOperand(sp, (argc + 1) * kPointerSize)); |
| 4069 // Call the target. |
| 4070 __ mov(r3, Operand(argc)); |
| 4071 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 4072 // Restore context register. |
| 4073 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 4074 // Discard the function left on TOS. |
| 4075 context()->DropAndPlug(1, r3); |
| 4076 } |
| 4077 |
| 4078 |
4059 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 4079 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
4060 ZoneList<Expression*>* args = expr->arguments(); | 4080 ZoneList<Expression*>* args = expr->arguments(); |
4061 DCHECK(args->length() >= 2); | 4081 DCHECK(args->length() >= 2); |
4062 | 4082 |
4063 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 4083 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
4064 for (int i = 0; i < arg_count + 1; i++) { | 4084 for (int i = 0; i < arg_count + 1; i++) { |
4065 VisitForStackValue(args->at(i)); | 4085 VisitForStackValue(args->at(i)); |
4066 } | 4086 } |
4067 VisitForAccumulatorValue(args->last()); // Function. | 4087 VisitForAccumulatorValue(args->last()); // Function. |
4068 | 4088 |
4069 Label runtime, done; | 4089 Label runtime, done; |
4070 // Check for non-function argument (including proxy). | 4090 // Check for non-function argument (including proxy). |
4071 __ JumpIfSmi(r3, &runtime); | 4091 __ JumpIfSmi(r3, &runtime); |
4072 __ CompareObjectType(r3, r4, r4, JS_FUNCTION_TYPE); | 4092 __ CompareObjectType(r3, r4, r4, JS_FUNCTION_TYPE); |
4073 __ bne(&runtime); | 4093 __ bne(&runtime); |
4074 | 4094 |
4075 // InvokeFunction requires the function in r4. Move it in there. | 4095 // InvokeFunction requires the function in r4. Move it in there. |
4076 __ mr(r4, result_register()); | 4096 __ mr(r4, result_register()); |
4077 ParameterCount count(arg_count); | 4097 ParameterCount count(arg_count); |
4078 __ InvokeFunction(r4, count, CALL_FUNCTION, NullCallWrapper()); | 4098 __ InvokeFunction(r4, count, CALL_FUNCTION, NullCallWrapper()); |
4079 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4099 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4080 __ b(&done); | 4100 __ b(&done); |
4081 | 4101 |
4082 __ bind(&runtime); | 4102 __ bind(&runtime); |
4083 __ push(r3); | 4103 __ push(r3); |
4084 __ CallRuntime(Runtime::kCall, args->length()); | 4104 __ CallRuntime(Runtime::kCallFunction, args->length()); |
4085 __ bind(&done); | 4105 __ bind(&done); |
4086 | 4106 |
4087 context()->Plug(r3); | 4107 context()->Plug(r3); |
4088 } | 4108 } |
4089 | 4109 |
4090 | 4110 |
4091 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 4111 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
4092 ZoneList<Expression*>* args = expr->arguments(); | 4112 ZoneList<Expression*>* args = expr->arguments(); |
4093 DCHECK(args->length() == 2); | 4113 DCHECK(args->length() == 2); |
4094 | 4114 |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5294 return ON_STACK_REPLACEMENT; | 5314 return ON_STACK_REPLACEMENT; |
5295 } | 5315 } |
5296 | 5316 |
5297 DCHECK(interrupt_address == | 5317 DCHECK(interrupt_address == |
5298 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5318 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5299 return OSR_AFTER_STACK_CHECK; | 5319 return OSR_AFTER_STACK_CHECK; |
5300 } | 5320 } |
5301 } // namespace internal | 5321 } // namespace internal |
5302 } // namespace v8 | 5322 } // namespace v8 |
5303 #endif // V8_TARGET_ARCH_PPC | 5323 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |