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

Side by Side Diff: src/scopes.h

Issue 1124233002: Remove Scope::scope_uses_arguments_ flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/preparser.h ('k') | src/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 // --------------------------------------------------------------------------- 206 // ---------------------------------------------------------------------------
207 // Scope-specific info. 207 // Scope-specific info.
208 208
209 // Inform the scope that the corresponding code contains a with statement. 209 // Inform the scope that the corresponding code contains a with statement.
210 void RecordWithStatement() { scope_contains_with_ = true; } 210 void RecordWithStatement() { scope_contains_with_ = true; }
211 211
212 // Inform the scope that the corresponding code contains an eval call. 212 // Inform the scope that the corresponding code contains an eval call.
213 void RecordEvalCall() { if (!is_script_scope()) scope_calls_eval_ = true; } 213 void RecordEvalCall() { if (!is_script_scope()) scope_calls_eval_ = true; }
214 214
215 // Inform the scope that the corresponding code uses "arguments".
216 void RecordArgumentsUsage() { scope_uses_arguments_ = true; }
217
218 // Inform the scope that the corresponding code uses "super". 215 // Inform the scope that the corresponding code uses "super".
219 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } 216 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; }
220 217
221 // Set the language mode flag (unless disabled by a global flag). 218 // Set the language mode flag (unless disabled by a global flag).
222 void SetLanguageMode(LanguageMode language_mode) { 219 void SetLanguageMode(LanguageMode language_mode) {
223 language_mode_ = language_mode; 220 language_mode_ = language_mode;
224 } 221 }
225 222
226 // Set the ASM module flag. 223 // Set the ASM module flag.
227 void SetAsmModule() { asm_module_ = true; } 224 void SetAsmModule() { asm_module_ = true; }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return outer_scope_calls_sloppy_eval_; 301 return outer_scope_calls_sloppy_eval_;
305 } 302 }
306 bool asm_module() const { return asm_module_; } 303 bool asm_module() const { return asm_module_; }
307 bool asm_function() const { return asm_function_; } 304 bool asm_function() const { return asm_function_; }
308 305
309 // Is this scope inside a with statement. 306 // Is this scope inside a with statement.
310 bool inside_with() const { return scope_inside_with_; } 307 bool inside_with() const { return scope_inside_with_; }
311 // Does this scope contain a with statement. 308 // Does this scope contain a with statement.
312 bool contains_with() const { return scope_contains_with_; } 309 bool contains_with() const { return scope_contains_with_; }
313 310
314 // Does this scope access "arguments".
315 bool uses_arguments() const { return scope_uses_arguments_; }
316 // Does any inner scope access "arguments".
317 bool inner_uses_arguments() const { return inner_scope_uses_arguments_; }
318 // Does this scope access "super" property (super.foo). 311 // Does this scope access "super" property (super.foo).
319 bool uses_super_property() const { return scope_uses_super_property_; } 312 bool uses_super_property() const { return scope_uses_super_property_; }
320 // Does any inner scope access "super" property. 313 // Does any inner scope access "super" property.
321 bool inner_uses_super_property() const { 314 bool inner_uses_super_property() const {
322 return inner_scope_uses_super_property_; 315 return inner_scope_uses_super_property_;
323 } 316 }
324 317
325 const Scope* NearestOuterEvalScope() const { 318 const Scope* NearestOuterEvalScope() const {
326 if (is_eval_scope()) return this; 319 if (is_eval_scope()) return this;
327 if (outer_scope() == nullptr) return nullptr; 320 if (outer_scope() == nullptr) return nullptr;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 567
575 // Scope-specific information computed during parsing. 568 // Scope-specific information computed during parsing.
576 // 569 //
577 // This scope is inside a 'with' of some outer scope. 570 // This scope is inside a 'with' of some outer scope.
578 bool scope_inside_with_; 571 bool scope_inside_with_;
579 // This scope contains a 'with' statement. 572 // This scope contains a 'with' statement.
580 bool scope_contains_with_; 573 bool scope_contains_with_;
581 // This scope or a nested catch scope or with scope contain an 'eval' call. At 574 // This scope or a nested catch scope or with scope contain an 'eval' call. At
582 // the 'eval' call site this scope is the declaration scope. 575 // the 'eval' call site this scope is the declaration scope.
583 bool scope_calls_eval_; 576 bool scope_calls_eval_;
584 // This scope uses "arguments".
585 bool scope_uses_arguments_;
586 // This scope uses "super" property ('super.foo'). 577 // This scope uses "super" property ('super.foo').
587 bool scope_uses_super_property_; 578 bool scope_uses_super_property_;
588 // This scope contains an "use asm" annotation. 579 // This scope contains an "use asm" annotation.
589 bool asm_module_; 580 bool asm_module_;
590 // This scope's outer context is an asm module. 581 // This scope's outer context is an asm module.
591 bool asm_function_; 582 bool asm_function_;
592 // The language mode of this scope. 583 // The language mode of this scope.
593 LanguageMode language_mode_; 584 LanguageMode language_mode_;
594 // Source positions. 585 // Source positions.
595 int start_position_; 586 int start_position_;
596 int end_position_; 587 int end_position_;
597 588
598 // Computed via PropagateScopeInfo. 589 // Computed via PropagateScopeInfo.
599 bool outer_scope_calls_sloppy_eval_; 590 bool outer_scope_calls_sloppy_eval_;
600 bool inner_scope_calls_eval_; 591 bool inner_scope_calls_eval_;
601 bool inner_scope_uses_arguments_;
602 bool inner_scope_uses_super_property_; 592 bool inner_scope_uses_super_property_;
603 bool force_eager_compilation_; 593 bool force_eager_compilation_;
604 bool force_context_allocation_; 594 bool force_context_allocation_;
605 595
606 // True if it doesn't need scope resolution (e.g., if the scope was 596 // True if it doesn't need scope resolution (e.g., if the scope was
607 // constructed based on a serialized scope info or a catch context). 597 // constructed based on a serialized scope info or a catch context).
608 bool already_resolved_; 598 bool already_resolved_;
609 599
610 // Computed as variables are declared. 600 // Computed as variables are declared.
611 int num_var_or_const_; 601 int num_var_or_const_;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 PendingCompilationErrorHandler pending_error_handler_; 742 PendingCompilationErrorHandler pending_error_handler_;
753 743
754 // For tracking which classes are declared consecutively. Needed for strong 744 // For tracking which classes are declared consecutively. Needed for strong
755 // mode. 745 // mode.
756 int class_declaration_group_start_; 746 int class_declaration_group_start_;
757 }; 747 };
758 748
759 } } // namespace v8::internal 749 } } // namespace v8::internal
760 750
761 #endif // V8_SCOPES_H_ 751 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698