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

Unified Diff: src/asmjs/asm-typer.cc

Issue 2372823004: [wasm] asm.js: Work around parser converting !0 and !1 to boolean. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | src/asmjs/asm-wasm-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/asmjs/asm-typer.cc
diff --git a/src/asmjs/asm-typer.cc b/src/asmjs/asm-typer.cc
index a98c18b5328d4ae12dc5746130b9a56afeffdfa2..76cdf25456dcdbc578459a9e929ee8e884fa50d3 100644
--- a/src/asmjs/asm-typer.cc
+++ b/src/asmjs/asm-typer.cc
@@ -1664,6 +1664,12 @@ AsmType* AsmTyper::ValidateNumericLiteral(Literal* literal) {
return AsmType::Double();
}
+ // The parser collapses expressions like !0 and !123 to true/false.
+ // We therefore need to permit these as alternate versions of 0 / 1.
+ if (literal->raw_value()->IsTrue() || literal->raw_value()->IsFalse()) {
+ return AsmType::Int();
+ }
+
uint32_t value;
if (!literal->value()->ToUint32(&value)) {
int32_t value;
« no previous file with comments | « no previous file | src/asmjs/asm-wasm-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698