OLD | NEW |
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_CONTEXTS_H_ | 5 #ifndef V8_CONTEXTS_H_ |
6 #define V8_CONTEXTS_H_ | 6 #define V8_CONTEXTS_H_ |
7 | 7 |
8 #include "src/heap.h" | 8 #include "src/heap.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Heap-allocated activation contexts. | 67 // Heap-allocated activation contexts. |
68 // | 68 // |
69 // Contexts are implemented as FixedArray objects; the Context | 69 // Contexts are implemented as FixedArray objects; the Context |
70 // class is a convenience interface casted on a FixedArray object. | 70 // class is a convenience interface casted on a FixedArray object. |
71 // | 71 // |
72 // Note: Context must have no virtual functions and Context objects | 72 // Note: Context must have no virtual functions and Context objects |
73 // must always be allocated via Heap::AllocateContext() or | 73 // must always be allocated via Heap::AllocateContext() or |
74 // Factory::NewContext. | 74 // Factory::NewContext. |
75 | 75 |
76 #define NATIVE_CONTEXT_FIELDS(V) \ | 76 #define NATIVE_CONTEXT_FIELDS(V) \ |
77 V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \ | 77 V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \ |
78 V(SECURITY_TOKEN_INDEX, Object, security_token) \ | 78 V(SECURITY_TOKEN_INDEX, Object, security_token) \ |
79 V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \ | 79 V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \ |
80 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ | 80 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ |
81 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ | 81 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ |
82 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ | 82 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ |
83 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \ | 83 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \ |
84 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ | 84 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ |
85 V(INTERNAL_ARRAY_FUNCTION_INDEX, JSFunction, internal_array_function) \ | 85 V(INTERNAL_ARRAY_FUNCTION_INDEX, JSFunction, internal_array_function) \ |
86 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ | 86 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ |
87 V(JS_ARRAY_MAPS_INDEX, Object, js_array_maps) \ | 87 V(JS_ARRAY_MAPS_INDEX, Object, js_array_maps) \ |
88 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \ | 88 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \ |
89 V(JSON_OBJECT_INDEX, JSObject, json_object) \ | 89 V(JSON_OBJECT_INDEX, JSObject, json_object) \ |
90 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ | 90 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ |
91 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \ | 91 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \ |
92 V(INITIAL_ARRAY_PROTOTYPE_INDEX, JSObject, initial_array_prototype) \ | 92 V(INITIAL_ARRAY_PROTOTYPE_INDEX, JSObject, initial_array_prototype) \ |
93 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ | 93 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ |
94 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ | 94 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ |
95 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) \ | 95 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) \ |
96 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \ | 96 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \ |
97 V(TO_OBJECT_FUN_INDEX, JSFunction, to_object_fun) \ | 97 V(TO_OBJECT_FUN_INDEX, JSFunction, to_object_fun) \ |
98 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \ | 98 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \ |
99 V(TO_UINT32_FUN_INDEX, JSFunction, to_uint32_fun) \ | 99 V(TO_UINT32_FUN_INDEX, JSFunction, to_uint32_fun) \ |
100 V(TO_INT32_FUN_INDEX, JSFunction, to_int32_fun) \ | 100 V(TO_INT32_FUN_INDEX, JSFunction, to_int32_fun) \ |
101 V(GLOBAL_EVAL_FUN_INDEX, JSFunction, global_eval_fun) \ | 101 V(GLOBAL_EVAL_FUN_INDEX, JSFunction, global_eval_fun) \ |
102 V(INSTANTIATE_FUN_INDEX, JSFunction, instantiate_fun) \ | 102 V(INSTANTIATE_FUN_INDEX, JSFunction, instantiate_fun) \ |
103 V(CONFIGURE_INSTANCE_FUN_INDEX, JSFunction, configure_instance_fun) \ | 103 V(CONFIGURE_INSTANCE_FUN_INDEX, JSFunction, configure_instance_fun) \ |
104 V(ARRAY_BUFFER_FUN_INDEX, JSFunction, array_buffer_fun) \ | 104 V(ARRAY_BUFFER_FUN_INDEX, JSFunction, array_buffer_fun) \ |
105 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \ | 105 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \ |
106 V(INT8_ARRAY_FUN_INDEX, JSFunction, int8_array_fun) \ | 106 V(INT8_ARRAY_FUN_INDEX, JSFunction, int8_array_fun) \ |
107 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \ | 107 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \ |
108 V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun) \ | 108 V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun) \ |
109 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \ | 109 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \ |
110 V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun) \ | 110 V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun) \ |
111 V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \ | 111 V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \ |
112 V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \ | 112 V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \ |
113 V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \ | 113 V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \ |
114 V(INT8_ARRAY_EXTERNAL_MAP_INDEX, Map, int8_array_external_map) \ | 114 V(INT8_ARRAY_EXTERNAL_MAP_INDEX, Map, int8_array_external_map) \ |
115 V(UINT8_ARRAY_EXTERNAL_MAP_INDEX, Map, uint8_array_external_map) \ | 115 V(UINT8_ARRAY_EXTERNAL_MAP_INDEX, Map, uint8_array_external_map) \ |
116 V(INT16_ARRAY_EXTERNAL_MAP_INDEX, Map, int16_array_external_map) \ | 116 V(INT16_ARRAY_EXTERNAL_MAP_INDEX, Map, int16_array_external_map) \ |
117 V(UINT16_ARRAY_EXTERNAL_MAP_INDEX, Map, uint16_array_external_map) \ | 117 V(UINT16_ARRAY_EXTERNAL_MAP_INDEX, Map, uint16_array_external_map) \ |
118 V(INT32_ARRAY_EXTERNAL_MAP_INDEX, Map, int32_array_external_map) \ | 118 V(INT32_ARRAY_EXTERNAL_MAP_INDEX, Map, int32_array_external_map) \ |
119 V(UINT32_ARRAY_EXTERNAL_MAP_INDEX, Map, uint32_array_external_map) \ | 119 V(UINT32_ARRAY_EXTERNAL_MAP_INDEX, Map, uint32_array_external_map) \ |
120 V(FLOAT32_ARRAY_EXTERNAL_MAP_INDEX, Map, float32_array_external_map) \ | 120 V(FLOAT32_ARRAY_EXTERNAL_MAP_INDEX, Map, float32_array_external_map) \ |
121 V(FLOAT64_ARRAY_EXTERNAL_MAP_INDEX, Map, float64_array_external_map) \ | 121 V(FLOAT64_ARRAY_EXTERNAL_MAP_INDEX, Map, float64_array_external_map) \ |
122 V(UINT8_CLAMPED_ARRAY_EXTERNAL_MAP_INDEX, Map, \ | 122 V(UINT8_CLAMPED_ARRAY_EXTERNAL_MAP_INDEX, Map, \ |
123 uint8_clamped_array_external_map) \ | 123 uint8_clamped_array_external_map) \ |
124 V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \ | 124 V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \ |
125 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \ | 125 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \ |
126 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \ | 126 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \ |
127 sloppy_function_with_readonly_prototype_map) \ | 127 sloppy_function_with_readonly_prototype_map) \ |
128 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ | 128 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ |
129 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ | 129 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ |
130 sloppy_function_without_prototype_map) \ | 130 sloppy_function_without_prototype_map) \ |
131 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ | 131 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ |
132 strict_function_without_prototype_map) \ | 132 strict_function_without_prototype_map) \ |
133 V(BOUND_FUNCTION_MAP_INDEX, Map, bound_function_map) \ | 133 V(BOUND_FUNCTION_MAP_INDEX, Map, bound_function_map) \ |
134 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map)\ | 134 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \ |
135 V(SLOPPY_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ | 135 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \ |
136 sloppy_arguments_boilerplate) \ | 136 V(ALIASED_ARGUMENTS_MAP_INDEX, Map, aliased_arguments_map) \ |
137 V(ALIASED_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ | 137 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \ |
138 aliased_arguments_boilerplate) \ | 138 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \ |
139 V(STRICT_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ | 139 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \ |
140 strict_arguments_boilerplate) \ | 140 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \ |
141 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \ | 141 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ |
142 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \ | 142 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \ |
143 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \ | 143 V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \ |
144 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ | 144 V(NORMALIZED_MAP_CACHE_INDEX, NormalizedMapCache, normalized_map_cache) \ |
145 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \ | 145 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ |
146 V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \ | 146 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \ |
147 V(NORMALIZED_MAP_CACHE_INDEX, NormalizedMapCache, normalized_map_cache) \ | 147 V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \ |
148 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ | 148 call_as_constructor_delegate) \ |
149 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \ | 149 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ |
150 V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \ | 150 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \ |
151 call_as_constructor_delegate) \ | 151 V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \ |
152 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ | 152 V(MAP_CACHE_INDEX, Object, map_cache) \ |
153 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \ | 153 V(EMBEDDER_DATA_INDEX, FixedArray, embedder_data) \ |
154 V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \ | 154 V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \ |
155 V(MAP_CACHE_INDEX, Object, map_cache) \ | 155 V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object, \ |
156 V(EMBEDDER_DATA_INDEX, FixedArray, embedder_data) \ | 156 error_message_for_code_gen_from_strings) \ |
157 V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \ | 157 V(IS_PROMISE_INDEX, JSFunction, is_promise) \ |
158 V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object, \ | 158 V(PROMISE_CREATE_INDEX, JSFunction, promise_create) \ |
159 error_message_for_code_gen_from_strings) \ | 159 V(PROMISE_RESOLVE_INDEX, JSFunction, promise_resolve) \ |
160 V(IS_PROMISE_INDEX, JSFunction, is_promise) \ | 160 V(PROMISE_REJECT_INDEX, JSFunction, promise_reject) \ |
161 V(PROMISE_CREATE_INDEX, JSFunction, promise_create) \ | 161 V(PROMISE_CHAIN_INDEX, JSFunction, promise_chain) \ |
162 V(PROMISE_RESOLVE_INDEX, JSFunction, promise_resolve) \ | 162 V(PROMISE_CATCH_INDEX, JSFunction, promise_catch) \ |
163 V(PROMISE_REJECT_INDEX, JSFunction, promise_reject) \ | 163 V(PROMISE_THEN_INDEX, JSFunction, promise_then) \ |
164 V(PROMISE_CHAIN_INDEX, JSFunction, promise_chain) \ | 164 V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \ |
165 V(PROMISE_CATCH_INDEX, JSFunction, promise_catch) \ | 165 to_complete_property_descriptor) \ |
166 V(PROMISE_THEN_INDEX, JSFunction, promise_then) \ | 166 V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \ |
167 V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \ | 167 V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \ |
168 to_complete_property_descriptor) \ | 168 V(DERIVED_SET_TRAP_INDEX, JSFunction, derived_set_trap) \ |
169 V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \ | 169 V(PROXY_ENUMERATE_INDEX, JSFunction, proxy_enumerate) \ |
170 V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \ | 170 V(OBSERVERS_NOTIFY_CHANGE_INDEX, JSFunction, observers_notify_change) \ |
171 V(DERIVED_SET_TRAP_INDEX, JSFunction, derived_set_trap) \ | 171 V(OBSERVERS_ENQUEUE_SPLICE_INDEX, JSFunction, observers_enqueue_splice) \ |
172 V(PROXY_ENUMERATE_INDEX, JSFunction, proxy_enumerate) \ | 172 V(OBSERVERS_BEGIN_SPLICE_INDEX, JSFunction, observers_begin_perform_splice) \ |
173 V(OBSERVERS_NOTIFY_CHANGE_INDEX, JSFunction, observers_notify_change) \ | 173 V(OBSERVERS_END_SPLICE_INDEX, JSFunction, observers_end_perform_splice) \ |
174 V(OBSERVERS_ENQUEUE_SPLICE_INDEX, JSFunction, observers_enqueue_splice) \ | 174 V(NATIVE_OBJECT_OBSERVE_INDEX, JSFunction, native_object_observe) \ |
175 V(OBSERVERS_BEGIN_SPLICE_INDEX, JSFunction, \ | 175 V(NATIVE_OBJECT_GET_NOTIFIER_INDEX, JSFunction, native_object_get_notifier) \ |
176 observers_begin_perform_splice) \ | 176 V(NATIVE_OBJECT_NOTIFIER_PERFORM_CHANGE, JSFunction, \ |
177 V(OBSERVERS_END_SPLICE_INDEX, JSFunction, \ | 177 native_object_notifier_perform_change) \ |
178 observers_end_perform_splice) \ | 178 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \ |
179 V(NATIVE_OBJECT_OBSERVE_INDEX, JSFunction, \ | 179 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \ |
180 native_object_observe) \ | 180 V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, generator_object_prototype_map) \ |
181 V(NATIVE_OBJECT_GET_NOTIFIER_INDEX, JSFunction, \ | 181 V(ITERATOR_RESULT_MAP_INDEX, Map, iterator_result_map) \ |
182 native_object_get_notifier) \ | 182 V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map) \ |
183 V(NATIVE_OBJECT_NOTIFIER_PERFORM_CHANGE, JSFunction, \ | 183 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \ |
184 native_object_notifier_perform_change) \ | |
185 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \ | |
186 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \ | |
187 V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, \ | |
188 generator_object_prototype_map) \ | |
189 V(ITERATOR_RESULT_MAP_INDEX, Map, iterator_result_map) \ | |
190 V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map) \ | |
191 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \ | |
192 V(ITERATOR_SYMBOL_INDEX, Symbol, iterator_symbol) | 184 V(ITERATOR_SYMBOL_INDEX, Symbol, iterator_symbol) |
193 | 185 |
194 // JSFunctions are pairs (context, function code), sometimes also called | 186 // JSFunctions are pairs (context, function code), sometimes also called |
195 // closures. A Context object is used to represent function contexts and | 187 // closures. A Context object is used to represent function contexts and |
196 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak). | 188 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak). |
197 // | 189 // |
198 // At runtime, the contexts build a stack in parallel to the execution | 190 // At runtime, the contexts build a stack in parallel to the execution |
199 // stack, with the top-most context being the current context. All contexts | 191 // stack, with the top-most context being the current context. All contexts |
200 // have the following slots: | 192 // have the following slots: |
201 // | 193 // |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 EXTENSION_INDEX, | 248 EXTENSION_INDEX, |
257 GLOBAL_OBJECT_INDEX, | 249 GLOBAL_OBJECT_INDEX, |
258 MIN_CONTEXT_SLOTS, | 250 MIN_CONTEXT_SLOTS, |
259 | 251 |
260 // This slot holds the thrown value in catch contexts. | 252 // This slot holds the thrown value in catch contexts. |
261 THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS, | 253 THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS, |
262 | 254 |
263 // These slots are only in native contexts. | 255 // These slots are only in native contexts. |
264 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS, | 256 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS, |
265 SECURITY_TOKEN_INDEX, | 257 SECURITY_TOKEN_INDEX, |
266 SLOPPY_ARGUMENTS_BOILERPLATE_INDEX, | 258 SLOPPY_ARGUMENTS_MAP_INDEX, |
267 ALIASED_ARGUMENTS_BOILERPLATE_INDEX, | 259 ALIASED_ARGUMENTS_MAP_INDEX, |
268 STRICT_ARGUMENTS_BOILERPLATE_INDEX, | 260 STRICT_ARGUMENTS_MAP_INDEX, |
269 REGEXP_RESULT_MAP_INDEX, | 261 REGEXP_RESULT_MAP_INDEX, |
270 SLOPPY_FUNCTION_MAP_INDEX, | 262 SLOPPY_FUNCTION_MAP_INDEX, |
271 SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, | 263 SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, |
272 STRICT_FUNCTION_MAP_INDEX, | 264 STRICT_FUNCTION_MAP_INDEX, |
273 SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, | 265 SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, |
274 STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, | 266 STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, |
275 BOUND_FUNCTION_MAP_INDEX, | 267 BOUND_FUNCTION_MAP_INDEX, |
276 INITIAL_OBJECT_PROTOTYPE_INDEX, | 268 INITIAL_OBJECT_PROTOTYPE_INDEX, |
277 INITIAL_ARRAY_PROTOTYPE_INDEX, | 269 INITIAL_ARRAY_PROTOTYPE_INDEX, |
278 BOOLEAN_FUNCTION_INDEX, | 270 BOOLEAN_FUNCTION_INDEX, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // Properties from here are treated as weak references by the full GC. | 360 // Properties from here are treated as weak references by the full GC. |
369 // Scavenge treats them as strong references. | 361 // Scavenge treats them as strong references. |
370 OPTIMIZED_FUNCTIONS_LIST, // Weak. | 362 OPTIMIZED_FUNCTIONS_LIST, // Weak. |
371 OPTIMIZED_CODE_LIST, // Weak. | 363 OPTIMIZED_CODE_LIST, // Weak. |
372 DEOPTIMIZED_CODE_LIST, // Weak. | 364 DEOPTIMIZED_CODE_LIST, // Weak. |
373 MAP_CACHE_INDEX, // Weak. | 365 MAP_CACHE_INDEX, // Weak. |
374 NEXT_CONTEXT_LINK, // Weak. | 366 NEXT_CONTEXT_LINK, // Weak. |
375 | 367 |
376 // Total number of slots. | 368 // Total number of slots. |
377 NATIVE_CONTEXT_SLOTS, | 369 NATIVE_CONTEXT_SLOTS, |
378 | |
379 FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST | 370 FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST |
380 }; | 371 }; |
381 | 372 |
382 // Direct slot access. | 373 // Direct slot access. |
383 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); } | 374 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); } |
384 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); } | 375 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); } |
385 | 376 |
386 Context* previous() { | 377 Context* previous() { |
387 Object* result = unchecked_previous(); | 378 Object* result = unchecked_previous(); |
388 ASSERT(IsBootstrappingOrValidParentContext(result, this)); | 379 ASSERT(IsBootstrappingOrValidParentContext(result, this)); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 542 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
552 #endif | 543 #endif |
553 | 544 |
554 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 545 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
555 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 546 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
556 }; | 547 }; |
557 | 548 |
558 } } // namespace v8::internal | 549 } } // namespace v8::internal |
559 | 550 |
560 #endif // V8_CONTEXTS_H_ | 551 #endif // V8_CONTEXTS_H_ |
OLD | NEW |