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

Side by Side 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: skip on TF; roll back arrows 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_SCOPES_H_ 5 #ifndef V8_SCOPES_H_
6 #define V8_SCOPES_H_ 6 #define V8_SCOPES_H_
7 7
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/pending-compilation-error-handler.h" 9 #include "src/pending-compilation-error-handler.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } 217 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; }
218 218
219 // Set the language mode flag (unless disabled by a global flag). 219 // Set the language mode flag (unless disabled by a global flag).
220 void SetLanguageMode(LanguageMode language_mode) { 220 void SetLanguageMode(LanguageMode language_mode) {
221 language_mode_ = language_mode; 221 language_mode_ = language_mode;
222 } 222 }
223 223
224 // Set the ASM module flag. 224 // Set the ASM module flag.
225 void SetAsmModule() { asm_module_ = true; } 225 void SetAsmModule() { asm_module_ = true; }
226 226
227 // Inform the scope that the may execute declarations nonlinearly.
adamk 2015/08/24 22:15:01 Comment unclear...I think the "the" is either misp
Dan Ehrenberg 2015/08/25 01:48:14 Explained in the code.
228 void SetNonlinear() { scope_nonlinear_ = true; }
229
227 // Position in the source where this scope begins and ends. 230 // Position in the source where this scope begins and ends.
228 // 231 //
229 // * For the scope of a with statement 232 // * For the scope of a with statement
230 // with (obj) stmt 233 // with (obj) stmt
231 // start position: start position of first token of 'stmt' 234 // start position: start position of first token of 'stmt'
232 // end position: end position of last token of 'stmt' 235 // end position: end position of last token of 'stmt'
233 // * For the scope of a block 236 // * For the scope of a block
234 // { stmts } 237 // { stmts }
235 // start position: start position of '{' 238 // start position: start position of '{'
236 // end position: end position of '}' 239 // end position: end position of '}'
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 bool inside_with() const { return scope_inside_with_; } 304 bool inside_with() const { return scope_inside_with_; }
302 // Does this scope contain a with statement. 305 // Does this scope contain a with statement.
303 bool contains_with() const { return scope_contains_with_; } 306 bool contains_with() const { return scope_contains_with_; }
304 307
305 // Does this scope access "arguments". 308 // Does this scope access "arguments".
306 bool uses_arguments() const { return scope_uses_arguments_; } 309 bool uses_arguments() const { return scope_uses_arguments_; }
307 // Does any inner scope access "arguments". 310 // Does any inner scope access "arguments".
308 bool inner_uses_arguments() const { return inner_scope_uses_arguments_; } 311 bool inner_uses_arguments() const { return inner_scope_uses_arguments_; }
309 // Does this scope access "super" property (super.foo). 312 // Does this scope access "super" property (super.foo).
310 bool uses_super_property() const { return scope_uses_super_property_; } 313 bool uses_super_property() const { return scope_uses_super_property_; }
314 // Does this scope have the potential to execute declarations non-linearly?
315 bool is_nonlinear() const { return scope_nonlinear_; }
311 316
312 // Whether this needs to be represented by a runtime context. 317 // Whether this needs to be represented by a runtime context.
313 bool NeedsContext() const { return num_heap_slots() > 0; } 318 bool NeedsContext() const { return num_heap_slots() > 0; }
314 319
315 bool NeedsHomeObject() const { 320 bool NeedsHomeObject() const {
316 return scope_uses_super_property_ || 321 return scope_uses_super_property_ ||
317 (scope_calls_eval_ && (IsConciseMethod(function_kind()) || 322 (scope_calls_eval_ && (IsConciseMethod(function_kind()) ||
318 IsAccessorFunction(function_kind()) || 323 IsAccessorFunction(function_kind()) ||
319 IsConstructor(function_kind()))); 324 IsConstructor(function_kind())));
320 } 325 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // the 'eval' call site this scope is the declaration scope. 599 // the 'eval' call site this scope is the declaration scope.
595 bool scope_calls_eval_; 600 bool scope_calls_eval_;
596 // This scope uses "arguments". 601 // This scope uses "arguments".
597 bool scope_uses_arguments_; 602 bool scope_uses_arguments_;
598 // This scope uses "super" property ('super.foo'). 603 // This scope uses "super" property ('super.foo').
599 bool scope_uses_super_property_; 604 bool scope_uses_super_property_;
600 // This scope contains an "use asm" annotation. 605 // This scope contains an "use asm" annotation.
601 bool asm_module_; 606 bool asm_module_;
602 // This scope's outer context is an asm module. 607 // This scope's outer context is an asm module.
603 bool asm_function_; 608 bool asm_function_;
609 // This scope's declarations might not be executed in order (e.g., switch).
610 bool scope_nonlinear_;
604 // The language mode of this scope. 611 // The language mode of this scope.
605 LanguageMode language_mode_; 612 LanguageMode language_mode_;
606 // Source positions. 613 // Source positions.
607 int start_position_; 614 int start_position_;
608 int end_position_; 615 int end_position_;
609 616
610 // Computed via PropagateScopeInfo. 617 // Computed via PropagateScopeInfo.
611 bool outer_scope_calls_sloppy_eval_; 618 bool outer_scope_calls_sloppy_eval_;
612 bool inner_scope_calls_eval_; 619 bool inner_scope_calls_eval_;
613 bool inner_scope_uses_arguments_; 620 bool inner_scope_uses_arguments_;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 PendingCompilationErrorHandler pending_error_handler_; 776 PendingCompilationErrorHandler pending_error_handler_;
770 777
771 // For tracking which classes are declared consecutively. Needed for strong 778 // For tracking which classes are declared consecutively. Needed for strong
772 // mode. 779 // mode.
773 int class_declaration_group_start_; 780 int class_declaration_group_start_;
774 }; 781 };
775 782
776 } } // namespace v8::internal 783 } } // namespace v8::internal
777 784
778 #endif // V8_SCOPES_H_ 785 #endif // V8_SCOPES_H_
OLDNEW
« src/full-codegen/full-codegen.cc ('K') | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698