Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: src/full-codegen/arm/full-codegen-arm.cc

Issue 1325573004: [runtime] Replace many buggy uses of %_CallFunction with %_Call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address feedback. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler.h" 10 #include "src/compiler.h"
(...skipping 4038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4049 VisitForStackValue(args->at(0)); 4049 VisitForStackValue(args->at(0));
4050 VisitForAccumulatorValue(args->at(1)); 4050 VisitForAccumulatorValue(args->at(1));
4051 4051
4052 __ pop(r1); 4052 __ pop(r1);
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(r0); 4055 context()->Plug(r0);
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 r1.
4067 int const argc = args->length() - 2;
4068 __ ldr(r1, MemOperand(sp, (argc + 1) * kPointerSize));
4069 // Call the target.
4070 __ mov(r0, Operand(argc));
4071 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
4072 // Restore context register.
4073 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4074 // Discard the function left on TOS.
4075 context()->DropAndPlug(1, r0);
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(r0, &runtime); 4091 __ JumpIfSmi(r0, &runtime);
4072 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); 4092 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE);
4073 __ b(ne, &runtime); 4093 __ b(ne, &runtime);
4074 4094
4075 // InvokeFunction requires the function in r1. Move it in there. 4095 // InvokeFunction requires the function in r1. Move it in there.
4076 __ mov(r1, result_register()); 4096 __ mov(r1, result_register());
4077 ParameterCount count(arg_count); 4097 ParameterCount count(arg_count);
4078 __ InvokeFunction(r1, count, CALL_FUNCTION, NullCallWrapper()); 4098 __ InvokeFunction(r1, count, CALL_FUNCTION, NullCallWrapper());
4079 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4099 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4080 __ jmp(&done); 4100 __ jmp(&done);
4081 4101
4082 __ bind(&runtime); 4102 __ bind(&runtime);
4083 __ push(r0); 4103 __ push(r0);
4084 __ CallRuntime(Runtime::kCall, args->length()); 4104 __ CallRuntime(Runtime::kCallFunction, args->length());
4085 __ bind(&done); 4105 __ bind(&done);
4086 4106
4087 context()->Plug(r0); 4107 context()->Plug(r0);
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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
5348 DCHECK(interrupt_address == 5368 DCHECK(interrupt_address ==
5349 isolate->builtins()->OsrAfterStackCheck()->entry()); 5369 isolate->builtins()->OsrAfterStackCheck()->entry());
5350 return OSR_AFTER_STACK_CHECK; 5370 return OSR_AFTER_STACK_CHECK;
5351 } 5371 }
5352 5372
5353 5373
5354 } // namespace internal 5374 } // namespace internal
5355 } // namespace v8 5375 } // namespace v8
5356 5376
5357 #endif // V8_TARGET_ARCH_ARM 5377 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698