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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 10228001: Turn more explicitly named temps into uses of definitions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 71f5adb622868c21dad4bb16e56100cb395086fa..19d1d9db9ff5c8b5f96071e8716cfc95f11a2596 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -1557,7 +1557,8 @@ void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) {
// Context is saved around the call, it's treated as an extra operand
// consumed by the call (but not an argument).
- AddInstruction(new BindInstr(temp_index(), new CurrentContextComp()));
+ BindInstr* context = new BindInstr(temp_index(), new CurrentContextComp());
+ AddInstruction(context);
ArgumentGraphVisitor for_closure(owner(), temp_index() + 1);
node->closure()->Visit(&for_closure);
@@ -1570,22 +1571,23 @@ void EffectGraphVisitor::VisitClosureCallNode(ClosureCallNode* node) {
// First operand is the saved context, consumed by the call.
ClosureCallComp* call = new ClosureCallComp(node,
owner()->try_index(),
- new TempVal(temp_index()),
+ new UseVal(context),
arguments);
ReturnComputation(call);
}
void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) {
- AddInstruction(new BindInstr(temp_index(), new CurrentContextComp()));
- TempVal* ctx = new TempVal(temp_index());
- AddInstruction(new BindInstr(temp_index(),
- new CloneContextComp(node->id(),
- node->token_index(),
- owner()->try_index(),
- ctx)));
- TempVal* cloned_ctx = new TempVal(temp_index());
- ReturnComputation(new StoreContextComp(cloned_ctx));
+ BindInstr* context = new BindInstr(temp_index(), new CurrentContextComp());
+ AddInstruction(context);
+ BindInstr* clone =
+ new BindInstr(temp_index(),
+ new CloneContextComp(node->id(),
+ node->token_index(),
+ owner()->try_index(),
+ new UseVal(context)));
+ AddInstruction(clone);
+ ReturnComputation(new StoreContextComp(new UseVal(clone)));
}
@@ -2024,13 +2026,14 @@ bool EffectGraphVisitor::MustSaveRestoreContext(SequenceNode* node) const {
void EffectGraphVisitor::UnchainContext() {
- AddInstruction(new BindInstr(temp_index(), new CurrentContextComp()));
- TempVal* temp_ctx = new TempVal(temp_index());
- NativeLoadFieldComp* load = new NativeLoadFieldComp(
- temp_ctx, Context::parent_offset());
- AddInstruction(new BindInstr(temp_index(), load));
- TempVal* parent_ctx = new TempVal(temp_index());
- AddInstruction(new DoInstr(new StoreContextComp(parent_ctx)));
+ BindInstr* context = new BindInstr(temp_index(), new CurrentContextComp());
+ AddInstruction(context);
+ BindInstr* parent =
+ new BindInstr(temp_index(),
+ new NativeLoadFieldComp(
+ new UseVal(context), Context::parent_offset()));
+ AddInstruction(parent);
+ AddInstruction(new DoInstr(new StoreContextComp(new UseVal(parent))));
}
@@ -2046,22 +2049,24 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
// The loop local scope declares variables that are captured.
// Allocate and chain a new context.
// Allocate context computation (uses current CTX)
- AllocateContextComp* comp = new AllocateContextComp(
- node->token_index(),
- owner()->try_index(),
- num_context_variables);
- AddInstruction(new BindInstr(temp_index(), comp));
- Value* allocated_context_value = new TempVal(temp_index());
+ BindInstr* allocated_context =
+ new BindInstr(temp_index(),
+ new AllocateContextComp(node->token_index(),
+ owner()->try_index(),
+ num_context_variables));
+ AddInstruction(allocated_context);
// If this node_sequence is the body of the function being compiled, and if
// this function is not a closure, do not link the current context as the
// parent of the newly allocated context, as it is not accessible. Instead,
// save it in a pre-allocated variable and restore it on exit.
if (MustSaveRestoreContext(node)) {
- AddInstruction(new BindInstr(temp_index() + 1, new CurrentContextComp()));
+ BindInstr* current_context =
+ new BindInstr(temp_index() + 1, new CurrentContextComp());
+ AddInstruction(current_context);
StoreLocalComp* store_local = new StoreLocalComp(
*owner()->parsed_function().saved_context_var(),
- new TempVal(temp_index() + 1),
+ new UseVal(current_context),
0);
AddInstruction(new DoInstr(store_local));
StoreContextComp* store_context =
@@ -2069,8 +2074,8 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
AddInstruction(new DoInstr(store_context));
}
- ChainContextComp* chain_context = new ChainContextComp(
- allocated_context_value);
+ ChainContextComp* chain_context =
+ new ChainContextComp(new UseVal(allocated_context));
AddInstruction(new DoInstr(chain_context));
owner()->set_context_level(scope->context_level());
@@ -2096,12 +2101,14 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
temp_local->set_index(param_frame_index);
// Copy parameter from local frame to current context.
- LoadLocalComp* load_comp = new LoadLocalComp(
- *temp_local, owner()->context_level());
- AddInstruction(new BindInstr(temp_index(), load_comp));
+ BindInstr* load =
+ new BindInstr(temp_index(),
+ new LoadLocalComp(*temp_local,
+ owner()->context_level()));
+ AddInstruction(load);
StoreLocalComp* store_local = new StoreLocalComp(
parameter,
- new TempVal(temp_index()),
+ new UseVal(load),
owner()->context_level());
AddInstruction(new DoInstr(store_local));
// Write NULL to the source location to detect buggy accesses and
@@ -2125,13 +2132,14 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
const LocalVariable& parameter = *scope->VariableAt(pos);
ASSERT(parameter.owner() == scope);
if (!CanSkipTypeCheck(NULL, parameter.type())) {
- LoadLocalComp* load = new LoadLocalComp(parameter,
- owner()->context_level());
- AddInstruction(new BindInstr(temp_index(), load));
- TempVal* argument_value = new TempVal(temp_index());
+ BindInstr* load =
+ new BindInstr(temp_index(),
+ new LoadLocalComp(parameter,
+ owner()->context_level()));
+ AddInstruction(load);
BuildAssertAssignable(node->ParameterIdAt(pos),
parameter.token_index(),
- argument_value,
+ new UseVal(load),
parameter.type(),
parameter.name(),
temp_index());
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698