OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_SCOPEINFO_H_ | 5 #ifndef V8_SCOPEINFO_H_ |
6 #define V8_SCOPEINFO_H_ | 6 #define V8_SCOPEINFO_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/interface.h" | 9 #include "src/modules.h" |
10 #include "src/variables.h" | 10 #include "src/variables.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 // Cache for mapping (data, property name) into context slot index. | 15 // Cache for mapping (data, property name) into context slot index. |
16 // The cache contains both positive and negative results. | 16 // The cache contains both positive and negative results. |
17 // Slot index equals -1 means the property is absent. | 17 // Slot index equals -1 means the property is absent. |
18 // Cleared at startup and prior to mark sweep collection. | 18 // Cleared at startup and prior to mark sweep collection. |
19 class ContextSlotCache { | 19 class ContextSlotCache { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 //--------------------------------------------------------------------------- | 113 //--------------------------------------------------------------------------- |
114 // Auxiliary class used for the description of module instances. | 114 // Auxiliary class used for the description of module instances. |
115 // Used by Runtime_DeclareModules. | 115 // Used by Runtime_DeclareModules. |
116 | 116 |
117 class ModuleInfo: public FixedArray { | 117 class ModuleInfo: public FixedArray { |
118 public: | 118 public: |
119 static ModuleInfo* cast(Object* description) { | 119 static ModuleInfo* cast(Object* description) { |
120 return static_cast<ModuleInfo*>(FixedArray::cast(description)); | 120 return static_cast<ModuleInfo*>(FixedArray::cast(description)); |
121 } | 121 } |
122 | 122 |
123 static Handle<ModuleInfo> Create( | 123 static Handle<ModuleInfo> Create(Isolate* isolate, |
124 Isolate* isolate, Interface* interface, Scope* scope); | 124 ModuleDescriptor* descriptor, Scope* scope); |
125 | 125 |
126 // Index of module's context in host context. | 126 // Index of module's context in host context. |
127 int host_index() { return Smi::cast(get(HOST_OFFSET))->value(); } | 127 int host_index() { return Smi::cast(get(HOST_OFFSET))->value(); } |
128 | 128 |
129 // Name, mode, and index of the i-th export, respectively. | 129 // Name, mode, and index of the i-th export, respectively. |
130 // For value exports, the index is the slot of the value in the module | 130 // For value exports, the index is the slot of the value in the module |
131 // context, for exported modules it is the slot index of the | 131 // context, for exported modules it is the slot index of the |
132 // referred module's context in the host context. | 132 // referred module's context in the host context. |
133 // TODO(rossberg): This format cannot yet handle exports of modules declared | 133 // TODO(rossberg): This format cannot yet handle exports of modules declared |
134 // in earlier scripts. | 134 // in earlier scripts. |
(...skipping 30 matching lines...) Expand all Loading... |
165 } | 165 } |
166 void set_index(int i, int index) { | 166 void set_index(int i, int index) { |
167 set(index_offset(i), Smi::FromInt(index)); | 167 set(index_offset(i), Smi::FromInt(index)); |
168 } | 168 } |
169 }; | 169 }; |
170 | 170 |
171 | 171 |
172 } } // namespace v8::internal | 172 } } // namespace v8::internal |
173 | 173 |
174 #endif // V8_SCOPEINFO_H_ | 174 #endif // V8_SCOPEINFO_H_ |
OLD | NEW |