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

Unified Diff: runtime/vm/kernel_binary.h

Issue 2820363002: Move Kernel strings into the VM's heap. (Closed)
Patch Set: Created 3 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
Index: runtime/vm/kernel_binary.h
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index 0c3636db7af322feffc4063eb1a0f29d3020ac04..093255d525d81315ddf302859d673b1e76f3e8c9 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -330,7 +330,7 @@ class ReaderHelper {
class Reader {
public:
Reader(const uint8_t* buffer, intptr_t size)
- : buffer_(buffer), size_(size), offset_(0) {}
+ : buffer_(buffer), size_(size), offset_(0), string_data_offset_(-1) {}
uint32_t ReadUInt32() {
ASSERT(offset_ + 4 <= size_);
@@ -503,6 +503,17 @@ class Reader {
const uint8_t* buffer() { return buffer_; }
+ intptr_t string_data_offset() { return string_data_offset_; }
+ void MarkStringDataOffset() {
+ ASSERT(string_data_offset_ == -1);
+ string_data_offset_ = offset_;
+ }
+
+ uint8_t CharacterAt(String* str, intptr_t index) {
+ ASSERT(index < str->size());
+ return buffer_[string_data_offset_ + str->offset() + index];
+ }
+
private:
const uint8_t* buffer_;
intptr_t size_;
@@ -512,6 +523,8 @@ class Reader {
TokenPosition min_position_;
intptr_t current_script_id_;
+ intptr_t string_data_offset_;
+
friend class PositionScope;
};
« no previous file with comments | « runtime/vm/kernel.cc ('k') | runtime/vm/kernel_binary.cc » ('j') | runtime/vm/kernel_binary.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698