| 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.
|
|
|