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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym) \ | 317 V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym) \ |
318 V(SLOPPY_ASYNC_FUNCTION_MAP_INDEX, Map, sloppy_async_function_map) \ | 318 V(SLOPPY_ASYNC_FUNCTION_MAP_INDEX, Map, sloppy_async_function_map) \ |
319 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \ | 319 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \ |
320 V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map) \ | 320 V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map) \ |
321 V(STRICT_ASYNC_FUNCTION_MAP_INDEX, Map, strict_async_function_map) \ | 321 V(STRICT_ASYNC_FUNCTION_MAP_INDEX, Map, strict_async_function_map) \ |
322 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \ | 322 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \ |
323 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ | 323 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ |
324 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ | 324 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ |
325 strict_function_without_prototype_map) \ | 325 strict_function_without_prototype_map) \ |
326 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \ | 326 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \ |
| 327 V(CLASS_FUNCTION_MAP_INDEX, Map, class_function_map) \ |
327 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ | 328 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ |
328 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ | 329 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ |
329 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \ | 330 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \ |
330 V(TYPED_ARRAY_FUN_INDEX, JSFunction, typed_array_function) \ | 331 V(TYPED_ARRAY_FUN_INDEX, JSFunction, typed_array_function) \ |
331 V(TYPED_ARRAY_PROTOTYPE_INDEX, JSObject, typed_array_prototype) \ | 332 V(TYPED_ARRAY_PROTOTYPE_INDEX, JSObject, typed_array_prototype) \ |
332 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \ | 333 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \ |
333 V(UINT16X8_FUNCTION_INDEX, JSFunction, uint16x8_function) \ | 334 V(UINT16X8_FUNCTION_INDEX, JSFunction, uint16x8_function) \ |
334 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \ | 335 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \ |
335 V(UINT32X4_FUNCTION_INDEX, JSFunction, uint32x4_function) \ | 336 V(UINT32X4_FUNCTION_INDEX, JSFunction, uint32x4_function) \ |
336 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \ | 337 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \ |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX | 610 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX |
610 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; | 611 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; |
611 } | 612 } |
612 | 613 |
613 if (IsAsyncFunction(kind)) { | 614 if (IsAsyncFunction(kind)) { |
614 return is_strict(language_mode) ? STRICT_ASYNC_FUNCTION_MAP_INDEX | 615 return is_strict(language_mode) ? STRICT_ASYNC_FUNCTION_MAP_INDEX |
615 : SLOPPY_ASYNC_FUNCTION_MAP_INDEX; | 616 : SLOPPY_ASYNC_FUNCTION_MAP_INDEX; |
616 } | 617 } |
617 | 618 |
618 if (IsClassConstructor(kind)) { | 619 if (IsClassConstructor(kind)) { |
619 // Use strict function map (no own "caller" / "arguments") | 620 // Like the strict function map, but with no 'name' accessor. 'name' |
620 return STRICT_FUNCTION_MAP_INDEX; | 621 // needs to be the last property and it is added during instantiation, |
| 622 // in case a static property with the same name exists" |
| 623 return CLASS_FUNCTION_MAP_INDEX; |
621 } | 624 } |
622 | 625 |
623 if (IsArrowFunction(kind) || IsConciseMethod(kind) || | 626 if (IsArrowFunction(kind) || IsConciseMethod(kind) || |
624 IsAccessorFunction(kind)) { | 627 IsAccessorFunction(kind)) { |
625 return STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; | 628 return STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; |
626 } | 629 } |
627 | 630 |
628 return is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX | 631 return is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX |
629 : SLOPPY_FUNCTION_MAP_INDEX; | 632 : SLOPPY_FUNCTION_MAP_INDEX; |
630 } | 633 } |
(...skipping 26 matching lines...) Expand all Loading... |
657 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 660 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
658 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 661 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
659 }; | 662 }; |
660 | 663 |
661 typedef Context::Field ContextField; | 664 typedef Context::Field ContextField; |
662 | 665 |
663 } // namespace internal | 666 } // namespace internal |
664 } // namespace v8 | 667 } // namespace v8 |
665 | 668 |
666 #endif // V8_CONTEXTS_H_ | 669 #endif // V8_CONTEXTS_H_ |
OLD | NEW |