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

Side by Side Diff: src/globals.h

Issue 2199283002: [modules] Introduce new VariableLocation for module imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 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
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/interpreter/bytecode-generator.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_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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 879
880 // The order of this enum has to be kept in sync with the predicates below. 880 // The order of this enum has to be kept in sync with the predicates below.
881 enum VariableMode { 881 enum VariableMode {
882 // User declared variables: 882 // User declared variables:
883 VAR, // declared via 'var', and 'function' declarations 883 VAR, // declared via 'var', and 'function' declarations
884 884
885 CONST_LEGACY, // declared via legacy 'const' declarations 885 CONST_LEGACY, // declared via legacy 'const' declarations
886 886
887 LET, // declared via 'let' declarations (first lexical) 887 LET, // declared via 'let' declarations (first lexical)
888 888
889 // TODO(neis): Is it correct to make this one of the lexical modes?
890 IMPORT, // declared via 'import' declarations (except namespace imports)
891
892 CONST, // declared via 'const' declarations (last lexical) 889 CONST, // declared via 'const' declarations (last lexical)
893 890
894 // Variables introduced by the compiler: 891 // Variables introduced by the compiler:
895 TEMPORARY, // temporary variables (not user-visible), stack-allocated 892 TEMPORARY, // temporary variables (not user-visible), stack-allocated
896 // unless the scope as a whole has forced context allocation 893 // unless the scope as a whole has forced context allocation
897 894
898 DYNAMIC, // always require dynamic lookup (we don't know 895 DYNAMIC, // always require dynamic lookup (we don't know
899 // the declaration) 896 // the declaration)
900 897
901 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the 898 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the
(...skipping 15 matching lines...) Expand all
917 return mode >= VAR && mode <= CONST; 914 return mode >= VAR && mode <= CONST;
918 } 915 }
919 916
920 917
921 inline bool IsLexicalVariableMode(VariableMode mode) { 918 inline bool IsLexicalVariableMode(VariableMode mode) {
922 return mode >= LET && mode <= CONST; 919 return mode >= LET && mode <= CONST;
923 } 920 }
924 921
925 922
926 inline bool IsImmutableVariableMode(VariableMode mode) { 923 inline bool IsImmutableVariableMode(VariableMode mode) {
927 return mode == CONST || mode == CONST_LEGACY || mode == IMPORT; 924 return mode == CONST || mode == CONST_LEGACY;
928 } 925 }
929 926
930
931 enum class VariableLocation { 927 enum class VariableLocation {
932 // Before and during variable allocation, a variable whose location is 928 // Before and during variable allocation, a variable whose location is
933 // not yet determined. After allocation, a variable looked up as a 929 // not yet determined. After allocation, a variable looked up as a
934 // property on the global object (and possibly absent). name() is the 930 // property on the global object (and possibly absent). name() is the
935 // variable name, index() is invalid. 931 // variable name, index() is invalid.
936 UNALLOCATED, 932 UNALLOCATED,
937 933
938 // A slot in the parameter section on the stack. index() is the 934 // A slot in the parameter section on the stack. index() is the
939 // parameter index, counting left-to-right. The receiver is index -1; 935 // parameter index, counting left-to-right. The receiver is index -1;
940 // the first parameter is index 0. 936 // the first parameter is index 0.
(...skipping 10 matching lines...) Expand all
951 947
952 // An indexed slot in a script context that contains a respective global 948 // An indexed slot in a script context that contains a respective global
953 // property cell. name() is the variable name, index() is the variable 949 // property cell. name() is the variable name, index() is the variable
954 // index in the context object on the heap, starting at 0. scope() is the 950 // index in the context object on the heap, starting at 0. scope() is the
955 // corresponding script scope. 951 // corresponding script scope.
956 GLOBAL, 952 GLOBAL,
957 953
958 // A named slot in a heap context. name() is the variable name in the 954 // A named slot in a heap context. name() is the variable name in the
959 // context object on the heap, with lookup starting at the current 955 // context object on the heap, with lookup starting at the current
960 // context. index() is invalid. 956 // context. index() is invalid.
961 LOOKUP 957 LOOKUP,
958
959 // A named slot in a module's export table.
960 MODULE
962 }; 961 };
963 962
964
965 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable 963 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable
966 // and immutable bindings that can be in two states: initialized and 964 // and immutable bindings that can be in two states: initialized and
967 // uninitialized. In ES5 only immutable bindings have these two states. When 965 // uninitialized. In ES5 only immutable bindings have these two states. When
968 // accessing a binding, it needs to be checked for initialization. However in 966 // accessing a binding, it needs to be checked for initialization. However in
969 // the following cases the binding is initialized immediately after creation 967 // the following cases the binding is initialized immediately after creation
970 // so the initialization check can always be skipped: 968 // so the initialization check can always be skipped:
971 // 1. Var declared local variables. 969 // 1. Var declared local variables.
972 // var foo; 970 // var foo;
973 // 2. A local variable introduced by a function declaration. 971 // 2. A local variable introduced by a function declaration.
974 // function foo() {} 972 // function foo() {}
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> 1147 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >>
1150 kPointerSizeLog2); 1148 kPointerSizeLog2);
1151 } 1149 }
1152 1150
1153 } // namespace internal 1151 } // namespace internal
1154 } // namespace v8 1152 } // namespace v8
1155 1153
1156 namespace i = v8::internal; 1154 namespace i = v8::internal;
1157 1155
1158 #endif // V8_GLOBALS_H_ 1156 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698