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

Unified Diff: src/wasm/ast-decoder.cc

Issue 2423883003: [wasm] add atomic opcodes (Closed)
Patch Set: [wasm] add atomic opcodes Created 4 years, 2 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/flag-definitions.h ('k') | src/wasm/wasm-opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/flag-definitions.h ('k') | src/wasm/wasm-opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698