Chromium Code Reviews| Index: src/wasm/ast-decoder.cc |
| diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc |
| index 4e19d0f6b6a1894851890ffb5bedbac1790f9c99..64f48645a53adec12ee858f48ab9929390663c2a 100644 |
| --- a/src/wasm/ast-decoder.cc |
| +++ b/src/wasm/ast-decoder.cc |
| @@ -1146,6 +1146,24 @@ class WasmFullDecoder : public WasmDecoder { |
| len += DecodeSimdOpcode(opcode); |
| break; |
| } |
| + case kAtomicPrefix: { |
| + if (!module_ || module_->origin != kAsmJsOrigin) { |
| + error("Atomics are allowed only in AsmJs modules"); |
| + break; |
| + } |
| + if (!FLAG_wasm_atomics_prototype) { |
|
titzer
2016/10/26 08:07:17
You can use the macro for this check.
aseemgarg
2016/10/26 19:53:57
The CHECK_PROTOTYPE_OPCODE checks that module orig
|
| + error("Invalid opcode (enable with --wasm_atomics_prototype)"); |
| + break; |
| + } |
| + len++; |
|
titzer
2016/10/26 08:07:17
Please don't do len++, but set len = 2.
aseemgarg
2016/10/26 19:53:57
Done. Can you explain why?
|
| + byte atomic_index = checked_read_u8(pc_, 1, "atomic index"); |
|
titzer
2016/10/26 08:07:17
"atomic opcode" instead of "atomic index"
aseemgarg
2016/10/26 19:53:57
Done.
|
| + opcode = static_cast<WasmOpcode>(opcode << 8 | atomic_index); |
| + sig = WasmOpcodes::AtomicSignature(opcode); |
| + if (sig) { |
| + BuildAtomicOperator(opcode); |
| + } |
| + break; |
| + } |
| default: { |
| // Deal with special asmjs opcodes. |
| if (module_ && module_->origin == kAsmJsOrigin) { |
| @@ -1328,6 +1346,8 @@ class WasmFullDecoder : public WasmDecoder { |
| return len; |
| } |
| + void BuildAtomicOperator(WasmOpcode opcode) { UNIMPLEMENTED(); } |
| + |
| void DoReturn() { |
| int count = static_cast<int>(sig_->return_count()); |
| TFNode** buffer = nullptr; |