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

Unified Diff: runtime/vm/snapshot.h

Issue 1808553002: Precompilation: 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: union Created 4 years, 9 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/snapshot.h
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 7f6436b8b841a71a13821d789f910f08603f75a7..0bb9178f4d7e477f5efc80864f7e70ef075f0fc6 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -32,6 +32,7 @@ class LanguageError;
class Library;
class Object;
class PassiveObject;
+class ObjectPool;
class ObjectStore;
class MegamorphicCache;
class PageSpace;
@@ -370,7 +371,7 @@ class InstructionsReader : public ZoneAllocated {
OS::PreferredCodeAlignment()));
}
- RawInstructions* GetInstructionsAt(int32_t offset, uword expected_tags);
+ uword GetInstructionsAt(int32_t offset);
RawObject* GetObjectAt(int32_t offset);
private:
@@ -402,6 +403,7 @@ class SnapshotReader : public BaseReader {
Code* CodeHandle() { return &code_; }
Function* FunctionHandle() { return &function_; }
MegamorphicCache* MegamorphicCacheHandle() { return &megamorphic_cache_; }
+ ObjectPool* ObjectPoolHandle() { return &object_pool_; }
Snapshot::Kind kind() const { return kind_; }
bool snapshot_code() const { return snapshot_code_; }
@@ -483,8 +485,8 @@ class SnapshotReader : public BaseReader {
RawWeakProperty* NewWeakProperty();
RawRegExp* NewRegExp();
- RawInstructions* GetInstructionsAt(int32_t offset, uword expected_tags) {
- return instructions_reader_->GetInstructionsAt(offset, expected_tags);
+ uword GetInstructionsAt(int32_t offset) {
+ return instructions_reader_->GetInstructionsAt(offset);
}
RawObject* GetObjectAt(int32_t offset) {
@@ -588,6 +590,7 @@ class SnapshotReader : public BaseReader {
Code& code_; // Temporary code handle.
Function& function_; // Temporary function handle.
MegamorphicCache& megamorphic_cache_; // Temporary megamorphic cache handle.
+ ObjectPool& object_pool_; // Temporary object pool handle.
UnhandledException& error_; // Error handle.
intptr_t max_vm_isolate_object_id_;
ZoneGrowableArray<BackRefNode>* backward_references_;
@@ -862,26 +865,18 @@ class InstructionsWriter : public ZoneAllocated {
intptr_t binary_size() { return binary_size_; }
- int32_t GetOffsetFor(RawInstructions* instructions);
+ int32_t GetOffsetFor(RawInstructions* instructions, RawCode* code);
int32_t GetObjectOffsetFor(RawObject* raw_object);
- 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) { }
+ explicit InstructionsData(RawInstructions* insns,
+ RawCode* code,
+ intptr_t offset)
+ : raw_insns_(insns), raw_code_(code), offset_(offset) { }
union {
RawInstructions* raw_insns_;
@@ -891,6 +886,7 @@ class InstructionsWriter : public ZoneAllocated {
RawCode* raw_code_;
const Code* code_;
};
+ intptr_t offset_;
};
struct ObjectData {
@@ -970,18 +966,14 @@ class SnapshotWriter : public BaseWriter {
static intptr_t FirstObjectId();
- int32_t GetInstructionsId(RawInstructions* instructions) {
- return instructions_writer_->GetOffsetFor(instructions);
+ int32_t GetInstructionsId(RawInstructions* instructions, RawCode* code) {
+ return instructions_writer_->GetOffsetFor(instructions, code);
}
int32_t GetObjectId(RawObject* raw) {
return instructions_writer_->GetObjectOffsetFor(raw);
}
- void SetInstructionsCode(RawInstructions* instructions, RawCode* code) {
- return instructions_writer_->SetInstructionsCode(instructions, code);
- }
-
void WriteFunctionId(RawFunction* func, bool owner_is_class);
RawFunction* IsSerializableClosure(RawClosure* closure);
@@ -1048,6 +1040,7 @@ class SnapshotWriter : public BaseWriter {
friend class RawArray;
friend class RawClass;
friend class RawClosureData;
+ friend class RawCode;
friend class RawContextScope;
friend class RawExceptionHandlers;
friend class RawField;

Powered by Google App Engine
This is Rietveld 408576698