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

Side by Side Diff: src/x64/macro-assembler-x64.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/x64/lithium-codegen-x64.cc ('k') | no next file » | 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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3614 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 Label* done, 3625 Label* done,
3626 bool* definitely_mismatches, 3626 bool* definitely_mismatches,
3627 InvokeFlag flag, 3627 InvokeFlag flag,
3628 Label::Distance near_jump, 3628 Label::Distance near_jump,
3629 const CallWrapper& call_wrapper) { 3629 const CallWrapper& call_wrapper) {
3630 bool definitely_matches = false; 3630 bool definitely_matches = false;
3631 *definitely_mismatches = false; 3631 *definitely_mismatches = false;
3632 Label invoke; 3632 Label invoke;
3633 if (expected.is_immediate()) { 3633 if (expected.is_immediate()) {
3634 DCHECK(actual.is_immediate()); 3634 DCHECK(actual.is_immediate());
3635 Set(rax, actual.immediate());
3635 if (expected.immediate() == actual.immediate()) { 3636 if (expected.immediate() == actual.immediate()) {
3636 definitely_matches = true; 3637 definitely_matches = true;
3637 } else { 3638 } else {
3638 Set(rax, actual.immediate());
3639 if (expected.immediate() == 3639 if (expected.immediate() ==
3640 SharedFunctionInfo::kDontAdaptArgumentsSentinel) { 3640 SharedFunctionInfo::kDontAdaptArgumentsSentinel) {
3641 // Don't worry about adapting arguments for built-ins that 3641 // Don't worry about adapting arguments for built-ins that
3642 // don't want that done. Skip adaption code by making it look 3642 // don't want that done. Skip adaption code by making it look
3643 // like we have a match between expected and actual number of 3643 // like we have a match between expected and actual number of
3644 // arguments. 3644 // arguments.
3645 definitely_matches = true; 3645 definitely_matches = true;
3646 } else { 3646 } else {
3647 *definitely_mismatches = true; 3647 *definitely_mismatches = true;
3648 Set(rbx, expected.immediate()); 3648 Set(rbx, expected.immediate());
3649 } 3649 }
3650 } 3650 }
3651 } else { 3651 } else {
3652 if (actual.is_immediate()) { 3652 if (actual.is_immediate()) {
3653 // Expected is in register, actual is immediate. This is the 3653 // Expected is in register, actual is immediate. This is the
3654 // case when we invoke function values without going through the 3654 // case when we invoke function values without going through the
3655 // IC mechanism. 3655 // IC mechanism.
3656 Set(rax, actual.immediate());
3656 cmpp(expected.reg(), Immediate(actual.immediate())); 3657 cmpp(expected.reg(), Immediate(actual.immediate()));
3657 j(equal, &invoke, Label::kNear); 3658 j(equal, &invoke, Label::kNear);
3658 DCHECK(expected.reg().is(rbx)); 3659 DCHECK(expected.reg().is(rbx));
3659 Set(rax, actual.immediate());
3660 } else if (!expected.reg().is(actual.reg())) { 3660 } else if (!expected.reg().is(actual.reg())) {
3661 // Both expected and actual are in (different) registers. This 3661 // Both expected and actual are in (different) registers. This
3662 // is the case when we invoke functions using call and apply. 3662 // is the case when we invoke functions using call and apply.
3663 cmpp(expected.reg(), actual.reg()); 3663 cmpp(expected.reg(), actual.reg());
3664 j(equal, &invoke, Label::kNear); 3664 j(equal, &invoke, Label::kNear);
3665 DCHECK(actual.reg().is(rax)); 3665 DCHECK(actual.reg().is(rax));
3666 DCHECK(expected.reg().is(rbx)); 3666 DCHECK(expected.reg().is(rbx));
3667 } else {
3668 Move(rax, actual.reg());
3667 } 3669 }
3668 } 3670 }
3669 3671
3670 if (!definitely_matches) { 3672 if (!definitely_matches) {
3671 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline(); 3673 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline();
3672 if (!code_constant.is_null()) { 3674 if (!code_constant.is_null()) {
3673 Move(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); 3675 Move(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT);
3674 addp(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 3676 addp(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag));
3675 } else if (!code_register.is(rdx)) { 3677 } else if (!code_register.is(rdx)) {
3676 movp(rdx, code_register); 3678 movp(rdx, code_register);
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
5065 movl(rax, dividend); 5067 movl(rax, dividend);
5066 shrl(rax, Immediate(31)); 5068 shrl(rax, Immediate(31));
5067 addl(rdx, rax); 5069 addl(rdx, rax);
5068 } 5070 }
5069 5071
5070 5072
5071 } // namespace internal 5073 } // namespace internal
5072 } // namespace v8 5074 } // namespace v8
5073 5075
5074 #endif // V8_TARGET_ARCH_X64 5076 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698