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

Unified Diff: src/wasm/ast-decoder.h

Issue 1764723002: [wasm] Remove TableSwitch and replace with br_table. (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
« no previous file with comments | « no previous file | src/wasm/ast-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.h
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h
index d173986e72c1fd86e80d8b18e030b000539c33ee..4693af1ca0b2435f93ecb41606dcd89688d8e1e3 100644
--- a/src/wasm/ast-decoder.h
+++ b/src/wasm/ast-decoder.h
@@ -142,24 +142,23 @@ struct ImportIndexOperand {
}
};
-struct TableSwitchOperand {
- uint32_t case_count;
+struct BranchTableOperand {
uint32_t table_count;
const byte* table;
int length;
- inline TableSwitchOperand(Decoder* decoder, const byte* pc) {
- case_count = decoder->checked_read_u16(pc, 1, "expected #cases");
- table_count = decoder->checked_read_u16(pc, 3, "expected #entries");
- length = 4 + table_count * 2;
+ inline BranchTableOperand(Decoder* decoder, const byte* pc) {
+ table_count = decoder->checked_read_u16(pc, 1, "expected #entries");
+ length = 2 + table_count * 2 + 2;
- if (decoder->check(pc, 5, table_count * 2, "expected <table entries>")) {
- table = pc + 5;
+ if (decoder->check(pc, 3, table_count * 2 + 2,
+ "expected <table entries>")) {
+ table = pc + 3;
} else {
table = nullptr;
}
}
inline uint16_t read_entry(Decoder* decoder, int i) {
- DCHECK(i >= 0 && static_cast<uint32_t>(i) < table_count);
+ DCHECK(i >= 0 && static_cast<uint32_t>(i) <= table_count);
return table ? decoder->read_u16(table + i * sizeof(uint16_t)) : 0;
}
};
« no previous file with comments | « no previous file | src/wasm/ast-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698