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

Side by Side Diff: src/scopes.h

Issue 1128963005: Remove Scope::scope_uses_this_ 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
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". 215 // Inform the scope that the corresponding code uses "arguments".
216 void RecordArgumentsUsage() { scope_uses_arguments_ = true; } 216 void RecordArgumentsUsage() { scope_uses_arguments_ = true; }
217 217
218 // Inform the scope that the corresponding code uses "super". 218 // Inform the scope that the corresponding code uses "super".
219 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } 219 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; }
220 220
221 // Inform the scope that the corresponding code uses "this".
222 void RecordThisUsage() { scope_uses_this_ = true; }
223
224 // Set the language mode flag (unless disabled by a global flag). 221 // Set the language mode flag (unless disabled by a global flag).
225 void SetLanguageMode(LanguageMode language_mode) { 222 void SetLanguageMode(LanguageMode language_mode) {
226 language_mode_ = language_mode; 223 language_mode_ = language_mode;
227 } 224 }
228 225
229 // Set the ASM module flag. 226 // Set the ASM module flag.
230 void SetAsmModule() { asm_module_ = true; } 227 void SetAsmModule() { asm_module_ = true; }
231 228
232 // Position in the source where this scope begins and ends. 229 // Position in the source where this scope begins and ends.
233 // 230 //
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Does this scope access "arguments". 314 // Does this scope access "arguments".
318 bool uses_arguments() const { return scope_uses_arguments_; } 315 bool uses_arguments() const { return scope_uses_arguments_; }
319 // Does any inner scope access "arguments". 316 // Does any inner scope access "arguments".
320 bool inner_uses_arguments() const { return inner_scope_uses_arguments_; } 317 bool inner_uses_arguments() const { return inner_scope_uses_arguments_; }
321 // Does this scope access "super" property (super.foo). 318 // Does this scope access "super" property (super.foo).
322 bool uses_super_property() const { return scope_uses_super_property_; } 319 bool uses_super_property() const { return scope_uses_super_property_; }
323 // Does any inner scope access "super" property. 320 // Does any inner scope access "super" property.
324 bool inner_uses_super_property() const { 321 bool inner_uses_super_property() const {
325 return inner_scope_uses_super_property_; 322 return inner_scope_uses_super_property_;
326 } 323 }
327 // Does this scope access "this".
328 bool uses_this() const { return scope_uses_this_; }
329 // Does any inner scope access "this".
330 bool inner_uses_this() const { return inner_scope_uses_this_; }
331 324
332 const Scope* NearestOuterEvalScope() const { 325 const Scope* NearestOuterEvalScope() const {
333 if (is_eval_scope()) return this; 326 if (is_eval_scope()) return this;
334 if (outer_scope() == nullptr) return nullptr; 327 if (outer_scope() == nullptr) return nullptr;
335 return outer_scope()->NearestOuterEvalScope(); 328 return outer_scope()->NearestOuterEvalScope();
336 } 329 }
337 330
338 // --------------------------------------------------------------------------- 331 // ---------------------------------------------------------------------------
339 // Accessors. 332 // Accessors.
340 333
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 bool scope_inside_with_; 578 bool scope_inside_with_;
586 // This scope contains a 'with' statement. 579 // This scope contains a 'with' statement.
587 bool scope_contains_with_; 580 bool scope_contains_with_;
588 // This scope or a nested catch scope or with scope contain an 'eval' call. At 581 // This scope or a nested catch scope or with scope contain an 'eval' call. At
589 // the 'eval' call site this scope is the declaration scope. 582 // the 'eval' call site this scope is the declaration scope.
590 bool scope_calls_eval_; 583 bool scope_calls_eval_;
591 // This scope uses "arguments". 584 // This scope uses "arguments".
592 bool scope_uses_arguments_; 585 bool scope_uses_arguments_;
593 // This scope uses "super" property ('super.foo'). 586 // This scope uses "super" property ('super.foo').
594 bool scope_uses_super_property_; 587 bool scope_uses_super_property_;
595 // This scope uses "this".
596 bool scope_uses_this_;
597 // This scope contains an "use asm" annotation. 588 // This scope contains an "use asm" annotation.
598 bool asm_module_; 589 bool asm_module_;
599 // This scope's outer context is an asm module. 590 // This scope's outer context is an asm module.
600 bool asm_function_; 591 bool asm_function_;
601 // The language mode of this scope. 592 // The language mode of this scope.
602 LanguageMode language_mode_; 593 LanguageMode language_mode_;
603 // Source positions. 594 // Source positions.
604 int start_position_; 595 int start_position_;
605 int end_position_; 596 int end_position_;
606 597
607 // Computed via PropagateScopeInfo. 598 // Computed via PropagateScopeInfo.
608 bool outer_scope_calls_sloppy_eval_; 599 bool outer_scope_calls_sloppy_eval_;
609 bool inner_scope_calls_eval_; 600 bool inner_scope_calls_eval_;
610 bool inner_scope_uses_arguments_; 601 bool inner_scope_uses_arguments_;
611 bool inner_scope_uses_super_property_; 602 bool inner_scope_uses_super_property_;
612 bool inner_scope_uses_this_;
613 bool force_eager_compilation_; 603 bool force_eager_compilation_;
614 bool force_context_allocation_; 604 bool force_context_allocation_;
615 605
616 // True if it doesn't need scope resolution (e.g., if the scope was 606 // True if it doesn't need scope resolution (e.g., if the scope was
617 // constructed based on a serialized scope info or a catch context). 607 // constructed based on a serialized scope info or a catch context).
618 bool already_resolved_; 608 bool already_resolved_;
619 609
620 // Computed as variables are declared. 610 // Computed as variables are declared.
621 int num_var_or_const_; 611 int num_var_or_const_;
622 612
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 PendingCompilationErrorHandler pending_error_handler_; 752 PendingCompilationErrorHandler pending_error_handler_;
763 753
764 // For tracking which classes are declared consecutively. Needed for strong 754 // For tracking which classes are declared consecutively. Needed for strong
765 // mode. 755 // mode.
766 int class_declaration_group_start_; 756 int class_declaration_group_start_;
767 }; 757 };
768 758
769 } } // namespace v8::internal 759 } } // namespace v8::internal
770 760
771 #endif // V8_SCOPES_H_ 761 #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