Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Side by Side Diff: src/contexts.h

Issue 2423053002: Install the 'name' property in classes at runtime (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym) \ 216 V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym) \
217 V(SLOPPY_ASYNC_FUNCTION_MAP_INDEX, Map, sloppy_async_function_map) \ 217 V(SLOPPY_ASYNC_FUNCTION_MAP_INDEX, Map, sloppy_async_function_map) \
218 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \ 218 V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \
219 V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map) \ 219 V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map) \
220 V(STRICT_ASYNC_FUNCTION_MAP_INDEX, Map, strict_async_function_map) \ 220 V(STRICT_ASYNC_FUNCTION_MAP_INDEX, Map, strict_async_function_map) \
221 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \ 221 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \
222 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \ 222 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \
223 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ 223 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
224 strict_function_without_prototype_map) \ 224 strict_function_without_prototype_map) \
225 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \ 225 V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \
226 V(CLASS_FUNCTION_MAP_INDEX, Map, class_function_map) \
226 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ 227 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \
227 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ 228 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \
228 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \ 229 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \
229 V(TYPED_ARRAY_FUN_INDEX, JSFunction, typed_array_function) \ 230 V(TYPED_ARRAY_FUN_INDEX, JSFunction, typed_array_function) \
230 V(TYPED_ARRAY_PROTOTYPE_INDEX, JSObject, typed_array_prototype) \ 231 V(TYPED_ARRAY_PROTOTYPE_INDEX, JSObject, typed_array_prototype) \
231 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \ 232 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \
232 V(UINT16X8_FUNCTION_INDEX, JSFunction, uint16x8_function) \ 233 V(UINT16X8_FUNCTION_INDEX, JSFunction, uint16x8_function) \
233 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \ 234 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \
234 V(UINT32X4_FUNCTION_INDEX, JSFunction, uint32x4_function) \ 235 V(UINT32X4_FUNCTION_INDEX, JSFunction, uint32x4_function) \
235 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \ 236 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX 508 return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX
508 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX; 509 : SLOPPY_GENERATOR_FUNCTION_MAP_INDEX;
509 } 510 }
510 511
511 if (IsAsyncFunction(kind)) { 512 if (IsAsyncFunction(kind)) {
512 return is_strict(language_mode) ? STRICT_ASYNC_FUNCTION_MAP_INDEX 513 return is_strict(language_mode) ? STRICT_ASYNC_FUNCTION_MAP_INDEX
513 : SLOPPY_ASYNC_FUNCTION_MAP_INDEX; 514 : SLOPPY_ASYNC_FUNCTION_MAP_INDEX;
514 } 515 }
515 516
516 if (IsClassConstructor(kind)) { 517 if (IsClassConstructor(kind)) {
517 // Use strict function map (no own "caller" / "arguments") 518 // Like the strict function map, but with no 'name' accessor. 'name'
518 return STRICT_FUNCTION_MAP_INDEX; 519 // needs to be the last property and it is added during instantiation,
520 // in case a static property with the same name exists"
521 return CLASS_FUNCTION_MAP_INDEX;
519 } 522 }
520 523
521 if (IsArrowFunction(kind) || IsConciseMethod(kind) || 524 if (IsArrowFunction(kind) || IsConciseMethod(kind) ||
522 IsAccessorFunction(kind)) { 525 IsAccessorFunction(kind)) {
523 return STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX; 526 return STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX;
524 } 527 }
525 528
526 return is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX 529 return is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX
527 : SLOPPY_FUNCTION_MAP_INDEX; 530 : SLOPPY_FUNCTION_MAP_INDEX;
528 } 531 }
(...skipping 23 matching lines...) Expand all
552 #endif 555 #endif
553 556
554 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); 557 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize);
555 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); 558 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex);
556 }; 559 };
557 560
558 } // namespace internal 561 } // namespace internal
559 } // namespace v8 562 } // namespace v8
560 563
561 #endif // V8_CONTEXTS_H_ 564 #endif // V8_CONTEXTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698