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

Side by Side Diff: src/objects.h

Issue 2080243003: Use instance type in Object.prototype.toString(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO comment about checking IsArray() before reading toStringTag. Created 4 years, 5 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
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 V(FIXED_DOUBLE_ARRAY_TYPE) \ 408 V(FIXED_DOUBLE_ARRAY_TYPE) \
409 V(SHARED_FUNCTION_INFO_TYPE) \ 409 V(SHARED_FUNCTION_INFO_TYPE) \
410 V(WEAK_CELL_TYPE) \ 410 V(WEAK_CELL_TYPE) \
411 V(TRANSITION_ARRAY_TYPE) \ 411 V(TRANSITION_ARRAY_TYPE) \
412 \ 412 \
413 V(JS_MESSAGE_OBJECT_TYPE) \ 413 V(JS_MESSAGE_OBJECT_TYPE) \
414 \ 414 \
415 V(JS_VALUE_TYPE) \ 415 V(JS_VALUE_TYPE) \
416 V(JS_DATE_TYPE) \ 416 V(JS_DATE_TYPE) \
417 V(JS_OBJECT_TYPE) \ 417 V(JS_OBJECT_TYPE) \
418 V(JS_ARGUMENTS_TYPE) \
418 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 419 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
419 V(JS_GENERATOR_OBJECT_TYPE) \ 420 V(JS_GENERATOR_OBJECT_TYPE) \
420 V(JS_MODULE_TYPE) \ 421 V(JS_MODULE_TYPE) \
421 V(JS_GLOBAL_OBJECT_TYPE) \ 422 V(JS_GLOBAL_OBJECT_TYPE) \
422 V(JS_GLOBAL_PROXY_TYPE) \ 423 V(JS_GLOBAL_PROXY_TYPE) \
423 V(JS_API_OBJECT_TYPE) \ 424 V(JS_API_OBJECT_TYPE) \
424 V(JS_SPECIAL_API_OBJECT_TYPE) \ 425 V(JS_SPECIAL_API_OBJECT_TYPE) \
425 V(JS_ARRAY_TYPE) \ 426 V(JS_ARRAY_TYPE) \
426 V(JS_ARRAY_BUFFER_TYPE) \ 427 V(JS_ARRAY_BUFFER_TYPE) \
427 V(JS_TYPED_ARRAY_TYPE) \ 428 V(JS_TYPED_ARRAY_TYPE) \
428 V(JS_DATA_VIEW_TYPE) \ 429 V(JS_DATA_VIEW_TYPE) \
429 V(JS_PROXY_TYPE) \ 430 V(JS_PROXY_TYPE) \
430 V(JS_SET_TYPE) \ 431 V(JS_SET_TYPE) \
431 V(JS_MAP_TYPE) \ 432 V(JS_MAP_TYPE) \
432 V(JS_SET_ITERATOR_TYPE) \ 433 V(JS_SET_ITERATOR_TYPE) \
433 V(JS_MAP_ITERATOR_TYPE) \ 434 V(JS_MAP_ITERATOR_TYPE) \
434 V(JS_WEAK_MAP_TYPE) \ 435 V(JS_WEAK_MAP_TYPE) \
435 V(JS_WEAK_SET_TYPE) \ 436 V(JS_WEAK_SET_TYPE) \
436 V(JS_PROMISE_TYPE) \ 437 V(JS_PROMISE_TYPE) \
437 V(JS_REGEXP_TYPE) \ 438 V(JS_REGEXP_TYPE) \
439 V(JS_ERROR_TYPE) \
438 \ 440 \
439 V(JS_BOUND_FUNCTION_TYPE) \ 441 V(JS_BOUND_FUNCTION_TYPE) \
440 V(JS_FUNCTION_TYPE) \ 442 V(JS_FUNCTION_TYPE) \
441 V(DEBUG_INFO_TYPE) \ 443 V(DEBUG_INFO_TYPE) \
442 V(BREAK_POINT_INFO_TYPE) 444 V(BREAK_POINT_INFO_TYPE)
443 445
444 // Since string types are not consecutive, this macro is used to 446 // Since string types are not consecutive, this macro is used to
445 // iterate over them. 447 // iterate over them.
446 #define STRING_TYPE_LIST(V) \ 448 #define STRING_TYPE_LIST(V) \
447 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ 449 V(STRING_TYPE, kVariableSizeSentinel, string, String) \
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 JS_GLOBAL_PROXY_TYPE, 707 JS_GLOBAL_PROXY_TYPE,
706 // Like JS_API_OBJECT_TYPE, but requires access checks and/or has 708 // Like JS_API_OBJECT_TYPE, but requires access checks and/or has
707 // interceptors. 709 // interceptors.
708 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE 710 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE
709 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER 711 JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER
710 JS_MESSAGE_OBJECT_TYPE, 712 JS_MESSAGE_OBJECT_TYPE,
711 JS_DATE_TYPE, 713 JS_DATE_TYPE,
712 // Like JS_OBJECT_TYPE, but created from API function. 714 // Like JS_OBJECT_TYPE, but created from API function.
713 JS_API_OBJECT_TYPE, 715 JS_API_OBJECT_TYPE,
714 JS_OBJECT_TYPE, 716 JS_OBJECT_TYPE,
717 JS_ARGUMENTS_TYPE,
715 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 718 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
716 JS_GENERATOR_OBJECT_TYPE, 719 JS_GENERATOR_OBJECT_TYPE,
717 JS_MODULE_TYPE, 720 JS_MODULE_TYPE,
718 JS_ARRAY_TYPE, 721 JS_ARRAY_TYPE,
719 JS_ARRAY_BUFFER_TYPE, 722 JS_ARRAY_BUFFER_TYPE,
720 JS_TYPED_ARRAY_TYPE, 723 JS_TYPED_ARRAY_TYPE,
721 JS_DATA_VIEW_TYPE, 724 JS_DATA_VIEW_TYPE,
722 JS_SET_TYPE, 725 JS_SET_TYPE,
723 JS_MAP_TYPE, 726 JS_MAP_TYPE,
724 JS_SET_ITERATOR_TYPE, 727 JS_SET_ITERATOR_TYPE,
725 JS_MAP_ITERATOR_TYPE, 728 JS_MAP_ITERATOR_TYPE,
726 JS_WEAK_MAP_TYPE, 729 JS_WEAK_MAP_TYPE,
727 JS_WEAK_SET_TYPE, 730 JS_WEAK_SET_TYPE,
728 JS_PROMISE_TYPE, 731 JS_PROMISE_TYPE,
729 JS_REGEXP_TYPE, 732 JS_REGEXP_TYPE,
733 JS_ERROR_TYPE,
730 JS_BOUND_FUNCTION_TYPE, 734 JS_BOUND_FUNCTION_TYPE,
731 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 735 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
732 736
733 // Pseudo-types 737 // Pseudo-types
734 FIRST_TYPE = 0x0, 738 FIRST_TYPE = 0x0,
735 LAST_TYPE = JS_FUNCTION_TYPE, 739 LAST_TYPE = JS_FUNCTION_TYPE,
736 FIRST_NAME_TYPE = FIRST_TYPE, 740 FIRST_NAME_TYPE = FIRST_TYPE,
737 LAST_NAME_TYPE = SYMBOL_TYPE, 741 LAST_NAME_TYPE = SYMBOL_TYPE,
738 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, 742 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
739 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, 743 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 1936
1933 // ES6 [[PreventExtensions]] (when passed DONT_THROW) 1937 // ES6 [[PreventExtensions]] (when passed DONT_THROW)
1934 MUST_USE_RESULT static Maybe<bool> PreventExtensions( 1938 MUST_USE_RESULT static Maybe<bool> PreventExtensions(
1935 Handle<JSReceiver> object, ShouldThrow should_throw); 1939 Handle<JSReceiver> object, ShouldThrow should_throw);
1936 1940
1937 MUST_USE_RESULT static Maybe<bool> IsExtensible(Handle<JSReceiver> object); 1941 MUST_USE_RESULT static Maybe<bool> IsExtensible(Handle<JSReceiver> object);
1938 1942
1939 // Returns the class name ([[Class]] property in the specification). 1943 // Returns the class name ([[Class]] property in the specification).
1940 String* class_name(); 1944 String* class_name();
1941 1945
1942 // Returns the builtin string tag used in Object.prototype.toString.
1943 MUST_USE_RESULT static MaybeHandle<String> BuiltinStringTag(
1944 Handle<JSReceiver> object);
1945
1946 // Returns the constructor name (the name (possibly, inferred name) of the 1946 // Returns the constructor name (the name (possibly, inferred name) of the
1947 // function that was used to instantiate the object). 1947 // function that was used to instantiate the object).
1948 static Handle<String> GetConstructorName(Handle<JSReceiver> receiver); 1948 static Handle<String> GetConstructorName(Handle<JSReceiver> receiver);
1949 1949
1950 Context* GetCreationContext(); 1950 Context* GetCreationContext();
1951 1951
1952 MUST_USE_RESULT static inline Maybe<PropertyAttributes> GetPropertyAttributes( 1952 MUST_USE_RESULT static inline Maybe<PropertyAttributes> GetPropertyAttributes(
1953 Handle<JSReceiver> object, Handle<Name> name); 1953 Handle<JSReceiver> object, Handle<Name> name);
1954 MUST_USE_RESULT static inline Maybe<PropertyAttributes> 1954 MUST_USE_RESULT static inline Maybe<PropertyAttributes>
1955 GetOwnPropertyAttributes(Handle<JSReceiver> object, Handle<Name> name); 1955 GetOwnPropertyAttributes(Handle<JSReceiver> object, Handle<Name> name);
(...skipping 8859 matching lines...) Expand 10 before | Expand all | Expand 10 after
10815 } 10815 }
10816 return value; 10816 return value;
10817 } 10817 }
10818 }; 10818 };
10819 10819
10820 10820
10821 } // NOLINT, false-positive due to second-order macros. 10821 } // NOLINT, false-positive due to second-order macros.
10822 } // NOLINT, false-positive due to second-order macros. 10822 } // NOLINT, false-positive due to second-order macros.
10823 10823
10824 #endif // V8_OBJECTS_H_ 10824 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698