| 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/heap.h" | 8 #include "src/heap/heap.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 | 10 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 regexp_internal_match_info) \ | 299 regexp_internal_match_info) \ |
| 300 V(REGEXP_PROTOTYPE_MAP_INDEX, Map, regexp_prototype_map) \ | 300 V(REGEXP_PROTOTYPE_MAP_INDEX, Map, regexp_prototype_map) \ |
| 301 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \ | 301 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \ |
| 302 V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \ | 302 V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \ |
| 303 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ | 303 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ |
| 304 V(SECURITY_TOKEN_INDEX, Object, security_token) \ | 304 V(SECURITY_TOKEN_INDEX, Object, security_token) \ |
| 305 V(SELF_WEAK_CELL_INDEX, WeakCell, self_weak_cell) \ | 305 V(SELF_WEAK_CELL_INDEX, WeakCell, self_weak_cell) \ |
| 306 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \ | 306 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \ |
| 307 V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun) \ | 307 V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun) \ |
| 308 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \ | 308 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \ |
| 309 V(SLOPPY_ASYNC_FUNCTION_MAP_INDEX, Map, sloppy_async_function_map) \ | |
| 310 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \ | 309 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \ |
| 311 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ | 310 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ |
| 312 sloppy_function_without_prototype_map) \ | 311 sloppy_function_without_prototype_map) \ |
| 313 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \ | 312 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \ |
| 314 sloppy_function_with_readonly_prototype_map) \ | 313 sloppy_function_with_readonly_prototype_map) \ |
| 315 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \ | |
| 316 V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map) \ | 314 V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map) \ |
| 317 V(SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP, Map, \ | 315 V(SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP, Map, \ |
| 318 slow_object_with_null_prototype_map) \ | 316 slow_object_with_null_prototype_map) \ |
| 319 V(SLOW_TEMPLATE_INSTANTIATIONS_CACHE_INDEX, UnseededNumberDictionary, \ | 317 V(SLOW_TEMPLATE_INSTANTIATIONS_CACHE_INDEX, UnseededNumberDictionary, \ |
| 320 slow_template_instantiations_cache) \ | 318 slow_template_instantiations_cache) \ |
| 321 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \ | 319 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \ |
| 322 V(STRICT_ASYNC_FUNCTION_MAP_INDEX, Map, strict_async_function_map) \ | 320 V(ASYNC_FUNCTION_MAP_INDEX, Map, async_function_map) \ |
| 323 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ | 321 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ |
| 324 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ | 322 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ |
| 325 strict_function_without_prototype_map) \ | 323 strict_function_without_prototype_map) \ |
| 326 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \ | 324 V(GENERATOR_FUNCTION_MAP_INDEX, Map, generator_function_map) \ |
| 327 V(CLASS_FUNCTION_MAP_INDEX, Map, class_function_map) \ | 325 V(CLASS_FUNCTION_MAP_INDEX, Map, class_function_map) \ |
| 328 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ | 326 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ |
| 329 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ | 327 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ |
| 330 V(STRING_ITERATOR_MAP_INDEX, Map, string_iterator_map) \ | 328 V(STRING_ITERATOR_MAP_INDEX, Map, string_iterator_map) \ |
| 331 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \ | 329 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \ |
| 332 V(WASM_FUNCTION_MAP_INDEX, Map, wasm_function_map) \ | 330 V(WASM_FUNCTION_MAP_INDEX, Map, wasm_function_map) \ |
| 333 V(WASM_INSTANCE_CONSTRUCTOR_INDEX, JSFunction, wasm_instance_constructor) \ | 331 V(WASM_INSTANCE_CONSTRUCTOR_INDEX, JSFunction, wasm_instance_constructor) \ |
| 334 V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym) \ | 332 V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym) \ |
| 335 V(WASM_MEMORY_CONSTRUCTOR_INDEX, JSFunction, wasm_memory_constructor) \ | 333 V(WASM_MEMORY_CONSTRUCTOR_INDEX, JSFunction, wasm_memory_constructor) \ |
| 336 V(WASM_MEMORY_SYM_INDEX, Symbol, wasm_memory_sym) \ | 334 V(WASM_MEMORY_SYM_INDEX, Symbol, wasm_memory_sym) \ |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 VariableMode* variable_mode); | 630 VariableMode* variable_mode); |
| 633 | 631 |
| 634 // Code generation support. | 632 // Code generation support. |
| 635 static int SlotOffset(int index) { | 633 static int SlotOffset(int index) { |
| 636 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 634 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
| 637 } | 635 } |
| 638 | 636 |
| 639 static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) { | 637 static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) { |
| 640 // Note: Must be kept in sync with the FastNewClosure builtin. | 638 // Note: Must be kept in sync with the FastNewClosure builtin. |
| 641 if (IsGeneratorFunction(kind)) { | 639 if (IsGeneratorFunction(kind)) { |
| 642 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX | 640 return GENERATOR_FUNCTION_MAP_INDEX; |
| 643 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; | |
| 644 } | 641 } |
| 645 | 642 |
| 646 if (IsAsyncFunction(kind)) { | 643 if (IsAsyncFunction(kind)) { |
| 647 return is_strict(language_mode) ? STRICT_ASYNC_FUNCTION_MAP_INDEX | 644 return ASYNC_FUNCTION_MAP_INDEX; |
| 648 : SLOPPY_ASYNC_FUNCTION_MAP_INDEX; | |
| 649 } | 645 } |
| 650 | 646 |
| 651 if (IsClassConstructor(kind)) { | 647 if (IsClassConstructor(kind)) { |
| 652 // Like the strict function map, but with no 'name' accessor. 'name' | 648 // Like the strict function map, but with no 'name' accessor. 'name' |
| 653 // needs to be the last property and it is added during instantiation, | 649 // needs to be the last property and it is added during instantiation, |
| 654 // in case a static property with the same name exists" | 650 // in case a static property with the same name exists" |
| 655 return CLASS_FUNCTION_MAP_INDEX; | 651 return CLASS_FUNCTION_MAP_INDEX; |
| 656 } | 652 } |
| 657 | 653 |
| 658 if (IsArrowFunction(kind) || IsConciseMethod(kind) || | 654 if (IsArrowFunction(kind) || IsConciseMethod(kind) || |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 688 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
| 693 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 689 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
| 694 }; | 690 }; |
| 695 | 691 |
| 696 typedef Context::Field ContextField; | 692 typedef Context::Field ContextField; |
| 697 | 693 |
| 698 } // namespace internal | 694 } // namespace internal |
| 699 } // namespace v8 | 695 } // namespace v8 |
| 700 | 696 |
| 701 #endif // V8_CONTEXTS_H_ | 697 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |