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

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

Issue 2435823002: [V8][asm.js] Adds support to global const variables. (Closed)
Patch Set: Addresses comments. 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 | « no previous file | src/asmjs/asm-typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/asmjs/asm-typer.h
diff --git a/src/asmjs/asm-typer.h b/src/asmjs/asm-typer.h
index 942ca21370cf11f719df7a4658d4ddf42b52d695..2c66948d567f5ef3afb689c54105aa82f701ff61 100644
--- a/src/asmjs/asm-typer.h
+++ b/src/asmjs/asm-typer.h
@@ -102,6 +102,13 @@ class AsmTyper final {
kInvalidMutability,
kLocal,
kMutableGlobal,
+ // *VIOLATION* We support const variables in asm.js, as per the
+ //
+ // https://discourse.wicg.io/t/allow-const-global-variables/684
+ //
+ // Global const variables are treated as if they were numeric literals,
+ // and can be used anywhere a literal can be used.
+ kConstGlobal,
kImmutableGlobal,
};
@@ -114,7 +121,8 @@ class AsmTyper final {
}
bool IsGlobal() const {
- return mutability_ == kImmutableGlobal || mutability_ == kMutableGlobal;
+ return mutability_ == kImmutableGlobal || mutability_ == kConstGlobal ||
+ mutability_ == kMutableGlobal;
}
bool IsStdlib() const { return standard_member_ == kStdlib; }
@@ -307,8 +315,9 @@ class AsmTyper final {
AsmType* ReturnTypeAnnotations(ReturnStatement* statement);
// 5.4 VariableTypeAnnotations
// 5.5 GlobalVariableTypeAnnotations
- AsmType* VariableTypeAnnotations(Expression* initializer,
- bool global = false);
+ AsmType* VariableTypeAnnotations(
+ Expression* initializer,
+ VariableInfo::Mutability global = VariableInfo::kLocal);
AsmType* ImportExpression(Property* import);
AsmType* NewHeapView(CallNew* new_heap_view);
« no previous file with comments | « no previous file | src/asmjs/asm-typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698