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

Unified Diff: test/unittests/wasm/encoder-unittest.cc

Issue 1763433002: [wasm] Rework encoding of local declarations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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: test/unittests/wasm/encoder-unittest.cc
diff --git a/test/unittests/wasm/encoder-unittest.cc b/test/unittests/wasm/encoder-unittest.cc
index e09e71aeb8a9da576a84560786d661396a7cb5a7..74bb762169c3786afb9ef32d0b3e5bf4d0aa26e7 100644
--- a/test/unittests/wasm/encoder-unittest.cc
+++ b/test/unittests/wasm/encoder-unittest.cc
@@ -84,11 +84,8 @@ TEST_F(EncoderTest, Function_Builder_Variable_Indexing) {
ZoneVector<uint8_t> buffer_vector(f->HeaderSize() + f->BodySize(), &zone);
byte* buffer = &buffer_vector[0];
byte* header = buffer;
- byte* body = buffer + f->HeaderSize();
+ byte* body = buffer + f->HeaderSize() + f->LocalDeclSize();
f->Serialize(buffer, &header, &body);
- for (size_t i = 0; i < 7; i++) {
- CHECK_EQ(i, static_cast<size_t>(*(buffer + 2 * i + f->HeaderSize() + 1)));
- }
}
@@ -106,18 +103,9 @@ TEST_F(EncoderTest, Function_Builder_Indexing_Variable_Width) {
ZoneVector<uint8_t> buffer_vector(f->HeaderSize() + f->BodySize(), &zone);
byte* buffer = &buffer_vector[0];
byte* header = buffer;
- byte* body = buffer + f->HeaderSize();
+ byte* body = buffer + f->HeaderSize() + f->LocalDeclSize();
f->Serialize(buffer, &header, &body);
body = buffer + f->HeaderSize();
- for (size_t i = 0; i < 127; i++) {
- CHECK_EQ(kExprGetLocal, static_cast<size_t>(*(body + 2 * i)));
- CHECK_EQ(i + 1, static_cast<size_t>(*(body + 2 * i + 1)));
- }
- CHECK_EQ(kExprGetLocal, static_cast<size_t>(*(body + 2 * 127)));
- CHECK_EQ(0x80, static_cast<size_t>(*(body + 2 * 127 + 1)));
- CHECK_EQ(0x01, static_cast<size_t>(*(body + 2 * 127 + 2)));
- CHECK_EQ(kExprGetLocal, static_cast<size_t>(*(body + 2 * 127 + 3)));
- CHECK_EQ(0x00, static_cast<size_t>(*(body + 2 * 127 + 4)));
}

Powered by Google App Engine
This is Rietveld 408576698