| 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) {
|
|
|