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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 343803002: Finishes removing intptr_t from raw object fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
Index: runtime/vm/raw_object_snapshot.cc
===================================================================
--- runtime/vm/raw_object_snapshot.cc (revision 37464)
+++ runtime/vm/raw_object_snapshot.cc (working copy)
@@ -97,7 +97,7 @@
!RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) {
// Write out the class and tags information.
writer->WriteVMIsolateObject(kClassCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the non object pointer fields.
// NOTE: cpp_vtable_ is not written.
@@ -167,7 +167,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kUnresolvedClassCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->Write<int32_t>(ptr()->token_pos_);
@@ -253,7 +253,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kTypeCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->Write<int32_t>(ptr()->token_pos_);
@@ -305,7 +305,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kTypeRefCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -360,7 +360,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kTypeParameterCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->Write<int32_t>(ptr()->index_);
@@ -412,7 +412,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kBoundedTypeCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -497,7 +497,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kTypeArgumentsCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the length field.
writer->Write<RawObject*>(ptr()->length_);
@@ -557,7 +557,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kPatchClassCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
visitor.VisitPointers(from(), to());
@@ -606,7 +606,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kClosureDataCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Context scope.
// We don't write the context scope in the snapshot.
@@ -666,7 +666,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kRedirectionDataCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -730,7 +730,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kFunctionCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the non object fields.
writer->Write<int32_t>(ptr()->token_pos_);
@@ -798,7 +798,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kFieldCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the non object fields.
writer->Write<int32_t>(ptr()->token_pos_);
@@ -828,7 +828,7 @@
literal_token.set_tags(tags);
// Read the token attributes.
- Token::Kind token_kind = static_cast<Token::Kind>(reader->ReadIntptrValue());
+ Token::Kind token_kind = static_cast<Token::Kind>(reader->Read<int32_t>());
literal_token.set_kind(token_kind);
*reader->StringHandle() ^= reader->ReadObjectImpl();
literal_token.set_literal(*reader->StringHandle());
@@ -850,10 +850,10 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kLiteralTokenCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the kind field.
- writer->Write<intptr_t>(ptr()->kind_);
+ writer->Write<int32_t>(ptr()->kind_);
// Write out literal and value fields.
writer->WriteObjectImpl(ptr()->literal_);
@@ -913,7 +913,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kTokenStreamCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the length field and the token stream.
RawExternalTypedData* stream = ptr()->stream_;
@@ -977,7 +977,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kScriptCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
writer->WriteObjectImpl(ptr()->url_);
@@ -1058,7 +1058,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kLibraryCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
if ((kind == Snapshot::kScript) &&
RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) {
@@ -1138,7 +1138,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kLibraryPrefixCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all non object fields.
writer->Write<int32_t>(ptr()->num_imports_);
@@ -1193,7 +1193,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kNamespaceCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -1322,7 +1322,7 @@
ASSERT(reader != NULL);
// Allocate context object.
- intptr_t num_vars = reader->ReadIntptrValue();
+ int32_t num_vars = reader->Read<int32_t>();
Context& context = Context::ZoneHandle(reader->isolate(), Context::null());
if (kind == Snapshot::kFull) {
context = reader->NewContext(num_vars);
@@ -1361,10 +1361,10 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kContextCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out num of variables in the context.
- writer->WriteIntptrValue(ptr()->num_variables_);
+ writer->Write<int32_t>(ptr()->num_variables_);
// Can't serialize the isolate pointer, we set it implicitly on read.
@@ -1492,7 +1492,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kApiErrorCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -1543,7 +1543,7 @@
// Write out the class and tags information.
writer->WriteVMIsolateObject(kLanguageErrorCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the non object fields.
writer->Write<int32_t>(ptr()->token_pos_);
@@ -1632,7 +1632,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kInstanceCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
}
@@ -1682,7 +1682,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kMintCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the 64 bit value.
writer->Write<int64_t>(ptr()->value_);
@@ -1696,7 +1696,7 @@
ASSERT(reader != NULL);
// Read in the HexCString representation of the bigint.
- intptr_t len = reader->ReadIntptrValue();
+ int32_t len = reader->Read<int32_t>();
char* str = Isolate::Current()->current_zone()->Alloc<char>(len + 1);
str[len] = '\0';
reader->ReadBytes(reinterpret_cast<uint8_t*>(str), len);
@@ -1740,10 +1740,10 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kBigintCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the bigint value as a HEXCstring.
- intptr_t length = ptr()->signed_length_;
+ int32_t length = ptr()->signed_length_;
bool is_negative = false;
if (length <= 0) {
length = -length;
@@ -1763,10 +1763,10 @@
intptr_t len = strlen(str);
ASSERT(len > 2 && str[0] == '0' && str[1] == 'x');
if (neg) {
- writer->WriteIntptrValue(len - 1); // Include '-' in length.
+ writer->Write<int32_t>(len - 1); // Include '-' in length.
writer->Write<uint8_t>('-');
} else {
- writer->WriteIntptrValue(len - 2);
+ writer->Write<int32_t>(len - 2);
}
writer->WriteBytes(reinterpret_cast<const uint8_t*>(&(str[2])), (len - 2));
}
@@ -1816,7 +1816,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kDoubleCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the double value.
writer->WriteDouble(ptr()->value_);
@@ -1946,7 +1946,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(class_id);
- writer->WriteIntptrValue(tags);
+ writer->Write<int32_t>(tags);
// Write out the length field.
writer->Write<RawObject*>(length);
@@ -2162,7 +2162,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kGrowableObjectArrayCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the used length field.
writer->Write<RawObject*>(ptr()->length_);
@@ -2208,7 +2208,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kFloat32x4Cid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the float values.
writer->Write<float>(ptr()->value_[0]);
@@ -2254,7 +2254,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kInt32x4Cid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the mask values.
writer->Write<uint32_t>(ptr()->value_[0]);
@@ -2298,7 +2298,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kFloat64x2Cid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the float values.
writer->Write<double>(ptr()->value_[0]);
@@ -2411,7 +2411,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(cid);
- writer->WriteIntptrValue(tags);
+ writer->Write<int32_t>(tags);
// Write out the length field.
writer->Write<RawObject*>(ptr()->length_);
@@ -2466,7 +2466,7 @@
#define EXT_TYPED_DATA_WRITE(cid, type) \
writer->WriteIndexedObject(cid); \
- writer->WriteIntptrValue(RawObject::ClassIdTag::update(cid, tags)); \
+ writer->Write<int32_t>(RawObject::ClassIdTag::update(cid, tags)); \
writer->Write<RawObject*>(ptr()->length_); \
TYPED_EXT_DATA_WRITE(type) \
@@ -2584,7 +2584,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kSendPortCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
writer->Write(ptr()->id_);
}
@@ -2636,7 +2636,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kStacktraceCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -2674,8 +2674,8 @@
regex.raw_ptr()->num_bracket_expressions_ = reader->ReadAsSmi();
*reader->StringHandle() ^= reader->ReadObjectImpl();
regex.set_pattern(*reader->StringHandle());
- regex.raw_ptr()->type_ = reader->ReadIntptrValue();
- regex.raw_ptr()->flags_ = reader->ReadIntptrValue();
+ regex.raw_ptr()->type_ = reader->Read<int32_t>();
+ regex.raw_ptr()->flags_ = reader->Read<int32_t>();
// TODO(5411462): Need to implement a way of recompiling the regex.
@@ -2694,7 +2694,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kJSRegExpCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out the data length field.
writer->Write<RawObject*>(ptr()->data_length_);
@@ -2702,8 +2702,8 @@
// Write out all the other fields.
writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
writer->WriteObjectImpl(ptr()->pattern_);
- writer->WriteIntptrValue(ptr()->type_);
- writer->WriteIntptrValue(ptr()->flags_);
+ writer->Write<int32_t>(ptr()->type_);
+ writer->Write<int32_t>(ptr()->flags_);
// Do not write out the data part which is native.
}
@@ -2741,7 +2741,7 @@
// Write out the class and tags information.
writer->WriteIndexedObject(kWeakPropertyCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
+ writer->Write<int32_t>(writer->GetObjectTags(this));
// Write out all the other fields.
writer->Write<RawObject*>(ptr()->key_);

Powered by Google App Engine
This is Rietveld 408576698