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

Unified Diff: src/wasm/encoder.cc

Issue 1830663002: [wasm] Binary 11: AST changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/wasm/encoder.h ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/encoder.cc
diff --git a/src/wasm/encoder.cc b/src/wasm/encoder.cc
index 3e30731c381dbf8ddd072c49758052e2a9b129a4..1246907a8d23ab98cbe06cd76c081e732055139b 100644
--- a/src/wasm/encoder.cc
+++ b/src/wasm/encoder.cc
@@ -189,6 +189,16 @@ void WasmFunctionBuilder::EmitWithVarInt(WasmOpcode opcode,
EmitVarInt(immediate);
}
+void WasmFunctionBuilder::EmitI32Const(int32_t value) {
+ // TODO(titzer): variable-length signed and unsigned i32 constants.
+ if (-128 <= value && value <= 127) {
+ EmitWithU8(kExprI8Const, static_cast<byte>(value));
+ } else {
+ byte code[] = {WASM_I32V_5(value)};
+ EmitCode(code, sizeof(code));
+ }
+}
+
uint32_t WasmFunctionBuilder::EmitEditableVarIntImmediate() {
// Guess that the immediate will be 1 byte. If it is more, we'll have to
// shift everything down.
« no previous file with comments | « src/wasm/encoder.h ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698