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

Side by Side Diff: src/objects.h

Issue 6321012: Version 3.0.9... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 11 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-debug.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 617 }
618 void Print(FILE* out); 618 void Print(FILE* out);
619 void PrintLn(FILE* out); 619 void PrintLn(FILE* out);
620 #endif 620 #endif
621 #ifdef DEBUG 621 #ifdef DEBUG
622 // Verifies the object. 622 // Verifies the object.
623 void Verify(); 623 void Verify();
624 #endif 624 #endif
625 }; 625 };
626 626
627
628 #define OBJECT_TYPE_LIST(V) \
629 V(Smi) \
630 V(HeapObject) \
631 V(Number) \
632
633 #define HEAP_OBJECT_TYPE_LIST(V) \
634 V(HeapNumber) \
635 V(String) \
636 V(Symbol) \
637 V(SeqString) \
638 V(ExternalString) \
639 V(ConsString) \
640 V(ExternalTwoByteString) \
641 V(ExternalAsciiString) \
642 V(SeqTwoByteString) \
643 V(SeqAsciiString) \
644 \
645 V(PixelArray) \
646 V(ExternalArray) \
647 V(ExternalByteArray) \
648 V(ExternalUnsignedByteArray) \
649 V(ExternalShortArray) \
650 V(ExternalUnsignedShortArray) \
651 V(ExternalIntArray) \
652 V(ExternalUnsignedIntArray) \
653 V(ExternalFloatArray) \
654 V(ByteArray) \
655 V(JSObject) \
656 V(JSContextExtensionObject) \
657 V(Map) \
658 V(DescriptorArray) \
659 V(DeoptimizationInputData) \
660 V(DeoptimizationOutputData) \
661 V(FixedArray) \
662 V(Context) \
663 V(CatchContext) \
664 V(GlobalContext) \
665 V(JSFunction) \
666 V(Code) \
667 V(Oddball) \
668 V(SharedFunctionInfo) \
669 V(JSValue) \
670 V(StringWrapper) \
671 V(Proxy) \
672 V(Boolean) \
673 V(JSArray) \
674 V(JSRegExp) \
675 V(HashTable) \
676 V(Dictionary) \
677 V(SymbolTable) \
678 V(JSFunctionResultCache) \
679 V(NormalizedMapCache) \
680 V(CompilationCacheTable) \
681 V(CodeCacheHashTable) \
682 V(MapCache) \
683 V(Primitive) \
684 V(GlobalObject) \
685 V(JSGlobalObject) \
686 V(JSBuiltinsObject) \
687 V(JSGlobalProxy) \
688 V(UndetectableObject) \
689 V(AccessCheckNeeded) \
690 V(JSGlobalPropertyCell) \
691
627 // Object is the abstract superclass for all classes in the 692 // Object is the abstract superclass for all classes in the
628 // object hierarchy. 693 // object hierarchy.
629 // Object does not use any virtual functions to avoid the 694 // Object does not use any virtual functions to avoid the
630 // allocation of the C++ vtable. 695 // allocation of the C++ vtable.
631 // Since Smi and Failure are subclasses of Object no 696 // Since Smi and Failure are subclasses of Object no
632 // data members can be present in Object. 697 // data members can be present in Object.
633 class Object : public MaybeObject { 698 class Object : public MaybeObject {
634 public: 699 public:
635 // Type testing. 700 // Type testing.
636 inline bool IsSmi(); 701 #define IS_TYPE_FUNCTION_DECL(type_) inline bool Is##type_();
637 inline bool IsHeapObject(); 702 OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
638 inline bool IsHeapNumber(); 703 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
639 inline bool IsString(); 704 #undef IS_TYPE_FUNCTION_DECL
640 inline bool IsSymbol();
641 // See objects-inl.h for more details
642 inline bool IsSeqString();
643 inline bool IsExternalString();
644 inline bool IsExternalTwoByteString();
645 inline bool IsExternalAsciiString();
646 inline bool IsSeqTwoByteString();
647 inline bool IsSeqAsciiString();
648 inline bool IsConsString();
649
650 inline bool IsNumber();
651 inline bool IsByteArray();
652 inline bool IsPixelArray();
653 inline bool IsExternalArray();
654 inline bool IsExternalByteArray();
655 inline bool IsExternalUnsignedByteArray();
656 inline bool IsExternalShortArray();
657 inline bool IsExternalUnsignedShortArray();
658 inline bool IsExternalIntArray();
659 inline bool IsExternalUnsignedIntArray();
660 inline bool IsExternalFloatArray();
661 inline bool IsJSObject();
662 inline bool IsJSContextExtensionObject();
663 inline bool IsMap();
664 inline bool IsFixedArray();
665 inline bool IsDescriptorArray();
666 inline bool IsDeoptimizationInputData();
667 inline bool IsDeoptimizationOutputData();
668 inline bool IsContext();
669 inline bool IsCatchContext();
670 inline bool IsGlobalContext();
671 inline bool IsJSFunction();
672 inline bool IsCode();
673 inline bool IsOddball();
674 inline bool IsSharedFunctionInfo();
675 inline bool IsJSValue();
676 inline bool IsStringWrapper();
677 inline bool IsProxy();
678 inline bool IsBoolean();
679 inline bool IsJSArray();
680 inline bool IsJSRegExp();
681 inline bool IsHashTable();
682 inline bool IsDictionary();
683 inline bool IsSymbolTable();
684 inline bool IsJSFunctionResultCache();
685 inline bool IsNormalizedMapCache();
686 inline bool IsCompilationCacheTable();
687 inline bool IsCodeCacheHashTable();
688 inline bool IsMapCache();
689 inline bool IsPrimitive();
690 inline bool IsGlobalObject();
691 inline bool IsJSGlobalObject();
692 inline bool IsJSBuiltinsObject();
693 inline bool IsJSGlobalProxy();
694 inline bool IsUndetectableObject();
695 inline bool IsAccessCheckNeeded();
696 inline bool IsJSGlobalPropertyCell();
697 705
698 // Returns true if this object is an instance of the specified 706 // Returns true if this object is an instance of the specified
699 // function template. 707 // function template.
700 inline bool IsInstanceOf(FunctionTemplateInfo* type); 708 inline bool IsInstanceOf(FunctionTemplateInfo* type);
701 709
702 inline bool IsStruct(); 710 inline bool IsStruct();
703 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); 711 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name();
704 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) 712 STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
705 #undef DECLARE_STRUCT_PREDICATE 713 #undef DECLARE_STRUCT_PREDICATE
706 714
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 2614
2607 static const int kEntrySize = 2; // key + value 2615 static const int kEntrySize = 2; // key + value
2608 2616
2609 static const int kFactoryOffset = kHeaderSize; 2617 static const int kFactoryOffset = kHeaderSize;
2610 static const int kFingerOffset = kFactoryOffset + kPointerSize; 2618 static const int kFingerOffset = kFactoryOffset + kPointerSize;
2611 static const int kCacheSizeOffset = kFingerOffset + kPointerSize; 2619 static const int kCacheSizeOffset = kFingerOffset + kPointerSize;
2612 2620
2613 inline void MakeZeroSize(); 2621 inline void MakeZeroSize();
2614 inline void Clear(); 2622 inline void Clear();
2615 2623
2624 inline int size();
2625 inline void set_size(int size);
2626 inline int finger_index();
2627 inline void set_finger_index(int finger_index);
2628
2616 // Casting 2629 // Casting
2617 static inline JSFunctionResultCache* cast(Object* obj); 2630 static inline JSFunctionResultCache* cast(Object* obj);
2618 2631
2619 #ifdef DEBUG 2632 #ifdef DEBUG
2620 void JSFunctionResultCacheVerify(); 2633 void JSFunctionResultCacheVerify();
2621 #endif 2634 #endif
2622 }; 2635 };
2623 2636
2624 2637
2625 // The cache for maps used by normalized (dictionary mode) objects. 2638 // The cache for maps used by normalized (dictionary mode) objects.
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
3156 // Pseudo-kinds. 3169 // Pseudo-kinds.
3157 REGEXP = BUILTIN, 3170 REGEXP = BUILTIN,
3158 FIRST_IC_KIND = LOAD_IC, 3171 FIRST_IC_KIND = LOAD_IC,
3159 LAST_IC_KIND = COMPARE_IC 3172 LAST_IC_KIND = COMPARE_IC
3160 }; 3173 };
3161 3174
3162 enum { 3175 enum {
3163 NUMBER_OF_KINDS = LAST_IC_KIND + 1 3176 NUMBER_OF_KINDS = LAST_IC_KIND + 1
3164 }; 3177 };
3165 3178
3179 typedef int ExtraICState;
3180
3181 static const ExtraICState kNoExtraICState = 0;
3182
3166 #ifdef ENABLE_DISASSEMBLER 3183 #ifdef ENABLE_DISASSEMBLER
3167 // Printing 3184 // Printing
3168 static const char* Kind2String(Kind kind); 3185 static const char* Kind2String(Kind kind);
3169 static const char* ICState2String(InlineCacheState state); 3186 static const char* ICState2String(InlineCacheState state);
3170 static const char* PropertyType2String(PropertyType type); 3187 static const char* PropertyType2String(PropertyType type);
3171 inline void Disassemble(const char* name) { 3188 inline void Disassemble(const char* name) {
3172 Disassemble(name, stdout); 3189 Disassemble(name, stdout);
3173 } 3190 }
3174 void Disassemble(const char* name, FILE* out); 3191 void Disassemble(const char* name, FILE* out);
3175 #endif // ENABLE_DISASSEMBLER 3192 #endif // ENABLE_DISASSEMBLER
(...skipping 15 matching lines...) Expand all
3191 3208
3192 inline int relocation_size(); 3209 inline int relocation_size();
3193 3210
3194 // [flags]: Various code flags. 3211 // [flags]: Various code flags.
3195 inline Flags flags(); 3212 inline Flags flags();
3196 inline void set_flags(Flags flags); 3213 inline void set_flags(Flags flags);
3197 3214
3198 // [flags]: Access to specific code flags. 3215 // [flags]: Access to specific code flags.
3199 inline Kind kind(); 3216 inline Kind kind();
3200 inline InlineCacheState ic_state(); // Only valid for IC stubs. 3217 inline InlineCacheState ic_state(); // Only valid for IC stubs.
3218 inline ExtraICState extra_ic_state(); // Only valid for IC stubs.
3201 inline InLoopFlag ic_in_loop(); // Only valid for IC stubs. 3219 inline InLoopFlag ic_in_loop(); // Only valid for IC stubs.
3202 inline PropertyType type(); // Only valid for monomorphic IC stubs. 3220 inline PropertyType type(); // Only valid for monomorphic IC stubs.
3203 inline int arguments_count(); // Only valid for call IC stubs. 3221 inline int arguments_count(); // Only valid for call IC stubs.
3204 3222
3205 // Testers for IC stub kinds. 3223 // Testers for IC stub kinds.
3206 inline bool is_inline_cache_stub(); 3224 inline bool is_inline_cache_stub();
3207 inline bool is_load_stub() { return kind() == LOAD_IC; } 3225 inline bool is_load_stub() { return kind() == LOAD_IC; }
3208 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 3226 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
3209 inline bool is_store_stub() { return kind() == STORE_IC; } 3227 inline bool is_store_stub() { return kind() == STORE_IC; }
3210 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } 3228 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3275 SafepointEntry GetSafepointEntry(Address pc); 3293 SafepointEntry GetSafepointEntry(Address pc);
3276 3294
3277 // Mark this code object as not having a stack check table. Assumes kind 3295 // Mark this code object as not having a stack check table. Assumes kind
3278 // is FUNCTION. 3296 // is FUNCTION.
3279 void SetNoStackCheckTable(); 3297 void SetNoStackCheckTable();
3280 3298
3281 // Find the first map in an IC stub. 3299 // Find the first map in an IC stub.
3282 Map* FindFirstMap(); 3300 Map* FindFirstMap();
3283 3301
3284 // Flags operations. 3302 // Flags operations.
3285 static inline Flags ComputeFlags(Kind kind, 3303 static inline Flags ComputeFlags(
3286 InLoopFlag in_loop = NOT_IN_LOOP, 3304 Kind kind,
3287 InlineCacheState ic_state = UNINITIALIZED, 3305 InLoopFlag in_loop = NOT_IN_LOOP,
3288 PropertyType type = NORMAL, 3306 InlineCacheState ic_state = UNINITIALIZED,
3289 int argc = -1, 3307 ExtraICState extra_ic_state = kNoExtraICState,
3290 InlineCacheHolderFlag holder = OWN_MAP); 3308 PropertyType type = NORMAL,
3309 int argc = -1,
3310 InlineCacheHolderFlag holder = OWN_MAP);
3291 3311
3292 static inline Flags ComputeMonomorphicFlags( 3312 static inline Flags ComputeMonomorphicFlags(
3293 Kind kind, 3313 Kind kind,
3294 PropertyType type, 3314 PropertyType type,
3315 ExtraICState extra_ic_state = kNoExtraICState,
3295 InlineCacheHolderFlag holder = OWN_MAP, 3316 InlineCacheHolderFlag holder = OWN_MAP,
3296 InLoopFlag in_loop = NOT_IN_LOOP, 3317 InLoopFlag in_loop = NOT_IN_LOOP,
3297 int argc = -1); 3318 int argc = -1);
3298 3319
3299 static inline Kind ExtractKindFromFlags(Flags flags); 3320 static inline Kind ExtractKindFromFlags(Flags flags);
3300 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); 3321 static inline InlineCacheState ExtractICStateFromFlags(Flags flags);
3322 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
3301 static inline InLoopFlag ExtractICInLoopFromFlags(Flags flags); 3323 static inline InLoopFlag ExtractICInLoopFromFlags(Flags flags);
3302 static inline PropertyType ExtractTypeFromFlags(Flags flags); 3324 static inline PropertyType ExtractTypeFromFlags(Flags flags);
3303 static inline int ExtractArgumentsCountFromFlags(Flags flags); 3325 static inline int ExtractArgumentsCountFromFlags(Flags flags);
3304 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); 3326 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
3305 static inline Flags RemoveTypeFromFlags(Flags flags); 3327 static inline Flags RemoveTypeFromFlags(Flags flags);
3306 3328
3307 // Convert a target address into a code object. 3329 // Convert a target address into a code object.
3308 static inline Code* GetCodeFromTargetAddress(Address address); 3330 static inline Code* GetCodeFromTargetAddress(Address address);
3309 3331
3310 // Convert an entry address into an object. 3332 // Convert an entry address into an object.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3411 3433
3412 static const int kSafepointTableStartOffset = kStackSlotsOffset + kIntSize; 3434 static const int kSafepointTableStartOffset = kStackSlotsOffset + kIntSize;
3413 static const int kStackCheckTableStartOffset = kStackSlotsOffset + kIntSize; 3435 static const int kStackCheckTableStartOffset = kStackSlotsOffset + kIntSize;
3414 3436
3415 // Flags layout. 3437 // Flags layout.
3416 static const int kFlagsICStateShift = 0; 3438 static const int kFlagsICStateShift = 0;
3417 static const int kFlagsICInLoopShift = 3; 3439 static const int kFlagsICInLoopShift = 3;
3418 static const int kFlagsTypeShift = 4; 3440 static const int kFlagsTypeShift = 4;
3419 static const int kFlagsKindShift = 7; 3441 static const int kFlagsKindShift = 7;
3420 static const int kFlagsICHolderShift = 11; 3442 static const int kFlagsICHolderShift = 11;
3421 static const int kFlagsArgumentsCountShift = 12; 3443 static const int kFlagsExtraICStateShift = 12;
3444 static const int kFlagsArgumentsCountShift = 14;
3422 3445
3423 static const int kFlagsICStateMask = 0x00000007; // 00000000111 3446 static const int kFlagsICStateMask = 0x00000007; // 00000000111
3424 static const int kFlagsICInLoopMask = 0x00000008; // 00000001000 3447 static const int kFlagsICInLoopMask = 0x00000008; // 00000001000
3425 static const int kFlagsTypeMask = 0x00000070; // 00001110000 3448 static const int kFlagsTypeMask = 0x00000070; // 00001110000
3426 static const int kFlagsKindMask = 0x00000780; // 11110000000 3449 static const int kFlagsKindMask = 0x00000780; // 11110000000
3427 static const int kFlagsCacheInPrototypeMapMask = 0x00000800; 3450 static const int kFlagsCacheInPrototypeMapMask = 0x00000800;
3428 static const int kFlagsArgumentsCountMask = 0xFFFFF000; 3451 static const int kFlagsExtraICStateMask = 0x00003000;
3452 static const int kFlagsArgumentsCountMask = 0xFFFFC000;
3429 3453
3430 static const int kFlagsNotUsedInLookup = 3454 static const int kFlagsNotUsedInLookup =
3431 (kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask); 3455 (kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask);
3432 3456
3433 private: 3457 private:
3434 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); 3458 DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
3435 }; 3459 };
3436 3460
3437 3461
3438 // All heap objects have a Map that describes their structure. 3462 // All heap objects have a Map that describes their structure.
(...skipping 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after
6393 } else { 6417 } else {
6394 value &= ~(1 << bit_position); 6418 value &= ~(1 << bit_position);
6395 } 6419 }
6396 return value; 6420 return value;
6397 } 6421 }
6398 }; 6422 };
6399 6423
6400 } } // namespace v8::internal 6424 } } // namespace v8::internal
6401 6425
6402 #endif // V8_OBJECTS_H_ 6426 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698