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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.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_IA32 5 #if V8_TARGET_ARCH_IA32
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 3947 matching lines...) Expand 10 before | Expand all | Expand 10 after
3958 VisitForStackValue(args->at(0)); 3958 VisitForStackValue(args->at(0));
3959 VisitForAccumulatorValue(args->at(1)); 3959 VisitForAccumulatorValue(args->at(1));
3960 3960
3961 __ pop(edx); 3961 __ pop(edx);
3962 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED); 3962 StringAddStub stub(isolate(), STRING_ADD_CHECK_BOTH, NOT_TENURED);
3963 __ CallStub(&stub); 3963 __ CallStub(&stub);
3964 context()->Plug(eax); 3964 context()->Plug(eax);
3965 } 3965 }
3966 3966
3967 3967
3968 void FullCodeGenerator::EmitCall(CallRuntime* expr) {
3969 ZoneList<Expression*>* args = expr->arguments();
3970 DCHECK_LE(2, args->length());
3971 // Push target, receiver and arguments onto the stack.
3972 for (Expression* const arg : *args) {
3973 VisitForStackValue(arg);
3974 }
3975 // Move target to edi.
3976 int const argc = args->length() - 2;
3977 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize));
3978 // Call the target.
3979 __ mov(eax, Immediate(argc));
3980 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3981 // Restore context register.
3982 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3983 // Discard the function left on TOS.
3984 context()->DropAndPlug(1, eax);
3985 }
3986
3987
3968 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3988 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3969 ZoneList<Expression*>* args = expr->arguments(); 3989 ZoneList<Expression*>* args = expr->arguments();
3970 DCHECK(args->length() >= 2); 3990 DCHECK(args->length() >= 2);
3971 3991
3972 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3992 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3973 for (int i = 0; i < arg_count + 1; ++i) { 3993 for (int i = 0; i < arg_count + 1; ++i) {
3974 VisitForStackValue(args->at(i)); 3994 VisitForStackValue(args->at(i));
3975 } 3995 }
3976 VisitForAccumulatorValue(args->last()); // Function. 3996 VisitForAccumulatorValue(args->last()); // Function.
3977 3997
3978 Label runtime, done; 3998 Label runtime, done;
3979 // Check for non-function argument (including proxy). 3999 // Check for non-function argument (including proxy).
3980 __ JumpIfSmi(eax, &runtime); 4000 __ JumpIfSmi(eax, &runtime);
3981 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); 4001 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
3982 __ j(not_equal, &runtime); 4002 __ j(not_equal, &runtime);
3983 4003
3984 // InvokeFunction requires the function in edi. Move it in there. 4004 // InvokeFunction requires the function in edi. Move it in there.
3985 __ mov(edi, result_register()); 4005 __ mov(edi, result_register());
3986 ParameterCount count(arg_count); 4006 ParameterCount count(arg_count);
3987 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); 4007 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper());
3988 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 4008 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3989 __ jmp(&done); 4009 __ jmp(&done);
3990 4010
3991 __ bind(&runtime); 4011 __ bind(&runtime);
3992 __ push(eax); 4012 __ push(eax);
3993 __ CallRuntime(Runtime::kCall, args->length()); 4013 __ CallRuntime(Runtime::kCallFunction, args->length());
3994 __ bind(&done); 4014 __ bind(&done);
3995 4015
3996 context()->Plug(eax); 4016 context()->Plug(eax);
3997 } 4017 }
3998 4018
3999 4019
4000 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 4020 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
4001 ZoneList<Expression*>* args = expr->arguments(); 4021 ZoneList<Expression*>* args = expr->arguments();
4002 DCHECK(args->length() == 2); 4022 DCHECK(args->length() == 2);
4003 4023
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
5228 Assembler::target_address_at(call_target_address, 5248 Assembler::target_address_at(call_target_address,
5229 unoptimized_code)); 5249 unoptimized_code));
5230 return OSR_AFTER_STACK_CHECK; 5250 return OSR_AFTER_STACK_CHECK;
5231 } 5251 }
5232 5252
5233 5253
5234 } // namespace internal 5254 } // namespace internal
5235 } // namespace v8 5255 } // namespace v8
5236 5256
5237 #endif // V8_TARGET_ARCH_IA32 5257 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698