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

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

Issue 1336443002: X87: [runtime] Replace many buggy uses of %_CallFunction with %_Call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/x87/interface-descriptors-x87.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_X87 5 #if V8_TARGET_ARCH_X87
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 3937 matching lines...) Expand 10 before | Expand all | Expand 10 after
3948 VisitForStackValue(args->at(0)); 3948 VisitForStackValue(args->at(0));
3949 VisitForAccumulatorValue(args->at(1)); 3949 VisitForAccumulatorValue(args->at(1));
3950 3950
3951 __ pop(edx); 3951 __ pop(edx);
3952 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); 3952 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED);
3953 __ CallStub(&stub); 3953 __ CallStub(&stub);
3954 context()->Plug(eax); 3954 context()->Plug(eax);
3955 } 3955 }
3956 3956
3957 3957
3958 void FullCodeGenerator::EmitCall(CallRuntime* expr) {
3959 ZoneList<Expression*>* args = expr->arguments();
3960 DCHECK_LE(2, args->length());
3961 // Push target, receiver and arguments onto the stack.
3962 for (Expression* const arg : *args) {
3963 VisitForStackValue(arg);
3964 }
3965 // Move target to edi.
3966 int const argc = args->length() - 2;
3967 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize));
3968 // Call the target.
3969 __ mov(eax, Immediate(argc));
3970 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3971 // Restore context register.
3972 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3973 // Discard the function left on TOS.
3974 context()->DropAndPlug(1, eax);
3975 }
3976
3977
3958 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3978 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3959 ZoneList<Expression*>* args = expr->arguments(); 3979 ZoneList<Expression*>* args = expr->arguments();
3960 DCHECK(args->length() >= 2); 3980 DCHECK(args->length() >= 2);
3961 3981
3962 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3982 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3963 for (int i = 0; i < arg_count + 1; ++i) { 3983 for (int i = 0; i < arg_count + 1; ++i) {
3964 VisitForStackValue(args->at(i)); 3984 VisitForStackValue(args->at(i));
3965 } 3985 }
3966 VisitForAccumulatorValue(args->last()); // Function. 3986 VisitForAccumulatorValue(args->last()); // Function.
3967 3987
3968 Label runtime, done; 3988 Label runtime, done;
3969 // Check for non-function argument (including proxy). 3989 // Check for non-function argument (including proxy).
3970 __ JumpIfSmi(eax, &runtime); 3990 __ JumpIfSmi(eax, &runtime);
3971 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); 3991 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
3972 __ j(not_equal, &runtime); 3992 __ j(not_equal, &runtime);
3973 3993
3974 // InvokeFunction requires the function in edi. Move it in there. 3994 // InvokeFunction requires the function in edi. Move it in there.
3975 __ mov(edi, result_register()); 3995 __ mov(edi, result_register());
3976 ParameterCount count(arg_count); 3996 ParameterCount count(arg_count);
3977 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); 3997 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper());
3978 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 3998 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3979 __ jmp(&done); 3999 __ jmp(&done);
3980 4000
3981 __ bind(&runtime); 4001 __ bind(&runtime);
3982 __ push(eax); 4002 __ push(eax);
3983 __ CallRuntime(Runtime::kCall, args->length()); 4003 __ CallRuntime(Runtime::kCallFunction, args->length());
3984 __ bind(&done); 4004 __ bind(&done);
3985 4005
3986 context()->Plug(eax); 4006 context()->Plug(eax);
3987 } 4007 }
3988 4008
3989 4009
3990 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 4010 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
3991 ZoneList<Expression*>* args = expr->arguments(); 4011 ZoneList<Expression*>* args = expr->arguments();
3992 DCHECK(args->length() == 2); 4012 DCHECK(args->length() == 2);
3993 4013
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
5214 Assembler::target_address_at(call_target_address, 5234 Assembler::target_address_at(call_target_address,
5215 unoptimized_code)); 5235 unoptimized_code));
5216 return OSR_AFTER_STACK_CHECK; 5236 return OSR_AFTER_STACK_CHECK;
5217 } 5237 }
5218 5238
5219 5239
5220 } // namespace internal 5240 } // namespace internal
5221 } // namespace v8 5241 } // namespace v8
5222 5242
5223 #endif // V8_TARGET_ARCH_X87 5243 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698