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

Side by Side Diff: src/objects.h

Issue 1765713003: Reland "Speed up the LookupIterator" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: wrap in assertThrows Created 4 years, 9 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/lookup.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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 V(JS_MESSAGE_OBJECT_TYPE) \ 412 V(JS_MESSAGE_OBJECT_TYPE) \
413 \ 413 \
414 V(JS_VALUE_TYPE) \ 414 V(JS_VALUE_TYPE) \
415 V(JS_DATE_TYPE) \ 415 V(JS_DATE_TYPE) \
416 V(JS_OBJECT_TYPE) \ 416 V(JS_OBJECT_TYPE) \
417 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 417 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
418 V(JS_GENERATOR_OBJECT_TYPE) \ 418 V(JS_GENERATOR_OBJECT_TYPE) \
419 V(JS_MODULE_TYPE) \ 419 V(JS_MODULE_TYPE) \
420 V(JS_GLOBAL_OBJECT_TYPE) \ 420 V(JS_GLOBAL_OBJECT_TYPE) \
421 V(JS_GLOBAL_PROXY_TYPE) \ 421 V(JS_GLOBAL_PROXY_TYPE) \
422 V(JS_SPECIAL_API_OBJECT_TYPE) \
422 V(JS_ARRAY_TYPE) \ 423 V(JS_ARRAY_TYPE) \
423 V(JS_ARRAY_BUFFER_TYPE) \ 424 V(JS_ARRAY_BUFFER_TYPE) \
424 V(JS_TYPED_ARRAY_TYPE) \ 425 V(JS_TYPED_ARRAY_TYPE) \
425 V(JS_DATA_VIEW_TYPE) \ 426 V(JS_DATA_VIEW_TYPE) \
426 V(JS_PROXY_TYPE) \ 427 V(JS_PROXY_TYPE) \
427 V(JS_SET_TYPE) \ 428 V(JS_SET_TYPE) \
428 V(JS_MAP_TYPE) \ 429 V(JS_MAP_TYPE) \
429 V(JS_SET_ITERATOR_TYPE) \ 430 V(JS_SET_ITERATOR_TYPE) \
430 V(JS_MAP_ITERATOR_TYPE) \ 431 V(JS_MAP_ITERATOR_TYPE) \
431 V(JS_WEAK_MAP_TYPE) \ 432 V(JS_WEAK_MAP_TYPE) \
432 V(JS_WEAK_SET_TYPE) \ 433 V(JS_WEAK_SET_TYPE) \
433 V(JS_PROMISE_TYPE) \ 434 V(JS_PROMISE_TYPE) \
434 V(JS_REGEXP_TYPE) \ 435 V(JS_REGEXP_TYPE) \
435 \ 436 \
436 V(JS_BOUND_FUNCTION_TYPE) \ 437 V(JS_BOUND_FUNCTION_TYPE) \
437 V(JS_FUNCTION_TYPE) \ 438 V(JS_FUNCTION_TYPE) \
438 V(DEBUG_INFO_TYPE) \ 439 V(DEBUG_INFO_TYPE) \
439 V(BREAK_POINT_INFO_TYPE) 440 V(BREAK_POINT_INFO_TYPE)
440 441
441
442 // Since string types are not consecutive, this macro is used to 442 // Since string types are not consecutive, this macro is used to
443 // iterate over them. 443 // iterate over them.
444 #define STRING_TYPE_LIST(V) \ 444 #define STRING_TYPE_LIST(V) \
445 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ 445 V(STRING_TYPE, kVariableSizeSentinel, string, String) \
446 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ 446 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \
447 OneByteString) \ 447 OneByteString) \
448 V(CONS_STRING_TYPE, ConsString::kSize, cons_string, ConsString) \ 448 V(CONS_STRING_TYPE, ConsString::kSize, cons_string, ConsString) \
449 V(CONS_ONE_BYTE_STRING_TYPE, ConsString::kSize, cons_one_byte_string, \ 449 V(CONS_ONE_BYTE_STRING_TYPE, ConsString::kSize, cons_one_byte_string, \
450 ConsOneByteString) \ 450 ConsOneByteString) \
451 V(SLICED_STRING_TYPE, SlicedString::kSize, sliced_string, SlicedString) \ 451 V(SLICED_STRING_TYPE, SlicedString::kSize, sliced_string, SlicedString) \
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 const uint32_t kShortcutTypeMask = 584 const uint32_t kShortcutTypeMask =
585 kIsNotStringMask | 585 kIsNotStringMask |
586 kIsNotInternalizedMask | 586 kIsNotInternalizedMask |
587 kStringRepresentationMask; 587 kStringRepresentationMask;
588 const uint32_t kShortcutTypeTag = kConsStringTag | kNotInternalizedTag; 588 const uint32_t kShortcutTypeTag = kConsStringTag | kNotInternalizedTag;
589 589
590 static inline bool IsShortcutCandidate(int type) { 590 static inline bool IsShortcutCandidate(int type) {
591 return ((type & kShortcutTypeMask) == kShortcutTypeTag); 591 return ((type & kShortcutTypeMask) == kShortcutTypeTag);
592 } 592 }
593 593
594
595 enum InstanceType { 594 enum InstanceType {
596 // String types. 595 // String types.
597 INTERNALIZED_STRING_TYPE = kTwoByteStringTag | kSeqStringTag | 596 INTERNALIZED_STRING_TYPE = kTwoByteStringTag | kSeqStringTag |
598 kInternalizedTag, // FIRST_PRIMITIVE_TYPE 597 kInternalizedTag, // FIRST_PRIMITIVE_TYPE
599 ONE_BYTE_INTERNALIZED_STRING_TYPE = 598 ONE_BYTE_INTERNALIZED_STRING_TYPE =
600 kOneByteStringTag | kSeqStringTag | kInternalizedTag, 599 kOneByteStringTag | kSeqStringTag | kInternalizedTag,
601 EXTERNAL_INTERNALIZED_STRING_TYPE = 600 EXTERNAL_INTERNALIZED_STRING_TYPE =
602 kTwoByteStringTag | kExternalStringTag | kInternalizedTag, 601 kTwoByteStringTag | kExternalStringTag | kInternalizedTag,
603 EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE = 602 EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE =
604 kOneByteStringTag | kExternalStringTag | kInternalizedTag, 603 kOneByteStringTag | kExternalStringTag | kInternalizedTag,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 WEAK_CELL_TYPE, 695 WEAK_CELL_TYPE,
697 TRANSITION_ARRAY_TYPE, 696 TRANSITION_ARRAY_TYPE,
698 PROPERTY_CELL_TYPE, 697 PROPERTY_CELL_TYPE,
699 PROTOTYPE_INFO_TYPE, 698 PROTOTYPE_INFO_TYPE,
700 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, 699 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE,
701 700
702 // All the following types are subtypes of JSReceiver, which corresponds to 701 // All the following types are subtypes of JSReceiver, which corresponds to
703 // objects in the JS sense. The first and the last type in this range are 702 // objects in the JS sense. The first and the last type in this range are
704 // the two forms of function. This organization enables using the same 703 // the two forms of function. This organization enables using the same
705 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. 704 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range.
706 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE 705 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE
707 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE 706 JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE
707 JS_GLOBAL_PROXY_TYPE,
708 // Like JS_OBJECT_TYPE, but requires access checks and/or has interceptors.
709 JS_SPECIAL_API_OBJECT_TYPE, // LAST_SPECIAL_RECEIVER_TYPE
710 JS_VALUE_TYPE,
708 JS_MESSAGE_OBJECT_TYPE, 711 JS_MESSAGE_OBJECT_TYPE,
709 JS_DATE_TYPE, 712 JS_DATE_TYPE,
710 JS_OBJECT_TYPE, 713 JS_OBJECT_TYPE,
711 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 714 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
712 JS_GENERATOR_OBJECT_TYPE, 715 JS_GENERATOR_OBJECT_TYPE,
713 JS_MODULE_TYPE, 716 JS_MODULE_TYPE,
714 JS_GLOBAL_OBJECT_TYPE,
715 JS_GLOBAL_PROXY_TYPE,
716 JS_ARRAY_TYPE, 717 JS_ARRAY_TYPE,
717 JS_ARRAY_BUFFER_TYPE, 718 JS_ARRAY_BUFFER_TYPE,
718 JS_TYPED_ARRAY_TYPE, 719 JS_TYPED_ARRAY_TYPE,
719 JS_DATA_VIEW_TYPE, 720 JS_DATA_VIEW_TYPE,
720 JS_SET_TYPE, 721 JS_SET_TYPE,
721 JS_MAP_TYPE, 722 JS_MAP_TYPE,
722 JS_SET_ITERATOR_TYPE, 723 JS_SET_ITERATOR_TYPE,
723 JS_MAP_ITERATOR_TYPE, 724 JS_MAP_ITERATOR_TYPE,
724 JS_WEAK_MAP_TYPE, 725 JS_WEAK_MAP_TYPE,
725 JS_WEAK_SET_TYPE, 726 JS_WEAK_SET_TYPE,
(...skipping 20 matching lines...) Expand all
746 // Boundary for promotion to old space. 747 // Boundary for promotion to old space.
747 LAST_DATA_TYPE = FILLER_TYPE, 748 LAST_DATA_TYPE = FILLER_TYPE,
748 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). 749 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
749 // Note that there is no range for JSObject or JSProxy, since their subtypes 750 // Note that there is no range for JSObject or JSProxy, since their subtypes
750 // are not continuous in this enum! The enum ranges instead reflect the 751 // are not continuous in this enum! The enum ranges instead reflect the
751 // external class names, where proxies are treated as either ordinary objects, 752 // external class names, where proxies are treated as either ordinary objects,
752 // or functions. 753 // or functions.
753 FIRST_JS_RECEIVER_TYPE = JS_PROXY_TYPE, 754 FIRST_JS_RECEIVER_TYPE = JS_PROXY_TYPE,
754 LAST_JS_RECEIVER_TYPE = LAST_TYPE, 755 LAST_JS_RECEIVER_TYPE = LAST_TYPE,
755 // Boundaries for testing the types represented as JSObject 756 // Boundaries for testing the types represented as JSObject
756 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, 757 FIRST_JS_OBJECT_TYPE = JS_GLOBAL_OBJECT_TYPE,
757 LAST_JS_OBJECT_TYPE = LAST_TYPE, 758 LAST_JS_OBJECT_TYPE = LAST_TYPE,
759 // Boundary for testing JSReceivers that need special property lookup handling
760 LAST_SPECIAL_RECEIVER_TYPE = JS_SPECIAL_API_OBJECT_TYPE,
758 }; 761 };
759 762
760 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); 763 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
761 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); 764 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
762 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); 765 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
763 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); 766 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType);
764 767
765 768
766 std::ostream& operator<<(std::ostream& os, InstanceType instance_type); 769 std::ostream& operator<<(std::ostream& os, InstanceType instance_type);
767 770
(...skipping 10096 matching lines...) Expand 10 before | Expand all | Expand 10 after
10864 } 10867 }
10865 return value; 10868 return value;
10866 } 10869 }
10867 }; 10870 };
10868 10871
10869 10872
10870 } // NOLINT, false-positive due to second-order macros. 10873 } // NOLINT, false-positive due to second-order macros.
10871 } // NOLINT, false-positive due to second-order macros. 10874 } // NOLINT, false-positive due to second-order macros.
10872 10875
10873 #endif // V8_OBJECTS_H_ 10876 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698