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

Unified Diff: src/snapshot-source-sink.cc

Issue 781943002: Reland "Encode reservation meta data in the snapshot blob." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 6 years 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 | « src/snapshot-source-sink.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot-source-sink.cc
diff --git a/src/snapshot-source-sink.cc b/src/snapshot-source-sink.cc
index 9935ff73963c7e157b40b33c3e4c2da6dbe5b380..b2613b325ece423c9b5ed008c968bade8e747730 100644
--- a/src/snapshot-source-sink.cc
+++ b/src/snapshot-source-sink.cc
@@ -13,15 +13,6 @@
namespace v8 {
namespace internal {
-
-SnapshotByteSource::SnapshotByteSource(const byte* array, int length)
- : data_(array), length_(length), position_(0) {
-}
-
-
-SnapshotByteSource::~SnapshotByteSource() { }
-
-
int32_t SnapshotByteSource::GetUnalignedInt() {
DCHECK(position_ < length_); // Require at least one byte left.
int32_t answer = data_[position_];
@@ -52,15 +43,17 @@ void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) {
if (bytes > 3) Put(static_cast<int>((integer >> 24) & 0xff), "IntPart4");
}
-void SnapshotByteSink::PutRaw(byte* data, int number_of_bytes,
+
+void SnapshotByteSink::PutRaw(const byte* data, int number_of_bytes,
const char* description) {
- data_.AddAll(Vector<byte>(data, number_of_bytes));
+ data_.AddAll(Vector<byte>(const_cast<byte*>(data), number_of_bytes));
}
-void SnapshotByteSink::PutBlob(byte* data, int number_of_bytes,
+
+void SnapshotByteSink::PutBlob(Vector<const byte> blob,
const char* description) {
- PutInt(number_of_bytes, description);
- PutRaw(data, number_of_bytes, description);
+ PutInt(blob.length(), description);
+ PutRaw(blob.start(), blob.length(), description);
}
@@ -77,7 +70,7 @@ bool SnapshotByteSource::GetBlob(const byte** data, int* number_of_bytes) {
int size = GetInt();
*number_of_bytes = size;
- if (position_ + size < length_) {
+ if (position_ + size <= length_) {
*data = &data_[position_];
Advance(size);
return true;
« no previous file with comments | « src/snapshot-source-sink.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698