 Chromium Code Reviews
 Chromium Code Reviews Issue 391693002:
  In-object double fields unboxing (for 64-bit only).  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 391693002:
  In-object double fields unboxing (for 64-bit only).  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| OLD | NEW | 
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/allocation.h" | 8 #include "src/allocation.h" | 
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" | 
| 10 #include "src/builtins.h" | 10 #include "src/builtins.h" | 
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 | 874 | 
| 875 class AccessorPair; | 875 class AccessorPair; | 
| 876 class AllocationSite; | 876 class AllocationSite; | 
| 877 class AllocationSiteCreationContext; | 877 class AllocationSiteCreationContext; | 
| 878 class AllocationSiteUsageContext; | 878 class AllocationSiteUsageContext; | 
| 879 class DictionaryElementsAccessor; | 879 class DictionaryElementsAccessor; | 
| 880 class ElementsAccessor; | 880 class ElementsAccessor; | 
| 881 class FixedArrayBase; | 881 class FixedArrayBase; | 
| 882 class GlobalObject; | 882 class GlobalObject; | 
| 883 class ObjectVisitor; | 883 class ObjectVisitor; | 
| 884 class LayoutDescriptor; | |
| 884 class LookupIterator; | 885 class LookupIterator; | 
| 885 class StringStream; | 886 class StringStream; | 
| 886 // We cannot just say "class HeapType;" if it is created from a template... =8-? | 887 // We cannot just say "class HeapType;" if it is created from a template... =8-? | 
| 887 template<class> class TypeImpl; | 888 template<class> class TypeImpl; | 
| 888 struct HeapTypeConfig; | 889 struct HeapTypeConfig; | 
| 889 typedef TypeImpl<HeapTypeConfig> HeapType; | 890 typedef TypeImpl<HeapTypeConfig> HeapType; | 
| 890 | 891 | 
| 891 | 892 | 
| 892 // A template-ized version of the IsXXX functions. | 893 // A template-ized version of the IsXXX functions. | 
| 893 template <class C> inline bool Is(Object* obj); | 894 template <class C> inline bool Is(Object* obj); | 
| 894 | 895 | 
| 895 #ifdef VERIFY_HEAP | 896 #ifdef VERIFY_HEAP | 
| 896 #define DECLARE_VERIFIER(Name) void Name##Verify(); | 897 #define DECLARE_VERIFIER(Name) void Name##Verify(); | 
| 897 #else | 898 #else | 
| 898 #define DECLARE_VERIFIER(Name) | 899 #define DECLARE_VERIFIER(Name) | 
| 899 #endif | 900 #endif | 
| 900 | 901 | 
| 901 #ifdef OBJECT_PRINT | 902 #ifdef OBJECT_PRINT | 
| 902 #define DECLARE_PRINTER(Name) void Name##Print(OStream& os); // NOLINT | 903 #define DECLARE_PRINTER(Name) void Name##Print(OStream& os); // NOLINT | 
| 903 #else | 904 #else | 
| 904 #define DECLARE_PRINTER(Name) | 905 #define DECLARE_PRINTER(Name) | 
| 905 #endif | 906 #endif | 
| 906 | 907 | 
| 907 | 908 | 
| 908 #define OBJECT_TYPE_LIST(V) \ | 909 #define OBJECT_TYPE_LIST(V) \ | 
| 909 V(Smi) \ | 910 V(Smi) \ | 
| 910 V(HeapObject) \ | 911 V(HeapObject) \ | 
| 911 V(Number) \ | 912 V(Number) | 
| 912 | 913 | 
| 913 #define HEAP_OBJECT_TYPE_LIST(V) \ | 914 #define HEAP_OBJECT_TYPE_LIST(V) \ | 
| 914 V(HeapNumber) \ | 915 V(HeapNumber) \ | 
| 915 V(MutableHeapNumber) \ | 916 V(MutableHeapNumber) \ | 
| 916 V(Name) \ | 917 V(Name) \ | 
| 917 V(UniqueName) \ | 918 V(UniqueName) \ | 
| 918 V(String) \ | 919 V(String) \ | 
| 919 V(SeqString) \ | 920 V(SeqString) \ | 
| 920 V(ExternalString) \ | 921 V(ExternalString) \ | 
| 921 V(ConsString) \ | 922 V(ConsString) \ | 
| 922 V(SlicedString) \ | 923 V(SlicedString) \ | 
| 923 V(ExternalTwoByteString) \ | 924 V(ExternalTwoByteString) \ | 
| 924 V(ExternalAsciiString) \ | 925 V(ExternalAsciiString) \ | 
| 925 V(SeqTwoByteString) \ | 926 V(SeqTwoByteString) \ | 
| 926 V(SeqOneByteString) \ | 927 V(SeqOneByteString) \ | 
| 927 V(InternalizedString) \ | 928 V(InternalizedString) \ | 
| 928 V(Symbol) \ | 929 V(Symbol) \ | 
| 929 \ | 930 \ | 
| 930 V(ExternalArray) \ | 931 V(ExternalArray) \ | 
| 931 V(ExternalInt8Array) \ | 932 V(ExternalInt8Array) \ | 
| 932 V(ExternalUint8Array) \ | 933 V(ExternalUint8Array) \ | 
| 933 V(ExternalInt16Array) \ | 934 V(ExternalInt16Array) \ | 
| 934 V(ExternalUint16Array) \ | 935 V(ExternalUint16Array) \ | 
| 935 V(ExternalInt32Array) \ | 936 V(ExternalInt32Array) \ | 
| 936 V(ExternalUint32Array) \ | 937 V(ExternalUint32Array) \ | 
| 937 V(ExternalFloat32Array) \ | 938 V(ExternalFloat32Array) \ | 
| 938 V(ExternalFloat64Array) \ | 939 V(ExternalFloat64Array) \ | 
| 939 V(ExternalUint8ClampedArray) \ | 940 V(ExternalUint8ClampedArray) \ | 
| 940 V(FixedTypedArrayBase) \ | 941 V(FixedTypedArrayBase) \ | 
| 941 V(FixedUint8Array) \ | 942 V(FixedUint8Array) \ | 
| 942 V(FixedInt8Array) \ | 943 V(FixedInt8Array) \ | 
| 943 V(FixedUint16Array) \ | 944 V(FixedUint16Array) \ | 
| 944 V(FixedInt16Array) \ | 945 V(FixedInt16Array) \ | 
| 945 V(FixedUint32Array) \ | 946 V(FixedUint32Array) \ | 
| 946 V(FixedInt32Array) \ | 947 V(FixedInt32Array) \ | 
| 947 V(FixedFloat32Array) \ | 948 V(FixedFloat32Array) \ | 
| 948 V(FixedFloat64Array) \ | 949 V(FixedFloat64Array) \ | 
| 949 V(FixedUint8ClampedArray) \ | 950 V(FixedUint8ClampedArray) \ | 
| 950 V(ByteArray) \ | 951 V(ByteArray) \ | 
| 951 V(FreeSpace) \ | 952 V(FreeSpace) \ | 
| 952 V(JSReceiver) \ | 953 V(JSReceiver) \ | 
| 953 V(JSObject) \ | 954 V(JSObject) \ | 
| 954 V(JSContextExtensionObject) \ | 955 V(JSContextExtensionObject) \ | 
| 955 V(JSGeneratorObject) \ | 956 V(JSGeneratorObject) \ | 
| 956 V(JSModule) \ | 957 V(JSModule) \ | 
| 957 V(Map) \ | 958 V(Map) \ | 
| 958 V(DescriptorArray) \ | 959 V(DescriptorArray) \ | 
| 959 V(TransitionArray) \ | 960 V(LayoutDescriptor) \ | 
| 960 V(DeoptimizationInputData) \ | 961 V(TransitionArray) \ | 
| 961 V(DeoptimizationOutputData) \ | 962 V(DeoptimizationInputData) \ | 
| 962 V(DependentCode) \ | 963 V(DeoptimizationOutputData) \ | 
| 963 V(FixedArray) \ | 964 V(DependentCode) \ | 
| 964 V(FixedDoubleArray) \ | 965 V(FixedArray) \ | 
| 965 V(ConstantPoolArray) \ | 966 V(FixedDoubleArray) \ | 
| 966 V(Context) \ | 967 V(ConstantPoolArray) \ | 
| 967 V(NativeContext) \ | 968 V(Context) \ | 
| 968 V(ScopeInfo) \ | 969 V(NativeContext) \ | 
| 969 V(JSFunction) \ | 970 V(ScopeInfo) \ | 
| 970 V(Code) \ | 971 V(JSFunction) \ | 
| 971 V(Oddball) \ | 972 V(Code) \ | 
| 972 V(SharedFunctionInfo) \ | 973 V(Oddball) \ | 
| 973 V(JSValue) \ | 974 V(SharedFunctionInfo) \ | 
| 974 V(JSDate) \ | 975 V(JSValue) \ | 
| 975 V(JSMessageObject) \ | 976 V(JSDate) \ | 
| 976 V(StringWrapper) \ | 977 V(JSMessageObject) \ | 
| 977 V(Foreign) \ | 978 V(StringWrapper) \ | 
| 978 V(Boolean) \ | 979 V(Foreign) \ | 
| 979 V(JSArray) \ | 980 V(Boolean) \ | 
| 980 V(JSArrayBuffer) \ | 981 V(JSArray) \ | 
| 981 V(JSArrayBufferView) \ | 982 V(JSArrayBuffer) \ | 
| 982 V(JSTypedArray) \ | 983 V(JSArrayBufferView) \ | 
| 983 V(JSDataView) \ | 984 V(JSTypedArray) \ | 
| 984 V(JSProxy) \ | 985 V(JSDataView) \ | 
| 985 V(JSFunctionProxy) \ | 986 V(JSProxy) \ | 
| 986 V(JSSet) \ | 987 V(JSFunctionProxy) \ | 
| 987 V(JSMap) \ | 988 V(JSSet) \ | 
| 988 V(JSSetIterator) \ | 989 V(JSMap) \ | 
| 989 V(JSMapIterator) \ | 990 V(JSSetIterator) \ | 
| 990 V(JSWeakCollection) \ | 991 V(JSMapIterator) \ | 
| 991 V(JSWeakMap) \ | 992 V(JSWeakCollection) \ | 
| 992 V(JSWeakSet) \ | 993 V(JSWeakMap) \ | 
| 993 V(JSRegExp) \ | 994 V(JSWeakSet) \ | 
| 994 V(HashTable) \ | 995 V(JSRegExp) \ | 
| 995 V(Dictionary) \ | 996 V(HashTable) \ | 
| 996 V(StringTable) \ | 997 V(Dictionary) \ | 
| 997 V(JSFunctionResultCache) \ | 998 V(StringTable) \ | 
| 998 V(NormalizedMapCache) \ | 999 V(JSFunctionResultCache) \ | 
| 999 V(CompilationCacheTable) \ | 1000 V(NormalizedMapCache) \ | 
| 1000 V(CodeCacheHashTable) \ | 1001 V(CompilationCacheTable) \ | 
| 1001 V(PolymorphicCodeCacheHashTable) \ | 1002 V(CodeCacheHashTable) \ | 
| 1002 V(MapCache) \ | 1003 V(PolymorphicCodeCacheHashTable) \ | 
| 1003 V(Primitive) \ | 1004 V(MapCache) \ | 
| 1004 V(GlobalObject) \ | 1005 V(Primitive) \ | 
| 1005 V(JSGlobalObject) \ | 1006 V(GlobalObject) \ | 
| 1006 V(JSBuiltinsObject) \ | 1007 V(JSGlobalObject) \ | 
| 1007 V(JSGlobalProxy) \ | 1008 V(JSBuiltinsObject) \ | 
| 1008 V(UndetectableObject) \ | 1009 V(JSGlobalProxy) \ | 
| 1009 V(AccessCheckNeeded) \ | 1010 V(UndetectableObject) \ | 
| 1010 V(Cell) \ | 1011 V(AccessCheckNeeded) \ | 
| 1011 V(PropertyCell) \ | 1012 V(Cell) \ | 
| 1012 V(ObjectHashTable) \ | 1013 V(PropertyCell) \ | 
| 1013 V(WeakHashTable) \ | 1014 V(ObjectHashTable) \ | 
| 1015 V(WeakHashTable) \ | |
| 1014 V(OrderedHashTable) | 1016 V(OrderedHashTable) | 
| 1015 | 1017 | 
| 1016 | 1018 | 
| 1017 #define ERROR_MESSAGES_LIST(V) \ | 1019 #define ERROR_MESSAGES_LIST(V) \ | 
| 1018 V(kNoReason, "no reason") \ | 1020 V(kNoReason, "no reason") \ | 
| 1019 \ | 1021 \ | 
| 1020 V(k32BitValueInRegisterIsNotZeroExtended, \ | 1022 V(k32BitValueInRegisterIsNotZeroExtended, \ | 
| 1021 "32 bit value in register is not zero-extended") \ | 1023 "32 bit value in register is not zero-extended") \ | 
| 1022 V(kAlignmentMarkerExpected, "Alignment marker expected") \ | 1024 V(kAlignmentMarkerExpected, "Alignment marker expected") \ | 
| 1023 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \ | 1025 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \ | 
| (...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2463 | 2465 | 
| 2464 // Transform slow named properties to fast variants. | 2466 // Transform slow named properties to fast variants. | 
| 2465 static void MigrateSlowToFast(Handle<JSObject> object, | 2467 static void MigrateSlowToFast(Handle<JSObject> object, | 
| 2466 int unused_property_fields); | 2468 int unused_property_fields); | 
| 2467 | 2469 | 
| 2468 // Access fast-case object properties at index. | 2470 // Access fast-case object properties at index. | 
| 2469 static Handle<Object> FastPropertyAt(Handle<JSObject> object, | 2471 static Handle<Object> FastPropertyAt(Handle<JSObject> object, | 
| 2470 Representation representation, | 2472 Representation representation, | 
| 2471 FieldIndex index); | 2473 FieldIndex index); | 
| 2472 inline Object* RawFastPropertyAt(FieldIndex index); | 2474 inline Object* RawFastPropertyAt(FieldIndex index); | 
| 2475 static inline Handle<Object> RawFastBoxedPropertyAt(Handle<JSObject> object, | |
| 2476 FieldIndex index); | |
| 2477 inline double RawFastDoublePropertyAt(FieldIndex index); | |
| 2478 inline void FastPropertyAtPut(Map* map, FieldIndex index, Object* value); | |
| 2473 inline void FastPropertyAtPut(FieldIndex index, Object* value); | 2479 inline void FastPropertyAtPut(FieldIndex index, Object* value); | 
| 2474 void WriteToField(int descriptor, Object* value); | 2480 void WriteToField(int descriptor, Object* value); | 
| 2481 inline void FastDoublePropertyAtPut(FieldIndex index, double value); | |
| 2475 | 2482 | 
| 2476 // Access to in object properties. | 2483 // Access to in object properties. | 
| 2477 inline int GetInObjectPropertyOffset(int index); | 2484 inline int GetInObjectPropertyOffset(int index); | 
| 2478 inline Object* InObjectPropertyAt(int index); | 2485 inline Object* InObjectPropertyAt(int index); | 
| 2479 inline Object* InObjectPropertyAtPut(int index, | 2486 inline Object* InObjectPropertyAtPut(int index, | 
| 2480 Object* value, | 2487 Object* value, | 
| 2481 WriteBarrierMode mode | 2488 WriteBarrierMode mode | 
| 2482 = UPDATE_WRITE_BARRIER); | 2489 = UPDATE_WRITE_BARRIER); | 
| 2483 | 2490 | 
| 2484 // Set the object's prototype (only JSReceiver and null are allowed values). | 2491 // Set the object's prototype (only JSReceiver and null are allowed values). | 
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3406 return len == 0 ? 0 : (len - kFirstIndex) / kDescriptorSize; | 3413 return len == 0 ? 0 : (len - kFirstIndex) / kDescriptorSize; | 
| 3407 } | 3414 } | 
| 3408 | 3415 | 
| 3409 int NumberOfSlackDescriptors() { | 3416 int NumberOfSlackDescriptors() { | 
| 3410 return number_of_descriptors_storage() - number_of_descriptors(); | 3417 return number_of_descriptors_storage() - number_of_descriptors(); | 
| 3411 } | 3418 } | 
| 3412 | 3419 | 
| 3413 inline void SetNumberOfDescriptors(int number_of_descriptors); | 3420 inline void SetNumberOfDescriptors(int number_of_descriptors); | 
| 3414 inline int number_of_entries() { return number_of_descriptors(); } | 3421 inline int number_of_entries() { return number_of_descriptors(); } | 
| 3415 | 3422 | 
| 3423 inline Object* cached_layout_descriptor(); | |
| 3424 inline void set_cached_layout_descriptor(LayoutDescriptor* cached); | |
| 3425 inline void drop_cached_layout_descriptor(); | |
| 3426 | |
| 3416 bool HasEnumCache() { | 3427 bool HasEnumCache() { | 
| 3417 return !IsEmpty() && !get(kEnumCacheIndex)->IsSmi(); | 3428 return !IsEmpty() && !get(kEnumCacheIndex)->IsSmi(); | 
| 3418 } | 3429 } | 
| 3419 | 3430 | 
| 3420 void CopyEnumCacheFrom(DescriptorArray* array) { | 3431 void CopyEnumCacheFrom(DescriptorArray* array) { | 
| 3421 set(kEnumCacheIndex, array->get(kEnumCacheIndex)); | 3432 set(kEnumCacheIndex, array->get(kEnumCacheIndex)); | 
| 3422 } | 3433 } | 
| 3423 | 3434 | 
| 3424 FixedArray* GetEnumCache() { | 3435 FixedArray* GetEnumCache() { | 
| 3425 ASSERT(HasEnumCache()); | 3436 ASSERT(HasEnumCache()); | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3512 static Handle<DescriptorArray> Allocate(Isolate* isolate, | 3523 static Handle<DescriptorArray> Allocate(Isolate* isolate, | 
| 3513 int number_of_descriptors, | 3524 int number_of_descriptors, | 
| 3514 int slack = 0); | 3525 int slack = 0); | 
| 3515 | 3526 | 
| 3516 DECLARE_CAST(DescriptorArray) | 3527 DECLARE_CAST(DescriptorArray) | 
| 3517 | 3528 | 
| 3518 // Constant for denoting key was not found. | 3529 // Constant for denoting key was not found. | 
| 3519 static const int kNotFound = -1; | 3530 static const int kNotFound = -1; | 
| 3520 | 3531 | 
| 3521 static const int kDescriptorLengthIndex = 0; | 3532 static const int kDescriptorLengthIndex = 0; | 
| 3533 #if V8_DOUBLE_FIELDS_UNBOXING | |
| 3534 static const int kLayoutDescriptorCacheIndex = 1; | |
| 3535 static const int kEnumCacheIndex = 2; | |
| 3536 static const int kFirstIndex = 3; | |
| 3537 #else | |
| 3538 static const int kLayoutDescriptorCacheIndex = -1; | |
| 3522 static const int kEnumCacheIndex = 1; | 3539 static const int kEnumCacheIndex = 1; | 
| 3523 static const int kFirstIndex = 2; | 3540 static const int kFirstIndex = 2; | 
| 3541 #endif | |
| 3524 | 3542 | 
| 3525 // The length of the "bridge" to the enum cache. | 3543 // The length of the "bridge" to the enum cache. | 
| 3526 static const int kEnumCacheBridgeLength = 2; | 3544 static const int kEnumCacheBridgeLength = 2; | 
| 3527 static const int kEnumCacheBridgeCacheIndex = 0; | 3545 static const int kEnumCacheBridgeCacheIndex = 0; | 
| 3528 static const int kEnumCacheBridgeIndicesCacheIndex = 1; | 3546 static const int kEnumCacheBridgeIndicesCacheIndex = 1; | 
| 3529 | 3547 | 
| 3530 // Layout description. | 3548 // Layout description. | 
| 3531 static const int kDescriptorLengthOffset = FixedArray::kHeaderSize; | 3549 static const int kDescriptorLengthOffset = FixedArray::kHeaderSize; | 
| 3550 #if V8_DOUBLE_FIELDS_UNBOXING | |
| 3551 static const int kLayoutDescriptorOffset = | |
| 3552 kDescriptorLengthOffset + kPointerSize; | |
| 3553 static const int kEnumCacheOffset = kLayoutDescriptorOffset + kPointerSize; | |
| 3554 #else | |
| 3555 static const int kLayoutDescriptorOffset = 1; // Must not be used. | |
| 3532 static const int kEnumCacheOffset = kDescriptorLengthOffset + kPointerSize; | 3556 static const int kEnumCacheOffset = kDescriptorLengthOffset + kPointerSize; | 
| 3557 #endif | |
| 3533 static const int kFirstOffset = kEnumCacheOffset + kPointerSize; | 3558 static const int kFirstOffset = kEnumCacheOffset + kPointerSize; | 
| 3534 | 3559 | 
| 3535 // Layout description for the bridge array. | 3560 // Layout description for the bridge array. | 
| 3536 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize; | 3561 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize; | 
| 3537 | 3562 | 
| 3538 // Layout of descriptor. | 3563 // Layout of descriptor. | 
| 3539 static const int kDescriptorKey = 0; | 3564 static const int kDescriptorKey = 0; | 
| 3540 static const int kDescriptorDetails = 1; | 3565 static const int kDescriptorDetails = 1; | 
| 3541 static const int kDescriptorValue = 2; | 3566 static const int kDescriptorValue = 2; | 
| 3542 static const int kDescriptorSize = 3; | 3567 static const int kDescriptorSize = 3; | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3609 } | 3634 } | 
| 3610 | 3635 | 
| 3611 static int ToValueIndex(int descriptor_number) { | 3636 static int ToValueIndex(int descriptor_number) { | 
| 3612 return kFirstIndex + | 3637 return kFirstIndex + | 
| 3613 (descriptor_number * kDescriptorSize) + | 3638 (descriptor_number * kDescriptorSize) + | 
| 3614 kDescriptorValue; | 3639 kDescriptorValue; | 
| 3615 } | 3640 } | 
| 3616 | 3641 | 
| 3617 // Transfer a complete descriptor from the src descriptor array to this | 3642 // Transfer a complete descriptor from the src descriptor array to this | 
| 3618 // descriptor array. | 3643 // descriptor array. | 
| 3619 void CopyFrom(int index, | 3644 void CopyFrom(int index, DescriptorArray* src, const WhitenessWitness&); | 
| 3620 DescriptorArray* src, | |
| 3621 const WhitenessWitness&); | |
| 3622 | 3645 | 
| 3623 inline void Set(int descriptor_number, | 3646 inline void Set(int descriptor_number, | 
| 3624 Descriptor* desc, | 3647 Descriptor* desc, | 
| 3625 const WhitenessWitness&); | 3648 const WhitenessWitness&); | 
| 3626 | 3649 | 
| 3627 inline void Append(Descriptor* desc, const WhitenessWitness&); | 3650 inline void Append(Descriptor* desc, const WhitenessWitness&); | 
| 3628 | 3651 | 
| 3629 // Swap first and second descriptor. | 3652 // Swap first and second descriptor. | 
| 3630 inline void SwapSortedKeys(int first, int second); | 3653 inline void SwapSortedKeys(int first, int second); | 
| 3631 | 3654 | 
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5270 elementType scalar); \ | 5293 elementType scalar); \ | 
| 5271 static inline elementType defaultValue(); \ | 5294 static inline elementType defaultValue(); \ | 
| 5272 }; \ | 5295 }; \ | 
| 5273 \ | 5296 \ | 
| 5274 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; | 5297 typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; | 
| 5275 | 5298 | 
| 5276 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) | 5299 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) | 
| 5277 | 5300 | 
| 5278 #undef FIXED_TYPED_ARRAY_TRAITS | 5301 #undef FIXED_TYPED_ARRAY_TRAITS | 
| 5279 | 5302 | 
| 5303 | |
| 5304 // LayoutDescriptor is a bit vector defining which fields contain non-tagged | |
| 5305 // values. It could either be a fixed typed array (slow form) or a Smi | |
| 5306 // if the length fits (fast form). | |
| 5307 // Each bit in the layout represents a FIELD. The bits are referenced by | |
| 5308 // field_index which is a field number. If the bit is set then corresponding | |
| 5309 // field contains non tagged value and therefore must be skipped by GC. | |
| 5310 // Otherwise the field is considered tagged. | |
| 5311 class LayoutDescriptor : public FixedTypedArray<Uint32ArrayTraits> { | |
| 5312 public: | |
| 5313 INLINE(MUST_USE_RESULT LayoutDescriptor* SetTagged(int field_index, | |
| 5314 bool tagged)); | |
| 5315 INLINE(bool IsTagged(int field_index)); | |
| 5316 | |
| 5317 // Returns true if this is a layout of the object having only tagged fields. | |
| 5318 INLINE(bool IsFastPointerLayout()); | |
| 5319 | |
| 5320 DECLARE_CAST(LayoutDescriptor) | |
| 5321 INLINE(static LayoutDescriptor* cast_gc_safe(Object* object)); | |
| 5322 | |
| 5323 // Builds layout descriptor by given descriptors array. | |
| 5324 static Handle<LayoutDescriptor> New(Handle<DescriptorArray> descriptors); | |
| 5325 | |
| 5326 // Layout descriptor that corresponds to an object all fields of which are | |
| 5327 // tagged (FastPointerLayout). | |
| 5328 INLINE(static LayoutDescriptor* FastPointerLayout()); | |
| 5329 | |
| 5330 // If the descriptor has fixed array form then this method tries to convert | |
| 5331 // make an optimized descriptor which has a smi form if particular |map| | |
| 5332 // refers only to a small part of the layout. | |
| 5333 // Otherwise |this| is returned. | |
| 5334 INLINE(LayoutDescriptor* OptimizeFor(Map* map)); | |
| 5335 | |
| 5336 #ifdef DEBUG | |
| 5337 // Check that this layout descriptor corresponds to given map. | |
| 5338 bool IsConsistentWithMap(Map* map); | |
| 5339 #endif | |
| 5340 | |
| 5341 #ifdef OBJECT_PRINT | |
| 5342 void Print(OStream& os); // NOLINT | |
| 5343 #endif | |
| 5344 | |
| 5345 private: | |
| 5346 static const int kNumberOfBits = 32; | |
| 5347 | |
| 5348 INLINE(bool IsSlowLayout()); | |
| 5349 | |
| 5350 INLINE(static Handle<LayoutDescriptor> New(Isolate* isolate, int length)); | |
| 5351 INLINE(static LayoutDescriptor* FromSmi(Smi* smi)); | |
| 5352 | |
| 5353 INLINE(void GetIndexes(int field_index, int* layout_word_index, | |
| 5354 uint32_t* layout_mask)); | |
| 5355 }; | |
| 5356 | |
| 5280 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 5357 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 
| 5281 // data for code generated by the Hydrogen/Lithium compiler. It also | 5358 // data for code generated by the Hydrogen/Lithium compiler. It also | 
| 5282 // contains information about functions that were inlined. If N different | 5359 // contains information about functions that were inlined. If N different | 
| 5283 // functions were inlined then first N elements of the literal array will | 5360 // functions were inlined then first N elements of the literal array will | 
| 5284 // contain these functions. | 5361 // contain these functions. | 
| 5285 // | 5362 // | 
| 5286 // It can be empty. | 5363 // It can be empty. | 
| 5287 class DeoptimizationInputData: public FixedArray { | 5364 class DeoptimizationInputData: public FixedArray { | 
| 5288 public: | 5365 public: | 
| 5289 // Layout description. Indices in the array. | 5366 // Layout description. Indices in the array. | 
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6361 inline bool has_code_cache(); | 6438 inline bool has_code_cache(); | 
| 6362 | 6439 | 
| 6363 // [prototype]: implicit prototype object. | 6440 // [prototype]: implicit prototype object. | 
| 6364 DECL_ACCESSORS(prototype, Object) | 6441 DECL_ACCESSORS(prototype, Object) | 
| 6365 | 6442 | 
| 6366 // [constructor]: points back to the function responsible for this map. | 6443 // [constructor]: points back to the function responsible for this map. | 
| 6367 DECL_ACCESSORS(constructor, Object) | 6444 DECL_ACCESSORS(constructor, Object) | 
| 6368 | 6445 | 
| 6369 // [instance descriptors]: describes the object. | 6446 // [instance descriptors]: describes the object. | 
| 6370 DECL_ACCESSORS(instance_descriptors, DescriptorArray) | 6447 DECL_ACCESSORS(instance_descriptors, DescriptorArray) | 
| 6371 inline void InitializeDescriptors(DescriptorArray* descriptors); | 6448 | 
| 6449 // [layout descriptor]: describes the object layout. | |
| 6450 DECL_ACCESSORS(layout_descriptor, LayoutDescriptor) | |
| 6451 // |layout descriptor| accessor which can be used from GC. | |
| 6452 inline LayoutDescriptor* layout_descriptor_gc_safe(); | |
| 6453 | |
| 6454 inline static void RebuildLayoutDescriptor(Handle<Map> map); | |
| 
Toon Verwaest
2014/07/29 15:02:09
Avoid having a Rebuild method. Just make sure that
 | |
| 6455 inline void InitializeDescriptors(DescriptorArray* descriptors, | |
| 
Toon Verwaest
2014/07/29 15:02:09
UpdateDescriptors / SetDescriptors
 
Igor Sheludko
2014/10/30 14:23:44
Done.
 | |
| 6456 LayoutDescriptor* layout_descriptor); | |
| 6457 inline void InitializeOwnDescriptors(DescriptorArray* descriptors, | |
| 
Toon Verwaest
2014/07/29 15:02:09
InitializeDescriptors
 
Igor Sheludko
2014/10/30 14:23:44
Done.
 | |
| 6458 LayoutDescriptor* layout_descriptor); | |
| 6372 | 6459 | 
| 6373 // [stub cache]: contains stubs compiled for this map. | 6460 // [stub cache]: contains stubs compiled for this map. | 
| 6374 DECL_ACCESSORS(code_cache, Object) | 6461 DECL_ACCESSORS(code_cache, Object) | 
| 6375 | 6462 | 
| 6376 // [dependent code]: list of optimized codes that weakly embed this map. | 6463 // [dependent code]: list of optimized codes that weakly embed this map. | 
| 6377 DECL_ACCESSORS(dependent_code, DependentCode) | 6464 DECL_ACCESSORS(dependent_code, DependentCode) | 
| 6378 | 6465 | 
| 6379 // [back pointer]: points back to the parent map from which a transition | 6466 // [back pointer]: points back to the parent map from which a transition | 
| 6380 // leads to this map. The field overlaps with prototype transitions and the | 6467 // leads to this map. The field overlaps with prototype transitions and the | 
| 6381 // back pointer will be moved into the prototype transitions array if | 6468 // back pointer will be moved into the prototype transitions array if | 
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6671 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; | 6758 static const int kPrototypeOffset = kBitField3Offset + kPointerSize; | 
| 6672 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; | 6759 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; | 
| 6673 // Storage for the transition array is overloaded to directly contain a back | 6760 // Storage for the transition array is overloaded to directly contain a back | 
| 6674 // pointer if unused. When the map has transitions, the back pointer is | 6761 // pointer if unused. When the map has transitions, the back pointer is | 
| 6675 // transferred to the transition array and accessed through an extra | 6762 // transferred to the transition array and accessed through an extra | 
| 6676 // indirection. | 6763 // indirection. | 
| 6677 static const int kTransitionsOrBackPointerOffset = | 6764 static const int kTransitionsOrBackPointerOffset = | 
| 6678 kConstructorOffset + kPointerSize; | 6765 kConstructorOffset + kPointerSize; | 
| 6679 static const int kDescriptorsOffset = | 6766 static const int kDescriptorsOffset = | 
| 6680 kTransitionsOrBackPointerOffset + kPointerSize; | 6767 kTransitionsOrBackPointerOffset + kPointerSize; | 
| 6768 #if V8_DOUBLE_FIELDS_UNBOXING | |
| 6769 static const int kLayoutDecriptorOffset = kDescriptorsOffset + kPointerSize; | |
| 6770 static const int kCodeCacheOffset = kLayoutDecriptorOffset + kPointerSize; | |
| 6771 #else | |
| 6772 static const int kLayoutDecriptorOffset = 1; // Must not be ever accessed. | |
| 6681 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; | 6773 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; | 
| 6774 #endif | |
| 6682 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; | 6775 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; | 
| 6683 static const int kSize = kDependentCodeOffset + kPointerSize; | 6776 static const int kSize = kDependentCodeOffset + kPointerSize; | 
| 6684 | 6777 | 
| 6685 // Layout of pointer fields. Heap iteration code relies on them | 6778 // Layout of pointer fields. Heap iteration code relies on them | 
| 6686 // being continuously allocated. | 6779 // being continuously allocated. | 
| 6687 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 6780 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 
| 6688 static const int kPointerFieldsEndOffset = kSize; | 6781 static const int kPointerFieldsEndOffset = kSize; | 
| 6689 | 6782 | 
| 6690 // Byte offsets within kInstanceSizesOffset. | 6783 // Byte offsets within kInstanceSizesOffset. | 
| 6691 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 6784 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6749 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, | 6842 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, | 
| 6750 kPointerFieldsEndOffset, | 6843 kPointerFieldsEndOffset, | 
| 6751 kSize> BodyDescriptor; | 6844 kSize> BodyDescriptor; | 
| 6752 | 6845 | 
| 6753 // Compares this map to another to see if they describe equivalent objects. | 6846 // Compares this map to another to see if they describe equivalent objects. | 
| 6754 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if | 6847 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if | 
| 6755 // it had exactly zero inobject properties. | 6848 // it had exactly zero inobject properties. | 
| 6756 // The "shared" flags of both this map and |other| are ignored. | 6849 // The "shared" flags of both this map and |other| are ignored. | 
| 6757 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode); | 6850 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode); | 
| 6758 | 6851 | 
| 6852 // Returns true if given field is unboxed double. | |
| 6853 inline bool IsUnboxedDoubleField(FieldIndex index); | |
| 6854 | |
| 6759 private: | 6855 private: | 
| 6760 static Handle<TransitionArray> SetElementsTransitionMap( | 6856 static Handle<TransitionArray> SetElementsTransitionMap( | 
| 6761 Handle<Map> map, Handle<Map> transitioned_map); | 6857 Handle<Map> map, Handle<Map> transitioned_map); | 
| 6762 | 6858 | 
| 6763 bool EquivalentToForTransition(Map* other); | 6859 bool EquivalentToForTransition(Map* other); | 
| 6764 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); | 6860 static Handle<Map> RawCopy(Handle<Map> map, int instance_size); | 
| 6765 static Handle<Map> ShareDescriptor(Handle<Map> map, | 6861 static Handle<Map> ShareDescriptor(Handle<Map> map, | 
| 6766 Handle<DescriptorArray> descriptors, | 6862 Handle<DescriptorArray> descriptors, | 
| 6767 Descriptor* descriptor); | 6863 Descriptor* descriptor); | 
| 6768 static Handle<Map> CopyInstallDescriptors( | 6864 static Handle<Map> CopyInstallDescriptors( | 
| (...skipping 30 matching lines...) Expand all Loading... | |
| 6799 // Zaps the contents of backing data structures. Note that the | 6895 // Zaps the contents of backing data structures. Note that the | 
| 6800 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects | 6896 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects | 
| 6801 // holding weak references when incremental marking is used, because it also | 6897 // holding weak references when incremental marking is used, because it also | 
| 6802 // iterates over objects that are otherwise unreachable. | 6898 // iterates over objects that are otherwise unreachable. | 
| 6803 // In general we only want to call these functions in release mode when | 6899 // In general we only want to call these functions in release mode when | 
| 6804 // heap verification is turned on. | 6900 // heap verification is turned on. | 
| 6805 void ZapPrototypeTransitions(); | 6901 void ZapPrototypeTransitions(); | 
| 6806 void ZapTransitions(); | 6902 void ZapTransitions(); | 
| 6807 | 6903 | 
| 6808 void DeprecateTransitionTree(); | 6904 void DeprecateTransitionTree(); | 
| 6809 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 6905 void DeprecateTarget(Handle<Name> key, | 
| 6906 Handle<DescriptorArray> new_descriptors); | |
| 6810 | 6907 | 
| 6811 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6908 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 
| 6812 | 6909 | 
| 6813 void UpdateDescriptor(int descriptor_number, Descriptor* desc); | 6910 void UpdateDescriptor(int descriptor_number, Descriptor* desc); | 
| 6814 | 6911 | 
| 6815 void PrintGeneralization(FILE* file, | 6912 void PrintGeneralization(FILE* file, | 
| 6816 const char* reason, | 6913 const char* reason, | 
| 6817 int modify_index, | 6914 int modify_index, | 
| 6818 int split, | 6915 int split, | 
| 6819 int descriptors, | 6916 int descriptors, | 
| (...skipping 4405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11225 static inline int set(int value, int bit_position, bool v) { | 11322 static inline int set(int value, int bit_position, bool v) { | 
| 11226 if (v) { | 11323 if (v) { | 
| 11227 value |= (1 << bit_position); | 11324 value |= (1 << bit_position); | 
| 11228 } else { | 11325 } else { | 
| 11229 value &= ~(1 << bit_position); | 11326 value &= ~(1 << bit_position); | 
| 11230 } | 11327 } | 
| 11231 return value; | 11328 return value; | 
| 11232 } | 11329 } | 
| 11233 }; | 11330 }; | 
| 11234 | 11331 | 
| 11332 | |
| 11333 // InobjectPropertiesHelper is a helper class for querying layout descriptor | |
| 11334 // about whether the field at given offset is tagged or not. | |
| 11335 class InobjectPropertiesHelper { | |
| 11336 public: | |
| 11337 inline explicit InobjectPropertiesHelper(Map* map); | |
| 11338 | |
| 11339 bool all_fields_tagged() { return all_fields_tagged_; } | |
| 11340 inline bool IsTagged(int offset_in_bytes); | |
| 11341 | |
| 11342 private: | |
| 11343 bool all_fields_tagged_; | |
| 11344 int header_size_; | |
| 11345 int inobject_properties_count_; | |
| 11346 LayoutDescriptor* layout_descriptor_; | |
| 11347 }; | |
| 11235 } } // namespace v8::internal | 11348 } } // namespace v8::internal | 
| 11236 | 11349 | 
| 11237 #endif // V8_OBJECTS_H_ | 11350 #endif // V8_OBJECTS_H_ | 
| OLD | NEW |