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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 1553703002: [runtime] TailCallRuntime and CallRuntime should use default argument counts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-12-29_TailCallRuntime_default_result_size_1_1550923002
Patch Set: Created 4 years, 11 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
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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 void MacroAssembler::CallExternalReference(const ExternalReference& ext, 655 void MacroAssembler::CallExternalReference(const ExternalReference& ext,
656 int num_arguments) { 656 int num_arguments) {
657 Set(rax, num_arguments); 657 Set(rax, num_arguments);
658 LoadAddress(rbx, ext); 658 LoadAddress(rbx, ext);
659 659
660 CEntryStub stub(isolate(), 1); 660 CEntryStub stub(isolate(), 1);
661 CallStub(&stub); 661 CallStub(&stub);
662 } 662 }
663 663
664 664
665 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, 665 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
666 int num_arguments) {
667 // ----------- S t a t e ------------- 666 // ----------- S t a t e -------------
668 // -- rsp[0] : return address 667 // -- rsp[0] : return address
669 // -- rsp[8] : argument num_arguments - 1 668 // -- rsp[8] : argument num_arguments - 1
670 // ... 669 // ...
671 // -- rsp[8 * num_arguments] : argument 0 (receiver) 670 // -- rsp[8 * num_arguments] : argument 0 (receiver)
671 //
672 // For runtime functions with variable arguments:
673 // -- rax : number of arguments
672 // ----------------------------------- 674 // -----------------------------------
673 675
674 // TODO(1236192): Most runtime routines don't need the number of 676 const Runtime::Function* function = Runtime::FunctionForId(fid);
675 // arguments passed in because it is constant. At some point we 677 DCHECK_EQ(1, function->result_size);
676 // should remove this need and make the runtime routine entry code 678 if (function->nargs >= 0) {
Igor Sheludko 2015/12/30 14:48:18 Ditto.
677 // smarter. 679 Set(rax, function->nargs);
678 Set(rax, num_arguments); 680 }
679 JumpToExternalReference(ext); 681 JumpToExternalReference(ExternalReference(fid, isolate()));
680 } 682 }
681 683
682 684
683 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid,
684 int num_arguments) {
685 TailCallExternalReference(ExternalReference(fid, isolate()), num_arguments);
686 }
687
688
689 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { 685 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) {
690 // Set the entry point and jump to the C entry runtime stub. 686 // Set the entry point and jump to the C entry runtime stub.
691 LoadAddress(rbx, ext); 687 LoadAddress(rbx, ext);
692 CEntryStub ces(isolate(), 1); 688 CEntryStub ces(isolate(), 1);
693 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); 689 jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
694 } 690 }
695 691
696 692
697 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, 693 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag,
698 const CallWrapper& call_wrapper) { 694 const CallWrapper& call_wrapper) {
(...skipping 4765 matching lines...) Expand 10 before | Expand all | Expand 10 after
5464 movl(rax, dividend); 5460 movl(rax, dividend);
5465 shrl(rax, Immediate(31)); 5461 shrl(rax, Immediate(31));
5466 addl(rdx, rax); 5462 addl(rdx, rax);
5467 } 5463 }
5468 5464
5469 5465
5470 } // namespace internal 5466 } // namespace internal
5471 } // namespace v8 5467 } // namespace v8
5472 5468
5473 #endif // V8_TARGET_ARCH_X64 5469 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698