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

Side by Side Diff: src/full-codegen/x64/full-codegen-x64.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/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/harmony-array.js » ('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_X64 5 #if V8_TARGET_ARCH_X64
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 3934 matching lines...) Expand 10 before | Expand all | Expand 10 after
3945 VisitForStackValue(args->at(0)); 3945 VisitForStackValue(args->at(0));
3946 VisitForAccumulatorValue(args->at(1)); 3946 VisitForAccumulatorValue(args->at(1));
3947 3947
3948 __ Pop(rdx); 3948 __ Pop(rdx);
3949 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); 3949 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED);
3950 __ CallStub(&stub); 3950 __ CallStub(&stub);
3951 context()->Plug(rax); 3951 context()->Plug(rax);
3952 } 3952 }
3953 3953
3954 3954
3955 void FullCodeGenerator::EmitCall(CallRuntime* expr) {
3956 ZoneList<Expression*>* args = expr->arguments();
3957 DCHECK_LE(2, args->length());
3958 // Push target, receiver and arguments onto the stack.
3959 for (Expression* const arg : *args) {
3960 VisitForStackValue(arg);
3961 }
3962 // Move target to rdi.
3963 int const argc = args->length() - 2;
3964 __ movp(rdi, Operand(rsp, (argc + 1) * kPointerSize));
3965 // Call the target.
3966 __ Set(rax, argc);
3967 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3968 // Restore context register.
3969 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3970 // Discard the function left on TOS.
3971 context()->DropAndPlug(1, rax);
3972 }
3973
3974
3955 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3975 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3956 ZoneList<Expression*>* args = expr->arguments(); 3976 ZoneList<Expression*>* args = expr->arguments();
3957 DCHECK(args->length() >= 2); 3977 DCHECK(args->length() >= 2);
3958 3978
3959 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3979 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3960 for (int i = 0; i < arg_count + 1; i++) { 3980 for (int i = 0; i < arg_count + 1; i++) {
3961 VisitForStackValue(args->at(i)); 3981 VisitForStackValue(args->at(i));
3962 } 3982 }
3963 VisitForAccumulatorValue(args->last()); // Function. 3983 VisitForAccumulatorValue(args->last()); // Function.
3964 3984
3965 Label runtime, done; 3985 Label runtime, done;
3966 // Check for non-function argument (including proxy). 3986 // Check for non-function argument (including proxy).
3967 __ JumpIfSmi(rax, &runtime); 3987 __ JumpIfSmi(rax, &runtime);
3968 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx); 3988 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx);
3969 __ j(not_equal, &runtime); 3989 __ j(not_equal, &runtime);
3970 3990
3971 // InvokeFunction requires the function in rdi. Move it in there. 3991 // InvokeFunction requires the function in rdi. Move it in there.
3972 __ movp(rdi, result_register()); 3992 __ movp(rdi, result_register());
3973 ParameterCount count(arg_count); 3993 ParameterCount count(arg_count);
3974 __ InvokeFunction(rdi, count, CALL_FUNCTION, NullCallWrapper()); 3994 __ InvokeFunction(rdi, count, CALL_FUNCTION, NullCallWrapper());
3975 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 3995 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3976 __ jmp(&done); 3996 __ jmp(&done);
3977 3997
3978 __ bind(&runtime); 3998 __ bind(&runtime);
3979 __ Push(rax); 3999 __ Push(rax);
3980 __ CallRuntime(Runtime::kCall, args->length()); 4000 __ CallRuntime(Runtime::kCallFunction, args->length());
3981 __ bind(&done); 4001 __ bind(&done);
3982 4002
3983 context()->Plug(rax); 4003 context()->Plug(rax);
3984 } 4004 }
3985 4005
3986 4006
3987 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 4007 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
3988 ZoneList<Expression*>* args = expr->arguments(); 4008 ZoneList<Expression*>* args = expr->arguments();
3989 DCHECK(args->length() == 2); 4009 DCHECK(args->length() == 2);
3990 4010
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
5235 Assembler::target_address_at(call_target_address, 5255 Assembler::target_address_at(call_target_address,
5236 unoptimized_code)); 5256 unoptimized_code));
5237 return OSR_AFTER_STACK_CHECK; 5257 return OSR_AFTER_STACK_CHECK;
5238 } 5258 }
5239 5259
5240 5260
5241 } // namespace internal 5261 } // namespace internal
5242 } // namespace v8 5262 } // namespace v8
5243 5263
5244 #endif // V8_TARGET_ARCH_X64 5264 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/harmony-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698