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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 10509004: Implement AllocateContextComp, ChainContext, CloneContext on ia32 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index ed4c990f4bb1cc35c6a275b2e3555caa00e0ce77..bf11b76464b4e4ea41510a16ad17118d3f43647a 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -647,32 +647,63 @@ void ExtractConstructorInstantiatorComp::EmitNativeCode(
LocationSummary* AllocateContextComp::MakeLocationSummary() const {
- return NULL;
+ const intptr_t kNumInputs = 0;
+ const intptr_t kNumTemps = 1;
+ LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
+ locs->set_temp(0, Location::RegisterLocation(EDX));
+ locs->set_out(Location::RegisterLocation(EAX));
+ return locs;
}
void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ ASSERT(locs()->temp(0).reg() == EDX);
+ ASSERT(locs()->out().reg() == EAX);
+
+ __ movl(EDX, Immediate(num_context_variables()));
+ const ExternalLabel label("alloc_context",
+ StubCode::AllocateContextEntryPoint());
+ compiler->GenerateCall(token_index(),
+ try_index(),
+ &label,
+ PcDescriptors::kOther);
}
LocationSummary* ChainContextComp::MakeLocationSummary() const {
- return NULL;
+ return LocationSummary::Make(1, Location::NoLocation());
}
void ChainContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register context_value = locs()->in(0).reg();
+
+ // Chain the new context in context_value to its parent in CTX.
+ __ StoreIntoObject(context_value,
+ FieldAddress(context_value, Context::parent_offset()),
+ CTX);
+ // Set new context as current context.
+ __ movl(CTX, context_value);
}
LocationSummary* CloneContextComp::MakeLocationSummary() const {
- return NULL;
+ return LocationSummary::Make(1, Location::RequiresRegister());
}
void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register context_value = locs()->in(0).reg();
+ Register result = locs()->out().reg();
+
+ __ PushObject(Object::ZoneHandle()); // Make room for the result.
+ __ pushl(context_value);
+ compiler->GenerateCallRuntime(cid(),
+ token_index(),
+ try_index(),
+ kCloneContextRuntimeEntry);
+ __ popl(result); // Remove argument.
+ __ popl(result); // Get result (cloned context).
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698