OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \ | 128 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \ |
129 V(INT8_ARRAY_FUN_INDEX, JSFunction, int8_array_fun) \ | 129 V(INT8_ARRAY_FUN_INDEX, JSFunction, int8_array_fun) \ |
130 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \ | 130 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \ |
131 V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun) \ | 131 V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun) \ |
132 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \ | 132 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \ |
133 V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun) \ | 133 V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun) \ |
134 V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \ | 134 V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \ |
135 V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \ | 135 V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \ |
136 V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \ | 136 V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \ |
137 V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \ | 137 V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \ |
138 V(FUNCTION_MAP_INDEX, Map, function_map) \ | 138 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \ |
139 V(STRICT_MODE_FUNCTION_MAP_INDEX, Map, strict_mode_function_map) \ | 139 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ |
140 V(FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, function_without_prototype_map) \ | 140 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ |
141 V(STRICT_MODE_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ | 141 sloppy_function_without_prototype_map) \ |
142 strict_mode_function_without_prototype_map) \ | 142 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ |
| 143 strict_function_without_prototype_map) \ |
143 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map)\ | 144 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map)\ |
144 V(ARGUMENTS_BOILERPLATE_INDEX, JSObject, arguments_boilerplate) \ | 145 V(SLOPPY_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ |
| 146 sloppy_arguments_boilerplate) \ |
145 V(ALIASED_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ | 147 V(ALIASED_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ |
146 aliased_arguments_boilerplate) \ | 148 aliased_arguments_boilerplate) \ |
147 V(STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ | 149 V(STRICT_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ |
148 strict_mode_arguments_boilerplate) \ | 150 strict_arguments_boilerplate) \ |
149 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \ | 151 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \ |
150 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \ | 152 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \ |
151 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \ | 153 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \ |
152 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ | 154 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ |
153 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \ | 155 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \ |
154 V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \ | 156 V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \ |
155 V(NORMALIZED_MAP_CACHE_INDEX, NormalizedMapCache, normalized_map_cache) \ | 157 V(NORMALIZED_MAP_CACHE_INDEX, NormalizedMapCache, normalized_map_cache) \ |
156 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ | 158 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ |
157 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \ | 159 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \ |
158 V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \ | 160 V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \ |
(...skipping 14 matching lines...) Expand all Loading... |
173 V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \ | 175 V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \ |
174 V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \ | 176 V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \ |
175 V(DERIVED_SET_TRAP_INDEX, JSFunction, derived_set_trap) \ | 177 V(DERIVED_SET_TRAP_INDEX, JSFunction, derived_set_trap) \ |
176 V(PROXY_ENUMERATE_INDEX, JSFunction, proxy_enumerate) \ | 178 V(PROXY_ENUMERATE_INDEX, JSFunction, proxy_enumerate) \ |
177 V(OBSERVERS_NOTIFY_CHANGE_INDEX, JSFunction, observers_notify_change) \ | 179 V(OBSERVERS_NOTIFY_CHANGE_INDEX, JSFunction, observers_notify_change) \ |
178 V(OBSERVERS_ENQUEUE_SPLICE_INDEX, JSFunction, observers_enqueue_splice) \ | 180 V(OBSERVERS_ENQUEUE_SPLICE_INDEX, JSFunction, observers_enqueue_splice) \ |
179 V(OBSERVERS_BEGIN_SPLICE_INDEX, JSFunction, \ | 181 V(OBSERVERS_BEGIN_SPLICE_INDEX, JSFunction, \ |
180 observers_begin_perform_splice) \ | 182 observers_begin_perform_splice) \ |
181 V(OBSERVERS_END_SPLICE_INDEX, JSFunction, \ | 183 V(OBSERVERS_END_SPLICE_INDEX, JSFunction, \ |
182 observers_end_perform_splice) \ | 184 observers_end_perform_splice) \ |
183 V(GENERATOR_FUNCTION_MAP_INDEX, Map, generator_function_map) \ | 185 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \ |
184 V(STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX, Map, \ | 186 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \ |
185 strict_mode_generator_function_map) \ | |
186 V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, \ | 187 V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, \ |
187 generator_object_prototype_map) \ | 188 generator_object_prototype_map) \ |
188 V(GENERATOR_RESULT_MAP_INDEX, Map, generator_result_map) | 189 V(GENERATOR_RESULT_MAP_INDEX, Map, generator_result_map) |
189 | 190 |
190 // JSFunctions are pairs (context, function code), sometimes also called | 191 // JSFunctions are pairs (context, function code), sometimes also called |
191 // closures. A Context object is used to represent function contexts and | 192 // closures. A Context object is used to represent function contexts and |
192 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak). | 193 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak). |
193 // | 194 // |
194 // At runtime, the contexts build a stack in parallel to the execution | 195 // At runtime, the contexts build a stack in parallel to the execution |
195 // stack, with the top-most context being the current context. All contexts | 196 // stack, with the top-most context being the current context. All contexts |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 EXTENSION_INDEX, | 250 EXTENSION_INDEX, |
250 GLOBAL_OBJECT_INDEX, | 251 GLOBAL_OBJECT_INDEX, |
251 MIN_CONTEXT_SLOTS, | 252 MIN_CONTEXT_SLOTS, |
252 | 253 |
253 // This slot holds the thrown value in catch contexts. | 254 // This slot holds the thrown value in catch contexts. |
254 THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS, | 255 THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS, |
255 | 256 |
256 // These slots are only in native contexts. | 257 // These slots are only in native contexts. |
257 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS, | 258 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS, |
258 SECURITY_TOKEN_INDEX, | 259 SECURITY_TOKEN_INDEX, |
259 ARGUMENTS_BOILERPLATE_INDEX, | 260 SLOPPY_ARGUMENTS_BOILERPLATE_INDEX, |
260 ALIASED_ARGUMENTS_BOILERPLATE_INDEX, | 261 ALIASED_ARGUMENTS_BOILERPLATE_INDEX, |
261 STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX, | 262 STRICT_ARGUMENTS_BOILERPLATE_INDEX, |
262 REGEXP_RESULT_MAP_INDEX, | 263 REGEXP_RESULT_MAP_INDEX, |
263 FUNCTION_MAP_INDEX, | 264 SLOPPY_FUNCTION_MAP_INDEX, |
264 STRICT_MODE_FUNCTION_MAP_INDEX, | 265 STRICT_FUNCTION_MAP_INDEX, |
265 FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, | 266 SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, |
266 STRICT_MODE_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, | 267 STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, |
267 INITIAL_OBJECT_PROTOTYPE_INDEX, | 268 INITIAL_OBJECT_PROTOTYPE_INDEX, |
268 INITIAL_ARRAY_PROTOTYPE_INDEX, | 269 INITIAL_ARRAY_PROTOTYPE_INDEX, |
269 BOOLEAN_FUNCTION_INDEX, | 270 BOOLEAN_FUNCTION_INDEX, |
270 NUMBER_FUNCTION_INDEX, | 271 NUMBER_FUNCTION_INDEX, |
271 STRING_FUNCTION_INDEX, | 272 STRING_FUNCTION_INDEX, |
272 STRING_FUNCTION_PROTOTYPE_MAP_INDEX, | 273 STRING_FUNCTION_PROTOTYPE_MAP_INDEX, |
273 SYMBOL_FUNCTION_INDEX, | 274 SYMBOL_FUNCTION_INDEX, |
274 OBJECT_FUNCTION_INDEX, | 275 OBJECT_FUNCTION_INDEX, |
275 INTERNAL_ARRAY_FUNCTION_INDEX, | 276 INTERNAL_ARRAY_FUNCTION_INDEX, |
276 ARRAY_FUNCTION_INDEX, | 277 ARRAY_FUNCTION_INDEX, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 ENQUEUE_EXTERNAL_MICROTASK_INDEX, | 323 ENQUEUE_EXTERNAL_MICROTASK_INDEX, |
323 TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, | 324 TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, |
324 DERIVED_HAS_TRAP_INDEX, | 325 DERIVED_HAS_TRAP_INDEX, |
325 DERIVED_GET_TRAP_INDEX, | 326 DERIVED_GET_TRAP_INDEX, |
326 DERIVED_SET_TRAP_INDEX, | 327 DERIVED_SET_TRAP_INDEX, |
327 PROXY_ENUMERATE_INDEX, | 328 PROXY_ENUMERATE_INDEX, |
328 OBSERVERS_NOTIFY_CHANGE_INDEX, | 329 OBSERVERS_NOTIFY_CHANGE_INDEX, |
329 OBSERVERS_ENQUEUE_SPLICE_INDEX, | 330 OBSERVERS_ENQUEUE_SPLICE_INDEX, |
330 OBSERVERS_BEGIN_SPLICE_INDEX, | 331 OBSERVERS_BEGIN_SPLICE_INDEX, |
331 OBSERVERS_END_SPLICE_INDEX, | 332 OBSERVERS_END_SPLICE_INDEX, |
332 GENERATOR_FUNCTION_MAP_INDEX, | 333 SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, |
333 STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX, | 334 STRICT_GENERATOR_FUNCTION_MAP_INDEX, |
334 GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, | 335 GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, |
335 GENERATOR_RESULT_MAP_INDEX, | 336 GENERATOR_RESULT_MAP_INDEX, |
336 | 337 |
337 // Properties from here are treated as weak references by the full GC. | 338 // Properties from here are treated as weak references by the full GC. |
338 // Scavenge treats them as strong references. | 339 // Scavenge treats them as strong references. |
339 OPTIMIZED_FUNCTIONS_LIST, // Weak. | 340 OPTIMIZED_FUNCTIONS_LIST, // Weak. |
340 OPTIMIZED_CODE_LIST, // Weak. | 341 OPTIMIZED_CODE_LIST, // Weak. |
341 DEOPTIMIZED_CODE_LIST, // Weak. | 342 DEOPTIMIZED_CODE_LIST, // Weak. |
342 MAP_CACHE_INDEX, // Weak. | 343 MAP_CACHE_INDEX, // Weak. |
343 NEXT_CONTEXT_LINK, // Weak. | 344 NEXT_CONTEXT_LINK, // Weak. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 ContextLookupFlags flags, | 484 ContextLookupFlags flags, |
484 int* index, | 485 int* index, |
485 PropertyAttributes* attributes, | 486 PropertyAttributes* attributes, |
486 BindingFlags* binding_flags); | 487 BindingFlags* binding_flags); |
487 | 488 |
488 // Code generation support. | 489 // Code generation support. |
489 static int SlotOffset(int index) { | 490 static int SlotOffset(int index) { |
490 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 491 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
491 } | 492 } |
492 | 493 |
493 static int FunctionMapIndex(LanguageMode language_mode, bool is_generator) { | 494 static int FunctionMapIndex(StrictMode strict_mode, bool is_generator) { |
494 return is_generator | 495 return is_generator |
495 ? (language_mode == SLOPPY_MODE | 496 ? (strict_mode == SLOPPY |
496 ? GENERATOR_FUNCTION_MAP_INDEX | 497 ? SLOPPY_GENERATOR_FUNCTION_MAP_INDEX |
497 : STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX) | 498 : STRICT_GENERATOR_FUNCTION_MAP_INDEX) |
498 : (language_mode == SLOPPY_MODE | 499 : (strict_mode == SLOPPY |
499 ? FUNCTION_MAP_INDEX | 500 ? SLOPPY_FUNCTION_MAP_INDEX |
500 : STRICT_MODE_FUNCTION_MAP_INDEX); | 501 : STRICT_FUNCTION_MAP_INDEX); |
501 } | 502 } |
502 | 503 |
503 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; | 504 static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize; |
504 | 505 |
505 // GC support. | 506 // GC support. |
506 typedef FixedBodyDescriptor< | 507 typedef FixedBodyDescriptor< |
507 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; | 508 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; |
508 | 509 |
509 typedef FixedBodyDescriptor< | 510 typedef FixedBodyDescriptor< |
510 kHeaderSize, | 511 kHeaderSize, |
(...skipping 10 matching lines...) Expand all Loading... |
521 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 522 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
522 #endif | 523 #endif |
523 | 524 |
524 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); | 525 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); |
525 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 526 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
526 }; | 527 }; |
527 | 528 |
528 } } // namespace v8::internal | 529 } } // namespace v8::internal |
529 | 530 |
530 #endif // V8_CONTEXTS_H_ | 531 #endif // V8_CONTEXTS_H_ |
OLD | NEW |