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

Side by Side Diff: src/objects.h

Issue 7737036: Reorganize object type enum, such that proxies are no longer in the middle (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Erik's comments. Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects-inl.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // constants always having them avoids them getting different numbers 614 // constants always having them avoids them getting different numbers
615 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. 615 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not.
616 DEBUG_INFO_TYPE, 616 DEBUG_INFO_TYPE,
617 BREAK_POINT_INFO_TYPE, 617 BREAK_POINT_INFO_TYPE,
618 618
619 FIXED_ARRAY_TYPE, 619 FIXED_ARRAY_TYPE,
620 SHARED_FUNCTION_INFO_TYPE, 620 SHARED_FUNCTION_INFO_TYPE,
621 621
622 JS_MESSAGE_OBJECT_TYPE, 622 JS_MESSAGE_OBJECT_TYPE,
623 623
624 JS_VALUE_TYPE, // FIRST_NON_CALLABLE_OBJECT_TYPE, FIRST_JS_RECEIVER_TYPE 624 // All the following types are subtypes of JSReceiver, which corresponds to
625 // objects in the JS sense. The first and the last type in this range are
626 // the two forms of function. This organization enables using the same
627 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the
628 // NONCALLABLE_JS_OBJECT range.
629 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE
630 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE
631
632 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
625 JS_OBJECT_TYPE, 633 JS_OBJECT_TYPE,
626 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 634 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
627 JS_GLOBAL_OBJECT_TYPE, 635 JS_GLOBAL_OBJECT_TYPE,
628 JS_BUILTINS_OBJECT_TYPE, 636 JS_BUILTINS_OBJECT_TYPE,
629 JS_GLOBAL_PROXY_TYPE, 637 JS_GLOBAL_PROXY_TYPE,
630 JS_ARRAY_TYPE, 638 JS_ARRAY_TYPE,
631 JS_PROXY_TYPE,
632 JS_WEAK_MAP_TYPE, 639 JS_WEAK_MAP_TYPE,
633 640
634 JS_REGEXP_TYPE, // LAST_NONCALLABLE_SPEC_OBJECT_TYPE 641 JS_REGEXP_TYPE,
635 642
636 JS_FUNCTION_TYPE, // FIRST_CALLABLE_SPEC_OBJECT_TYPE 643 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
637 JS_FUNCTION_PROXY_TYPE, // LAST_CALLABLE_SPEC_OBJECT_TYPE
638 644
639 // Pseudo-types 645 // Pseudo-types
640 FIRST_TYPE = 0x0, 646 FIRST_TYPE = 0x0,
641 LAST_TYPE = JS_FUNCTION_PROXY_TYPE, 647 LAST_TYPE = JS_FUNCTION_TYPE,
642 INVALID_TYPE = FIRST_TYPE - 1, 648 INVALID_TYPE = FIRST_TYPE - 1,
643 FIRST_NONSTRING_TYPE = MAP_TYPE, 649 FIRST_NONSTRING_TYPE = MAP_TYPE,
644 // Boundaries for testing for an external array. 650 // Boundaries for testing for an external array.
645 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, 651 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE,
646 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, 652 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE,
647 // Boundary for promotion to old data space/old pointer space. 653 // Boundary for promotion to old data space/old pointer space.
648 LAST_DATA_TYPE = FILLER_TYPE, 654 LAST_DATA_TYPE = FILLER_TYPE,
649 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). 655 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
650 // Note that there is no range for JSObject or JSProxy, since their subtypes 656 // Note that there is no range for JSObject or JSProxy, since their subtypes
651 // are not continuous in this enum! The enum ranges instead reflect the 657 // are not continuous in this enum! The enum ranges instead reflect the
652 // external class names, where proxies are treated as either ordinary objects, 658 // external class names, where proxies are treated as either ordinary objects,
653 // or functions. 659 // or functions.
654 FIRST_JS_RECEIVER_TYPE = JS_VALUE_TYPE, 660 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE,
655 LAST_JS_RECEIVER_TYPE = LAST_TYPE, 661 LAST_JS_RECEIVER_TYPE = LAST_TYPE,
662 // Boundaries for testing the types represented as JSObject
663 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
664 LAST_JS_OBJECT_TYPE = LAST_TYPE,
665 // Boundaries for testing the types represented as JSProxy
666 FIRST_JS_PROXY_TYPE = JS_FUNCTION_PROXY_TYPE,
667 LAST_JS_PROXY_TYPE = JS_PROXY_TYPE,
668 // Boundaries for testing whether the type is a JavaScript object.
669 FIRST_SPEC_OBJECT_TYPE = FIRST_JS_RECEIVER_TYPE,
670 LAST_SPEC_OBJECT_TYPE = LAST_JS_RECEIVER_TYPE,
656 // Boundaries for testing the types for which typeof is "object". 671 // Boundaries for testing the types for which typeof is "object".
657 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE, 672 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE,
658 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, 673 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE,
659 // Boundaries for testing the types for which typeof is "function". 674 // Note that the types for which typeof is "function" are not continuous.
660 FIRST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_TYPE, 675 // Define this so that we can put assertions on discrete checks.
661 LAST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_PROXY_TYPE, 676 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2
662 // Boundaries for testing whether the type is a JavaScript object.
663 FIRST_SPEC_OBJECT_TYPE = FIRST_NONCALLABLE_SPEC_OBJECT_TYPE,
664 LAST_SPEC_OBJECT_TYPE = LAST_CALLABLE_SPEC_OBJECT_TYPE
665 }; 677 };
666 678
667 static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE - 679 static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE -
668 FIRST_EXTERNAL_ARRAY_TYPE + 1; 680 FIRST_EXTERNAL_ARRAY_TYPE + 1;
669 681
670 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); 682 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType);
671 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); 683 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
672 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType); 684 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType);
673 685
674 686
(...skipping 6811 matching lines...) Expand 10 before | Expand all | Expand 10 after
7486 } else { 7498 } else {
7487 value &= ~(1 << bit_position); 7499 value &= ~(1 << bit_position);
7488 } 7500 }
7489 return value; 7501 return value;
7490 } 7502 }
7491 }; 7503 };
7492 7504
7493 } } // namespace v8::internal 7505 } } // namespace v8::internal
7494 7506
7495 #endif // V8_OBJECTS_H_ 7507 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698