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

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 Kevin'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
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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 // constants always having them avoids them getting different numbers 583 // constants always having them avoids them getting different numbers
584 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. 584 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not.
585 DEBUG_INFO_TYPE, 585 DEBUG_INFO_TYPE,
586 BREAK_POINT_INFO_TYPE, 586 BREAK_POINT_INFO_TYPE,
587 587
588 FIXED_ARRAY_TYPE, 588 FIXED_ARRAY_TYPE,
589 SHARED_FUNCTION_INFO_TYPE, 589 SHARED_FUNCTION_INFO_TYPE,
590 590
591 JS_MESSAGE_OBJECT_TYPE, 591 JS_MESSAGE_OBJECT_TYPE,
592 592
593 JS_VALUE_TYPE, // FIRST_NON_CALLABLE_OBJECT_TYPE, FIRST_JS_RECEIVER_TYPE 593 // All the following types are subtypes of JSReceiver, which corresponds to
594 // objects in the JS sense. The first and the last type in this range are
595 // the two forms of function. This organization enables using the same
596 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the
597 // NONCALLABLE_JS_OBJECT range.
598 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE
599 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE
600
601 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
594 JS_OBJECT_TYPE, 602 JS_OBJECT_TYPE,
595 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 603 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
596 JS_GLOBAL_OBJECT_TYPE, 604 JS_GLOBAL_OBJECT_TYPE,
597 JS_BUILTINS_OBJECT_TYPE, 605 JS_BUILTINS_OBJECT_TYPE,
598 JS_GLOBAL_PROXY_TYPE, 606 JS_GLOBAL_PROXY_TYPE,
599 JS_ARRAY_TYPE, 607 JS_ARRAY_TYPE,
600 JS_PROXY_TYPE,
601 JS_WEAK_MAP_TYPE, 608 JS_WEAK_MAP_TYPE,
602 609
603 JS_REGEXP_TYPE, // LAST_NONCALLABLE_SPEC_OBJECT_TYPE 610 JS_REGEXP_TYPE,
604 611
605 JS_FUNCTION_TYPE, // FIRST_CALLABLE_SPEC_OBJECT_TYPE 612 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
606 JS_FUNCTION_PROXY_TYPE, // LAST_CALLABLE_SPEC_OBJECT_TYPE
607 613
608 // Pseudo-types 614 // Pseudo-types
609 FIRST_TYPE = 0x0, 615 FIRST_TYPE = 0x0,
610 LAST_TYPE = JS_FUNCTION_PROXY_TYPE, 616 LAST_TYPE = JS_FUNCTION_TYPE,
611 INVALID_TYPE = FIRST_TYPE - 1, 617 INVALID_TYPE = FIRST_TYPE - 1,
612 FIRST_NONSTRING_TYPE = MAP_TYPE, 618 FIRST_NONSTRING_TYPE = MAP_TYPE,
613 // Boundaries for testing for an external array. 619 // Boundaries for testing for an external array.
614 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, 620 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE,
615 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, 621 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE,
616 // Boundary for promotion to old data space/old pointer space. 622 // Boundary for promotion to old data space/old pointer space.
617 LAST_DATA_TYPE = FILLER_TYPE, 623 LAST_DATA_TYPE = FILLER_TYPE,
618 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). 624 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
619 // Note that there is no range for JSObject or JSProxy, since their subtypes 625 // Note that there is no range for JSObject or JSProxy, since their subtypes
620 // are not continuous in this enum! The enum ranges instead reflect the 626 // are not continuous in this enum! The enum ranges instead reflect the
621 // external class names, where proxies are treated as either ordinary objects, 627 // external class names, where proxies are treated as either ordinary objects,
622 // or functions. 628 // or functions.
623 FIRST_JS_RECEIVER_TYPE = JS_VALUE_TYPE, 629 FIRST_JS_RECEIVER_TYPE = JS_FUNCTION_PROXY_TYPE,
624 LAST_JS_RECEIVER_TYPE = LAST_TYPE, 630 LAST_JS_RECEIVER_TYPE = LAST_TYPE,
631 // Boundaries for testing the types represented as JSObject
632 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
633 LAST_JS_OBJECT_TYPE = LAST_TYPE,
634 // Boundaries for testing the types represented as JSProxy
635 FIRST_JS_PROXY_TYPE = JS_FUNCTION_PROXY_TYPE,
636 LAST_JS_PROXY_TYPE = JS_PROXY_TYPE,
637 // Boundaries for testing whether the type is a JavaScript object.
638 FIRST_SPEC_OBJECT_TYPE = FIRST_JS_RECEIVER_TYPE,
639 LAST_SPEC_OBJECT_TYPE = LAST_JS_RECEIVER_TYPE,
625 // Boundaries for testing the types for which typeof is "object". 640 // Boundaries for testing the types for which typeof is "object".
626 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE, 641 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_PROXY_TYPE,
627 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, 642 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE,
628 // Boundaries for testing the types for which typeof is "function". 643 // Note that the types for which typeof is "function" are not continuous.
629 FIRST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_TYPE, 644 // Define this so that we can put assertions on discrete checks.
630 LAST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_PROXY_TYPE, 645 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2
631 // Boundaries for testing whether the type is a JavaScript object.
632 FIRST_SPEC_OBJECT_TYPE = FIRST_NONCALLABLE_SPEC_OBJECT_TYPE,
633 LAST_SPEC_OBJECT_TYPE = LAST_CALLABLE_SPEC_OBJECT_TYPE
634 }; 646 };
635 647
636 static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE - 648 static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE -
637 FIRST_EXTERNAL_ARRAY_TYPE + 1; 649 FIRST_EXTERNAL_ARRAY_TYPE + 1;
638 650
639 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); 651 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType);
640 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); 652 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
641 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType); 653 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType);
642 654
643 655
(...skipping 6814 matching lines...) Expand 10 before | Expand all | Expand 10 after
7458 } else { 7470 } else {
7459 value &= ~(1 << bit_position); 7471 value &= ~(1 << bit_position);
7460 } 7472 }
7461 return value; 7473 return value;
7462 } 7474 }
7463 }; 7475 };
7464 7476
7465 } } // namespace v8::internal 7477 } } // namespace v8::internal
7466 7478
7467 #endif // V8_OBJECTS_H_ 7479 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698