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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 1925153003: Undo "Don't include an object header for instructions in the text section." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 2b715b28022cdb66e336e85f415ff18c932dcce2..782595e89b1bbb7b816791fa4177c7c6a83cbca8 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1358,20 +1358,24 @@ RawCode* Code::ReadFrom(SnapshotReader* reader,
result.set_lazy_deopt_pc_offset(-1);
int32_t text_offset = reader->Read<int32_t>();
- int32_t instructions_size = reader->Read<int32_t>();
- uword entry_point = reader->GetInstructionsAt(text_offset);
+ RawInstructions* instr = reinterpret_cast<RawInstructions*>(
+ reader->GetInstructionsAt(text_offset) + kHeapObjectTag);
+ uword entry_point = Instructions::EntryPoint(instr);
#if defined(DEBUG)
+ ASSERT(instr->IsMarked());
+ ASSERT(instr->IsVMHeapObject());
uword expected_check = reader->Read<uword>();
+ intptr_t instructions_size = Utils::RoundUp(instr->size_,
+ OS::PreferredCodeAlignment());
uword actual_check = Checksum(entry_point, instructions_size);
ASSERT(expected_check == actual_check);
#endif
result.StoreNonPointer(&result.raw_ptr()->entry_point_, entry_point);
- result.StorePointer(reinterpret_cast<RawSmi*const*>(
- &result.raw_ptr()->instructions_),
- Smi::New(instructions_size));
+ result.StorePointer(&result.raw_ptr()->active_instructions_, instr);
+ result.StorePointer(&result.raw_ptr()->instructions_, instr);
(*reader->PassiveObjectHandle()) ^= reader->ReadObjectImpl(kAsReference);
result.StorePointer(reinterpret_cast<RawObject*const*>(
@@ -1415,9 +1419,6 @@ RawCode* Code::ReadFrom(SnapshotReader* reader,
result.StorePointer(&result.raw_ptr()->return_address_metadata_,
Object::null());
- ASSERT(result.Size() == instructions_size);
- ASSERT(result.EntryPoint() == entry_point);
-
return result.raw();
}
@@ -1446,14 +1447,18 @@ void RawCode::WriteTo(SnapshotWriter* writer,
// Write out all the non object fields.
writer->Write<int32_t>(ptr()->state_bits_);
+ // No disabled code in precompilation.
+ ASSERT(ptr()->instructions_ == ptr()->active_instructions_);
+
RawInstructions* instr = ptr()->instructions_;
- intptr_t size = instr->ptr()->size_;
int32_t text_offset = writer->GetInstructionsId(instr, this);
writer->Write<int32_t>(text_offset);
- writer->Write<int32_t>(size);
+
#if defined(DEBUG)
uword entry = ptr()->entry_point_;
- uword check = Checksum(entry, size);
+ intptr_t instructions_size = Utils::RoundUp(instr->size_,
+ OS::PreferredCodeAlignment());
+ uword check = Checksum(entry, instructions_size);
writer->Write<uword>(check);
#endif
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698