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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 1294113004: VM: Link native calls lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: added flag Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 6534500895f62217868e52a2c2d43f1998bfcfc2..48bc8efa0615afdefadaac11f707b9e5ef2ae7cc 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -828,11 +828,19 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else {
__ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize));
}
- __ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function())));
__ movl(EDX, Immediate(argc_tag));
- const StubEntry* stub_entry = (is_bootstrap_native() || is_leaf_call) ?
- StubCode::CallBootstrapCFunction_entry() :
- StubCode::CallNativeCFunction_entry();
+
+ const StubEntry* stub_entry;
+ if (link_lazily()) {
+ stub_entry = StubCode::CallBootstrapCFunction_entry();
+ __ movl(ECX, Immediate(NativeEntry::LinkNativeCallLabel().address()));
+ } else {
+ stub_entry = (is_bootstrap_native() || is_leaf_call) ?
+ StubCode::CallBootstrapCFunction_entry() :
+ StubCode::CallNativeCFunction_entry();
+ const ExternalLabel label(reinterpret_cast<uword>(native_c_function()));
+ __ movl(ECX, Immediate(label.address()));
+ }
compiler->GenerateCall(token_pos(),
*stub_entry,
RawPcDescriptors::kOther,

Powered by Google App Engine
This is Rietveld 408576698