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

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 315223003: Use CallBootstrapC stub for leaf native calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/stub_code_arm.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 locs->set_out(0, Location::RegisterLocation(RAX)); 716 locs->set_out(0, Location::RegisterLocation(RAX));
717 return locs; 717 return locs;
718 } 718 }
719 719
720 720
721 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 721 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
722 ASSERT(locs()->temp(0).reg() == RAX); 722 ASSERT(locs()->temp(0).reg() == RAX);
723 ASSERT(locs()->temp(1).reg() == RBX); 723 ASSERT(locs()->temp(1).reg() == RBX);
724 ASSERT(locs()->temp(2).reg() == R10); 724 ASSERT(locs()->temp(2).reg() == R10);
725 Register result = locs()->out(0).reg(); 725 Register result = locs()->out(0).reg();
726 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
727 const bool is_leaf_call =
728 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
726 729
727 // Push the result place holder initialized to NULL. 730 // Push the result place holder initialized to NULL.
728 __ PushObject(Object::ZoneHandle(), PP); 731 __ PushObject(Object::ZoneHandle(), PP);
729 // Pass a pointer to the first argument in RAX. 732 // Pass a pointer to the first argument in RAX.
730 if (!function().HasOptionalParameters()) { 733 if (!function().HasOptionalParameters()) {
731 __ leaq(RAX, Address(RBP, (kParamEndSlotFromFp + 734 __ leaq(RAX, Address(RBP, (kParamEndSlotFromFp +
732 function().NumParameters()) * kWordSize)); 735 function().NumParameters()) * kWordSize));
733 } else { 736 } else {
734 __ leaq(RAX, 737 __ leaq(RAX,
735 Address(RBP, kFirstLocalSlotFromFp * kWordSize)); 738 Address(RBP, kFirstLocalSlotFromFp * kWordSize));
736 } 739 }
737 __ LoadImmediate( 740 __ LoadImmediate(
738 RBX, Immediate(reinterpret_cast<uword>(native_c_function())), PP); 741 RBX, Immediate(reinterpret_cast<uword>(native_c_function())), PP);
739 __ LoadImmediate( 742 __ LoadImmediate(
740 R10, Immediate(NativeArguments::ComputeArgcTag(function())), PP); 743 R10, Immediate(argc_tag), PP);
741 const ExternalLabel* stub_entry = 744 const ExternalLabel* stub_entry = (is_bootstrap_native() || is_leaf_call) ?
742 (is_bootstrap_native()) ? &StubCode::CallBootstrapCFunctionLabel() : 745 &StubCode::CallBootstrapCFunctionLabel() :
743 &StubCode::CallNativeCFunctionLabel(); 746 &StubCode::CallNativeCFunctionLabel();
744 compiler->GenerateCall(token_pos(), 747 compiler->GenerateCall(token_pos(),
745 stub_entry, 748 stub_entry,
746 PcDescriptors::kOther, 749 PcDescriptors::kOther,
747 locs()); 750 locs());
748 __ popq(result); 751 __ popq(result);
749 } 752 }
750 753
751 754
752 static bool CanBeImmediateIndex(Value* index, intptr_t cid) { 755 static bool CanBeImmediateIndex(Value* index, intptr_t cid) {
753 if (!index->definition()->IsConstant()) return false; 756 if (!index->definition()->IsConstant()) return false;
(...skipping 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after
5817 PcDescriptors::kOther, 5820 PcDescriptors::kOther,
5818 locs()); 5821 locs());
5819 __ Drop(ArgumentCount()); // Discard arguments. 5822 __ Drop(ArgumentCount()); // Discard arguments.
5820 } 5823 }
5821 5824
5822 } // namespace dart 5825 } // namespace dart
5823 5826
5824 #undef __ 5827 #undef __
5825 5828
5826 #endif // defined TARGET_ARCH_X64 5829 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698