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

Unified Diff: src/scopes.h

Issue 1312613003: Ensure hole checks take place in switch statement scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename function and add sloppy mode tests Created 5 years, 4 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/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 59965352058fe18ee26c0fa0e48c288eebbebcde..021b7b3b17820a8aae3da5aa20096c846d7f056d 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -225,6 +225,17 @@ class Scope: public ZoneObject {
// Set the ASM module flag.
void SetAsmModule() { asm_module_ = true; }
+ // Inform the scope that the scope may execute declarations nonlinearly.
+ // Currently, the only nonlinear scope is a switch statement. The name is
+ // more general in case something else comes up with similar control flow,
+ // for example the ability to break out of something which does not have
+ // its own lexical scope.
+ // The bit does not need to be stored on the ScopeInfo because none of
+ // the three compilers will perform hole check elimination on a variable
+ // located in VariableLocation::CONTEXT. So, direct eval and closures
+ // will not expose holes.
+ void SetNonlinear() { scope_nonlinear_ = true; }
+
// Position in the source where this scope begins and ends.
//
// * For the scope of a with statement
@@ -309,6 +320,8 @@ class Scope: public ZoneObject {
bool inner_uses_arguments() const { return inner_scope_uses_arguments_; }
// Does this scope access "super" property (super.foo).
bool uses_super_property() const { return scope_uses_super_property_; }
+ // Does this scope have the potential to execute declarations non-linearly?
+ bool is_nonlinear() const { return scope_nonlinear_; }
// Whether this needs to be represented by a runtime context.
bool NeedsContext() const { return num_heap_slots() > 0; }
@@ -609,6 +622,8 @@ class Scope: public ZoneObject {
bool asm_module_;
// This scope's outer context is an asm module.
bool asm_function_;
+ // This scope's declarations might not be executed in order (e.g., switch).
+ bool scope_nonlinear_;
// The language mode of this scope.
LanguageMode language_mode_;
// Source positions.
« no previous file with comments | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698