Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Wasm SignExtend operators by default #5136

Merged
merged 1 commit into from
May 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Common/ConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ PHASE(All)
#define DEFAULT_CONFIG_WasmMaxTableSize (10000000)
#define DEFAULT_CONFIG_WasmThreads (false)
#define DEFAULT_CONFIG_WasmMultiValue (false)
#define DEFAULT_CONFIG_WasmSignExtends (true)
#define DEFAULT_CONFIG_WasmNontrapping (true)
#define DEFAULT_CONFIG_WasmExperimental (false)
#define DEFAULT_CONFIG_BgJitDelayFgBuffer (0)
Expand Down Expand Up @@ -937,6 +938,7 @@ FLAGNR(Boolean, WasmIgnoreResponse , "Ignore the type of the Response object"
FLAGNR(Number, WasmMaxTableSize , "Maximum size allowed to the WebAssembly.Table", DEFAULT_CONFIG_WasmMaxTableSize)
FLAGNR(Boolean, WasmThreads , "Enable WebAssembly threads feature", DEFAULT_CONFIG_WasmThreads)
FLAGNR(Boolean, WasmMultiValue , "Use new WebAssembly multi-value", DEFAULT_CONFIG_WasmMultiValue)
FLAGNR(Boolean, WasmSignExtends , "Use new WebAssembly sign extension operators", DEFAULT_CONFIG_WasmSignExtends)
FLAGNR(Boolean, WasmNontrapping, "Enable non-trapping float-to-int conversions in WebAssembly", DEFAULT_CONFIG_WasmNontrapping)

// WebAssembly Experimental Features
Expand All @@ -947,7 +949,6 @@ FLAGR(Boolean, WasmExperimental, "Enable WebAssembly experimental features", DEF
// Turning on the parent causes the child flag to take on their default value (aka on)
// In Edge, we manually turn on the individual child flags
// Not having the DEFAULT_CONFIG_XXXX macro ensures we use CONFIG_FLAG_RELEASE instead of CONFIG_FLAG
FLAGPR_EXPERIMENTAL_WASM(Boolean, WasmSignExtends , "Use new WebAssembly sign extension operators")
FLAGPR_EXPERIMENTAL_WASM(Boolean, WasmSimd , "Enable SIMD in WebAssembly")

FLAGNR(Boolean, AssertBreak , "Debug break on assert", false)
Expand Down
11 changes: 6 additions & 5 deletions lib/WasmReader/WasmBinaryOpCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,12 @@ WASM_UNARY__OPCODE(F32ReinterpretI32, 0xbe, F_I , Reinterpret_ITF, true, "f32.re
WASM_UNARY__OPCODE(F64ReinterpretI64, 0xbf, D_L , Reinterpret_LTD, true, "f64.reinterpret/i64")

// New sign extend operators
WASM_UNARY__OPCODE(I32Extend8_s , 0xc0, I_I, I32Extend8_s , CONFIG_FLAG_RELEASE(WasmSignExtends), "i32.extend8_s")
WASM_UNARY__OPCODE(I32Extend16_s, 0xc1, I_I, I32Extend16_s, CONFIG_FLAG_RELEASE(WasmSignExtends), "i32.extend16_s")
WASM_UNARY__OPCODE(I64Extend8_s , 0xc2, L_L, I64Extend8_s , CONFIG_FLAG_RELEASE(WasmSignExtends), "i64.extend8_s")
WASM_UNARY__OPCODE(I64Extend16_s, 0xc3, L_L, I64Extend16_s, CONFIG_FLAG_RELEASE(WasmSignExtends), "i64.extend16_s")
WASM_UNARY__OPCODE(I64Extend32_s, 0xc4, L_L, I64Extend32_s, CONFIG_FLAG_RELEASE(WasmSignExtends), "i64.extend32_s")
#define __has_signextends (Wasm::SignExtends::IsEnabled())
WASM_UNARY__OPCODE(I32Extend8_s , 0xc0, I_I, I32Extend8_s , __has_signextends, "i32.extend8_s")
WASM_UNARY__OPCODE(I32Extend16_s, 0xc1, I_I, I32Extend16_s, __has_signextends, "i32.extend16_s")
WASM_UNARY__OPCODE(I64Extend8_s , 0xc2, L_L, I64Extend8_s , __has_signextends, "i64.extend8_s")
WASM_UNARY__OPCODE(I64Extend16_s, 0xc3, L_L, I64Extend16_s, __has_signextends, "i64.extend16_s")
WASM_UNARY__OPCODE(I64Extend32_s, 0xc4, L_L, I64Extend32_s, __has_signextends, "i64.extend32_s")

#define __has_atomics (Wasm::Threads::IsEnabled())
#define __prefix (WASM_PREFIX_THREADS << 8)
Expand Down
12 changes: 12 additions & 0 deletions lib/WasmReader/WasmParseTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ namespace WasmNontrapping
}
}

namespace SignExtends
{
bool IsEnabled()
{
#ifdef ENABLE_WASM
return CONFIG_FLAG(WasmSignExtends);
#else
return false;
#endif
}
}

}


Expand Down
5 changes: 5 additions & 0 deletions lib/WasmReader/WasmParseTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ namespace Wasm
bool IsEnabled();
};

namespace SignExtends
{
bool IsEnabled();
};

namespace WasmTypes
{
enum WasmType
Expand Down