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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 1330033002: [calls] Consistent call protocol for calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add arm64, mips and mips64 ports. 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/hydrogen-instructions.cc ('k') | src/ia32/macro-assembler-ia32.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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3333 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3333 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3334 bool can_invoke_directly = 3334 bool can_invoke_directly =
3335 dont_adapt_arguments || formal_parameter_count == arity; 3335 dont_adapt_arguments || formal_parameter_count == arity;
3336 3336
3337 Register function_reg = edi; 3337 Register function_reg = edi;
3338 3338
3339 if (can_invoke_directly) { 3339 if (can_invoke_directly) {
3340 // Change context. 3340 // Change context.
3341 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); 3341 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
3342 3342
3343 // Set eax to arguments count if adaption is not needed. Assumes that eax 3343 // Always initialize eax to the number of actual arguments.
3344 // is available to write to at this point. 3344 __ mov(eax, arity);
3345 if (dont_adapt_arguments) {
3346 __ mov(eax, arity);
3347 }
3348 3345
3349 // Invoke function directly. 3346 // Invoke function directly.
3350 if (function.is_identical_to(info()->closure())) { 3347 if (function.is_identical_to(info()->closure())) {
3351 __ CallSelf(); 3348 __ CallSelf();
3352 } else { 3349 } else {
3353 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); 3350 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset));
3354 } 3351 }
3355 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); 3352 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3356 } else { 3353 } else {
3357 // We need to adapt arguments. 3354 // We need to adapt arguments.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3399 } 3396 }
3400 generator.AfterCall(); 3397 generator.AfterCall();
3401 } 3398 }
3402 } 3399 }
3403 3400
3404 3401
3405 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { 3402 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
3406 DCHECK(ToRegister(instr->function()).is(edi)); 3403 DCHECK(ToRegister(instr->function()).is(edi));
3407 DCHECK(ToRegister(instr->result()).is(eax)); 3404 DCHECK(ToRegister(instr->result()).is(eax));
3408 3405
3409 if (instr->hydrogen()->pass_argument_count()) { 3406 __ mov(eax, instr->arity());
3410 __ mov(eax, instr->arity());
3411 }
3412 3407
3413 // Change context. 3408 // Change context.
3414 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 3409 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
3415 3410
3416 bool is_self_call = false; 3411 bool is_self_call = false;
3417 if (instr->hydrogen()->function()->IsConstant()) { 3412 if (instr->hydrogen()->function()->IsConstant()) {
3418 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); 3413 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
3419 Handle<JSFunction> jsfun = 3414 Handle<JSFunction> jsfun =
3420 Handle<JSFunction>::cast(fun_const->handle(isolate())); 3415 Handle<JSFunction>::cast(fun_const->handle(isolate()));
3421 is_self_call = jsfun.is_identical_to(info()->closure()); 3416 is_self_call = jsfun.is_identical_to(info()->closure());
(...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after
5754 RecordSafepoint(Safepoint::kNoLazyDeopt); 5749 RecordSafepoint(Safepoint::kNoLazyDeopt);
5755 } 5750 }
5756 5751
5757 5752
5758 #undef __ 5753 #undef __
5759 5754
5760 } // namespace internal 5755 } // namespace internal
5761 } // namespace v8 5756 } // namespace v8
5762 5757
5763 #endif // V8_TARGET_ARCH_IA32 5758 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698