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

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

Issue 1335453002: X87: [calls] Consistent call protocol for calls. (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/macro-assembler-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/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 3593 matching lines...) Expand 10 before | Expand all | Expand 10 after
3604 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3604 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3605 bool can_invoke_directly = 3605 bool can_invoke_directly =
3606 dont_adapt_arguments || formal_parameter_count == arity; 3606 dont_adapt_arguments || formal_parameter_count == arity;
3607 3607
3608 Register function_reg = edi; 3608 Register function_reg = edi;
3609 3609
3610 if (can_invoke_directly) { 3610 if (can_invoke_directly) {
3611 // Change context. 3611 // Change context.
3612 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset)); 3612 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
3613 3613
3614 // Set eax to arguments count if adaption is not needed. Assumes that eax 3614 // Always initialize eax to the number of actual arguments.
3615 // is available to write to at this point. 3615 __ mov(eax, arity);
3616 if (dont_adapt_arguments) {
3617 __ mov(eax, arity);
3618 }
3619 3616
3620 // Invoke function directly. 3617 // Invoke function directly.
3621 if (function.is_identical_to(info()->closure())) { 3618 if (function.is_identical_to(info()->closure())) {
3622 __ CallSelf(); 3619 __ CallSelf();
3623 } else { 3620 } else {
3624 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset)); 3621 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset));
3625 } 3622 }
3626 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); 3623 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3627 } else { 3624 } else {
3628 // We need to adapt arguments. 3625 // We need to adapt arguments.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3670 } 3667 }
3671 generator.AfterCall(); 3668 generator.AfterCall();
3672 } 3669 }
3673 } 3670 }
3674 3671
3675 3672
3676 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { 3673 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
3677 DCHECK(ToRegister(instr->function()).is(edi)); 3674 DCHECK(ToRegister(instr->function()).is(edi));
3678 DCHECK(ToRegister(instr->result()).is(eax)); 3675 DCHECK(ToRegister(instr->result()).is(eax));
3679 3676
3680 if (instr->hydrogen()->pass_argument_count()) { 3677 __ mov(eax, instr->arity());
3681 __ mov(eax, instr->arity());
3682 }
3683 3678
3684 // Change context. 3679 // Change context.
3685 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 3680 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
3686 3681
3687 bool is_self_call = false; 3682 bool is_self_call = false;
3688 if (instr->hydrogen()->function()->IsConstant()) { 3683 if (instr->hydrogen()->function()->IsConstant()) {
3689 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); 3684 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
3690 Handle<JSFunction> jsfun = 3685 Handle<JSFunction> jsfun =
3691 Handle<JSFunction>::cast(fun_const->handle(isolate())); 3686 Handle<JSFunction>::cast(fun_const->handle(isolate()));
3692 is_self_call = jsfun.is_identical_to(info()->closure()); 3687 is_self_call = jsfun.is_identical_to(info()->closure());
(...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after
6369 RecordSafepoint(Safepoint::kNoLazyDeopt); 6364 RecordSafepoint(Safepoint::kNoLazyDeopt);
6370 } 6365 }
6371 6366
6372 6367
6373 #undef __ 6368 #undef __
6374 6369
6375 } // namespace internal 6370 } // namespace internal
6376 } // namespace v8 6371 } // namespace v8
6377 6372
6378 #endif // V8_TARGET_ARCH_X87 6373 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698