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

Unified Diff: runtime/vm/snapshot.h

Issue 1309563006: Emit assembly instead of a blob for the instructions snapshot, and provide labels for the entry poi… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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_snapshot.cc ('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/snapshot.h
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index d0347b1a0eaacba7c6fe91b39f175339bca66e2e..f612073aa625f5b310bc441067282e8e61547096 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -22,9 +22,11 @@ class AbstractType;
class Array;
class Class;
class ClassTable;
+class Code;
class ExternalTypedData;
class GrowableObjectArray;
class Heap;
+class Instructions;
class LanguageError;
class Library;
class Object;
@@ -777,7 +779,9 @@ class InstructionsWriter : public ZoneAllocated {
InstructionsWriter(uint8_t** buffer,
ReAlloc alloc,
intptr_t initial_size)
- : stream_(buffer, alloc, initial_size) {
+ : stream_(buffer, alloc, initial_size),
+ next_offset_(0),
+ instructions_() {
ASSERT(buffer != NULL);
ASSERT(alloc != NULL);
}
@@ -787,8 +791,37 @@ class InstructionsWriter : public ZoneAllocated {
int32_t GetOffsetFor(RawInstructions* instructions);
+ void SetInstructionsCode(RawInstructions* insns, RawCode* code) {
+ for (intptr_t i = 0; i < instructions_.length(); i++) {
+ if (instructions_[i].raw_insns_ == insns) {
+ instructions_[i].raw_code_ = code;
+ return;
+ }
+ }
+ UNREACHABLE();
+ }
+
+ void WriteAssembly();
+
private:
+ struct InstructionsData {
+ explicit InstructionsData(RawInstructions* insns)
+ : raw_insns_(insns), raw_code_(NULL) { }
+
+ union {
+ RawInstructions* raw_insns_;
+ const Instructions* insns_;
+ };
+ union {
+ RawCode* raw_code_;
+ const Code* code_;
+ };
+ };
+
+
WriteStream stream_;
+ intptr_t next_offset_;
+ GrowableArray<InstructionsData> instructions_;
DISALLOW_COPY_AND_ASSIGN(InstructionsWriter);
};
@@ -839,6 +872,10 @@ class SnapshotWriter : public BaseWriter {
return instructions_writer_->GetOffsetFor(instructions);
}
+ void SetInstructionsCode(RawInstructions* instructions, RawCode* code) {
+ return instructions_writer_->SetInstructionsCode(instructions, code);
+ }
+
protected:
void UnmarkAll() {
if (!unmarked_objects_ && forward_list_ != NULL) {
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698