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

Unified Diff: vm/flow_graph_optimizer.cc

Issue 11745022: - Make Boolean 'true' and 'false' singleton VM isolate objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 12 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 | « vm/flow_graph_compiler_x64.cc ('k') | vm/handles.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/flow_graph_optimizer.cc
===================================================================
--- vm/flow_graph_optimizer.cc (revision 16591)
+++ vm/flow_graph_optimizer.cc (working copy)
@@ -2566,8 +2566,8 @@
instr->value()->CanComputeIsNull(&is_null) &&
(is_null ||
instr->value()->CanComputeIsInstanceOf(instr->type(), &is_instance))) {
- Definition* result = new ConstantInstr(Bool::ZoneHandle(Bool::Get(
- instr->negate_result() ? !is_instance : is_instance)));
+ bool val = instr->negate_result() ? !is_instance : is_instance;
+ Definition* result = new ConstantInstr(val ? Bool::True() : Bool::False());
result->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index());
result->InsertBefore(instr);
// Replace uses and remove the current instruction via the iterator.
@@ -3684,7 +3684,7 @@
if (IsNonConstant(value)) {
SetReachable(instr->true_successor());
SetReachable(instr->false_successor());
- } else if (value.raw() == Bool::True()) {
+ } else if (value.raw() == Bool::True().raw()) {
SetReachable(instr->true_successor());
} else if (!IsUnknown(value)) { // Any other constant.
SetReachable(instr->false_successor());
@@ -3830,14 +3830,14 @@
bool result = left.IsNull() ? (instr->right()->ResultCid() == kNullCid)
: (instr->left()->ResultCid() == kNullCid);
if (instr->kind() == Token::kNE_STRICT) result = !result;
- SetValue(instr, Bool::ZoneHandle(Bool::Get(result)));
+ SetValue(instr, result ? Bool::True() : Bool::False());
} else {
SetValue(instr, non_constant_);
}
} else if (IsConstant(left) && IsConstant(right)) {
bool result = (left.raw() == right.raw());
if (instr->kind() == Token::kNE_STRICT) result = !result;
- SetValue(instr, Bool::ZoneHandle(Bool::Get(result)));
+ SetValue(instr, result ? Bool::True() : Bool::False());
}
}
@@ -3870,7 +3870,7 @@
const bool result = CompareIntegers(instr->kind(),
Integer::Cast(left),
Integer::Cast(right));
- SetValue(instr, Bool::ZoneHandle(Bool::Get(result)));
+ SetValue(instr, result ? Bool::True() : Bool::False());
} else {
SetValue(instr, non_constant_);
}
@@ -3888,7 +3888,7 @@
const bool result = CompareIntegers(instr->kind(),
Integer::Cast(left),
Integer::Cast(right));
- SetValue(instr, Bool::ZoneHandle(Bool::Get(result)));
+ SetValue(instr, result ? Bool::True() : Bool::False());
} else {
SetValue(instr, non_constant_);
}
@@ -3943,7 +3943,8 @@
if (IsNonConstant(value)) {
SetValue(instr, non_constant_);
} else if (IsConstant(value)) {
- SetValue(instr, Bool::ZoneHandle(Bool::Get(value.raw() != Bool::True())));
+ bool val = value.raw() != Bool::True().raw();
+ SetValue(instr, val ? Bool::True() : Bool::False());
}
}
« no previous file with comments | « vm/flow_graph_compiler_x64.cc ('k') | vm/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698