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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_arm64.cc ('k') | runtime/vm/intermediate_language_mips.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 locs->set_out(0, Location::RegisterLocation(EAX)); 789 locs->set_out(0, Location::RegisterLocation(EAX));
790 return locs; 790 return locs;
791 } 791 }
792 792
793 793
794 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 794 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
795 ASSERT(locs()->temp(0).reg() == EAX); 795 ASSERT(locs()->temp(0).reg() == EAX);
796 ASSERT(locs()->temp(1).reg() == ECX); 796 ASSERT(locs()->temp(1).reg() == ECX);
797 ASSERT(locs()->temp(2).reg() == EDX); 797 ASSERT(locs()->temp(2).reg() == EDX);
798 Register result = locs()->out(0).reg(); 798 Register result = locs()->out(0).reg();
799 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
800 const bool is_leaf_call =
801 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
799 802
800 // Push the result place holder initialized to NULL. 803 // Push the result place holder initialized to NULL.
801 __ PushObject(Object::ZoneHandle()); 804 __ PushObject(Object::ZoneHandle());
802 // Pass a pointer to the first argument in EAX. 805 // Pass a pointer to the first argument in EAX.
803 if (!function().HasOptionalParameters()) { 806 if (!function().HasOptionalParameters()) {
804 __ leal(EAX, Address(EBP, (kParamEndSlotFromFp + 807 __ leal(EAX, Address(EBP, (kParamEndSlotFromFp +
805 function().NumParameters()) * kWordSize)); 808 function().NumParameters()) * kWordSize));
806 } else { 809 } else {
807 __ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); 810 __ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize));
808 } 811 }
809 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function()))); 812 __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function())));
810 __ movl(EDX, Immediate(NativeArguments::ComputeArgcTag(function()))); 813 __ movl(EDX, Immediate(argc_tag));
811 const ExternalLabel* stub_entry = 814 const ExternalLabel* stub_entry = (is_bootstrap_native() || is_leaf_call) ?
812 (is_bootstrap_native()) ? &StubCode::CallBootstrapCFunctionLabel() : 815 &StubCode::CallBootstrapCFunctionLabel() :
813 &StubCode::CallNativeCFunctionLabel(); 816 &StubCode::CallNativeCFunctionLabel();
814 compiler->GenerateCall(token_pos(), 817 compiler->GenerateCall(token_pos(),
815 stub_entry, 818 stub_entry,
816 PcDescriptors::kOther, 819 PcDescriptors::kOther,
817 locs()); 820 locs());
818 __ popl(result); 821 __ popl(result);
819 } 822 }
820 823
821 824
822 static bool CanBeImmediateIndex(Value* value, intptr_t cid) { 825 static bool CanBeImmediateIndex(Value* value, intptr_t cid) {
823 ConstantInstr* constant = value->definition()->AsConstant(); 826 ConstantInstr* constant = value->definition()->AsConstant();
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after
3318 } 3321 }
3319 3322
3320 3323
3321 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Isolate* isolate, 3324 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Isolate* isolate,
3322 bool opt) const { 3325 bool opt) const {
3323 intptr_t left_cid = left()->Type()->ToCid(); 3326 intptr_t left_cid = left()->Type()->ToCid();
3324 intptr_t right_cid = right()->Type()->ToCid(); 3327 intptr_t right_cid = right()->Type()->ToCid();
3325 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); 3328 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid));
3326 const intptr_t kNumInputs = 2; 3329 const intptr_t kNumInputs = 2;
3327 const bool need_temp = (left()->definition() != right()->definition()) 3330 const bool need_temp = (left()->definition() != right()->definition())
3328 &&(left_cid != kSmiCid) 3331 && (left_cid != kSmiCid)
3329 && (right_cid != kSmiCid); 3332 && (right_cid != kSmiCid);
3330 const intptr_t kNumTemps = need_temp ? 1 : 0; 3333 const intptr_t kNumTemps = need_temp ? 1 : 0;
3331 LocationSummary* summary = new(isolate) LocationSummary( 3334 LocationSummary* summary = new(isolate) LocationSummary(
3332 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3335 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3333 summary->set_in(0, Location::RequiresRegister()); 3336 summary->set_in(0, Location::RequiresRegister());
3334 summary->set_in(1, Location::RequiresRegister()); 3337 summary->set_in(1, Location::RequiresRegister());
3335 if (need_temp) summary->set_temp(0, Location::RequiresRegister()); 3338 if (need_temp) summary->set_temp(0, Location::RequiresRegister());
3336 return summary; 3339 return summary;
3337 } 3340 }
3338 3341
(...skipping 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after
6288 PcDescriptors::kOther, 6291 PcDescriptors::kOther,
6289 locs()); 6292 locs());
6290 __ Drop(ArgumentCount()); // Discard arguments. 6293 __ Drop(ArgumentCount()); // Discard arguments.
6291 } 6294 }
6292 6295
6293 } // namespace dart 6296 } // namespace dart
6294 6297
6295 #undef __ 6298 #undef __
6296 6299
6297 #endif // defined TARGET_ARCH_IA32 6300 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698