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

Unified Diff: runtime/vm/object.cc

Issue 14969019: A load static of an initialized static final field can be converted to its value, as long as it is … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 22579)
+++ runtime/vm/object.cc (working copy)
@@ -71,6 +71,8 @@
Array* Object::empty_array_ = NULL;
Instance* Object::sentinel_ = NULL;
Instance* Object::transition_sentinel_ = NULL;
+Instance* Object::unknown_constant_ = NULL;
+Instance* Object::non_constant_ = NULL;
Bool* Object::bool_true_ = NULL;
Bool* Object::bool_false_ = NULL;
LanguageError* Object::snapshot_writer_error_ = NULL;
@@ -321,6 +323,8 @@
empty_array_ = Array::ReadOnlyHandle(isolate);
sentinel_ = Instance::ReadOnlyHandle(isolate);
transition_sentinel_ = Instance::ReadOnlyHandle(isolate);
+ unknown_constant_ = Instance::ReadOnlyHandle(isolate);
+ non_constant_ = Instance::ReadOnlyHandle(isolate);
bool_true_ = Bool::ReadOnlyHandle(isolate);
bool_false_ = Bool::ReadOnlyHandle(isolate);
snapshot_writer_error_ = LanguageError::ReadOnlyHandle(isolate);
@@ -384,6 +388,14 @@
Object::Allocate(kNullCid, Instance::InstanceSize(), Heap::kOld);
}
+ // Allocate and initialize optimizing compiler constants.
+ {
+ *unknown_constant_ ^=
+ Object::Allocate(kNullCid, Instance::InstanceSize(), Heap::kOld);
+ *non_constant_ ^=
+ Object::Allocate(kNullCid, Instance::InstanceSize(), Heap::kOld);
+ }
+
cls = Class::New<Instance>(kDynamicCid);
cls.set_is_finalized();
cls.set_is_abstract();
@@ -524,6 +536,10 @@
ASSERT(sentinel_->IsInstance());
ASSERT(!transition_sentinel_->IsSmi());
ASSERT(transition_sentinel_->IsInstance());
+ ASSERT(!unknown_constant_->IsSmi());
+ ASSERT(unknown_constant_->IsInstance());
+ ASSERT(!non_constant_->IsSmi());
+ ASSERT(non_constant_->IsInstance());
ASSERT(!bool_true_->IsSmi());
ASSERT(bool_true_->IsBool());
ASSERT(!bool_false_->IsSmi());
@@ -9177,6 +9193,10 @@
return "sentinel";
} else if (raw() == Object::transition_sentinel().raw()) {
return "transition_sentinel";
+ } else if (raw() == Object::unknown_constant().raw()) {
+ return "unknown_constant";
+ } else if (raw() == Object::non_constant().raw()) {
+ return "non_constant";
} else if (Isolate::Current()->no_gc_scope_depth() > 0) {
// Can occur when running disassembler.
return "Instance";
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698