| Index: src/wasm/encoder.cc
|
| diff --git a/src/wasm/encoder.cc b/src/wasm/encoder.cc
|
| index 92e6b1145cba4670e204046bb209674a8bca51f5..fec170523fd077946c7043e5f9c57134aaebfb85 100644
|
| --- a/src/wasm/encoder.cc
|
| +++ b/src/wasm/encoder.cc
|
| @@ -190,6 +190,16 @@ void WasmFunctionBuilder::EmitWithVarInt(WasmOpcode opcode,
|
| EmitVarInt(&p, 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.
|
|
|