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

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: style fixes 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
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 97606a745bf563dc9e152071edb69e2f4a2dd85d..d30a95cda05584b8ec427ca3e39691a9ffb40dea 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -224,6 +224,13 @@ 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.
+ void SetNonlinear() { scope_nonlinear_ = true; }
Michael Starzinger 2015/08/26 11:30:30 Isn't it necessary to serialize this flag into the
rossberg 2015/08/26 12:07:58 Indeed, AFAICS this flag needs to be de/serialized
Dan Ehrenberg 2015/08/27 01:40:49 Well, that issue won't hit fullcodegen, as hole ch
+
// Position in the source where this scope begins and ends.
//
// * For the scope of a with statement
@@ -308,6 +315,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; }
@@ -601,6 +610,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.

Powered by Google App Engine
This is Rietveld 408576698