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

Unified Diff: runtime/vm/snapshot.h

Issue 1336763002: Last snapshot bits to get working precompiled hello_world on x64. (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 a23e69250e56718fa27d3d2efb4285a8a3dd8de6..2fe23f05c7093b0e222d2de5df0e66737fea3b58 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -196,6 +196,32 @@ class Snapshot {
};
+class InstructionsSnapshot : ValueObject {
+ public:
+ explicit InstructionsSnapshot(const void* raw_memory)
+ : raw_memory_(raw_memory) {
+ ASSERT(Utils::IsAligned(raw_memory, OS::kMaxPreferredCodeAlignment));
+ }
+
+ void* instructions_start() {
+ return reinterpret_cast<void*>(
+ reinterpret_cast<uword>(raw_memory_) + kHeaderSize);
+ }
+
+ uword instructions_size() {
+ uword snapshot_size = *reinterpret_cast<const uword*>(raw_memory_);
+ return snapshot_size - kHeaderSize;
+ }
+
+ static const intptr_t kHeaderSize = OS::kMaxPreferredCodeAlignment;
+
+ private:
+ const void* raw_memory_; // The symbol kInstructionsSnapshot.
+
+ DISALLOW_COPY_AND_ASSIGN(InstructionsSnapshot);
+};
+
+
class BaseReader {
public:
BaseReader(const uint8_t* buffer, intptr_t size) : stream_(buffer, size) {}
@@ -786,7 +812,7 @@ class InstructionsWriter : public ZoneAllocated {
ReAlloc alloc,
intptr_t initial_size)
: stream_(buffer, alloc, initial_size),
- next_offset_(0),
+ next_offset_(InstructionsSnapshot::kHeaderSize),
instructions_() {
ASSERT(buffer != NULL);
ASSERT(alloc != NULL);
@@ -824,6 +850,14 @@ class InstructionsWriter : public ZoneAllocated {
};
};
+ void WriteWordLiteral(uword value) {
+ // Padding is helpful for comparing the .S with --disassemble.
+#if defined(ARCH_IS_64_BIT)
+ stream_.Print(".quad 0x%0.16" Px "\n", value);
+#else
+ stream_.Print(".word 0x%0.8" Px "\n", value);
+#endif
+ }
WriteStream stream_;
intptr_t next_offset_;
« 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