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

Side by Side Diff: src/globals.h

Issue 1218783005: Support for global var shortcuts in script contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing builds Created 5 years, 5 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/factory.cc ('k') | src/heap/heap.h » ('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_GLOBALS_H_ 5 #ifndef V8_GLOBALS_H_
6 #define V8_GLOBALS_H_ 6 #define V8_GLOBALS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 inline bool IsLexicalVariableMode(VariableMode mode) { 844 inline bool IsLexicalVariableMode(VariableMode mode) {
845 return mode >= LET && mode <= IMPORT; 845 return mode >= LET && mode <= IMPORT;
846 } 846 }
847 847
848 848
849 inline bool IsImmutableVariableMode(VariableMode mode) { 849 inline bool IsImmutableVariableMode(VariableMode mode) {
850 return mode == CONST || mode == CONST_LEGACY || mode == IMPORT; 850 return mode == CONST || mode == CONST_LEGACY || mode == IMPORT;
851 } 851 }
852 852
853 853
854 enum class VariableLocation {
855 // Before and during variable allocation, a variable whose location is
856 // not yet determined. After allocation, a variable looked up as a
857 // property on the global object (and possibly absent). name() is the
858 // variable name, index() is invalid.
859 UNALLOCATED,
860
861 // A slot in the parameter section on the stack. index() is the
862 // parameter index, counting left-to-right. The receiver is index -1;
863 // the first parameter is index 0.
864 PARAMETER,
865
866 // A slot in the local section on the stack. index() is the variable
867 // index in the stack frame, starting at 0.
868 LOCAL,
869
870 // An indexed slot in a heap context. index() is the variable index in
871 // the context object on the heap, starting at 0. scope() is the
872 // corresponding scope.
873 CONTEXT,
874
875 // An indexed slot in a script context that contains a respective global
876 // property cell. name() is the variable name, index() is the variable
877 // index in the context object on the heap, starting at 0. scope() is the
878 // corresponding script scope.
879 GLOBAL,
880
881 // A named slot in a heap context. name() is the variable name in the
882 // context object on the heap, with lookup starting at the current
883 // context. index() is invalid.
884 LOOKUP
885 };
886
887
854 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable 888 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable
855 // and immutable bindings that can be in two states: initialized and 889 // and immutable bindings that can be in two states: initialized and
856 // uninitialized. In ES5 only immutable bindings have these two states. When 890 // uninitialized. In ES5 only immutable bindings have these two states. When
857 // accessing a binding, it needs to be checked for initialization. However in 891 // accessing a binding, it needs to be checked for initialization. However in
858 // the following cases the binding is initialized immediately after creation 892 // the following cases the binding is initialized immediately after creation
859 // so the initialization check can always be skipped: 893 // so the initialization check can always be skipped:
860 // 1. Var declared local variables. 894 // 1. Var declared local variables.
861 // var foo; 895 // var foo;
862 // 2. A local variable introduced by a function declaration. 896 // 2. A local variable introduced by a function declaration.
863 // function foo() {} 897 // function foo() {}
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { 1040 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) {
1007 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); 1041 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral);
1008 DCHECK(IsValidFunctionKind(kind)); 1042 DCHECK(IsValidFunctionKind(kind));
1009 return kind; 1043 return kind;
1010 } 1044 }
1011 } } // namespace v8::internal 1045 } } // namespace v8::internal
1012 1046
1013 namespace i = v8::internal; 1047 namespace i = v8::internal;
1014 1048
1015 #endif // V8_GLOBALS_H_ 1049 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698