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

Side by Side Diff: src/scopes.h

Issue 1178903003: Add script context with context-allocated "const this" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Add test Created 5 years, 6 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/scopeinfo.cc ('k') | src/snapshot/snapshot-common.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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 DCHECK_NOT_NULL(receiver_); 348 DCHECK_NOT_NULL(receiver_);
349 return receiver_; 349 return receiver_;
350 } 350 }
351 351
352 Variable* LookupThis() { return Lookup(ast_value_factory_->this_string()); } 352 Variable* LookupThis() { return Lookup(ast_value_factory_->this_string()); }
353 353
354 // TODO(wingo): Add a GLOBAL_SCOPE scope type which will lexically allocate 354 // TODO(wingo): Add a GLOBAL_SCOPE scope type which will lexically allocate
355 // "this" (and no other variable) on the native context. Script scopes then 355 // "this" (and no other variable) on the native context. Script scopes then
356 // will not have a "this" declaration. 356 // will not have a "this" declaration.
357 bool has_this_declaration() const { 357 bool has_this_declaration() const {
358 return (is_function_scope() && !is_arrow_scope()) || is_module_scope() || 358 return (is_function_scope() && !is_arrow_scope()) || is_module_scope();
359 is_script_scope();
360 } 359 }
361 360
362 // The variable corresponding to the 'new.target' value. 361 // The variable corresponding to the 'new.target' value.
363 Variable* new_target_var() { return new_target_; } 362 Variable* new_target_var() { return new_target_; }
364 363
365 // The variable holding the function literal for named function 364 // The variable holding the function literal for named function
366 // literals, or NULL. Only valid for function scopes. 365 // literals, or NULL. Only valid for function scopes.
367 VariableDeclaration* function() const { 366 VariableDeclaration* function() const {
368 DCHECK(is_function_scope()); 367 DCHECK(is_function_scope());
369 return function_; 368 return function_;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 PendingCompilationErrorHandler pending_error_handler_; 765 PendingCompilationErrorHandler pending_error_handler_;
767 766
768 // For tracking which classes are declared consecutively. Needed for strong 767 // For tracking which classes are declared consecutively. Needed for strong
769 // mode. 768 // mode.
770 int class_declaration_group_start_; 769 int class_declaration_group_start_;
771 }; 770 };
772 771
773 } } // namespace v8::internal 772 } } // namespace v8::internal
774 773
775 #endif // V8_SCOPES_H_ 774 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/scopeinfo.cc ('k') | src/snapshot/snapshot-common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698