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

Unified Diff: vm/snapshot.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/scopes.h ('k') | vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/snapshot.cc
===================================================================
--- vm/snapshot.cc (revision 16591)
+++ vm/snapshot.cc (working copy)
@@ -661,6 +661,12 @@
if (object_id == kEmptyArrayObject) {
return Object::empty_array().raw();
}
+ if (object_id == kTrueValue) {
+ return Bool::True().raw();
+ }
+ if (object_id == kFalseValue) {
+ return Bool::False().raw();
+ }
intptr_t class_id = ClassIdFromObjectId(object_id);
if (IsSingletonClassId(class_id)) {
return isolate()->class_table()->At(class_id); // get singleton class.
@@ -674,12 +680,6 @@
RawObject* SnapshotReader::ReadIndexedObject(intptr_t object_id) {
- if (object_id == kTrueValue) {
- return object_store()->true_value();
- }
- if (object_id == kFalseValue) {
- return object_store()->false_value();
- }
intptr_t class_id = ClassIdFromObjectId(object_id);
if (IsObjectStoreClassId(class_id)) {
return isolate()->class_table()->At(class_id); // get singleton class.
@@ -812,6 +812,18 @@
return;
}
+ // Check if it is a singleton boolean true object.
+ if (rawobj == Bool::True().raw()) {
+ WriteVMIsolateObject(kTrueValue);
+ return;
+ }
+
+ // Check if it is a singleton boolean false object.
+ if (rawobj == Bool::False().raw()) {
+ WriteVMIsolateObject(kFalseValue);
+ return;
+ }
+
// Check if it is a singleton class object which is shared by
// all isolates.
intptr_t id = rawobj->GetClassId();
@@ -1039,18 +1051,6 @@
return true;
}
- // Check if it is a singleton boolean true value.
- if (rawobj == object_store()->true_value()) {
- WriteIndexedObject(kTrueValue);
- return true;
- }
-
- // Check if it is a singleton boolean false value.
- if (rawobj == object_store()->false_value()) {
- WriteIndexedObject(kFalseValue);
- return true;
- }
-
// Check if the object is a Mint and could potentially be a Smi
// on other architectures (64 bit), if so write it out as int64_t value.
if (rawobj->GetClassId() == kMintCid) {
« no previous file with comments | « vm/scopes.h ('k') | vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698