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

Side by Side Diff: src/objects.h

Issue 347073003: Make our FOO::cast methods const. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Outlined stuff. Renamed macro. Created 6 years, 6 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 | « no previous file | 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 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 #define DECL_BOOLEAN_ACCESSORS(name) \ 847 #define DECL_BOOLEAN_ACCESSORS(name) \
848 inline bool name() const; \ 848 inline bool name() const; \
849 inline void set_##name(bool value); \ 849 inline void set_##name(bool value); \
850 850
851 851
852 #define DECL_ACCESSORS(name, type) \ 852 #define DECL_ACCESSORS(name, type) \
853 inline type* name() const; \ 853 inline type* name() const; \
854 inline void set_##name(type* value, \ 854 inline void set_##name(type* value, \
855 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 855 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
856 856
857
858 #define DECLARE_CAST(type) \
859 INLINE(static type* cast(Object* object)); \
860 INLINE(static const type* cast(const Object* object));
861
862
857 class AccessorPair; 863 class AccessorPair;
858 class AllocationSite; 864 class AllocationSite;
859 class AllocationSiteCreationContext; 865 class AllocationSiteCreationContext;
860 class AllocationSiteUsageContext; 866 class AllocationSiteUsageContext;
861 class DictionaryElementsAccessor; 867 class DictionaryElementsAccessor;
862 class ElementsAccessor; 868 class ElementsAccessor;
863 class FixedArrayBase; 869 class FixedArrayBase;
864 class GlobalObject; 870 class GlobalObject;
865 class ObjectVisitor; 871 class ObjectVisitor;
866 class LookupIterator; 872 class LookupIterator;
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 inline bool IsAccessorInfo(); 1366 inline bool IsAccessorInfo();
1361 1367
1362 inline bool IsStruct(); 1368 inline bool IsStruct();
1363 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); 1369 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name();
1364 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) 1370 STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
1365 #undef DECLARE_STRUCT_PREDICATE 1371 #undef DECLARE_STRUCT_PREDICATE
1366 1372
1367 INLINE(bool IsSpecObject()); 1373 INLINE(bool IsSpecObject());
1368 INLINE(bool IsSpecFunction()); 1374 INLINE(bool IsSpecFunction());
1369 INLINE(bool IsTemplateInfo()); 1375 INLINE(bool IsTemplateInfo());
1376 INLINE(bool IsNameDictionary());
1377 INLINE(bool IsSeededNumberDictionary());
1378 INLINE(bool IsUnseededNumberDictionary());
1379 INLINE(bool IsOrderedHashSet());
1380 INLINE(bool IsOrderedHashMap());
1370 bool IsCallable(); 1381 bool IsCallable();
1371 1382
1372 // Oddball testing. 1383 // Oddball testing.
1373 INLINE(bool IsUndefined()); 1384 INLINE(bool IsUndefined());
1374 INLINE(bool IsNull()); 1385 INLINE(bool IsNull());
1375 INLINE(bool IsTheHole()); 1386 INLINE(bool IsTheHole());
1376 INLINE(bool IsException()); 1387 INLINE(bool IsException());
1377 INLINE(bool IsUninitialized()); 1388 INLINE(bool IsUninitialized());
1378 INLINE(bool IsTrue()); 1389 INLINE(bool IsTrue());
1379 INLINE(bool IsFalse()); 1390 INLINE(bool IsFalse());
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 #endif 1548 #endif
1538 1549
1539 inline void VerifyApiCallResultType(); 1550 inline void VerifyApiCallResultType();
1540 1551
1541 // Prints this object without details. 1552 // Prints this object without details.
1542 void ShortPrint(FILE* out = stdout); 1553 void ShortPrint(FILE* out = stdout);
1543 1554
1544 // Prints this object without details to a message accumulator. 1555 // Prints this object without details to a message accumulator.
1545 void ShortPrint(StringStream* accumulator); 1556 void ShortPrint(StringStream* accumulator);
1546 1557
1547 // Casting: This cast is only needed to satisfy macros in objects-inl.h. 1558 DECLARE_CAST(Object)
1548 static Object* cast(Object* value) { return value; }
1549 1559
1550 // Layout description. 1560 // Layout description.
1551 static const int kHeaderSize = 0; // Object does not take up any space. 1561 static const int kHeaderSize = 0; // Object does not take up any space.
1552 1562
1553 #ifdef OBJECT_PRINT 1563 #ifdef OBJECT_PRINT
1554 // Prints this object with details. 1564 // Prints this object with details.
1555 void Print(); 1565 void Print();
1556 void Print(FILE* out); 1566 void Print(FILE* out);
1557 void PrintLn(); 1567 void PrintLn();
1558 void PrintLn(FILE* out); 1568 void PrintLn(FILE* out);
(...skipping 16 matching lines...) Expand all
1575 inline int value() const; 1585 inline int value() const;
1576 1586
1577 // Convert a value to a Smi object. 1587 // Convert a value to a Smi object.
1578 static inline Smi* FromInt(int value); 1588 static inline Smi* FromInt(int value);
1579 1589
1580 static inline Smi* FromIntptr(intptr_t value); 1590 static inline Smi* FromIntptr(intptr_t value);
1581 1591
1582 // Returns whether value can be represented in a Smi. 1592 // Returns whether value can be represented in a Smi.
1583 static inline bool IsValid(intptr_t value); 1593 static inline bool IsValid(intptr_t value);
1584 1594
1585 // Casting. 1595 DECLARE_CAST(Smi)
1586 static inline Smi* cast(Object* object);
1587 1596
1588 // Dispatched behavior. 1597 // Dispatched behavior.
1589 void SmiPrint(FILE* out = stdout); 1598 void SmiPrint(FILE* out = stdout);
1590 void SmiPrint(StringStream* accumulator); 1599 void SmiPrint(StringStream* accumulator);
1591 1600
1592 DECLARE_VERIFIER(Smi) 1601 DECLARE_VERIFIER(Smi)
1593 1602
1594 static const int kMinValue = 1603 static const int kMinValue =
1595 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); 1604 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
1596 static const int kMaxValue = -(kMinValue + 1); 1605 static const int kMaxValue = -(kMinValue + 1);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 // during marking GC. 1718 // during marking GC.
1710 static inline Object** RawField(HeapObject* obj, int offset); 1719 static inline Object** RawField(HeapObject* obj, int offset);
1711 1720
1712 // Adds the |code| object related to |name| to the code cache of this map. If 1721 // Adds the |code| object related to |name| to the code cache of this map. If
1713 // this map is a dictionary map that is shared, the map copied and installed 1722 // this map is a dictionary map that is shared, the map copied and installed
1714 // onto the object. 1723 // onto the object.
1715 static void UpdateMapCodeCache(Handle<HeapObject> object, 1724 static void UpdateMapCodeCache(Handle<HeapObject> object,
1716 Handle<Name> name, 1725 Handle<Name> name,
1717 Handle<Code> code); 1726 Handle<Code> code);
1718 1727
1719 // Casting. 1728 DECLARE_CAST(HeapObject)
1720 static inline HeapObject* cast(Object* obj);
1721 1729
1722 // Return the write barrier mode for this. Callers of this function 1730 // Return the write barrier mode for this. Callers of this function
1723 // must be able to present a reference to an DisallowHeapAllocation 1731 // must be able to present a reference to an DisallowHeapAllocation
1724 // object as a sign that they are not going to use this function 1732 // object as a sign that they are not going to use this function
1725 // from code that allocates and thus invalidates the returned write 1733 // from code that allocates and thus invalidates the returned write
1726 // barrier mode. 1734 // barrier mode.
1727 inline WriteBarrierMode GetWriteBarrierMode( 1735 inline WriteBarrierMode GetWriteBarrierMode(
1728 const DisallowHeapAllocation& promise); 1736 const DisallowHeapAllocation& promise);
1729 1737
1730 // Dispatched behavior. 1738 // Dispatched behavior.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 1813
1806 1814
1807 // The HeapNumber class describes heap allocated numbers that cannot be 1815 // The HeapNumber class describes heap allocated numbers that cannot be
1808 // represented in a Smi (small integer) 1816 // represented in a Smi (small integer)
1809 class HeapNumber: public HeapObject { 1817 class HeapNumber: public HeapObject {
1810 public: 1818 public:
1811 // [value]: number value. 1819 // [value]: number value.
1812 inline double value(); 1820 inline double value();
1813 inline void set_value(double value); 1821 inline void set_value(double value);
1814 1822
1815 // Casting. 1823 DECLARE_CAST(HeapNumber)
1816 static inline HeapNumber* cast(Object* obj);
1817 1824
1818 // Dispatched behavior. 1825 // Dispatched behavior.
1819 bool HeapNumberBooleanValue(); 1826 bool HeapNumberBooleanValue();
1820 1827
1821 void HeapNumberPrint(FILE* out = stdout); 1828 void HeapNumberPrint(FILE* out = stdout);
1822 void HeapNumberPrint(StringStream* accumulator); 1829 void HeapNumberPrint(StringStream* accumulator);
1823 DECLARE_VERIFIER(HeapNumber) 1830 DECLARE_VERIFIER(HeapNumber)
1824 1831
1825 inline int get_exponent(); 1832 inline int get_exponent();
1826 inline int get_sign(); 1833 inline int get_sign();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 CERTAINLY_NOT_STORE_FROM_KEYED 1907 CERTAINLY_NOT_STORE_FROM_KEYED
1901 }; 1908 };
1902 1909
1903 // Internal properties (e.g. the hidden properties dictionary) might 1910 // Internal properties (e.g. the hidden properties dictionary) might
1904 // be added even though the receiver is non-extensible. 1911 // be added even though the receiver is non-extensible.
1905 enum ExtensibilityCheck { 1912 enum ExtensibilityCheck {
1906 PERFORM_EXTENSIBILITY_CHECK, 1913 PERFORM_EXTENSIBILITY_CHECK,
1907 OMIT_EXTENSIBILITY_CHECK 1914 OMIT_EXTENSIBILITY_CHECK
1908 }; 1915 };
1909 1916
1910 // Casting. 1917 DECLARE_CAST(JSReceiver)
1911 static inline JSReceiver* cast(Object* obj);
1912 1918
1913 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. 1919 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5.
1914 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( 1920 MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
1915 Handle<JSReceiver> object, 1921 Handle<JSReceiver> object,
1916 Handle<Name> key, 1922 Handle<Name> key,
1917 Handle<Object> value, 1923 Handle<Object> value,
1918 PropertyAttributes attributes, 1924 PropertyAttributes attributes,
1919 StrictMode strict_mode, 1925 StrictMode strict_mode,
1920 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); 1926 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
1921 MUST_USE_RESULT static MaybeHandle<Object> SetElement( 1927 MUST_USE_RESULT static MaybeHandle<Object> SetElement(
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 Handle<JSObject> object, 2521 Handle<JSObject> object,
2516 AllocationSiteUsageContext* site_context, 2522 AllocationSiteUsageContext* site_context,
2517 DeepCopyHints hints = kNoHints); 2523 DeepCopyHints hints = kNoHints);
2518 MUST_USE_RESULT static MaybeHandle<JSObject> DeepWalk( 2524 MUST_USE_RESULT static MaybeHandle<JSObject> DeepWalk(
2519 Handle<JSObject> object, 2525 Handle<JSObject> object,
2520 AllocationSiteCreationContext* site_context); 2526 AllocationSiteCreationContext* site_context);
2521 2527
2522 static Handle<Object> GetDataProperty(Handle<JSObject> object, 2528 static Handle<Object> GetDataProperty(Handle<JSObject> object,
2523 Handle<Name> key); 2529 Handle<Name> key);
2524 2530
2525 // Casting. 2531 DECLARE_CAST(JSObject)
2526 static inline JSObject* cast(Object* obj);
2527 2532
2528 // Dispatched behavior. 2533 // Dispatched behavior.
2529 void JSObjectShortPrint(StringStream* accumulator); 2534 void JSObjectShortPrint(StringStream* accumulator);
2530 DECLARE_PRINTER(JSObject) 2535 DECLARE_PRINTER(JSObject)
2531 DECLARE_VERIFIER(JSObject) 2536 DECLARE_VERIFIER(JSObject)
2532 #ifdef OBJECT_PRINT 2537 #ifdef OBJECT_PRINT
2533 void PrintProperties(FILE* out = stdout); 2538 void PrintProperties(FILE* out = stdout);
2534 void PrintElements(FILE* out = stdout); 2539 void PrintElements(FILE* out = stdout);
2535 void PrintTransitions(FILE* out = stdout); 2540 void PrintTransitions(FILE* out = stdout);
2536 #endif 2541 #endif
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 class FixedArrayBase: public HeapObject { 2871 class FixedArrayBase: public HeapObject {
2867 public: 2872 public:
2868 // [length]: length of the array. 2873 // [length]: length of the array.
2869 inline int length() const; 2874 inline int length() const;
2870 inline void set_length(int value); 2875 inline void set_length(int value);
2871 2876
2872 // Get and set the length using acquire loads and release stores. 2877 // Get and set the length using acquire loads and release stores.
2873 inline int synchronized_length() const; 2878 inline int synchronized_length() const;
2874 inline void synchronized_set_length(int value); 2879 inline void synchronized_set_length(int value);
2875 2880
2876 inline static FixedArrayBase* cast(Object* object); 2881 DECLARE_CAST(FixedArrayBase)
2877 2882
2878 // Layout description. 2883 // Layout description.
2879 // Length is smi tagged when it is stored. 2884 // Length is smi tagged when it is stored.
2880 static const int kLengthOffset = HeapObject::kHeaderSize; 2885 static const int kLengthOffset = HeapObject::kHeaderSize;
2881 static const int kHeaderSize = kLengthOffset + kPointerSize; 2886 static const int kHeaderSize = kLengthOffset + kPointerSize;
2882 }; 2887 };
2883 2888
2884 2889
2885 class FixedDoubleArray; 2890 class FixedDoubleArray;
2886 class IncrementalMarking; 2891 class IncrementalMarking;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2940 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } 2945 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; }
2941 2946
2942 // Code Generation support. 2947 // Code Generation support.
2943 static int OffsetOfElementAt(int index) { return SizeFor(index); } 2948 static int OffsetOfElementAt(int index) { return SizeFor(index); }
2944 2949
2945 // Garbage collection support. 2950 // Garbage collection support.
2946 Object** RawFieldOfElementAt(int index) { 2951 Object** RawFieldOfElementAt(int index) {
2947 return HeapObject::RawField(this, OffsetOfElementAt(index)); 2952 return HeapObject::RawField(this, OffsetOfElementAt(index));
2948 } 2953 }
2949 2954
2950 // Casting. 2955 DECLARE_CAST(FixedArray)
2951 static inline FixedArray* cast(Object* obj);
2952 2956
2953 // Maximal allowed size, in bytes, of a single FixedArray. 2957 // Maximal allowed size, in bytes, of a single FixedArray.
2954 // Prevents overflowing size computations, as well as extreme memory 2958 // Prevents overflowing size computations, as well as extreme memory
2955 // consumption. 2959 // consumption.
2956 static const int kMaxSize = 128 * MB * kPointerSize; 2960 static const int kMaxSize = 128 * MB * kPointerSize;
2957 // Maximally allowed length of a FixedArray. 2961 // Maximally allowed length of a FixedArray.
2958 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; 2962 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize;
2959 2963
2960 // Dispatched behavior. 2964 // Dispatched behavior.
2961 DECLARE_PRINTER(FixedArray) 2965 DECLARE_PRINTER(FixedArray)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 3030
3027 inline void FillWithHoles(int from, int to); 3031 inline void FillWithHoles(int from, int to);
3028 3032
3029 // Code Generation support. 3033 // Code Generation support.
3030 static int OffsetOfElementAt(int index) { return SizeFor(index); } 3034 static int OffsetOfElementAt(int index) { return SizeFor(index); }
3031 3035
3032 inline static bool is_the_hole_nan(double value); 3036 inline static bool is_the_hole_nan(double value);
3033 inline static double hole_nan_as_double(); 3037 inline static double hole_nan_as_double();
3034 inline static double canonical_not_the_hole_nan_as_double(); 3038 inline static double canonical_not_the_hole_nan_as_double();
3035 3039
3036 // Casting. 3040 DECLARE_CAST(FixedDoubleArray)
3037 static inline FixedDoubleArray* cast(Object* obj);
3038 3041
3039 // Maximal allowed size, in bytes, of a single FixedDoubleArray. 3042 // Maximal allowed size, in bytes, of a single FixedDoubleArray.
3040 // Prevents overflowing size computations, as well as extreme memory 3043 // Prevents overflowing size computations, as well as extreme memory
3041 // consumption. 3044 // consumption.
3042 static const int kMaxSize = 512 * MB; 3045 static const int kMaxSize = 512 * MB;
3043 // Maximally allowed length of a FixedArray. 3046 // Maximally allowed length of a FixedArray.
3044 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; 3047 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize;
3045 3048
3046 // Dispatched behavior. 3049 // Dispatched behavior.
3047 DECLARE_PRINTER(FixedDoubleArray) 3050 DECLARE_PRINTER(FixedDoubleArray)
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 type = next_type(type)) { 3281 type = next_type(type)) {
3279 offset += entry_size(type) * number_of_entries(type, section); 3282 offset += entry_size(type) * number_of_entries(type, section);
3280 } 3283 }
3281 3284
3282 // Add offset for the index in it's type. 3285 // Add offset for the index in it's type.
3283 Type type = get_type(index); 3286 Type type = get_type(index);
3284 offset += entry_size(type) * (index - first_index(type, section)); 3287 offset += entry_size(type) * (index - first_index(type, section));
3285 return offset; 3288 return offset;
3286 } 3289 }
3287 3290
3288 // Casting. 3291 DECLARE_CAST(ConstantPoolArray)
3289 static inline ConstantPoolArray* cast(Object* obj);
3290 3292
3291 // Garbage collection support. 3293 // Garbage collection support.
3292 Object** RawFieldOfElementAt(int index) { 3294 Object** RawFieldOfElementAt(int index) {
3293 return HeapObject::RawField(this, OffsetOfElementAt(index)); 3295 return HeapObject::RawField(this, OffsetOfElementAt(index));
3294 } 3296 }
3295 3297
3296 // Small Layout description. 3298 // Small Layout description.
3297 static const int kSmallLayout1Offset = HeapObject::kHeaderSize; 3299 static const int kSmallLayout1Offset = HeapObject::kHeaderSize;
3298 static const int kSmallLayout2Offset = kSmallLayout1Offset + kInt32Size; 3300 static const int kSmallLayout2Offset = kSmallLayout1Offset + kInt32Size;
3299 static const int kHeaderSize = kSmallLayout2Offset + kInt32Size; 3301 static const int kHeaderSize = kSmallLayout2Offset + kInt32Size;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3472 // As the above, but uses DescriptorLookupCache and updates it when 3474 // As the above, but uses DescriptorLookupCache and updates it when
3473 // necessary. 3475 // necessary.
3474 INLINE(int SearchWithCache(Name* name, Map* map)); 3476 INLINE(int SearchWithCache(Name* name, Map* map));
3475 3477
3476 // Allocates a DescriptorArray, but returns the singleton 3478 // Allocates a DescriptorArray, but returns the singleton
3477 // empty descriptor array object if number_of_descriptors is 0. 3479 // empty descriptor array object if number_of_descriptors is 0.
3478 static Handle<DescriptorArray> Allocate(Isolate* isolate, 3480 static Handle<DescriptorArray> Allocate(Isolate* isolate,
3479 int number_of_descriptors, 3481 int number_of_descriptors,
3480 int slack = 0); 3482 int slack = 0);
3481 3483
3482 // Casting. 3484 DECLARE_CAST(DescriptorArray)
3483 static inline DescriptorArray* cast(Object* obj);
3484 3485
3485 // Constant for denoting key was not found. 3486 // Constant for denoting key was not found.
3486 static const int kNotFound = -1; 3487 static const int kNotFound = -1;
3487 3488
3488 static const int kDescriptorLengthIndex = 0; 3489 static const int kDescriptorLengthIndex = 0;
3489 static const int kEnumCacheIndex = 1; 3490 static const int kEnumCacheIndex = 1;
3490 static const int kFirstIndex = 2; 3491 static const int kFirstIndex = 2;
3491 3492
3492 // The length of the "bridge" to the enum cache. 3493 // The length of the "bridge" to the enum cache.
3493 static const int kEnumCacheBridgeLength = 2; 3494 static const int kEnumCacheBridgeLength = 2;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 // Tells whether k is a real key. The hole and undefined are not allowed 3727 // Tells whether k is a real key. The hole and undefined are not allowed
3727 // as keys and can be used to indicate missing or deleted elements. 3728 // as keys and can be used to indicate missing or deleted elements.
3728 bool IsKey(Object* k) { 3729 bool IsKey(Object* k) {
3729 return !k->IsTheHole() && !k->IsUndefined(); 3730 return !k->IsTheHole() && !k->IsUndefined();
3730 } 3731 }
3731 3732
3732 // Garbage collection support. 3733 // Garbage collection support.
3733 void IteratePrefix(ObjectVisitor* visitor); 3734 void IteratePrefix(ObjectVisitor* visitor);
3734 void IterateElements(ObjectVisitor* visitor); 3735 void IterateElements(ObjectVisitor* visitor);
3735 3736
3736 // Casting. 3737 DECLARE_CAST(HashTable)
3737 static inline HashTable* cast(Object* obj);
3738 3738
3739 // Compute the probe offset (quadratic probing). 3739 // Compute the probe offset (quadratic probing).
3740 INLINE(static uint32_t GetProbeOffset(uint32_t n)) { 3740 INLINE(static uint32_t GetProbeOffset(uint32_t n)) {
3741 return (n + n * n) >> 1; 3741 return (n + n * n) >> 1;
3742 } 3742 }
3743 3743
3744 static const int kNumberOfElementsIndex = 0; 3744 static const int kNumberOfElementsIndex = 0;
3745 static const int kNumberOfDeletedElementsIndex = 1; 3745 static const int kNumberOfDeletedElementsIndex = 1;
3746 static const int kCapacityIndex = 2; 3746 static const int kCapacityIndex = 2;
3747 static const int kPrefixStartIndex = 3; 3747 static const int kPrefixStartIndex = 3;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3900 // Looks up a string that is equal to the given string and returns 3900 // Looks up a string that is equal to the given string and returns
3901 // string handle if it is found, or an empty handle otherwise. 3901 // string handle if it is found, or an empty handle otherwise.
3902 MUST_USE_RESULT static MaybeHandle<String> LookupStringIfExists( 3902 MUST_USE_RESULT static MaybeHandle<String> LookupStringIfExists(
3903 Isolate* isolate, 3903 Isolate* isolate,
3904 Handle<String> str); 3904 Handle<String> str);
3905 MUST_USE_RESULT static MaybeHandle<String> LookupTwoCharsStringIfExists( 3905 MUST_USE_RESULT static MaybeHandle<String> LookupTwoCharsStringIfExists(
3906 Isolate* isolate, 3906 Isolate* isolate,
3907 uint16_t c1, 3907 uint16_t c1,
3908 uint16_t c2); 3908 uint16_t c2);
3909 3909
3910 // Casting. 3910 DECLARE_CAST(StringTable)
3911 static inline StringTable* cast(Object* obj);
3912 3911
3913 private: 3912 private:
3914 template <bool seq_ascii> friend class JsonParser; 3913 template <bool seq_ascii> friend class JsonParser;
3915 3914
3916 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); 3915 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable);
3917 }; 3916 };
3918 3917
3919 3918
3920 class MapCacheShape : public BaseShape<HashTableKey*> { 3919 class MapCacheShape : public BaseShape<HashTableKey*> {
3921 public: 3920 public:
(...skipping 19 matching lines...) Expand all
3941 // MapCache. 3940 // MapCache.
3942 // 3941 //
3943 // Maps keys that are a fixed array of unique names to a map. 3942 // Maps keys that are a fixed array of unique names to a map.
3944 // Used for canonicalize maps for object literals. 3943 // Used for canonicalize maps for object literals.
3945 class MapCache: public HashTable<MapCache, MapCacheShape, HashTableKey*> { 3944 class MapCache: public HashTable<MapCache, MapCacheShape, HashTableKey*> {
3946 public: 3945 public:
3947 // Find cached value for a name key, otherwise return null. 3946 // Find cached value for a name key, otherwise return null.
3948 Object* Lookup(FixedArray* key); 3947 Object* Lookup(FixedArray* key);
3949 static Handle<MapCache> Put( 3948 static Handle<MapCache> Put(
3950 Handle<MapCache> map_cache, Handle<FixedArray> key, Handle<Map> value); 3949 Handle<MapCache> map_cache, Handle<FixedArray> key, Handle<Map> value);
3951 static inline MapCache* cast(Object* obj); 3950 DECLARE_CAST(MapCache)
3952 3951
3953 private: 3952 private:
3954 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache); 3953 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache);
3955 }; 3954 };
3956 3955
3957 3956
3958 template <typename Derived, typename Shape, typename Key> 3957 template <typename Derived, typename Shape, typename Key>
3959 class Dictionary: public HashTable<Derived, Shape, Key> { 3958 class Dictionary: public HashTable<Derived, Shape, Key> {
3960 protected: 3959 protected:
3961 typedef HashTable<Derived, Shape, Key> DerivedHashTable; 3960 typedef HashTable<Derived, Shape, Key> DerivedHashTable;
3962 3961
3963 public: 3962 public:
3964 static inline Dictionary* cast(Object* obj) {
Michael Starzinger 2014/06/23 08:37:12 +1 on dropping this!
3965 return reinterpret_cast<Dictionary*>(obj);
3966 }
3967
3968 // Returns the value at entry. 3963 // Returns the value at entry.
3969 Object* ValueAt(int entry) { 3964 Object* ValueAt(int entry) {
3970 return this->get(DerivedHashTable::EntryToIndex(entry) + 1); 3965 return this->get(DerivedHashTable::EntryToIndex(entry) + 1);
3971 } 3966 }
3972 3967
3973 // Set the value for entry. 3968 // Set the value for entry.
3974 void ValueAtPut(int entry, Object* value) { 3969 void ValueAtPut(int entry, Object* value) {
3975 this->set(DerivedHashTable::EntryToIndex(entry) + 1, value); 3970 this->set(DerivedHashTable::EntryToIndex(entry) + 1, value);
3976 } 3971 }
3977 3972
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
4095 }; 4090 };
4096 4091
4097 4092
4098 class NameDictionary: public Dictionary<NameDictionary, 4093 class NameDictionary: public Dictionary<NameDictionary,
4099 NameDictionaryShape, 4094 NameDictionaryShape,
4100 Handle<Name> > { 4095 Handle<Name> > {
4101 typedef Dictionary< 4096 typedef Dictionary<
4102 NameDictionary, NameDictionaryShape, Handle<Name> > DerivedDictionary; 4097 NameDictionary, NameDictionaryShape, Handle<Name> > DerivedDictionary;
4103 4098
4104 public: 4099 public:
4105 static inline NameDictionary* cast(Object* obj) { 4100 DECLARE_CAST(NameDictionary)
4106 ASSERT(obj->IsDictionary());
4107 return reinterpret_cast<NameDictionary*>(obj);
4108 }
4109 4101
4110 // Copies enumerable keys to preallocated fixed array. 4102 // Copies enumerable keys to preallocated fixed array.
4111 void CopyEnumKeysTo(FixedArray* storage); 4103 void CopyEnumKeysTo(FixedArray* storage);
4112 inline static void DoGenerateNewEnumerationIndices( 4104 inline static void DoGenerateNewEnumerationIndices(
4113 Handle<NameDictionary> dictionary); 4105 Handle<NameDictionary> dictionary);
4114 4106
4115 // Find entry for key, otherwise return kNotFound. Optimized version of 4107 // Find entry for key, otherwise return kNotFound. Optimized version of
4116 // HashTable::FindEntry. 4108 // HashTable::FindEntry.
4117 int FindEntry(Handle<Name> key); 4109 int FindEntry(Handle<Name> key);
4118 }; 4110 };
(...skipping 27 matching lines...) Expand all
4146 static inline uint32_t Hash(uint32_t key); 4138 static inline uint32_t Hash(uint32_t key);
4147 static inline uint32_t HashForObject(uint32_t key, Object* object); 4139 static inline uint32_t HashForObject(uint32_t key, Object* object);
4148 }; 4140 };
4149 4141
4150 4142
4151 class SeededNumberDictionary 4143 class SeededNumberDictionary
4152 : public Dictionary<SeededNumberDictionary, 4144 : public Dictionary<SeededNumberDictionary,
4153 SeededNumberDictionaryShape, 4145 SeededNumberDictionaryShape,
4154 uint32_t> { 4146 uint32_t> {
4155 public: 4147 public:
4156 static SeededNumberDictionary* cast(Object* obj) { 4148 DECLARE_CAST(SeededNumberDictionary)
4157 ASSERT(obj->IsDictionary());
4158 return reinterpret_cast<SeededNumberDictionary*>(obj);
4159 }
4160 4149
4161 // Type specific at put (default NONE attributes is used when adding). 4150 // Type specific at put (default NONE attributes is used when adding).
4162 MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut( 4151 MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut(
4163 Handle<SeededNumberDictionary> dictionary, 4152 Handle<SeededNumberDictionary> dictionary,
4164 uint32_t key, 4153 uint32_t key,
4165 Handle<Object> value); 4154 Handle<Object> value);
4166 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry( 4155 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry(
4167 Handle<SeededNumberDictionary> dictionary, 4156 Handle<SeededNumberDictionary> dictionary,
4168 uint32_t key, 4157 uint32_t key,
4169 Handle<Object> value, 4158 Handle<Object> value,
(...skipping 27 matching lines...) Expand all
4197 static const int kRequiresSlowElementsTagSize = 1; 4186 static const int kRequiresSlowElementsTagSize = 1;
4198 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1; 4187 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1;
4199 }; 4188 };
4200 4189
4201 4190
4202 class UnseededNumberDictionary 4191 class UnseededNumberDictionary
4203 : public Dictionary<UnseededNumberDictionary, 4192 : public Dictionary<UnseededNumberDictionary,
4204 UnseededNumberDictionaryShape, 4193 UnseededNumberDictionaryShape,
4205 uint32_t> { 4194 uint32_t> {
4206 public: 4195 public:
4207 static UnseededNumberDictionary* cast(Object* obj) { 4196 DECLARE_CAST(UnseededNumberDictionary)
4208 ASSERT(obj->IsDictionary());
4209 return reinterpret_cast<UnseededNumberDictionary*>(obj);
4210 }
4211 4197
4212 // Type specific at put (default NONE attributes is used when adding). 4198 // Type specific at put (default NONE attributes is used when adding).
4213 MUST_USE_RESULT static Handle<UnseededNumberDictionary> AtNumberPut( 4199 MUST_USE_RESULT static Handle<UnseededNumberDictionary> AtNumberPut(
4214 Handle<UnseededNumberDictionary> dictionary, 4200 Handle<UnseededNumberDictionary> dictionary,
4215 uint32_t key, 4201 uint32_t key,
4216 Handle<Object> value); 4202 Handle<Object> value);
4217 MUST_USE_RESULT static Handle<UnseededNumberDictionary> AddNumberEntry( 4203 MUST_USE_RESULT static Handle<UnseededNumberDictionary> AddNumberEntry(
4218 Handle<UnseededNumberDictionary> dictionary, 4204 Handle<UnseededNumberDictionary> dictionary,
4219 uint32_t key, 4205 uint32_t key,
4220 Handle<Object> value); 4206 Handle<Object> value);
(...skipping 19 matching lines...) Expand all
4240 4226
4241 4227
4242 // ObjectHashTable maps keys that are arbitrary objects to object values by 4228 // ObjectHashTable maps keys that are arbitrary objects to object values by
4243 // using the identity hash of the key for hashing purposes. 4229 // using the identity hash of the key for hashing purposes.
4244 class ObjectHashTable: public HashTable<ObjectHashTable, 4230 class ObjectHashTable: public HashTable<ObjectHashTable,
4245 ObjectHashTableShape, 4231 ObjectHashTableShape,
4246 Handle<Object> > { 4232 Handle<Object> > {
4247 typedef HashTable< 4233 typedef HashTable<
4248 ObjectHashTable, ObjectHashTableShape, Handle<Object> > DerivedHashTable; 4234 ObjectHashTable, ObjectHashTableShape, Handle<Object> > DerivedHashTable;
4249 public: 4235 public:
4250 static inline ObjectHashTable* cast(Object* obj) { 4236 DECLARE_CAST(ObjectHashTable)
4251 ASSERT(obj->IsHashTable());
4252 return reinterpret_cast<ObjectHashTable*>(obj);
4253 }
4254 4237
4255 // Attempt to shrink hash table after removal of key. 4238 // Attempt to shrink hash table after removal of key.
4256 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink( 4239 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink(
4257 Handle<ObjectHashTable> table, 4240 Handle<ObjectHashTable> table,
4258 Handle<Object> key); 4241 Handle<Object> key);
4259 4242
4260 // Looks up the value associated with the given key. The hole value is 4243 // Looks up the value associated with the given key. The hole value is
4261 // returned in case the key is not present. 4244 // returned in case the key is not present.
4262 Object* Lookup(Handle<Object> key); 4245 Object* Lookup(Handle<Object> key);
4263 4246
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
4452 / (1 + (kEntrySize * kLoadFactor)); 4435 / (1 + (kEntrySize * kLoadFactor));
4453 }; 4436 };
4454 4437
4455 4438
4456 class JSSetIterator; 4439 class JSSetIterator;
4457 4440
4458 4441
4459 class OrderedHashSet: public OrderedHashTable< 4442 class OrderedHashSet: public OrderedHashTable<
4460 OrderedHashSet, JSSetIterator, 1> { 4443 OrderedHashSet, JSSetIterator, 1> {
4461 public: 4444 public:
4462 static OrderedHashSet* cast(Object* obj) { 4445 DECLARE_CAST(OrderedHashSet)
4463 ASSERT(obj->IsOrderedHashTable());
4464 return reinterpret_cast<OrderedHashSet*>(obj);
4465 }
4466 4446
4467 bool Contains(Handle<Object> key); 4447 bool Contains(Handle<Object> key);
4468 static Handle<OrderedHashSet> Add( 4448 static Handle<OrderedHashSet> Add(
4469 Handle<OrderedHashSet> table, Handle<Object> key); 4449 Handle<OrderedHashSet> table, Handle<Object> key);
4470 }; 4450 };
4471 4451
4472 4452
4473 class JSMapIterator; 4453 class JSMapIterator;
4474 4454
4475 4455
4476 class OrderedHashMap:public OrderedHashTable< 4456 class OrderedHashMap:public OrderedHashTable<
4477 OrderedHashMap, JSMapIterator, 2> { 4457 OrderedHashMap, JSMapIterator, 2> {
4478 public: 4458 public:
4479 static OrderedHashMap* cast(Object* obj) { 4459 DECLARE_CAST(OrderedHashMap)
4480 ASSERT(obj->IsOrderedHashTable());
4481 return reinterpret_cast<OrderedHashMap*>(obj);
4482 }
4483 4460
4484 Object* Lookup(Handle<Object> key); 4461 Object* Lookup(Handle<Object> key);
4485 static Handle<OrderedHashMap> Put( 4462 static Handle<OrderedHashMap> Put(
4486 Handle<OrderedHashMap> table, 4463 Handle<OrderedHashMap> table,
4487 Handle<Object> key, 4464 Handle<Object> key,
4488 Handle<Object> value); 4465 Handle<Object> value);
4489 4466
4490 private: 4467 private:
4491 Object* ValueAt(int entry) { 4468 Object* ValueAt(int entry) {
4492 return get(EntryToIndex(entry) + kValueOffset); 4469 return get(EntryToIndex(entry) + kValueOffset);
(...skipping 17 matching lines...) Expand all
4510 4487
4511 // WeakHashTable maps keys that are arbitrary objects to object values. 4488 // WeakHashTable maps keys that are arbitrary objects to object values.
4512 // It is used for the global weak hash table that maps objects 4489 // It is used for the global weak hash table that maps objects
4513 // embedded in optimized code to dependent code lists. 4490 // embedded in optimized code to dependent code lists.
4514 class WeakHashTable: public HashTable<WeakHashTable, 4491 class WeakHashTable: public HashTable<WeakHashTable,
4515 WeakHashTableShape<2>, 4492 WeakHashTableShape<2>,
4516 Handle<Object> > { 4493 Handle<Object> > {
4517 typedef HashTable< 4494 typedef HashTable<
4518 WeakHashTable, WeakHashTableShape<2>, Handle<Object> > DerivedHashTable; 4495 WeakHashTable, WeakHashTableShape<2>, Handle<Object> > DerivedHashTable;
4519 public: 4496 public:
4520 static inline WeakHashTable* cast(Object* obj) { 4497 DECLARE_CAST(WeakHashTable)
4521 ASSERT(obj->IsHashTable());
4522 return reinterpret_cast<WeakHashTable*>(obj);
4523 }
4524 4498
4525 // Looks up the value associated with the given key. The hole value is 4499 // Looks up the value associated with the given key. The hole value is
4526 // returned in case the key is not present. 4500 // returned in case the key is not present.
4527 Object* Lookup(Handle<Object> key); 4501 Object* Lookup(Handle<Object> key);
4528 4502
4529 // Adds (or overwrites) the value associated with the given key. Mapping a 4503 // Adds (or overwrites) the value associated with the given key. Mapping a
4530 // key to the hole value causes removal of the whole entry. 4504 // key to the hole value causes removal of the whole entry.
4531 MUST_USE_RESULT static Handle<WeakHashTable> Put(Handle<WeakHashTable> table, 4505 MUST_USE_RESULT static Handle<WeakHashTable> Put(Handle<WeakHashTable> table,
4532 Handle<Object> key, 4506 Handle<Object> key,
4533 Handle<Object> value); 4507 Handle<Object> value);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4575 static const int kCacheSizeOffset = kFingerOffset + kPointerSize; 4549 static const int kCacheSizeOffset = kFingerOffset + kPointerSize;
4576 4550
4577 inline void MakeZeroSize(); 4551 inline void MakeZeroSize();
4578 inline void Clear(); 4552 inline void Clear();
4579 4553
4580 inline int size(); 4554 inline int size();
4581 inline void set_size(int size); 4555 inline void set_size(int size);
4582 inline int finger_index(); 4556 inline int finger_index();
4583 inline void set_finger_index(int finger_index); 4557 inline void set_finger_index(int finger_index);
4584 4558
4585 // Casting 4559 DECLARE_CAST(JSFunctionResultCache)
4586 static inline JSFunctionResultCache* cast(Object* obj);
4587 4560
4588 DECLARE_VERIFIER(JSFunctionResultCache) 4561 DECLARE_VERIFIER(JSFunctionResultCache)
4589 }; 4562 };
4590 4563
4591 4564
4592 // ScopeInfo represents information about different scopes of a source 4565 // ScopeInfo represents information about different scopes of a source
4593 // program and the allocation of the scope's variables. Scope information 4566 // program and the allocation of the scope's variables. Scope information
4594 // is stored in a compressed form in ScopeInfo objects and is used 4567 // is stored in a compressed form in ScopeInfo objects and is used
4595 // at runtime (stack dumps, deoptimization, etc.). 4568 // at runtime (stack dumps, deoptimization, etc.).
4596 4569
4597 // This object provides quick access to scope info details for runtime 4570 // This object provides quick access to scope info details for runtime
4598 // routines. 4571 // routines.
4599 class ScopeInfo : public FixedArray { 4572 class ScopeInfo : public FixedArray {
4600 public: 4573 public:
4601 static inline ScopeInfo* cast(Object* object); 4574 DECLARE_CAST(ScopeInfo)
4602 4575
4603 // Return the type of this scope. 4576 // Return the type of this scope.
4604 ScopeType scope_type(); 4577 ScopeType scope_type();
4605 4578
4606 // Does this scope call eval? 4579 // Does this scope call eval?
4607 bool CallsEval(); 4580 bool CallsEval();
4608 4581
4609 // Return the strict mode of this scope. 4582 // Return the strict mode of this scope.
4610 StrictMode strict_mode(); 4583 StrictMode strict_mode();
4611 4584
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 class NormalizedMapCache: public FixedArray { 4779 class NormalizedMapCache: public FixedArray {
4807 public: 4780 public:
4808 static Handle<NormalizedMapCache> New(Isolate* isolate); 4781 static Handle<NormalizedMapCache> New(Isolate* isolate);
4809 4782
4810 MUST_USE_RESULT MaybeHandle<Map> Get(Handle<Map> fast_map, 4783 MUST_USE_RESULT MaybeHandle<Map> Get(Handle<Map> fast_map,
4811 PropertyNormalizationMode mode); 4784 PropertyNormalizationMode mode);
4812 void Set(Handle<Map> fast_map, Handle<Map> normalized_map); 4785 void Set(Handle<Map> fast_map, Handle<Map> normalized_map);
4813 4786
4814 void Clear(); 4787 void Clear();
4815 4788
4816 // Casting 4789 DECLARE_CAST(NormalizedMapCache)
4817 static inline NormalizedMapCache* cast(Object* obj); 4790
4818 static inline bool IsNormalizedMapCache(Object* obj); 4791 static inline bool IsNormalizedMapCache(Object* obj);
4819 4792
4820 DECLARE_VERIFIER(NormalizedMapCache) 4793 DECLARE_VERIFIER(NormalizedMapCache)
4821 private: 4794 private:
4822 static const int kEntries = 64; 4795 static const int kEntries = 64;
4823 4796
4824 static inline int GetIndex(Handle<Map> map); 4797 static inline int GetIndex(Handle<Map> map);
4825 4798
4826 // The following declarations hide base class methods. 4799 // The following declarations hide base class methods.
4827 Object* get(int index); 4800 Object* get(int index);
(...skipping 26 matching lines...) Expand all
4854 ASSERT(size_in_bytes >= kHeaderSize); 4827 ASSERT(size_in_bytes >= kHeaderSize);
4855 return size_in_bytes - kHeaderSize; 4828 return size_in_bytes - kHeaderSize;
4856 } 4829 }
4857 4830
4858 // Returns data start address. 4831 // Returns data start address.
4859 inline Address GetDataStartAddress(); 4832 inline Address GetDataStartAddress();
4860 4833
4861 // Returns a pointer to the ByteArray object for a given data start address. 4834 // Returns a pointer to the ByteArray object for a given data start address.
4862 static inline ByteArray* FromDataStartAddress(Address address); 4835 static inline ByteArray* FromDataStartAddress(Address address);
4863 4836
4864 // Casting. 4837 DECLARE_CAST(ByteArray)
4865 static inline ByteArray* cast(Object* obj);
4866 4838
4867 // Dispatched behavior. 4839 // Dispatched behavior.
4868 inline int ByteArraySize() { 4840 inline int ByteArraySize() {
4869 return SizeFor(this->length()); 4841 return SizeFor(this->length());
4870 } 4842 }
4871 DECLARE_PRINTER(ByteArray) 4843 DECLARE_PRINTER(ByteArray)
4872 DECLARE_VERIFIER(ByteArray) 4844 DECLARE_VERIFIER(ByteArray)
4873 4845
4874 // Layout description. 4846 // Layout description.
4875 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); 4847 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
(...skipping 14 matching lines...) Expand all
4890 public: 4862 public:
4891 // [size]: size of the free space including the header. 4863 // [size]: size of the free space including the header.
4892 inline int size() const; 4864 inline int size() const;
4893 inline void set_size(int value); 4865 inline void set_size(int value);
4894 4866
4895 inline int nobarrier_size() const; 4867 inline int nobarrier_size() const;
4896 inline void nobarrier_set_size(int value); 4868 inline void nobarrier_set_size(int value);
4897 4869
4898 inline int Size() { return size(); } 4870 inline int Size() { return size(); }
4899 4871
4900 // Casting. 4872 DECLARE_CAST(FreeSpace)
4901 static inline FreeSpace* cast(Object* obj);
4902 4873
4903 // Dispatched behavior. 4874 // Dispatched behavior.
4904 DECLARE_PRINTER(FreeSpace) 4875 DECLARE_PRINTER(FreeSpace)
4905 DECLARE_VERIFIER(FreeSpace) 4876 DECLARE_VERIFIER(FreeSpace)
4906 4877
4907 // Layout description. 4878 // Layout description.
4908 // Size is smi tagged when it is stored. 4879 // Size is smi tagged when it is stored.
4909 static const int kSizeOffset = HeapObject::kHeaderSize; 4880 static const int kSizeOffset = HeapObject::kHeaderSize;
4910 static const int kHeaderSize = kSizeOffset + kPointerSize; 4881 static const int kHeaderSize = kSizeOffset + kPointerSize;
4911 4882
(...skipping 30 matching lines...) Expand all
4942 // cast, not clamping. Out-of-range indices cause exceptions to be 4913 // cast, not clamping. Out-of-range indices cause exceptions to be
4943 // raised rather than being silently ignored. 4914 // raised rather than being silently ignored.
4944 class ExternalArray: public FixedArrayBase { 4915 class ExternalArray: public FixedArrayBase {
4945 public: 4916 public:
4946 inline bool is_the_hole(int index) { return false; } 4917 inline bool is_the_hole(int index) { return false; }
4947 4918
4948 // [external_pointer]: The pointer to the external memory area backing this 4919 // [external_pointer]: The pointer to the external memory area backing this
4949 // external array. 4920 // external array.
4950 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store. 4921 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
4951 4922
4952 // Casting. 4923 DECLARE_CAST(ExternalArray)
4953 static inline ExternalArray* cast(Object* obj);
4954 4924
4955 // Maximal acceptable length for an external array. 4925 // Maximal acceptable length for an external array.
4956 static const int kMaxLength = 0x3fffffff; 4926 static const int kMaxLength = 0x3fffffff;
4957 4927
4958 // ExternalArray headers are not quadword aligned. 4928 // ExternalArray headers are not quadword aligned.
4959 static const int kExternalPointerOffset = 4929 static const int kExternalPointerOffset =
4960 POINTER_SIZE_ALIGN(FixedArrayBase::kLengthOffset + kPointerSize); 4930 POINTER_SIZE_ALIGN(FixedArrayBase::kLengthOffset + kPointerSize);
4961 static const int kHeaderSize = kExternalPointerOffset + kPointerSize; 4931 static const int kHeaderSize = kExternalPointerOffset + kPointerSize;
4962 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); 4932 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
4963 4933
(...skipping 19 matching lines...) Expand all
4983 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array, 4953 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array,
4984 int index); 4954 int index);
4985 inline void set(int index, uint8_t value); 4955 inline void set(int index, uint8_t value);
4986 4956
4987 // This accessor applies the correct conversion from Smi, HeapNumber 4957 // This accessor applies the correct conversion from Smi, HeapNumber
4988 // and undefined and clamps the converted value between 0 and 255. 4958 // and undefined and clamps the converted value between 0 and 255.
4989 static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array, 4959 static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array,
4990 uint32_t index, 4960 uint32_t index,
4991 Handle<Object> value); 4961 Handle<Object> value);
4992 4962
4993 // Casting. 4963 DECLARE_CAST(ExternalUint8ClampedArray)
4994 static inline ExternalUint8ClampedArray* cast(Object* obj);
4995 4964
4996 // Dispatched behavior. 4965 // Dispatched behavior.
4997 DECLARE_PRINTER(ExternalUint8ClampedArray) 4966 DECLARE_PRINTER(ExternalUint8ClampedArray)
4998 DECLARE_VERIFIER(ExternalUint8ClampedArray) 4967 DECLARE_VERIFIER(ExternalUint8ClampedArray)
4999 4968
5000 private: 4969 private:
5001 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray); 4970 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray);
5002 }; 4971 };
5003 4972
5004 4973
5005 class ExternalInt8Array: public ExternalArray { 4974 class ExternalInt8Array: public ExternalArray {
5006 public: 4975 public:
5007 // Setter and getter. 4976 // Setter and getter.
5008 inline int8_t get_scalar(int index); 4977 inline int8_t get_scalar(int index);
5009 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index); 4978 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index);
5010 inline void set(int index, int8_t value); 4979 inline void set(int index, int8_t value);
5011 4980
5012 // This accessor applies the correct conversion from Smi, HeapNumber 4981 // This accessor applies the correct conversion from Smi, HeapNumber
5013 // and undefined. 4982 // and undefined.
5014 static Handle<Object> SetValue(Handle<ExternalInt8Array> array, 4983 static Handle<Object> SetValue(Handle<ExternalInt8Array> array,
5015 uint32_t index, 4984 uint32_t index,
5016 Handle<Object> value); 4985 Handle<Object> value);
5017 4986
5018 // Casting. 4987 DECLARE_CAST(ExternalInt8Array)
5019 static inline ExternalInt8Array* cast(Object* obj);
5020 4988
5021 // Dispatched behavior. 4989 // Dispatched behavior.
5022 DECLARE_PRINTER(ExternalInt8Array) 4990 DECLARE_PRINTER(ExternalInt8Array)
5023 DECLARE_VERIFIER(ExternalInt8Array) 4991 DECLARE_VERIFIER(ExternalInt8Array)
5024 4992
5025 private: 4993 private:
5026 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array); 4994 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array);
5027 }; 4995 };
5028 4996
5029 4997
5030 class ExternalUint8Array: public ExternalArray { 4998 class ExternalUint8Array: public ExternalArray {
5031 public: 4999 public:
5032 // Setter and getter. 5000 // Setter and getter.
5033 inline uint8_t get_scalar(int index); 5001 inline uint8_t get_scalar(int index);
5034 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index); 5002 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index);
5035 inline void set(int index, uint8_t value); 5003 inline void set(int index, uint8_t value);
5036 5004
5037 // This accessor applies the correct conversion from Smi, HeapNumber 5005 // This accessor applies the correct conversion from Smi, HeapNumber
5038 // and undefined. 5006 // and undefined.
5039 static Handle<Object> SetValue(Handle<ExternalUint8Array> array, 5007 static Handle<Object> SetValue(Handle<ExternalUint8Array> array,
5040 uint32_t index, 5008 uint32_t index,
5041 Handle<Object> value); 5009 Handle<Object> value);
5042 5010
5043 // Casting. 5011 DECLARE_CAST(ExternalUint8Array)
5044 static inline ExternalUint8Array* cast(Object* obj);
5045 5012
5046 // Dispatched behavior. 5013 // Dispatched behavior.
5047 DECLARE_PRINTER(ExternalUint8Array) 5014 DECLARE_PRINTER(ExternalUint8Array)
5048 DECLARE_VERIFIER(ExternalUint8Array) 5015 DECLARE_VERIFIER(ExternalUint8Array)
5049 5016
5050 private: 5017 private:
5051 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array); 5018 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array);
5052 }; 5019 };
5053 5020
5054 5021
5055 class ExternalInt16Array: public ExternalArray { 5022 class ExternalInt16Array: public ExternalArray {
5056 public: 5023 public:
5057 // Setter and getter. 5024 // Setter and getter.
5058 inline int16_t get_scalar(int index); 5025 inline int16_t get_scalar(int index);
5059 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index); 5026 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index);
5060 inline void set(int index, int16_t value); 5027 inline void set(int index, int16_t value);
5061 5028
5062 // This accessor applies the correct conversion from Smi, HeapNumber 5029 // This accessor applies the correct conversion from Smi, HeapNumber
5063 // and undefined. 5030 // and undefined.
5064 static Handle<Object> SetValue(Handle<ExternalInt16Array> array, 5031 static Handle<Object> SetValue(Handle<ExternalInt16Array> array,
5065 uint32_t index, 5032 uint32_t index,
5066 Handle<Object> value); 5033 Handle<Object> value);
5067 5034
5068 // Casting. 5035 DECLARE_CAST(ExternalInt16Array)
5069 static inline ExternalInt16Array* cast(Object* obj);
5070 5036
5071 // Dispatched behavior. 5037 // Dispatched behavior.
5072 DECLARE_PRINTER(ExternalInt16Array) 5038 DECLARE_PRINTER(ExternalInt16Array)
5073 DECLARE_VERIFIER(ExternalInt16Array) 5039 DECLARE_VERIFIER(ExternalInt16Array)
5074 5040
5075 private: 5041 private:
5076 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array); 5042 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array);
5077 }; 5043 };
5078 5044
5079 5045
5080 class ExternalUint16Array: public ExternalArray { 5046 class ExternalUint16Array: public ExternalArray {
5081 public: 5047 public:
5082 // Setter and getter. 5048 // Setter and getter.
5083 inline uint16_t get_scalar(int index); 5049 inline uint16_t get_scalar(int index);
5084 static inline Handle<Object> get(Handle<ExternalUint16Array> array, 5050 static inline Handle<Object> get(Handle<ExternalUint16Array> array,
5085 int index); 5051 int index);
5086 inline void set(int index, uint16_t value); 5052 inline void set(int index, uint16_t value);
5087 5053
5088 // This accessor applies the correct conversion from Smi, HeapNumber 5054 // This accessor applies the correct conversion from Smi, HeapNumber
5089 // and undefined. 5055 // and undefined.
5090 static Handle<Object> SetValue(Handle<ExternalUint16Array> array, 5056 static Handle<Object> SetValue(Handle<ExternalUint16Array> array,
5091 uint32_t index, 5057 uint32_t index,
5092 Handle<Object> value); 5058 Handle<Object> value);
5093 5059
5094 // Casting. 5060 DECLARE_CAST(ExternalUint16Array)
5095 static inline ExternalUint16Array* cast(Object* obj);
5096 5061
5097 // Dispatched behavior. 5062 // Dispatched behavior.
5098 DECLARE_PRINTER(ExternalUint16Array) 5063 DECLARE_PRINTER(ExternalUint16Array)
5099 DECLARE_VERIFIER(ExternalUint16Array) 5064 DECLARE_VERIFIER(ExternalUint16Array)
5100 5065
5101 private: 5066 private:
5102 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array); 5067 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array);
5103 }; 5068 };
5104 5069
5105 5070
5106 class ExternalInt32Array: public ExternalArray { 5071 class ExternalInt32Array: public ExternalArray {
5107 public: 5072 public:
5108 // Setter and getter. 5073 // Setter and getter.
5109 inline int32_t get_scalar(int index); 5074 inline int32_t get_scalar(int index);
5110 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index); 5075 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index);
5111 inline void set(int index, int32_t value); 5076 inline void set(int index, int32_t value);
5112 5077
5113 // This accessor applies the correct conversion from Smi, HeapNumber 5078 // This accessor applies the correct conversion from Smi, HeapNumber
5114 // and undefined. 5079 // and undefined.
5115 static Handle<Object> SetValue(Handle<ExternalInt32Array> array, 5080 static Handle<Object> SetValue(Handle<ExternalInt32Array> array,
5116 uint32_t index, 5081 uint32_t index,
5117 Handle<Object> value); 5082 Handle<Object> value);
5118 5083
5119 // Casting. 5084 DECLARE_CAST(ExternalInt32Array)
5120 static inline ExternalInt32Array* cast(Object* obj);
5121 5085
5122 // Dispatched behavior. 5086 // Dispatched behavior.
5123 DECLARE_PRINTER(ExternalInt32Array) 5087 DECLARE_PRINTER(ExternalInt32Array)
5124 DECLARE_VERIFIER(ExternalInt32Array) 5088 DECLARE_VERIFIER(ExternalInt32Array)
5125 5089
5126 private: 5090 private:
5127 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array); 5091 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array);
5128 }; 5092 };
5129 5093
5130 5094
5131 class ExternalUint32Array: public ExternalArray { 5095 class ExternalUint32Array: public ExternalArray {
5132 public: 5096 public:
5133 // Setter and getter. 5097 // Setter and getter.
5134 inline uint32_t get_scalar(int index); 5098 inline uint32_t get_scalar(int index);
5135 static inline Handle<Object> get(Handle<ExternalUint32Array> array, 5099 static inline Handle<Object> get(Handle<ExternalUint32Array> array,
5136 int index); 5100 int index);
5137 inline void set(int index, uint32_t value); 5101 inline void set(int index, uint32_t value);
5138 5102
5139 // This accessor applies the correct conversion from Smi, HeapNumber 5103 // This accessor applies the correct conversion from Smi, HeapNumber
5140 // and undefined. 5104 // and undefined.
5141 static Handle<Object> SetValue(Handle<ExternalUint32Array> array, 5105 static Handle<Object> SetValue(Handle<ExternalUint32Array> array,
5142 uint32_t index, 5106 uint32_t index,
5143 Handle<Object> value); 5107 Handle<Object> value);
5144 5108
5145 // Casting. 5109 DECLARE_CAST(ExternalUint32Array)
5146 static inline ExternalUint32Array* cast(Object* obj);
5147 5110
5148 // Dispatched behavior. 5111 // Dispatched behavior.
5149 DECLARE_PRINTER(ExternalUint32Array) 5112 DECLARE_PRINTER(ExternalUint32Array)
5150 DECLARE_VERIFIER(ExternalUint32Array) 5113 DECLARE_VERIFIER(ExternalUint32Array)
5151 5114
5152 private: 5115 private:
5153 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array); 5116 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array);
5154 }; 5117 };
5155 5118
5156 5119
5157 class ExternalFloat32Array: public ExternalArray { 5120 class ExternalFloat32Array: public ExternalArray {
5158 public: 5121 public:
5159 // Setter and getter. 5122 // Setter and getter.
5160 inline float get_scalar(int index); 5123 inline float get_scalar(int index);
5161 static inline Handle<Object> get(Handle<ExternalFloat32Array> array, 5124 static inline Handle<Object> get(Handle<ExternalFloat32Array> array,
5162 int index); 5125 int index);
5163 inline void set(int index, float value); 5126 inline void set(int index, float value);
5164 5127
5165 // This accessor applies the correct conversion from Smi, HeapNumber 5128 // This accessor applies the correct conversion from Smi, HeapNumber
5166 // and undefined. 5129 // and undefined.
5167 static Handle<Object> SetValue(Handle<ExternalFloat32Array> array, 5130 static Handle<Object> SetValue(Handle<ExternalFloat32Array> array,
5168 uint32_t index, 5131 uint32_t index,
5169 Handle<Object> value); 5132 Handle<Object> value);
5170 5133
5171 // Casting. 5134 DECLARE_CAST(ExternalFloat32Array)
5172 static inline ExternalFloat32Array* cast(Object* obj);
5173 5135
5174 // Dispatched behavior. 5136 // Dispatched behavior.
5175 DECLARE_PRINTER(ExternalFloat32Array) 5137 DECLARE_PRINTER(ExternalFloat32Array)
5176 DECLARE_VERIFIER(ExternalFloat32Array) 5138 DECLARE_VERIFIER(ExternalFloat32Array)
5177 5139
5178 private: 5140 private:
5179 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array); 5141 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array);
5180 }; 5142 };
5181 5143
5182 5144
5183 class ExternalFloat64Array: public ExternalArray { 5145 class ExternalFloat64Array: public ExternalArray {
5184 public: 5146 public:
5185 // Setter and getter. 5147 // Setter and getter.
5186 inline double get_scalar(int index); 5148 inline double get_scalar(int index);
5187 static inline Handle<Object> get(Handle<ExternalFloat64Array> array, 5149 static inline Handle<Object> get(Handle<ExternalFloat64Array> array,
5188 int index); 5150 int index);
5189 inline void set(int index, double value); 5151 inline void set(int index, double value);
5190 5152
5191 // This accessor applies the correct conversion from Smi, HeapNumber 5153 // This accessor applies the correct conversion from Smi, HeapNumber
5192 // and undefined. 5154 // and undefined.
5193 static Handle<Object> SetValue(Handle<ExternalFloat64Array> array, 5155 static Handle<Object> SetValue(Handle<ExternalFloat64Array> array,
5194 uint32_t index, 5156 uint32_t index,
5195 Handle<Object> value); 5157 Handle<Object> value);
5196 5158
5197 // Casting. 5159 DECLARE_CAST(ExternalFloat64Array)
5198 static inline ExternalFloat64Array* cast(Object* obj);
5199 5160
5200 // Dispatched behavior. 5161 // Dispatched behavior.
5201 DECLARE_PRINTER(ExternalFloat64Array) 5162 DECLARE_PRINTER(ExternalFloat64Array)
5202 DECLARE_VERIFIER(ExternalFloat64Array) 5163 DECLARE_VERIFIER(ExternalFloat64Array)
5203 5164
5204 private: 5165 private:
5205 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array); 5166 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array);
5206 }; 5167 };
5207 5168
5208 5169
5209 class FixedTypedArrayBase: public FixedArrayBase { 5170 class FixedTypedArrayBase: public FixedArrayBase {
5210 public: 5171 public:
5211 // Casting: 5172 DECLARE_CAST(FixedTypedArrayBase)
5212 static inline FixedTypedArrayBase* cast(Object* obj);
5213 5173
5214 static const int kDataOffset = kHeaderSize; 5174 static const int kDataOffset = kHeaderSize;
5215 5175
5216 inline int size(); 5176 inline int size();
5217 5177
5218 inline int TypedArraySize(InstanceType type); 5178 inline int TypedArraySize(InstanceType type);
5219 5179
5220 // Use with care: returns raw pointer into heap. 5180 // Use with care: returns raw pointer into heap.
5221 inline void* DataPtr(); 5181 inline void* DataPtr();
5222 5182
5223 inline int DataSize(); 5183 inline int DataSize();
5224 5184
5225 private: 5185 private:
5226 inline int DataSize(InstanceType type); 5186 inline int DataSize(InstanceType type);
5227 5187
5228 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase); 5188 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase);
5229 }; 5189 };
5230 5190
5231 5191
5232 template <class Traits> 5192 template <class Traits>
5233 class FixedTypedArray: public FixedTypedArrayBase { 5193 class FixedTypedArray: public FixedTypedArrayBase {
5234 public: 5194 public:
5235 typedef typename Traits::ElementType ElementType; 5195 typedef typename Traits::ElementType ElementType;
5236 static const InstanceType kInstanceType = Traits::kInstanceType; 5196 static const InstanceType kInstanceType = Traits::kInstanceType;
5237 5197
5238 // Casting: 5198 DECLARE_CAST(FixedTypedArray<Traits>)
5239 static inline FixedTypedArray<Traits>* cast(Object* obj);
5240 5199
5241 static inline int ElementOffset(int index) { 5200 static inline int ElementOffset(int index) {
5242 return kDataOffset + index * sizeof(ElementType); 5201 return kDataOffset + index * sizeof(ElementType);
5243 } 5202 }
5244 5203
5245 static inline int SizeFor(int length) { 5204 static inline int SizeFor(int length) {
5246 return ElementOffset(length); 5205 return ElementOffset(length);
5247 } 5206 }
5248 5207
5249 inline ElementType get_scalar(int index); 5208 inline ElementType get_scalar(int index);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
5354 5313
5355 int DeoptCount() { 5314 int DeoptCount() {
5356 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; 5315 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize;
5357 } 5316 }
5358 5317
5359 // Allocates a DeoptimizationInputData. 5318 // Allocates a DeoptimizationInputData.
5360 static Handle<DeoptimizationInputData> New(Isolate* isolate, 5319 static Handle<DeoptimizationInputData> New(Isolate* isolate,
5361 int deopt_entry_count, 5320 int deopt_entry_count,
5362 PretenureFlag pretenure); 5321 PretenureFlag pretenure);
5363 5322
5364 // Casting. 5323 DECLARE_CAST(DeoptimizationInputData)
5365 static inline DeoptimizationInputData* cast(Object* obj);
5366 5324
5367 #ifdef ENABLE_DISASSEMBLER 5325 #ifdef ENABLE_DISASSEMBLER
5368 void DeoptimizationInputDataPrint(FILE* out); 5326 void DeoptimizationInputDataPrint(FILE* out);
5369 #endif 5327 #endif
5370 5328
5371 private: 5329 private:
5372 static int IndexForEntry(int i) { 5330 static int IndexForEntry(int i) {
5373 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); 5331 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize);
5374 } 5332 }
5375 5333
(...skipping 25 matching lines...) Expand all
5401 5359
5402 static int LengthOfFixedArray(int deopt_points) { 5360 static int LengthOfFixedArray(int deopt_points) {
5403 return deopt_points * 2; 5361 return deopt_points * 2;
5404 } 5362 }
5405 5363
5406 // Allocates a DeoptimizationOutputData. 5364 // Allocates a DeoptimizationOutputData.
5407 static Handle<DeoptimizationOutputData> New(Isolate* isolate, 5365 static Handle<DeoptimizationOutputData> New(Isolate* isolate,
5408 int number_of_deopt_points, 5366 int number_of_deopt_points,
5409 PretenureFlag pretenure); 5367 PretenureFlag pretenure);
5410 5368
5411 // Casting. 5369 DECLARE_CAST(DeoptimizationOutputData)
5412 static inline DeoptimizationOutputData* cast(Object* obj);
5413 5370
5414 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 5371 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
5415 void DeoptimizationOutputDataPrint(FILE* out); 5372 void DeoptimizationOutputDataPrint(FILE* out);
5416 #endif 5373 #endif
5417 }; 5374 };
5418 5375
5419 5376
5420 // Forward declaration. 5377 // Forward declaration.
5421 class Cell; 5378 class Cell;
5422 class PropertyCell; 5379 class PropertyCell;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
5759 // Check that the assumptions about the layout of the code object holds. 5716 // Check that the assumptions about the layout of the code object holds.
5760 ASSERT_EQ(static_cast<int>(instruction_start() - address()), 5717 ASSERT_EQ(static_cast<int>(instruction_start() - address()),
5761 Code::kHeaderSize); 5718 Code::kHeaderSize);
5762 return instruction_size() + Code::kHeaderSize; 5719 return instruction_size() + Code::kHeaderSize;
5763 } 5720 }
5764 5721
5765 // Locating source position. 5722 // Locating source position.
5766 int SourcePosition(Address pc); 5723 int SourcePosition(Address pc);
5767 int SourceStatementPosition(Address pc); 5724 int SourceStatementPosition(Address pc);
5768 5725
5769 // Casting. 5726 DECLARE_CAST(Code)
5770 static inline Code* cast(Object* obj);
5771 5727
5772 // Dispatched behavior. 5728 // Dispatched behavior.
5773 int CodeSize() { return SizeFor(body_size()); } 5729 int CodeSize() { return SizeFor(body_size()); }
5774 inline void CodeIterateBody(ObjectVisitor* v); 5730 inline void CodeIterateBody(ObjectVisitor* v);
5775 5731
5776 template<typename StaticVisitor> 5732 template<typename StaticVisitor>
5777 inline void CodeIterateBody(Heap* heap); 5733 inline void CodeIterateBody(Heap* heap);
5778 5734
5779 DECLARE_PRINTER(Code) 5735 DECLARE_PRINTER(Code)
5780 DECLARE_VERIFIER(Code) 5736 DECLARE_VERIFIER(Code)
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
6077 inline int number_of_entries(DependencyGroup group); 6033 inline int number_of_entries(DependencyGroup group);
6078 inline void set_number_of_entries(DependencyGroup group, int value); 6034 inline void set_number_of_entries(DependencyGroup group, int value);
6079 inline bool is_code_at(int i); 6035 inline bool is_code_at(int i);
6080 inline Code* code_at(int i); 6036 inline Code* code_at(int i);
6081 inline CompilationInfo* compilation_info_at(int i); 6037 inline CompilationInfo* compilation_info_at(int i);
6082 inline void set_object_at(int i, Object* object); 6038 inline void set_object_at(int i, Object* object);
6083 inline Object** slot_at(int i); 6039 inline Object** slot_at(int i);
6084 inline Object* object_at(int i); 6040 inline Object* object_at(int i);
6085 inline void clear_at(int i); 6041 inline void clear_at(int i);
6086 inline void copy(int from, int to); 6042 inline void copy(int from, int to);
6087 static inline DependentCode* cast(Object* object); 6043 DECLARE_CAST(DependentCode)
6088 6044
6089 static DependentCode* ForObject(Handle<HeapObject> object, 6045 static DependentCode* ForObject(Handle<HeapObject> object,
6090 DependencyGroup group); 6046 DependencyGroup group);
6091 6047
6092 private: 6048 private:
6093 // Make a room at the end of the given group by moving out the first 6049 // Make a room at the end of the given group by moving out the first
6094 // code objects of the subsequent groups. 6050 // code objects of the subsequent groups.
6095 inline void ExtendGroup(DependencyGroup group); 6051 inline void ExtendGroup(DependencyGroup group);
6096 static const int kCodesStartIndex = kGroupCount; 6052 static const int kCodesStartIndex = kGroupCount;
6097 }; 6053 };
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
6542 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, 6498 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS,
6543 PropertyAttributes filter = NONE); 6499 PropertyAttributes filter = NONE);
6544 6500
6545 // Returns the number of slots allocated for the initial properties 6501 // Returns the number of slots allocated for the initial properties
6546 // backing storage for instances of this map. 6502 // backing storage for instances of this map.
6547 int InitialPropertiesLength() { 6503 int InitialPropertiesLength() {
6548 return pre_allocated_property_fields() + unused_property_fields() - 6504 return pre_allocated_property_fields() + unused_property_fields() -
6549 inobject_properties(); 6505 inobject_properties();
6550 } 6506 }
6551 6507
6552 // Casting. 6508 DECLARE_CAST(Map)
6553 static inline Map* cast(Object* obj);
6554 6509
6555 // Code cache operations. 6510 // Code cache operations.
6556 6511
6557 // Clears the code cache. 6512 // Clears the code cache.
6558 inline void ClearCodeCache(Heap* heap); 6513 inline void ClearCodeCache(Heap* heap);
6559 6514
6560 // Update code cache. 6515 // Update code cache.
6561 static void UpdateCodeCache(Handle<Map> map, 6516 static void UpdateCodeCache(Handle<Map> map,
6562 Handle<Name> name, 6517 Handle<Name> name,
6563 Handle<Code> code); 6518 Handle<Code> code);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
6835 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 6790 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
6836 }; 6791 };
6837 6792
6838 6793
6839 // An abstract superclass, a marker class really, for simple structure classes. 6794 // An abstract superclass, a marker class really, for simple structure classes.
6840 // It doesn't carry much functionality but allows struct classes to be 6795 // It doesn't carry much functionality but allows struct classes to be
6841 // identified in the type system. 6796 // identified in the type system.
6842 class Struct: public HeapObject { 6797 class Struct: public HeapObject {
6843 public: 6798 public:
6844 inline void InitializeBody(int object_size); 6799 inline void InitializeBody(int object_size);
6845 static inline Struct* cast(Object* that); 6800 DECLARE_CAST(Struct)
6846 }; 6801 };
6847 6802
6848 6803
6849 // A simple one-element struct, useful where smis need to be boxed. 6804 // A simple one-element struct, useful where smis need to be boxed.
6850 class Box : public Struct { 6805 class Box : public Struct {
6851 public: 6806 public:
6852 // [value]: the boxed contents. 6807 // [value]: the boxed contents.
6853 DECL_ACCESSORS(value, Object) 6808 DECL_ACCESSORS(value, Object)
6854 6809
6855 static inline Box* cast(Object* obj); 6810 DECLARE_CAST(Box)
6856 6811
6857 // Dispatched behavior. 6812 // Dispatched behavior.
6858 DECLARE_PRINTER(Box) 6813 DECLARE_PRINTER(Box)
6859 DECLARE_VERIFIER(Box) 6814 DECLARE_VERIFIER(Box)
6860 6815
6861 static const int kValueOffset = HeapObject::kHeaderSize; 6816 static const int kValueOffset = HeapObject::kHeaderSize;
6862 static const int kSize = kValueOffset + kPointerSize; 6817 static const int kSize = kValueOffset + kPointerSize;
6863 6818
6864 private: 6819 private:
6865 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); 6820 DISALLOW_IMPLICIT_CONSTRUCTORS(Box);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
6936 // compiled. Encoded in the 'flags' field. 6891 // compiled. Encoded in the 'flags' field.
6937 inline CompilationState compilation_state(); 6892 inline CompilationState compilation_state();
6938 inline void set_compilation_state(CompilationState state); 6893 inline void set_compilation_state(CompilationState state);
6939 6894
6940 // [is_shared_cross_origin]: An opaque boolean set by the embedder via 6895 // [is_shared_cross_origin]: An opaque boolean set by the embedder via
6941 // ScriptOrigin, and used by the embedder to make decisions about the 6896 // ScriptOrigin, and used by the embedder to make decisions about the
6942 // script's level of privilege. V8 just passes this through. Encoded in 6897 // script's level of privilege. V8 just passes this through. Encoded in
6943 // the 'flags' field. 6898 // the 'flags' field.
6944 DECL_BOOLEAN_ACCESSORS(is_shared_cross_origin) 6899 DECL_BOOLEAN_ACCESSORS(is_shared_cross_origin)
6945 6900
6946 static inline Script* cast(Object* obj); 6901 DECLARE_CAST(Script)
6947 6902
6948 // If script source is an external string, check that the underlying 6903 // If script source is an external string, check that the underlying
6949 // resource is accessible. Otherwise, always return true. 6904 // resource is accessible. Otherwise, always return true.
6950 inline bool HasValidSource(); 6905 inline bool HasValidSource();
6951 6906
6952 // Convert code position into column number. 6907 // Convert code position into column number.
6953 static int GetColumnNumber(Handle<Script> script, int code_pos); 6908 static int GetColumnNumber(Handle<Script> script, int code_pos);
6954 6909
6955 // Convert code position into (zero-based) line number. 6910 // Convert code position into (zero-based) line number.
6956 // The non-handlified version does not allocate, but may be much slower. 6911 // The non-handlified version does not allocate, but may be much slower.
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
7344 int CalculateInObjectProperties(); 7299 int CalculateInObjectProperties();
7345 7300
7346 // Dispatched behavior. 7301 // Dispatched behavior.
7347 // Set max_length to -1 for unlimited length. 7302 // Set max_length to -1 for unlimited length.
7348 void SourceCodePrint(StringStream* accumulator, int max_length); 7303 void SourceCodePrint(StringStream* accumulator, int max_length);
7349 DECLARE_PRINTER(SharedFunctionInfo) 7304 DECLARE_PRINTER(SharedFunctionInfo)
7350 DECLARE_VERIFIER(SharedFunctionInfo) 7305 DECLARE_VERIFIER(SharedFunctionInfo)
7351 7306
7352 void ResetForNewContext(int new_ic_age); 7307 void ResetForNewContext(int new_ic_age);
7353 7308
7354 // Casting. 7309 DECLARE_CAST(SharedFunctionInfo)
7355 static inline SharedFunctionInfo* cast(Object* obj);
7356 7310
7357 // Constants. 7311 // Constants.
7358 static const int kDontAdaptArgumentsSentinel = -1; 7312 static const int kDontAdaptArgumentsSentinel = -1;
7359 7313
7360 // Layout description. 7314 // Layout description.
7361 // Pointer fields. 7315 // Pointer fields.
7362 static const int kNameOffset = HeapObject::kHeaderSize; 7316 static const int kNameOffset = HeapObject::kHeaderSize;
7363 static const int kCodeOffset = kNameOffset + kPointerSize; 7317 static const int kCodeOffset = kNameOffset + kPointerSize;
7364 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; 7318 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize;
7365 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; 7319 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
7557 inline bool is_suspended(); 7511 inline bool is_suspended();
7558 7512
7559 // [operand_stack]: Saved operand stack. 7513 // [operand_stack]: Saved operand stack.
7560 DECL_ACCESSORS(operand_stack, FixedArray) 7514 DECL_ACCESSORS(operand_stack, FixedArray)
7561 7515
7562 // [stack_handler_index]: Index of first stack handler in operand_stack, or -1 7516 // [stack_handler_index]: Index of first stack handler in operand_stack, or -1
7563 // if the captured activation had no stack handler. 7517 // if the captured activation had no stack handler.
7564 inline int stack_handler_index() const; 7518 inline int stack_handler_index() const;
7565 inline void set_stack_handler_index(int stack_handler_index); 7519 inline void set_stack_handler_index(int stack_handler_index);
7566 7520
7567 // Casting. 7521 DECLARE_CAST(JSGeneratorObject)
7568 static inline JSGeneratorObject* cast(Object* obj);
7569 7522
7570 // Dispatched behavior. 7523 // Dispatched behavior.
7571 DECLARE_PRINTER(JSGeneratorObject) 7524 DECLARE_PRINTER(JSGeneratorObject)
7572 DECLARE_VERIFIER(JSGeneratorObject) 7525 DECLARE_VERIFIER(JSGeneratorObject)
7573 7526
7574 // Magic sentinel values for the continuation. 7527 // Magic sentinel values for the continuation.
7575 static const int kGeneratorExecuting = -1; 7528 static const int kGeneratorExecuting = -1;
7576 static const int kGeneratorClosed = 0; 7529 static const int kGeneratorClosed = 0;
7577 7530
7578 // Layout description. 7531 // Layout description.
(...skipping 27 matching lines...) Expand all
7606 7559
7607 // Representation for module instance objects. 7560 // Representation for module instance objects.
7608 class JSModule: public JSObject { 7561 class JSModule: public JSObject {
7609 public: 7562 public:
7610 // [context]: the context holding the module's locals, or undefined if none. 7563 // [context]: the context holding the module's locals, or undefined if none.
7611 DECL_ACCESSORS(context, Object) 7564 DECL_ACCESSORS(context, Object)
7612 7565
7613 // [scope_info]: Scope info. 7566 // [scope_info]: Scope info.
7614 DECL_ACCESSORS(scope_info, ScopeInfo) 7567 DECL_ACCESSORS(scope_info, ScopeInfo)
7615 7568
7616 // Casting. 7569 DECLARE_CAST(JSModule)
7617 static inline JSModule* cast(Object* obj);
7618 7570
7619 // Dispatched behavior. 7571 // Dispatched behavior.
7620 DECLARE_PRINTER(JSModule) 7572 DECLARE_PRINTER(JSModule)
7621 DECLARE_VERIFIER(JSModule) 7573 DECLARE_VERIFIER(JSModule)
7622 7574
7623 // Layout description. 7575 // Layout description.
7624 static const int kContextOffset = JSObject::kHeaderSize; 7576 static const int kContextOffset = JSObject::kHeaderSize;
7625 static const int kScopeInfoOffset = kContextOffset + kPointerSize; 7577 static const int kScopeInfoOffset = kContextOffset + kPointerSize;
7626 static const int kSize = kScopeInfoOffset + kPointerSize; 7578 static const int kSize = kScopeInfoOffset + kPointerSize;
7627 7579
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
7792 7744
7793 // [next_function_link]: Links functions into various lists, e.g. the list 7745 // [next_function_link]: Links functions into various lists, e.g. the list
7794 // of optimized functions hanging off the native_context. The CodeFlusher 7746 // of optimized functions hanging off the native_context. The CodeFlusher
7795 // uses this link to chain together flushing candidates. Treated weakly 7747 // uses this link to chain together flushing candidates. Treated weakly
7796 // by the garbage collector. 7748 // by the garbage collector.
7797 DECL_ACCESSORS(next_function_link, Object) 7749 DECL_ACCESSORS(next_function_link, Object)
7798 7750
7799 // Prints the name of the function using PrintF. 7751 // Prints the name of the function using PrintF.
7800 void PrintName(FILE* out = stdout); 7752 void PrintName(FILE* out = stdout);
7801 7753
7802 // Casting. 7754 DECLARE_CAST(JSFunction)
7803 static inline JSFunction* cast(Object* obj);
7804 7755
7805 // Iterates the objects, including code objects indirectly referenced 7756 // Iterates the objects, including code objects indirectly referenced
7806 // through pointers to the first instruction in the code object. 7757 // through pointers to the first instruction in the code object.
7807 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); 7758 void JSFunctionIterateBody(int object_size, ObjectVisitor* v);
7808 7759
7809 // Dispatched behavior. 7760 // Dispatched behavior.
7810 DECLARE_PRINTER(JSFunction) 7761 DECLARE_PRINTER(JSFunction)
7811 DECLARE_VERIFIER(JSFunction) 7762 DECLARE_VERIFIER(JSFunction)
7812 7763
7813 // Returns the number of allocated literals. 7764 // Returns the number of allocated literals.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
7856 7807
7857 class JSGlobalProxy : public JSObject { 7808 class JSGlobalProxy : public JSObject {
7858 public: 7809 public:
7859 // [native_context]: the owner native context of this global proxy object. 7810 // [native_context]: the owner native context of this global proxy object.
7860 // It is null value if this object is not used by any context. 7811 // It is null value if this object is not used by any context.
7861 DECL_ACCESSORS(native_context, Object) 7812 DECL_ACCESSORS(native_context, Object)
7862 7813
7863 // [hash]: The hash code property (undefined if not initialized yet). 7814 // [hash]: The hash code property (undefined if not initialized yet).
7864 DECL_ACCESSORS(hash, Object) 7815 DECL_ACCESSORS(hash, Object)
7865 7816
7866 // Casting. 7817 DECLARE_CAST(JSGlobalProxy)
7867 static inline JSGlobalProxy* cast(Object* obj);
7868 7818
7869 inline bool IsDetachedFrom(GlobalObject* global); 7819 inline bool IsDetachedFrom(GlobalObject* global);
7870 7820
7871 // Dispatched behavior. 7821 // Dispatched behavior.
7872 DECLARE_PRINTER(JSGlobalProxy) 7822 DECLARE_PRINTER(JSGlobalProxy)
7873 DECLARE_VERIFIER(JSGlobalProxy) 7823 DECLARE_VERIFIER(JSGlobalProxy)
7874 7824
7875 // Layout description. 7825 // Layout description.
7876 static const int kNativeContextOffset = JSObject::kHeaderSize; 7826 static const int kNativeContextOffset = JSObject::kHeaderSize;
7877 static const int kHashOffset = kNativeContextOffset + kPointerSize; 7827 static const int kHashOffset = kNativeContextOffset + kPointerSize;
(...skipping 19 matching lines...) Expand all
7897 7847
7898 // [global context]: the most recent (i.e. innermost) global context. 7848 // [global context]: the most recent (i.e. innermost) global context.
7899 DECL_ACCESSORS(global_context, Context) 7849 DECL_ACCESSORS(global_context, Context)
7900 7850
7901 // [global receiver]: the global receiver object of the context 7851 // [global receiver]: the global receiver object of the context
7902 DECL_ACCESSORS(global_receiver, JSObject) 7852 DECL_ACCESSORS(global_receiver, JSObject)
7903 7853
7904 // Retrieve the property cell used to store a property. 7854 // Retrieve the property cell used to store a property.
7905 PropertyCell* GetPropertyCell(LookupResult* result); 7855 PropertyCell* GetPropertyCell(LookupResult* result);
7906 7856
7907 // Casting. 7857 DECLARE_CAST(GlobalObject)
7908 static inline GlobalObject* cast(Object* obj);
7909 7858
7910 // Layout description. 7859 // Layout description.
7911 static const int kBuiltinsOffset = JSObject::kHeaderSize; 7860 static const int kBuiltinsOffset = JSObject::kHeaderSize;
7912 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; 7861 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize;
7913 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; 7862 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize;
7914 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; 7863 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize;
7915 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; 7864 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize;
7916 7865
7917 private: 7866 private:
7918 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); 7867 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject);
7919 }; 7868 };
7920 7869
7921 7870
7922 // JavaScript global object. 7871 // JavaScript global object.
7923 class JSGlobalObject: public GlobalObject { 7872 class JSGlobalObject: public GlobalObject {
7924 public: 7873 public:
7925 // Casting. 7874 DECLARE_CAST(JSGlobalObject)
7926 static inline JSGlobalObject* cast(Object* obj);
7927 7875
7928 // Ensure that the global object has a cell for the given property name. 7876 // Ensure that the global object has a cell for the given property name.
7929 static Handle<PropertyCell> EnsurePropertyCell(Handle<JSGlobalObject> global, 7877 static Handle<PropertyCell> EnsurePropertyCell(Handle<JSGlobalObject> global,
7930 Handle<Name> name); 7878 Handle<Name> name);
7931 7879
7932 inline bool IsDetached(); 7880 inline bool IsDetached();
7933 7881
7934 // Dispatched behavior. 7882 // Dispatched behavior.
7935 DECLARE_PRINTER(JSGlobalObject) 7883 DECLARE_PRINTER(JSGlobalObject)
7936 DECLARE_VERIFIER(JSGlobalObject) 7884 DECLARE_VERIFIER(JSGlobalObject)
(...skipping 11 matching lines...) Expand all
7948 class JSBuiltinsObject: public GlobalObject { 7896 class JSBuiltinsObject: public GlobalObject {
7949 public: 7897 public:
7950 // Accessors for the runtime routines written in JavaScript. 7898 // Accessors for the runtime routines written in JavaScript.
7951 inline Object* javascript_builtin(Builtins::JavaScript id); 7899 inline Object* javascript_builtin(Builtins::JavaScript id);
7952 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); 7900 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value);
7953 7901
7954 // Accessors for code of the runtime routines written in JavaScript. 7902 // Accessors for code of the runtime routines written in JavaScript.
7955 inline Code* javascript_builtin_code(Builtins::JavaScript id); 7903 inline Code* javascript_builtin_code(Builtins::JavaScript id);
7956 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value); 7904 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value);
7957 7905
7958 // Casting. 7906 DECLARE_CAST(JSBuiltinsObject)
7959 static inline JSBuiltinsObject* cast(Object* obj);
7960 7907
7961 // Dispatched behavior. 7908 // Dispatched behavior.
7962 DECLARE_PRINTER(JSBuiltinsObject) 7909 DECLARE_PRINTER(JSBuiltinsObject)
7963 DECLARE_VERIFIER(JSBuiltinsObject) 7910 DECLARE_VERIFIER(JSBuiltinsObject)
7964 7911
7965 // Layout description. The size of the builtins object includes 7912 // Layout description. The size of the builtins object includes
7966 // room for two pointers per runtime routine written in javascript 7913 // room for two pointers per runtime routine written in javascript
7967 // (function and code object). 7914 // (function and code object).
7968 static const int kJSBuiltinsCount = Builtins::id_count; 7915 static const int kJSBuiltinsCount = Builtins::id_count;
7969 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize; 7916 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize;
(...skipping 14 matching lines...) Expand all
7984 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject); 7931 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject);
7985 }; 7932 };
7986 7933
7987 7934
7988 // Representation for JS Wrapper objects, String, Number, Boolean, etc. 7935 // Representation for JS Wrapper objects, String, Number, Boolean, etc.
7989 class JSValue: public JSObject { 7936 class JSValue: public JSObject {
7990 public: 7937 public:
7991 // [value]: the object being wrapped. 7938 // [value]: the object being wrapped.
7992 DECL_ACCESSORS(value, Object) 7939 DECL_ACCESSORS(value, Object)
7993 7940
7994 // Casting. 7941 DECLARE_CAST(JSValue)
7995 static inline JSValue* cast(Object* obj);
7996 7942
7997 // Dispatched behavior. 7943 // Dispatched behavior.
7998 DECLARE_PRINTER(JSValue) 7944 DECLARE_PRINTER(JSValue)
7999 DECLARE_VERIFIER(JSValue) 7945 DECLARE_VERIFIER(JSValue)
8000 7946
8001 // Layout description. 7947 // Layout description.
8002 static const int kValueOffset = JSObject::kHeaderSize; 7948 static const int kValueOffset = JSObject::kHeaderSize;
8003 static const int kSize = kValueOffset + kPointerSize; 7949 static const int kSize = kValueOffset + kPointerSize;
8004 7950
8005 private: 7951 private:
(...skipping 20 matching lines...) Expand all
8026 // [hour]: caches hours. Either undefined, smi, or NaN. 7972 // [hour]: caches hours. Either undefined, smi, or NaN.
8027 DECL_ACCESSORS(hour, Object) 7973 DECL_ACCESSORS(hour, Object)
8028 // [min]: caches minutes. Either undefined, smi, or NaN. 7974 // [min]: caches minutes. Either undefined, smi, or NaN.
8029 DECL_ACCESSORS(min, Object) 7975 DECL_ACCESSORS(min, Object)
8030 // [sec]: caches seconds. Either undefined, smi, or NaN. 7976 // [sec]: caches seconds. Either undefined, smi, or NaN.
8031 DECL_ACCESSORS(sec, Object) 7977 DECL_ACCESSORS(sec, Object)
8032 // [cache stamp]: sample of the date cache stamp at the 7978 // [cache stamp]: sample of the date cache stamp at the
8033 // moment when chached fields were cached. 7979 // moment when chached fields were cached.
8034 DECL_ACCESSORS(cache_stamp, Object) 7980 DECL_ACCESSORS(cache_stamp, Object)
8035 7981
8036 // Casting. 7982 DECLARE_CAST(JSDate)
8037 static inline JSDate* cast(Object* obj);
8038 7983
8039 // Returns the date field with the specified index. 7984 // Returns the date field with the specified index.
8040 // See FieldIndex for the list of date fields. 7985 // See FieldIndex for the list of date fields.
8041 static Object* GetField(Object* date, Smi* index); 7986 static Object* GetField(Object* date, Smi* index);
8042 7987
8043 void SetValue(Object* value, bool is_value_nan); 7988 void SetValue(Object* value, bool is_value_nan);
8044 7989
8045 7990
8046 // Dispatched behavior. 7991 // Dispatched behavior.
8047 DECLARE_PRINTER(JSDate) 7992 DECLARE_PRINTER(JSDate)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
8122 DECL_ACCESSORS(stack_frames, Object) 8067 DECL_ACCESSORS(stack_frames, Object)
8123 8068
8124 // [start_position]: the start position in the script for the error message. 8069 // [start_position]: the start position in the script for the error message.
8125 inline int start_position() const; 8070 inline int start_position() const;
8126 inline void set_start_position(int value); 8071 inline void set_start_position(int value);
8127 8072
8128 // [end_position]: the end position in the script for the error message. 8073 // [end_position]: the end position in the script for the error message.
8129 inline int end_position() const; 8074 inline int end_position() const;
8130 inline void set_end_position(int value); 8075 inline void set_end_position(int value);
8131 8076
8132 // Casting. 8077 DECLARE_CAST(JSMessageObject)
8133 static inline JSMessageObject* cast(Object* obj);
8134 8078
8135 // Dispatched behavior. 8079 // Dispatched behavior.
8136 DECLARE_PRINTER(JSMessageObject) 8080 DECLARE_PRINTER(JSMessageObject)
8137 DECLARE_VERIFIER(JSMessageObject) 8081 DECLARE_VERIFIER(JSMessageObject)
8138 8082
8139 // Layout description. 8083 // Layout description.
8140 static const int kTypeOffset = JSObject::kHeaderSize; 8084 static const int kTypeOffset = JSObject::kHeaderSize;
8141 static const int kArgumentsOffset = kTypeOffset + kPointerSize; 8085 static const int kArgumentsOffset = kTypeOffset + kPointerSize;
8142 static const int kScriptOffset = kArgumentsOffset + kPointerSize; 8086 static const int kScriptOffset = kArgumentsOffset + kPointerSize;
8143 static const int kStackFramesOffset = kScriptOffset + kPointerSize; 8087 static const int kStackFramesOffset = kScriptOffset + kPointerSize;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
8207 } 8151 }
8208 8152
8209 static int saved_code_index(bool is_ascii) { 8153 static int saved_code_index(bool is_ascii) {
8210 if (is_ascii) { 8154 if (is_ascii) {
8211 return kIrregexpASCIICodeSavedIndex; 8155 return kIrregexpASCIICodeSavedIndex;
8212 } else { 8156 } else {
8213 return kIrregexpUC16CodeSavedIndex; 8157 return kIrregexpUC16CodeSavedIndex;
8214 } 8158 }
8215 } 8159 }
8216 8160
8217 static inline JSRegExp* cast(Object* obj); 8161 DECLARE_CAST(JSRegExp)
8218 8162
8219 // Dispatched behavior. 8163 // Dispatched behavior.
8220 DECLARE_VERIFIER(JSRegExp) 8164 DECLARE_VERIFIER(JSRegExp)
8221 8165
8222 static const int kDataOffset = JSObject::kHeaderSize; 8166 static const int kDataOffset = JSObject::kHeaderSize;
8223 static const int kSize = kDataOffset + kPointerSize; 8167 static const int kSize = kDataOffset + kPointerSize;
8224 8168
8225 // Indices in the data array. 8169 // Indices in the data array.
8226 static const int kTagIndex = 0; 8170 static const int kTagIndex = 0;
8227 static const int kSourceIndex = kTagIndex + 1; 8171 static const int kSourceIndex = kTagIndex + 1;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
8325 Handle<Context> context, Handle<Object> value); 8269 Handle<Context> context, Handle<Object> value);
8326 static Handle<CompilationCacheTable> PutEval( 8270 static Handle<CompilationCacheTable> PutEval(
8327 Handle<CompilationCacheTable> cache, Handle<String> src, 8271 Handle<CompilationCacheTable> cache, Handle<String> src,
8328 Handle<Context> context, Handle<SharedFunctionInfo> value, 8272 Handle<Context> context, Handle<SharedFunctionInfo> value,
8329 int scope_position); 8273 int scope_position);
8330 static Handle<CompilationCacheTable> PutRegExp( 8274 static Handle<CompilationCacheTable> PutRegExp(
8331 Handle<CompilationCacheTable> cache, Handle<String> src, 8275 Handle<CompilationCacheTable> cache, Handle<String> src,
8332 JSRegExp::Flags flags, Handle<FixedArray> value); 8276 JSRegExp::Flags flags, Handle<FixedArray> value);
8333 void Remove(Object* value); 8277 void Remove(Object* value);
8334 8278
8335 static inline CompilationCacheTable* cast(Object* obj); 8279 DECLARE_CAST(CompilationCacheTable)
8336 8280
8337 private: 8281 private:
8338 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 8282 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
8339 }; 8283 };
8340 8284
8341 8285
8342 class CodeCache: public Struct { 8286 class CodeCache: public Struct {
8343 public: 8287 public:
8344 DECL_ACCESSORS(default_cache, FixedArray) 8288 DECL_ACCESSORS(default_cache, FixedArray)
8345 DECL_ACCESSORS(normal_type_cache, Object) 8289 DECL_ACCESSORS(normal_type_cache, Object)
8346 8290
8347 // Add the code object to the cache. 8291 // Add the code object to the cache.
8348 static void Update( 8292 static void Update(
8349 Handle<CodeCache> cache, Handle<Name> name, Handle<Code> code); 8293 Handle<CodeCache> cache, Handle<Name> name, Handle<Code> code);
8350 8294
8351 // Lookup code object in the cache. Returns code object if found and undefined 8295 // Lookup code object in the cache. Returns code object if found and undefined
8352 // if not. 8296 // if not.
8353 Object* Lookup(Name* name, Code::Flags flags); 8297 Object* Lookup(Name* name, Code::Flags flags);
8354 8298
8355 // Get the internal index of a code object in the cache. Returns -1 if the 8299 // Get the internal index of a code object in the cache. Returns -1 if the
8356 // code object is not in that cache. This index can be used to later call 8300 // code object is not in that cache. This index can be used to later call
8357 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and 8301 // RemoveByIndex. The cache cannot be modified between a call to GetIndex and
8358 // RemoveByIndex. 8302 // RemoveByIndex.
8359 int GetIndex(Object* name, Code* code); 8303 int GetIndex(Object* name, Code* code);
8360 8304
8361 // Remove an object from the cache with the provided internal index. 8305 // Remove an object from the cache with the provided internal index.
8362 void RemoveByIndex(Object* name, Code* code, int index); 8306 void RemoveByIndex(Object* name, Code* code, int index);
8363 8307
8364 static inline CodeCache* cast(Object* obj); 8308 DECLARE_CAST(CodeCache)
8365 8309
8366 // Dispatched behavior. 8310 // Dispatched behavior.
8367 DECLARE_PRINTER(CodeCache) 8311 DECLARE_PRINTER(CodeCache)
8368 DECLARE_VERIFIER(CodeCache) 8312 DECLARE_VERIFIER(CodeCache)
8369 8313
8370 static const int kDefaultCacheOffset = HeapObject::kHeaderSize; 8314 static const int kDefaultCacheOffset = HeapObject::kHeaderSize;
8371 static const int kNormalTypeCacheOffset = 8315 static const int kNormalTypeCacheOffset =
8372 kDefaultCacheOffset + kPointerSize; 8316 kDefaultCacheOffset + kPointerSize;
8373 static const int kSize = kNormalTypeCacheOffset + kPointerSize; 8317 static const int kSize = kNormalTypeCacheOffset + kPointerSize;
8374 8318
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
8417 public: 8361 public:
8418 Object* Lookup(Name* name, Code::Flags flags); 8362 Object* Lookup(Name* name, Code::Flags flags);
8419 static Handle<CodeCacheHashTable> Put( 8363 static Handle<CodeCacheHashTable> Put(
8420 Handle<CodeCacheHashTable> table, 8364 Handle<CodeCacheHashTable> table,
8421 Handle<Name> name, 8365 Handle<Name> name,
8422 Handle<Code> code); 8366 Handle<Code> code);
8423 8367
8424 int GetIndex(Name* name, Code::Flags flags); 8368 int GetIndex(Name* name, Code::Flags flags);
8425 void RemoveByIndex(int index); 8369 void RemoveByIndex(int index);
8426 8370
8427 static inline CodeCacheHashTable* cast(Object* obj); 8371 DECLARE_CAST(CodeCacheHashTable)
8428 8372
8429 // Initial size of the fixed array backing the hash table. 8373 // Initial size of the fixed array backing the hash table.
8430 static const int kInitialSize = 64; 8374 static const int kInitialSize = 64;
8431 8375
8432 private: 8376 private:
8433 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); 8377 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable);
8434 }; 8378 };
8435 8379
8436 8380
8437 class PolymorphicCodeCache: public Struct { 8381 class PolymorphicCodeCache: public Struct {
8438 public: 8382 public:
8439 DECL_ACCESSORS(cache, Object) 8383 DECL_ACCESSORS(cache, Object)
8440 8384
8441 static void Update(Handle<PolymorphicCodeCache> cache, 8385 static void Update(Handle<PolymorphicCodeCache> cache,
8442 MapHandleList* maps, 8386 MapHandleList* maps,
8443 Code::Flags flags, 8387 Code::Flags flags,
8444 Handle<Code> code); 8388 Handle<Code> code);
8445 8389
8446 8390
8447 // Returns an undefined value if the entry is not found. 8391 // Returns an undefined value if the entry is not found.
8448 Handle<Object> Lookup(MapHandleList* maps, Code::Flags flags); 8392 Handle<Object> Lookup(MapHandleList* maps, Code::Flags flags);
8449 8393
8450 static inline PolymorphicCodeCache* cast(Object* obj); 8394 DECLARE_CAST(PolymorphicCodeCache)
8451 8395
8452 // Dispatched behavior. 8396 // Dispatched behavior.
8453 DECLARE_PRINTER(PolymorphicCodeCache) 8397 DECLARE_PRINTER(PolymorphicCodeCache)
8454 DECLARE_VERIFIER(PolymorphicCodeCache) 8398 DECLARE_VERIFIER(PolymorphicCodeCache)
8455 8399
8456 static const int kCacheOffset = HeapObject::kHeaderSize; 8400 static const int kCacheOffset = HeapObject::kHeaderSize;
8457 static const int kSize = kCacheOffset + kPointerSize; 8401 static const int kSize = kCacheOffset + kPointerSize;
8458 8402
8459 private: 8403 private:
8460 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); 8404 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache);
8461 }; 8405 };
8462 8406
8463 8407
8464 class PolymorphicCodeCacheHashTable 8408 class PolymorphicCodeCacheHashTable
8465 : public HashTable<PolymorphicCodeCacheHashTable, 8409 : public HashTable<PolymorphicCodeCacheHashTable,
8466 CodeCacheHashTableShape, 8410 CodeCacheHashTableShape,
8467 HashTableKey*> { 8411 HashTableKey*> {
8468 public: 8412 public:
8469 Object* Lookup(MapHandleList* maps, int code_kind); 8413 Object* Lookup(MapHandleList* maps, int code_kind);
8470 8414
8471 static Handle<PolymorphicCodeCacheHashTable> Put( 8415 static Handle<PolymorphicCodeCacheHashTable> Put(
8472 Handle<PolymorphicCodeCacheHashTable> hash_table, 8416 Handle<PolymorphicCodeCacheHashTable> hash_table,
8473 MapHandleList* maps, 8417 MapHandleList* maps,
8474 int code_kind, 8418 int code_kind,
8475 Handle<Code> code); 8419 Handle<Code> code);
8476 8420
8477 static inline PolymorphicCodeCacheHashTable* cast(Object* obj); 8421 DECLARE_CAST(PolymorphicCodeCacheHashTable)
8478 8422
8479 static const int kInitialSize = 64; 8423 static const int kInitialSize = 64;
8480 private: 8424 private:
8481 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); 8425 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable);
8482 }; 8426 };
8483 8427
8484 8428
8485 class TypeFeedbackInfo: public Struct { 8429 class TypeFeedbackInfo: public Struct {
8486 public: 8430 public:
8487 inline int ic_total_count(); 8431 inline int ic_total_count();
8488 inline void set_ic_total_count(int count); 8432 inline void set_ic_total_count(int count);
8489 8433
8490 inline int ic_with_type_info_count(); 8434 inline int ic_with_type_info_count();
8491 inline void change_ic_with_type_info_count(int count); 8435 inline void change_ic_with_type_info_count(int count);
8492 8436
8493 inline void initialize_storage(); 8437 inline void initialize_storage();
8494 8438
8495 inline void change_own_type_change_checksum(); 8439 inline void change_own_type_change_checksum();
8496 inline int own_type_change_checksum(); 8440 inline int own_type_change_checksum();
8497 8441
8498 inline void set_inlined_type_change_checksum(int checksum); 8442 inline void set_inlined_type_change_checksum(int checksum);
8499 inline bool matches_inlined_type_change_checksum(int checksum); 8443 inline bool matches_inlined_type_change_checksum(int checksum);
8500 8444
8501 8445
8502 static inline TypeFeedbackInfo* cast(Object* obj); 8446 DECLARE_CAST(TypeFeedbackInfo)
8503 8447
8504 // Dispatched behavior. 8448 // Dispatched behavior.
8505 DECLARE_PRINTER(TypeFeedbackInfo) 8449 DECLARE_PRINTER(TypeFeedbackInfo)
8506 DECLARE_VERIFIER(TypeFeedbackInfo) 8450 DECLARE_VERIFIER(TypeFeedbackInfo)
8507 8451
8508 static const int kStorage1Offset = HeapObject::kHeaderSize; 8452 static const int kStorage1Offset = HeapObject::kHeaderSize;
8509 static const int kStorage2Offset = kStorage1Offset + kPointerSize; 8453 static const int kStorage2Offset = kStorage1Offset + kPointerSize;
8510 static const int kSize = kStorage2Offset + kPointerSize; 8454 static const int kSize = kStorage2Offset + kPointerSize;
8511 8455
8512 // TODO(mvstanton): move these sentinel declarations to shared function info. 8456 // TODO(mvstanton): move these sentinel declarations to shared function info.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
8701 TRANSITIONS 8645 TRANSITIONS
8702 }; 8646 };
8703 8647
8704 static void AddDependentCompilationInfo(Handle<AllocationSite> site, 8648 static void AddDependentCompilationInfo(Handle<AllocationSite> site,
8705 Reason reason, 8649 Reason reason,
8706 CompilationInfo* info); 8650 CompilationInfo* info);
8707 8651
8708 DECLARE_PRINTER(AllocationSite) 8652 DECLARE_PRINTER(AllocationSite)
8709 DECLARE_VERIFIER(AllocationSite) 8653 DECLARE_VERIFIER(AllocationSite)
8710 8654
8711 static inline AllocationSite* cast(Object* obj); 8655 DECLARE_CAST(AllocationSite)
8712 static inline AllocationSiteMode GetMode( 8656 static inline AllocationSiteMode GetMode(
8713 ElementsKind boilerplate_elements_kind); 8657 ElementsKind boilerplate_elements_kind);
8714 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); 8658 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
8715 static inline bool CanTrack(InstanceType type); 8659 static inline bool CanTrack(InstanceType type);
8716 8660
8717 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; 8661 static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
8718 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; 8662 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize;
8719 static const int kPretenureDataOffset = kNestedSiteOffset + kPointerSize; 8663 static const int kPretenureDataOffset = kNestedSiteOffset + kPointerSize;
8720 static const int kPretenureCreateCountOffset = 8664 static const int kPretenureCreateCountOffset =
8721 kPretenureDataOffset + kPointerSize; 8665 kPretenureDataOffset + kPointerSize;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
8756 !AllocationSite::cast(allocation_site())->IsZombie(); 8700 !AllocationSite::cast(allocation_site())->IsZombie();
8757 } 8701 }
8758 AllocationSite* GetAllocationSite() { 8702 AllocationSite* GetAllocationSite() {
8759 ASSERT(IsValid()); 8703 ASSERT(IsValid());
8760 return AllocationSite::cast(allocation_site()); 8704 return AllocationSite::cast(allocation_site());
8761 } 8705 }
8762 8706
8763 DECLARE_PRINTER(AllocationMemento) 8707 DECLARE_PRINTER(AllocationMemento)
8764 DECLARE_VERIFIER(AllocationMemento) 8708 DECLARE_VERIFIER(AllocationMemento)
8765 8709
8766 static inline AllocationMemento* cast(Object* obj); 8710 DECLARE_CAST(AllocationMemento)
8767 8711
8768 private: 8712 private:
8769 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento); 8713 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento);
8770 }; 8714 };
8771 8715
8772 8716
8773 // Representation of a slow alias as part of a sloppy arguments objects. 8717 // Representation of a slow alias as part of a sloppy arguments objects.
8774 // For fast aliases (if HasSloppyArgumentsElements()): 8718 // For fast aliases (if HasSloppyArgumentsElements()):
8775 // - the parameter map contains an index into the context 8719 // - the parameter map contains an index into the context
8776 // - all attributes of the element have default values 8720 // - all attributes of the element have default values
8777 // For slow aliases (if HasDictionaryArgumentsElements()): 8721 // For slow aliases (if HasDictionaryArgumentsElements()):
8778 // - the parameter map contains no fast alias mapping (i.e. the hole) 8722 // - the parameter map contains no fast alias mapping (i.e. the hole)
8779 // - this struct (in the slow backing store) contains an index into the context 8723 // - this struct (in the slow backing store) contains an index into the context
8780 // - all attributes are available as part if the property details 8724 // - all attributes are available as part if the property details
8781 class AliasedArgumentsEntry: public Struct { 8725 class AliasedArgumentsEntry: public Struct {
8782 public: 8726 public:
8783 inline int aliased_context_slot() const; 8727 inline int aliased_context_slot() const;
8784 inline void set_aliased_context_slot(int count); 8728 inline void set_aliased_context_slot(int count);
8785 8729
8786 static inline AliasedArgumentsEntry* cast(Object* obj); 8730 DECLARE_CAST(AliasedArgumentsEntry)
8787 8731
8788 // Dispatched behavior. 8732 // Dispatched behavior.
8789 DECLARE_PRINTER(AliasedArgumentsEntry) 8733 DECLARE_PRINTER(AliasedArgumentsEntry)
8790 DECLARE_VERIFIER(AliasedArgumentsEntry) 8734 DECLARE_VERIFIER(AliasedArgumentsEntry)
8791 8735
8792 static const int kAliasedContextSlot = HeapObject::kHeaderSize; 8736 static const int kAliasedContextSlot = HeapObject::kHeaderSize;
8793 static const int kSize = kAliasedContextSlot + kPointerSize; 8737 static const int kSize = kAliasedContextSlot + kPointerSize;
8794 8738
8795 private: 8739 private:
8796 DISALLOW_IMPLICIT_CONSTRUCTORS(AliasedArgumentsEntry); 8740 DISALLOW_IMPLICIT_CONSTRUCTORS(AliasedArgumentsEntry);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
8918 // Returns a hash value used for the property table 8862 // Returns a hash value used for the property table
8919 inline uint32_t Hash(); 8863 inline uint32_t Hash();
8920 8864
8921 // Equality operations. 8865 // Equality operations.
8922 inline bool Equals(Name* other); 8866 inline bool Equals(Name* other);
8923 inline static bool Equals(Handle<Name> one, Handle<Name> two); 8867 inline static bool Equals(Handle<Name> one, Handle<Name> two);
8924 8868
8925 // Conversion. 8869 // Conversion.
8926 inline bool AsArrayIndex(uint32_t* index); 8870 inline bool AsArrayIndex(uint32_t* index);
8927 8871
8928 // Casting. 8872 DECLARE_CAST(Name)
8929 static inline Name* cast(Object* obj);
8930 8873
8931 DECLARE_PRINTER(Name) 8874 DECLARE_PRINTER(Name)
8932 8875
8933 // Layout description. 8876 // Layout description.
8934 static const int kHashFieldOffset = HeapObject::kHeaderSize; 8877 static const int kHashFieldOffset = HeapObject::kHeaderSize;
8935 static const int kSize = kHashFieldOffset + kPointerSize; 8878 static const int kSize = kHashFieldOffset + kPointerSize;
8936 8879
8937 // Mask constant for checking if a name has a computed hash code 8880 // Mask constant for checking if a name has a computed hash code
8938 // and if it is a string that is an array index. The least significant bit 8881 // and if it is a string that is an array index. The least significant bit
8939 // indicates whether a hash code has been computed. If the hash code has 8882 // indicates whether a hash code has been computed. If the hash code has
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
8993 class Symbol: public Name { 8936 class Symbol: public Name {
8994 public: 8937 public:
8995 // [name]: the print name of a symbol, or undefined if none. 8938 // [name]: the print name of a symbol, or undefined if none.
8996 DECL_ACCESSORS(name, Object) 8939 DECL_ACCESSORS(name, Object)
8997 8940
8998 DECL_ACCESSORS(flags, Smi) 8941 DECL_ACCESSORS(flags, Smi)
8999 8942
9000 // [is_private]: whether this is a private symbol. 8943 // [is_private]: whether this is a private symbol.
9001 DECL_BOOLEAN_ACCESSORS(is_private) 8944 DECL_BOOLEAN_ACCESSORS(is_private)
9002 8945
9003 // Casting. 8946 DECLARE_CAST(Symbol)
9004 static inline Symbol* cast(Object* obj);
9005 8947
9006 // Dispatched behavior. 8948 // Dispatched behavior.
9007 DECLARE_PRINTER(Symbol) 8949 DECLARE_PRINTER(Symbol)
9008 DECLARE_VERIFIER(Symbol) 8950 DECLARE_VERIFIER(Symbol)
9009 8951
9010 // Layout description. 8952 // Layout description.
9011 static const int kNameOffset = Name::kSize; 8953 static const int kNameOffset = Name::kSize;
9012 static const int kFlagsOffset = kNameOffset + kPointerSize; 8954 static const int kFlagsOffset = kNameOffset + kPointerSize;
9013 static const int kSize = kFlagsOffset + kPointerSize; 8955 static const int kSize = kFlagsOffset + kPointerSize;
9014 8956
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
9215 9157
9216 bool ComputeArrayIndex(uint32_t* index); 9158 bool ComputeArrayIndex(uint32_t* index);
9217 9159
9218 // Externalization. 9160 // Externalization.
9219 bool MakeExternal(v8::String::ExternalStringResource* resource); 9161 bool MakeExternal(v8::String::ExternalStringResource* resource);
9220 bool MakeExternal(v8::String::ExternalAsciiStringResource* resource); 9162 bool MakeExternal(v8::String::ExternalAsciiStringResource* resource);
9221 9163
9222 // Conversion. 9164 // Conversion.
9223 inline bool AsArrayIndex(uint32_t* index); 9165 inline bool AsArrayIndex(uint32_t* index);
9224 9166
9225 // Casting. 9167 DECLARE_CAST(String)
9226 static inline String* cast(Object* obj);
9227 9168
9228 void PrintOn(FILE* out); 9169 void PrintOn(FILE* out);
9229 9170
9230 // For use during stack traces. Performs rudimentary sanity check. 9171 // For use during stack traces. Performs rudimentary sanity check.
9231 bool LooksValid(); 9172 bool LooksValid();
9232 9173
9233 // Dispatched behavior. 9174 // Dispatched behavior.
9234 void StringShortPrint(StringStream* accumulator); 9175 void StringShortPrint(StringStream* accumulator);
9235 #ifdef OBJECT_PRINT 9176 #ifdef OBJECT_PRINT
9236 char* ToAsciiArray(); 9177 char* ToAsciiArray();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
9352 // Compute and set the hash code. 9293 // Compute and set the hash code.
9353 uint32_t ComputeAndSetHash(); 9294 uint32_t ComputeAndSetHash();
9354 9295
9355 DISALLOW_IMPLICIT_CONSTRUCTORS(String); 9296 DISALLOW_IMPLICIT_CONSTRUCTORS(String);
9356 }; 9297 };
9357 9298
9358 9299
9359 // The SeqString abstract class captures sequential string values. 9300 // The SeqString abstract class captures sequential string values.
9360 class SeqString: public String { 9301 class SeqString: public String {
9361 public: 9302 public:
9362 // Casting. 9303 DECLARE_CAST(SeqString)
9363 static inline SeqString* cast(Object* obj);
9364 9304
9365 // Layout description. 9305 // Layout description.
9366 static const int kHeaderSize = String::kSize; 9306 static const int kHeaderSize = String::kSize;
9367 9307
9368 // Truncate the string in-place if possible and return the result. 9308 // Truncate the string in-place if possible and return the result.
9369 // In case of new_length == 0, the empty string is returned without 9309 // In case of new_length == 0, the empty string is returned without
9370 // truncating the original string. 9310 // truncating the original string.
9371 MUST_USE_RESULT static Handle<String> Truncate(Handle<SeqString> string, 9311 MUST_USE_RESULT static Handle<String> Truncate(Handle<SeqString> string,
9372 int new_length); 9312 int new_length);
9373 private: 9313 private:
9374 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); 9314 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
9375 }; 9315 };
9376 9316
9377 9317
9378 // The AsciiString class captures sequential ASCII string objects. 9318 // The AsciiString class captures sequential ASCII string objects.
9379 // Each character in the AsciiString is an ASCII character. 9319 // Each character in the AsciiString is an ASCII character.
9380 class SeqOneByteString: public SeqString { 9320 class SeqOneByteString: public SeqString {
9381 public: 9321 public:
9382 static const bool kHasAsciiEncoding = true; 9322 static const bool kHasAsciiEncoding = true;
9383 9323
9384 // Dispatched behavior. 9324 // Dispatched behavior.
9385 inline uint16_t SeqOneByteStringGet(int index); 9325 inline uint16_t SeqOneByteStringGet(int index);
9386 inline void SeqOneByteStringSet(int index, uint16_t value); 9326 inline void SeqOneByteStringSet(int index, uint16_t value);
9387 9327
9388 // Get the address of the characters in this string. 9328 // Get the address of the characters in this string.
9389 inline Address GetCharsAddress(); 9329 inline Address GetCharsAddress();
9390 9330
9391 inline uint8_t* GetChars(); 9331 inline uint8_t* GetChars();
9392 9332
9393 // Casting 9333 DECLARE_CAST(SeqOneByteString)
9394 static inline SeqOneByteString* cast(Object* obj);
9395 9334
9396 // Garbage collection support. This method is called by the 9335 // Garbage collection support. This method is called by the
9397 // garbage collector to compute the actual size of an AsciiString 9336 // garbage collector to compute the actual size of an AsciiString
9398 // instance. 9337 // instance.
9399 inline int SeqOneByteStringSize(InstanceType instance_type); 9338 inline int SeqOneByteStringSize(InstanceType instance_type);
9400 9339
9401 // Computes the size for an AsciiString instance of a given length. 9340 // Computes the size for an AsciiString instance of a given length.
9402 static int SizeFor(int length) { 9341 static int SizeFor(int length) {
9403 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); 9342 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize);
9404 } 9343 }
(...skipping 18 matching lines...) Expand all
9423 inline void SeqTwoByteStringSet(int index, uint16_t value); 9362 inline void SeqTwoByteStringSet(int index, uint16_t value);
9424 9363
9425 // Get the address of the characters in this string. 9364 // Get the address of the characters in this string.
9426 inline Address GetCharsAddress(); 9365 inline Address GetCharsAddress();
9427 9366
9428 inline uc16* GetChars(); 9367 inline uc16* GetChars();
9429 9368
9430 // For regexp code. 9369 // For regexp code.
9431 const uint16_t* SeqTwoByteStringGetData(unsigned start); 9370 const uint16_t* SeqTwoByteStringGetData(unsigned start);
9432 9371
9433 // Casting 9372 DECLARE_CAST(SeqTwoByteString)
9434 static inline SeqTwoByteString* cast(Object* obj);
9435 9373
9436 // Garbage collection support. This method is called by the 9374 // Garbage collection support. This method is called by the
9437 // garbage collector to compute the actual size of a TwoByteString 9375 // garbage collector to compute the actual size of a TwoByteString
9438 // instance. 9376 // instance.
9439 inline int SeqTwoByteStringSize(InstanceType instance_type); 9377 inline int SeqTwoByteStringSize(InstanceType instance_type);
9440 9378
9441 // Computes the size for a TwoByteString instance of a given length. 9379 // Computes the size for a TwoByteString instance of a given length.
9442 static int SizeFor(int length) { 9380 static int SizeFor(int length) {
9443 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); 9381 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize);
9444 } 9382 }
(...skipping 30 matching lines...) Expand all
9475 inline String* second(); 9413 inline String* second();
9476 // Doesn't check that the result is a string, even in debug mode. This is 9414 // Doesn't check that the result is a string, even in debug mode. This is
9477 // useful during GC where the mark bits confuse the checks. 9415 // useful during GC where the mark bits confuse the checks.
9478 inline Object* unchecked_second(); 9416 inline Object* unchecked_second();
9479 inline void set_second(String* second, 9417 inline void set_second(String* second,
9480 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 9418 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
9481 9419
9482 // Dispatched behavior. 9420 // Dispatched behavior.
9483 uint16_t ConsStringGet(int index); 9421 uint16_t ConsStringGet(int index);
9484 9422
9485 // Casting. 9423 DECLARE_CAST(ConsString)
9486 static inline ConsString* cast(Object* obj);
9487 9424
9488 // Layout description. 9425 // Layout description.
9489 static const int kFirstOffset = POINTER_SIZE_ALIGN(String::kSize); 9426 static const int kFirstOffset = POINTER_SIZE_ALIGN(String::kSize);
9490 static const int kSecondOffset = kFirstOffset + kPointerSize; 9427 static const int kSecondOffset = kFirstOffset + kPointerSize;
9491 static const int kSize = kSecondOffset + kPointerSize; 9428 static const int kSize = kSecondOffset + kPointerSize;
9492 9429
9493 // Minimum length for a cons string. 9430 // Minimum length for a cons string.
9494 static const int kMinLength = 13; 9431 static const int kMinLength = 13;
9495 9432
9496 typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize> 9433 typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize>
(...skipping 22 matching lines...) Expand all
9519 public: 9456 public:
9520 inline String* parent(); 9457 inline String* parent();
9521 inline void set_parent(String* parent, 9458 inline void set_parent(String* parent,
9522 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 9459 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
9523 inline int offset() const; 9460 inline int offset() const;
9524 inline void set_offset(int offset); 9461 inline void set_offset(int offset);
9525 9462
9526 // Dispatched behavior. 9463 // Dispatched behavior.
9527 uint16_t SlicedStringGet(int index); 9464 uint16_t SlicedStringGet(int index);
9528 9465
9529 // Casting. 9466 DECLARE_CAST(SlicedString)
9530 static inline SlicedString* cast(Object* obj);
9531 9467
9532 // Layout description. 9468 // Layout description.
9533 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); 9469 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize);
9534 static const int kOffsetOffset = kParentOffset + kPointerSize; 9470 static const int kOffsetOffset = kParentOffset + kPointerSize;
9535 static const int kSize = kOffsetOffset + kPointerSize; 9471 static const int kSize = kOffsetOffset + kPointerSize;
9536 9472
9537 // Minimum length for a sliced string. 9473 // Minimum length for a sliced string.
9538 static const int kMinLength = 13; 9474 static const int kMinLength = 13;
9539 9475
9540 typedef FixedBodyDescriptor<kParentOffset, 9476 typedef FixedBodyDescriptor<kParentOffset,
(...skipping 11 matching lines...) Expand all
9552 // a string resource that lies outside the V8 heap. ExternalStrings 9488 // a string resource that lies outside the V8 heap. ExternalStrings
9553 // consist of the length field common to all strings, a pointer to the 9489 // consist of the length field common to all strings, a pointer to the
9554 // external resource. It is important to ensure (externally) that the 9490 // external resource. It is important to ensure (externally) that the
9555 // resource is not deallocated while the ExternalString is live in the 9491 // resource is not deallocated while the ExternalString is live in the
9556 // V8 heap. 9492 // V8 heap.
9557 // 9493 //
9558 // The API expects that all ExternalStrings are created through the 9494 // The API expects that all ExternalStrings are created through the
9559 // API. Therefore, ExternalStrings should not be used internally. 9495 // API. Therefore, ExternalStrings should not be used internally.
9560 class ExternalString: public String { 9496 class ExternalString: public String {
9561 public: 9497 public:
9562 // Casting 9498 DECLARE_CAST(ExternalString)
9563 static inline ExternalString* cast(Object* obj);
9564 9499
9565 // Layout description. 9500 // Layout description.
9566 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize); 9501 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize);
9567 static const int kShortSize = kResourceOffset + kPointerSize; 9502 static const int kShortSize = kResourceOffset + kPointerSize;
9568 static const int kResourceDataOffset = kResourceOffset + kPointerSize; 9503 static const int kResourceDataOffset = kResourceOffset + kPointerSize;
9569 static const int kSize = kResourceDataOffset + kPointerSize; 9504 static const int kSize = kResourceDataOffset + kPointerSize;
9570 9505
9571 static const int kMaxShortLength = 9506 static const int kMaxShortLength =
9572 (kShortSize - SeqString::kHeaderSize) / kCharSize; 9507 (kShortSize - SeqString::kHeaderSize) / kCharSize;
9573 9508
(...skipping 23 matching lines...) Expand all
9597 // The cached pointer is always valid, as the external character array does = 9532 // The cached pointer is always valid, as the external character array does =
9598 // not move during lifetime. Deserialization is the only exception, after 9533 // not move during lifetime. Deserialization is the only exception, after
9599 // which the pointer cache has to be refreshed. 9534 // which the pointer cache has to be refreshed.
9600 inline void update_data_cache(); 9535 inline void update_data_cache();
9601 9536
9602 inline const uint8_t* GetChars(); 9537 inline const uint8_t* GetChars();
9603 9538
9604 // Dispatched behavior. 9539 // Dispatched behavior.
9605 inline uint16_t ExternalAsciiStringGet(int index); 9540 inline uint16_t ExternalAsciiStringGet(int index);
9606 9541
9607 // Casting. 9542 DECLARE_CAST(ExternalAsciiString)
9608 static inline ExternalAsciiString* cast(Object* obj);
9609 9543
9610 // Garbage collection support. 9544 // Garbage collection support.
9611 inline void ExternalAsciiStringIterateBody(ObjectVisitor* v); 9545 inline void ExternalAsciiStringIterateBody(ObjectVisitor* v);
9612 9546
9613 template<typename StaticVisitor> 9547 template<typename StaticVisitor>
9614 inline void ExternalAsciiStringIterateBody(); 9548 inline void ExternalAsciiStringIterateBody();
9615 9549
9616 private: 9550 private:
9617 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); 9551 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString);
9618 }; 9552 };
(...skipping 18 matching lines...) Expand all
9637 inline void update_data_cache(); 9571 inline void update_data_cache();
9638 9572
9639 inline const uint16_t* GetChars(); 9573 inline const uint16_t* GetChars();
9640 9574
9641 // Dispatched behavior. 9575 // Dispatched behavior.
9642 inline uint16_t ExternalTwoByteStringGet(int index); 9576 inline uint16_t ExternalTwoByteStringGet(int index);
9643 9577
9644 // For regexp code. 9578 // For regexp code.
9645 inline const uint16_t* ExternalTwoByteStringGetData(unsigned start); 9579 inline const uint16_t* ExternalTwoByteStringGetData(unsigned start);
9646 9580
9647 // Casting. 9581 DECLARE_CAST(ExternalTwoByteString)
9648 static inline ExternalTwoByteString* cast(Object* obj);
9649 9582
9650 // Garbage collection support. 9583 // Garbage collection support.
9651 inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v); 9584 inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v);
9652 9585
9653 template<typename StaticVisitor> 9586 template<typename StaticVisitor>
9654 inline void ExternalTwoByteStringIterateBody(); 9587 inline void ExternalTwoByteStringIterateBody();
9655 9588
9656 private: 9589 private:
9657 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); 9590 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString);
9658 }; 9591 };
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
9803 public: 9736 public:
9804 // [to_string]: Cached to_string computed at startup. 9737 // [to_string]: Cached to_string computed at startup.
9805 DECL_ACCESSORS(to_string, String) 9738 DECL_ACCESSORS(to_string, String)
9806 9739
9807 // [to_number]: Cached to_number computed at startup. 9740 // [to_number]: Cached to_number computed at startup.
9808 DECL_ACCESSORS(to_number, Object) 9741 DECL_ACCESSORS(to_number, Object)
9809 9742
9810 inline byte kind(); 9743 inline byte kind();
9811 inline void set_kind(byte kind); 9744 inline void set_kind(byte kind);
9812 9745
9813 // Casting. 9746 DECLARE_CAST(Oddball)
9814 static inline Oddball* cast(Object* obj);
9815 9747
9816 // Dispatched behavior. 9748 // Dispatched behavior.
9817 DECLARE_VERIFIER(Oddball) 9749 DECLARE_VERIFIER(Oddball)
9818 9750
9819 // Initialize the fields. 9751 // Initialize the fields.
9820 static void Initialize(Isolate* isolate, 9752 static void Initialize(Isolate* isolate,
9821 Handle<Oddball> oddball, 9753 Handle<Oddball> oddball,
9822 const char* to_string, 9754 const char* to_string,
9823 Handle<Object> to_number, 9755 Handle<Object> to_number,
9824 byte kind); 9756 byte kind);
(...skipping 26 matching lines...) Expand all
9851 private: 9783 private:
9852 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); 9784 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball);
9853 }; 9785 };
9854 9786
9855 9787
9856 class Cell: public HeapObject { 9788 class Cell: public HeapObject {
9857 public: 9789 public:
9858 // [value]: value of the global property. 9790 // [value]: value of the global property.
9859 DECL_ACCESSORS(value, Object) 9791 DECL_ACCESSORS(value, Object)
9860 9792
9861 // Casting. 9793 DECLARE_CAST(Cell)
9862 static inline Cell* cast(Object* obj);
9863 9794
9864 static inline Cell* FromValueAddress(Address value) { 9795 static inline Cell* FromValueAddress(Address value) {
9865 Object* result = FromAddress(value - kValueOffset); 9796 Object* result = FromAddress(value - kValueOffset);
9866 ASSERT(result->IsCell() || result->IsPropertyCell()); 9797 ASSERT(result->IsCell() || result->IsPropertyCell());
9867 return static_cast<Cell*>(result); 9798 return static_cast<Cell*>(result);
9868 } 9799 }
9869 9800
9870 inline Address ValueAddress() { 9801 inline Address ValueAddress() {
9871 return address() + kValueOffset; 9802 return address() + kValueOffset;
9872 } 9803 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
9906 Handle<Object> value); 9837 Handle<Object> value);
9907 9838
9908 // Computes the new type of the cell's contents for the given value, but 9839 // Computes the new type of the cell's contents for the given value, but
9909 // without actually modifying the 'type' field. 9840 // without actually modifying the 'type' field.
9910 static Handle<HeapType> UpdatedType(Handle<PropertyCell> cell, 9841 static Handle<HeapType> UpdatedType(Handle<PropertyCell> cell,
9911 Handle<Object> value); 9842 Handle<Object> value);
9912 9843
9913 static void AddDependentCompilationInfo(Handle<PropertyCell> cell, 9844 static void AddDependentCompilationInfo(Handle<PropertyCell> cell,
9914 CompilationInfo* info); 9845 CompilationInfo* info);
9915 9846
9916 // Casting. 9847 DECLARE_CAST(PropertyCell)
9917 static inline PropertyCell* cast(Object* obj);
9918 9848
9919 inline Address TypeAddress() { 9849 inline Address TypeAddress() {
9920 return address() + kTypeOffset; 9850 return address() + kTypeOffset;
9921 } 9851 }
9922 9852
9923 // Dispatched behavior. 9853 // Dispatched behavior.
9924 DECLARE_PRINTER(PropertyCell) 9854 DECLARE_PRINTER(PropertyCell)
9925 DECLARE_VERIFIER(PropertyCell) 9855 DECLARE_VERIFIER(PropertyCell)
9926 9856
9927 // Layout description. 9857 // Layout description.
(...skipping 16 matching lines...) Expand all
9944 9874
9945 // The JSProxy describes EcmaScript Harmony proxies 9875 // The JSProxy describes EcmaScript Harmony proxies
9946 class JSProxy: public JSReceiver { 9876 class JSProxy: public JSReceiver {
9947 public: 9877 public:
9948 // [handler]: The handler property. 9878 // [handler]: The handler property.
9949 DECL_ACCESSORS(handler, Object) 9879 DECL_ACCESSORS(handler, Object)
9950 9880
9951 // [hash]: The hash code property (undefined if not initialized yet). 9881 // [hash]: The hash code property (undefined if not initialized yet).
9952 DECL_ACCESSORS(hash, Object) 9882 DECL_ACCESSORS(hash, Object)
9953 9883
9954 // Casting. 9884 DECLARE_CAST(JSProxy)
9955 static inline JSProxy* cast(Object* obj);
9956 9885
9957 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler( 9886 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler(
9958 Handle<JSProxy> proxy, 9887 Handle<JSProxy> proxy,
9959 Handle<Object> receiver, 9888 Handle<Object> receiver,
9960 Handle<Name> name); 9889 Handle<Name> name);
9961 MUST_USE_RESULT static inline MaybeHandle<Object> GetElementWithHandler( 9890 MUST_USE_RESULT static inline MaybeHandle<Object> GetElementWithHandler(
9962 Handle<JSProxy> proxy, 9891 Handle<JSProxy> proxy,
9963 Handle<Object> receiver, 9892 Handle<Object> receiver,
9964 uint32_t index); 9893 uint32_t index);
9965 9894
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
10060 9989
10061 9990
10062 class JSFunctionProxy: public JSProxy { 9991 class JSFunctionProxy: public JSProxy {
10063 public: 9992 public:
10064 // [call_trap]: The call trap. 9993 // [call_trap]: The call trap.
10065 DECL_ACCESSORS(call_trap, Object) 9994 DECL_ACCESSORS(call_trap, Object)
10066 9995
10067 // [construct_trap]: The construct trap. 9996 // [construct_trap]: The construct trap.
10068 DECL_ACCESSORS(construct_trap, Object) 9997 DECL_ACCESSORS(construct_trap, Object)
10069 9998
10070 // Casting. 9999 DECLARE_CAST(JSFunctionProxy)
10071 static inline JSFunctionProxy* cast(Object* obj);
10072 10000
10073 // Dispatched behavior. 10001 // Dispatched behavior.
10074 DECLARE_PRINTER(JSFunctionProxy) 10002 DECLARE_PRINTER(JSFunctionProxy)
10075 DECLARE_VERIFIER(JSFunctionProxy) 10003 DECLARE_VERIFIER(JSFunctionProxy)
10076 10004
10077 // Layout description. 10005 // Layout description.
10078 static const int kCallTrapOffset = JSProxy::kPaddingOffset; 10006 static const int kCallTrapOffset = JSProxy::kPaddingOffset;
10079 static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize; 10007 static const int kConstructTrapOffset = kCallTrapOffset + kPointerSize;
10080 static const int kPaddingOffset = kConstructTrapOffset + kPointerSize; 10008 static const int kPaddingOffset = kConstructTrapOffset + kPointerSize;
10081 static const int kSize = JSFunction::kSize; 10009 static const int kSize = JSFunction::kSize;
10082 static const int kPaddingSize = kSize - kPaddingOffset; 10010 static const int kPaddingSize = kSize - kPaddingOffset;
10083 10011
10084 STATIC_ASSERT(kPaddingSize >= 0); 10012 STATIC_ASSERT(kPaddingSize >= 0);
10085 10013
10086 typedef FixedBodyDescriptor<kHandlerOffset, 10014 typedef FixedBodyDescriptor<kHandlerOffset,
10087 kConstructTrapOffset + kPointerSize, 10015 kConstructTrapOffset + kPointerSize,
10088 kSize> BodyDescriptor; 10016 kSize> BodyDescriptor;
10089 10017
10090 private: 10018 private:
10091 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); 10019 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy);
10092 }; 10020 };
10093 10021
10094 10022
10095 // The JSSet describes EcmaScript Harmony sets 10023 // The JSSet describes EcmaScript Harmony sets
10096 class JSSet: public JSObject { 10024 class JSSet: public JSObject {
10097 public: 10025 public:
10098 // [set]: the backing hash set containing keys. 10026 // [set]: the backing hash set containing keys.
10099 DECL_ACCESSORS(table, Object) 10027 DECL_ACCESSORS(table, Object)
10100 10028
10101 // Casting. 10029 DECLARE_CAST(JSSet)
10102 static inline JSSet* cast(Object* obj);
10103 10030
10104 // Dispatched behavior. 10031 // Dispatched behavior.
10105 DECLARE_PRINTER(JSSet) 10032 DECLARE_PRINTER(JSSet)
10106 DECLARE_VERIFIER(JSSet) 10033 DECLARE_VERIFIER(JSSet)
10107 10034
10108 static const int kTableOffset = JSObject::kHeaderSize; 10035 static const int kTableOffset = JSObject::kHeaderSize;
10109 static const int kSize = kTableOffset + kPointerSize; 10036 static const int kSize = kTableOffset + kPointerSize;
10110 10037
10111 private: 10038 private:
10112 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSet); 10039 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSet);
10113 }; 10040 };
10114 10041
10115 10042
10116 // The JSMap describes EcmaScript Harmony maps 10043 // The JSMap describes EcmaScript Harmony maps
10117 class JSMap: public JSObject { 10044 class JSMap: public JSObject {
10118 public: 10045 public:
10119 // [table]: the backing hash table mapping keys to values. 10046 // [table]: the backing hash table mapping keys to values.
10120 DECL_ACCESSORS(table, Object) 10047 DECL_ACCESSORS(table, Object)
10121 10048
10122 // Casting. 10049 DECLARE_CAST(JSMap)
10123 static inline JSMap* cast(Object* obj);
10124 10050
10125 // Dispatched behavior. 10051 // Dispatched behavior.
10126 DECLARE_PRINTER(JSMap) 10052 DECLARE_PRINTER(JSMap)
10127 DECLARE_VERIFIER(JSMap) 10053 DECLARE_VERIFIER(JSMap)
10128 10054
10129 static const int kTableOffset = JSObject::kHeaderSize; 10055 static const int kTableOffset = JSObject::kHeaderSize;
10130 static const int kSize = kTableOffset + kPointerSize; 10056 static const int kSize = kTableOffset + kPointerSize;
10131 10057
10132 private: 10058 private:
10133 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 10059 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
10187 }; 10113 };
10188 10114
10189 10115
10190 class JSSetIterator: public OrderedHashTableIterator<JSSetIterator, 10116 class JSSetIterator: public OrderedHashTableIterator<JSSetIterator,
10191 OrderedHashSet> { 10117 OrderedHashSet> {
10192 public: 10118 public:
10193 // Dispatched behavior. 10119 // Dispatched behavior.
10194 DECLARE_PRINTER(JSSetIterator) 10120 DECLARE_PRINTER(JSSetIterator)
10195 DECLARE_VERIFIER(JSSetIterator) 10121 DECLARE_VERIFIER(JSSetIterator)
10196 10122
10197 // Casting. 10123 DECLARE_CAST(JSSetIterator)
10198 static inline JSSetIterator* cast(Object* obj);
10199 10124
10200 static Handle<Object> ValueForKind( 10125 static Handle<Object> ValueForKind(
10201 Handle<JSSetIterator> iterator, 10126 Handle<JSSetIterator> iterator,
10202 int entry_index); 10127 int entry_index);
10203 10128
10204 private: 10129 private:
10205 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSetIterator); 10130 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSetIterator);
10206 }; 10131 };
10207 10132
10208 10133
10209 class JSMapIterator: public OrderedHashTableIterator<JSMapIterator, 10134 class JSMapIterator: public OrderedHashTableIterator<JSMapIterator,
10210 OrderedHashMap> { 10135 OrderedHashMap> {
10211 public: 10136 public:
10212 // Dispatched behavior. 10137 // Dispatched behavior.
10213 DECLARE_PRINTER(JSMapIterator) 10138 DECLARE_PRINTER(JSMapIterator)
10214 DECLARE_VERIFIER(JSMapIterator) 10139 DECLARE_VERIFIER(JSMapIterator)
10215 10140
10216 // Casting. 10141 DECLARE_CAST(JSMapIterator)
10217 static inline JSMapIterator* cast(Object* obj);
10218 10142
10219 static Handle<Object> ValueForKind( 10143 static Handle<Object> ValueForKind(
10220 Handle<JSMapIterator> iterator, 10144 Handle<JSMapIterator> iterator,
10221 int entry_index); 10145 int entry_index);
10222 10146
10223 private: 10147 private:
10224 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMapIterator); 10148 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMapIterator);
10225 }; 10149 };
10226 10150
10227 10151
(...skipping 11 matching lines...) Expand all
10239 static const int kSize = kNextOffset + kPointerSize; 10163 static const int kSize = kNextOffset + kPointerSize;
10240 10164
10241 private: 10165 private:
10242 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection); 10166 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection);
10243 }; 10167 };
10244 10168
10245 10169
10246 // The JSWeakMap describes EcmaScript Harmony weak maps 10170 // The JSWeakMap describes EcmaScript Harmony weak maps
10247 class JSWeakMap: public JSWeakCollection { 10171 class JSWeakMap: public JSWeakCollection {
10248 public: 10172 public:
10249 // Casting. 10173 DECLARE_CAST(JSWeakMap)
10250 static inline JSWeakMap* cast(Object* obj);
10251 10174
10252 // Dispatched behavior. 10175 // Dispatched behavior.
10253 DECLARE_PRINTER(JSWeakMap) 10176 DECLARE_PRINTER(JSWeakMap)
10254 DECLARE_VERIFIER(JSWeakMap) 10177 DECLARE_VERIFIER(JSWeakMap)
10255 10178
10256 private: 10179 private:
10257 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap); 10180 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
10258 }; 10181 };
10259 10182
10260 10183
10261 // The JSWeakSet describes EcmaScript Harmony weak sets 10184 // The JSWeakSet describes EcmaScript Harmony weak sets
10262 class JSWeakSet: public JSWeakCollection { 10185 class JSWeakSet: public JSWeakCollection {
10263 public: 10186 public:
10264 // Casting. 10187 DECLARE_CAST(JSWeakSet)
10265 static inline JSWeakSet* cast(Object* obj);
10266 10188
10267 // Dispatched behavior. 10189 // Dispatched behavior.
10268 DECLARE_PRINTER(JSWeakSet) 10190 DECLARE_PRINTER(JSWeakSet)
10269 DECLARE_VERIFIER(JSWeakSet) 10191 DECLARE_VERIFIER(JSWeakSet)
10270 10192
10271 private: 10193 private:
10272 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet); 10194 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet);
10273 }; 10195 };
10274 10196
10275 10197
(...skipping 13 matching lines...) Expand all
10289 10211
10290 inline bool should_be_freed(); 10212 inline bool should_be_freed();
10291 inline void set_should_be_freed(bool value); 10213 inline void set_should_be_freed(bool value);
10292 10214
10293 // [weak_next]: linked list of array buffers. 10215 // [weak_next]: linked list of array buffers.
10294 DECL_ACCESSORS(weak_next, Object) 10216 DECL_ACCESSORS(weak_next, Object)
10295 10217
10296 // [weak_first_array]: weak linked list of views. 10218 // [weak_first_array]: weak linked list of views.
10297 DECL_ACCESSORS(weak_first_view, Object) 10219 DECL_ACCESSORS(weak_first_view, Object)
10298 10220
10299 // Casting. 10221 DECLARE_CAST(JSArrayBuffer)
10300 static inline JSArrayBuffer* cast(Object* obj);
10301 10222
10302 // Neutering. Only neuters the buffer, not associated typed arrays. 10223 // Neutering. Only neuters the buffer, not associated typed arrays.
10303 void Neuter(); 10224 void Neuter();
10304 10225
10305 // Dispatched behavior. 10226 // Dispatched behavior.
10306 DECLARE_PRINTER(JSArrayBuffer) 10227 DECLARE_PRINTER(JSArrayBuffer)
10307 DECLARE_VERIFIER(JSArrayBuffer) 10228 DECLARE_VERIFIER(JSArrayBuffer)
10308 10229
10309 static const int kBackingStoreOffset = JSObject::kHeaderSize; 10230 static const int kBackingStoreOffset = JSObject::kHeaderSize;
10310 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; 10231 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize;
(...skipping 21 matching lines...) Expand all
10332 10253
10333 // [byte_length]: offset of typed array in bytes. 10254 // [byte_length]: offset of typed array in bytes.
10334 DECL_ACCESSORS(byte_offset, Object) 10255 DECL_ACCESSORS(byte_offset, Object)
10335 10256
10336 // [byte_length]: length of typed array in bytes. 10257 // [byte_length]: length of typed array in bytes.
10337 DECL_ACCESSORS(byte_length, Object) 10258 DECL_ACCESSORS(byte_length, Object)
10338 10259
10339 // [weak_next]: linked list of typed arrays over the same array buffer. 10260 // [weak_next]: linked list of typed arrays over the same array buffer.
10340 DECL_ACCESSORS(weak_next, Object) 10261 DECL_ACCESSORS(weak_next, Object)
10341 10262
10342 // Casting. 10263 DECLARE_CAST(JSArrayBufferView)
10343 static inline JSArrayBufferView* cast(Object* obj);
10344 10264
10345 DECLARE_VERIFIER(JSArrayBufferView) 10265 DECLARE_VERIFIER(JSArrayBufferView)
10346 10266
10347 static const int kBufferOffset = JSObject::kHeaderSize; 10267 static const int kBufferOffset = JSObject::kHeaderSize;
10348 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; 10268 static const int kByteOffsetOffset = kBufferOffset + kPointerSize;
10349 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; 10269 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize;
10350 static const int kWeakNextOffset = kByteLengthOffset + kPointerSize; 10270 static const int kWeakNextOffset = kByteLengthOffset + kPointerSize;
10351 static const int kViewSize = kWeakNextOffset + kPointerSize; 10271 static const int kViewSize = kWeakNextOffset + kPointerSize;
10352 10272
10353 protected: 10273 protected:
10354 void NeuterView(); 10274 void NeuterView();
10355 10275
10356 private: 10276 private:
10357 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); 10277 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView);
10358 }; 10278 };
10359 10279
10360 10280
10361 class JSTypedArray: public JSArrayBufferView { 10281 class JSTypedArray: public JSArrayBufferView {
10362 public: 10282 public:
10363 // [length]: length of typed array in elements. 10283 // [length]: length of typed array in elements.
10364 DECL_ACCESSORS(length, Object) 10284 DECL_ACCESSORS(length, Object)
10365 10285
10366 // Neutering. Only neuters this typed array. 10286 // Neutering. Only neuters this typed array.
10367 void Neuter(); 10287 void Neuter();
10368 10288
10369 // Casting. 10289 DECLARE_CAST(JSTypedArray)
10370 static inline JSTypedArray* cast(Object* obj);
10371 10290
10372 ExternalArrayType type(); 10291 ExternalArrayType type();
10373 size_t element_size(); 10292 size_t element_size();
10374 10293
10375 Handle<JSArrayBuffer> GetBuffer(); 10294 Handle<JSArrayBuffer> GetBuffer();
10376 10295
10377 // Dispatched behavior. 10296 // Dispatched behavior.
10378 DECLARE_PRINTER(JSTypedArray) 10297 DECLARE_PRINTER(JSTypedArray)
10379 DECLARE_VERIFIER(JSTypedArray) 10298 DECLARE_VERIFIER(JSTypedArray)
10380 10299
10381 static const int kLengthOffset = kViewSize + kPointerSize; 10300 static const int kLengthOffset = kViewSize + kPointerSize;
10382 static const int kSize = kLengthOffset + kPointerSize; 10301 static const int kSize = kLengthOffset + kPointerSize;
10383 10302
10384 static const int kSizeWithInternalFields = 10303 static const int kSizeWithInternalFields =
10385 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10304 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize;
10386 10305
10387 private: 10306 private:
10388 static Handle<JSArrayBuffer> MaterializeArrayBuffer( 10307 static Handle<JSArrayBuffer> MaterializeArrayBuffer(
10389 Handle<JSTypedArray> typed_array); 10308 Handle<JSTypedArray> typed_array);
10390 10309
10391 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 10310 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
10392 }; 10311 };
10393 10312
10394 10313
10395 class JSDataView: public JSArrayBufferView { 10314 class JSDataView: public JSArrayBufferView {
10396 public: 10315 public:
10397 // Only neuters this DataView 10316 // Only neuters this DataView
10398 void Neuter(); 10317 void Neuter();
10399 10318
10400 // Casting. 10319 DECLARE_CAST(JSDataView)
10401 static inline JSDataView* cast(Object* obj);
10402 10320
10403 // Dispatched behavior. 10321 // Dispatched behavior.
10404 DECLARE_PRINTER(JSDataView) 10322 DECLARE_PRINTER(JSDataView)
10405 DECLARE_VERIFIER(JSDataView) 10323 DECLARE_VERIFIER(JSDataView)
10406 10324
10407 static const int kSize = kViewSize; 10325 static const int kSize = kViewSize;
10408 10326
10409 static const int kSizeWithInternalFields = 10327 static const int kSizeWithInternalFields =
10410 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10328 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize;
10411 10329
10412 private: 10330 private:
10413 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); 10331 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
10414 }; 10332 };
10415 10333
10416 10334
10417 // Foreign describes objects pointing from JavaScript to C structures. 10335 // Foreign describes objects pointing from JavaScript to C structures.
10418 // Since they cannot contain references to JS HeapObjects they can be 10336 // Since they cannot contain references to JS HeapObjects they can be
10419 // placed in old_data_space. 10337 // placed in old_data_space.
10420 class Foreign: public HeapObject { 10338 class Foreign: public HeapObject {
10421 public: 10339 public:
10422 // [address]: field containing the address. 10340 // [address]: field containing the address.
10423 inline Address foreign_address(); 10341 inline Address foreign_address();
10424 inline void set_foreign_address(Address value); 10342 inline void set_foreign_address(Address value);
10425 10343
10426 // Casting. 10344 DECLARE_CAST(Foreign)
10427 static inline Foreign* cast(Object* obj);
10428 10345
10429 // Dispatched behavior. 10346 // Dispatched behavior.
10430 inline void ForeignIterateBody(ObjectVisitor* v); 10347 inline void ForeignIterateBody(ObjectVisitor* v);
10431 10348
10432 template<typename StaticVisitor> 10349 template<typename StaticVisitor>
10433 inline void ForeignIterateBody(); 10350 inline void ForeignIterateBody();
10434 10351
10435 // Dispatched behavior. 10352 // Dispatched behavior.
10436 DECLARE_PRINTER(Foreign) 10353 DECLARE_PRINTER(Foreign)
10437 DECLARE_VERIFIER(Foreign) 10354 DECLARE_VERIFIER(Foreign)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
10479 inline bool AllowsSetElementsLength(); 10396 inline bool AllowsSetElementsLength();
10480 // Can cause GC. 10397 // Can cause GC.
10481 MUST_USE_RESULT static MaybeHandle<Object> SetElementsLength( 10398 MUST_USE_RESULT static MaybeHandle<Object> SetElementsLength(
10482 Handle<JSArray> array, 10399 Handle<JSArray> array,
10483 Handle<Object> length); 10400 Handle<Object> length);
10484 10401
10485 // Set the content of the array to the content of storage. 10402 // Set the content of the array to the content of storage.
10486 static inline void SetContent(Handle<JSArray> array, 10403 static inline void SetContent(Handle<JSArray> array,
10487 Handle<FixedArrayBase> storage); 10404 Handle<FixedArrayBase> storage);
10488 10405
10489 // Casting. 10406 DECLARE_CAST(JSArray)
10490 static inline JSArray* cast(Object* obj);
10491 10407
10492 // Ensures that the fixed array backing the JSArray has at 10408 // Ensures that the fixed array backing the JSArray has at
10493 // least the stated size. 10409 // least the stated size.
10494 static inline void EnsureSize(Handle<JSArray> array, 10410 static inline void EnsureSize(Handle<JSArray> array,
10495 int minimum_size_of_backing_fixed_array); 10411 int minimum_size_of_backing_fixed_array);
10496 10412
10497 // Expand the fixed array backing of a fast-case JSArray to at least 10413 // Expand the fixed array backing of a fast-case JSArray to at least
10498 // the requested size. 10414 // the requested size.
10499 static void Expand(Handle<JSArray> array, 10415 static void Expand(Handle<JSArray> array,
10500 int minimum_size_of_backing_fixed_array); 10416 int minimum_size_of_backing_fixed_array);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
10550 10466
10551 inline bool all_can_write(); 10467 inline bool all_can_write();
10552 inline void set_all_can_write(bool value); 10468 inline void set_all_can_write(bool value);
10553 10469
10554 inline PropertyAttributes property_attributes(); 10470 inline PropertyAttributes property_attributes();
10555 inline void set_property_attributes(PropertyAttributes attributes); 10471 inline void set_property_attributes(PropertyAttributes attributes);
10556 10472
10557 // Checks whether the given receiver is compatible with this accessor. 10473 // Checks whether the given receiver is compatible with this accessor.
10558 inline bool IsCompatibleReceiver(Object* receiver); 10474 inline bool IsCompatibleReceiver(Object* receiver);
10559 10475
10560 static inline AccessorInfo* cast(Object* obj); 10476 DECLARE_CAST(AccessorInfo)
10561 10477
10562 // Dispatched behavior. 10478 // Dispatched behavior.
10563 DECLARE_VERIFIER(AccessorInfo) 10479 DECLARE_VERIFIER(AccessorInfo)
10564 10480
10565 // Append all descriptors to the array that are not already there. 10481 // Append all descriptors to the array that are not already there.
10566 // Return number added. 10482 // Return number added.
10567 static int AppendUnique(Handle<Object> descriptors, 10483 static int AppendUnique(Handle<Object> descriptors,
10568 Handle<FixedArray> array, 10484 Handle<FixedArray> array,
10569 int valid_descriptors); 10485 int valid_descriptors);
10570 10486
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
10648 const int length_; 10564 const int length_;
10649 int offset_; 10565 int offset_;
10650 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptorIterator); 10566 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptorIterator);
10651 }; 10567 };
10652 10568
10653 10569
10654 class DeclaredAccessorDescriptor: public Struct { 10570 class DeclaredAccessorDescriptor: public Struct {
10655 public: 10571 public:
10656 DECL_ACCESSORS(serialized_data, ByteArray) 10572 DECL_ACCESSORS(serialized_data, ByteArray)
10657 10573
10658 static inline DeclaredAccessorDescriptor* cast(Object* obj); 10574 DECLARE_CAST(DeclaredAccessorDescriptor)
10659 10575
10660 static Handle<DeclaredAccessorDescriptor> Create( 10576 static Handle<DeclaredAccessorDescriptor> Create(
10661 Isolate* isolate, 10577 Isolate* isolate,
10662 const DeclaredAccessorDescriptorData& data, 10578 const DeclaredAccessorDescriptorData& data,
10663 Handle<DeclaredAccessorDescriptor> previous); 10579 Handle<DeclaredAccessorDescriptor> previous);
10664 10580
10665 // Dispatched behavior. 10581 // Dispatched behavior.
10666 DECLARE_PRINTER(DeclaredAccessorDescriptor) 10582 DECLARE_PRINTER(DeclaredAccessorDescriptor)
10667 DECLARE_VERIFIER(DeclaredAccessorDescriptor) 10583 DECLARE_VERIFIER(DeclaredAccessorDescriptor)
10668 10584
10669 static const int kSerializedDataOffset = HeapObject::kHeaderSize; 10585 static const int kSerializedDataOffset = HeapObject::kHeaderSize;
10670 static const int kSize = kSerializedDataOffset + kPointerSize; 10586 static const int kSize = kSerializedDataOffset + kPointerSize;
10671 10587
10672 private: 10588 private:
10673 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor); 10589 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor);
10674 }; 10590 };
10675 10591
10676 10592
10677 class DeclaredAccessorInfo: public AccessorInfo { 10593 class DeclaredAccessorInfo: public AccessorInfo {
10678 public: 10594 public:
10679 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) 10595 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor)
10680 10596
10681 static inline DeclaredAccessorInfo* cast(Object* obj); 10597 DECLARE_CAST(DeclaredAccessorInfo)
10682 10598
10683 // Dispatched behavior. 10599 // Dispatched behavior.
10684 DECLARE_PRINTER(DeclaredAccessorInfo) 10600 DECLARE_PRINTER(DeclaredAccessorInfo)
10685 DECLARE_VERIFIER(DeclaredAccessorInfo) 10601 DECLARE_VERIFIER(DeclaredAccessorInfo)
10686 10602
10687 static const int kDescriptorOffset = AccessorInfo::kSize; 10603 static const int kDescriptorOffset = AccessorInfo::kSize;
10688 static const int kSize = kDescriptorOffset + kPointerSize; 10604 static const int kSize = kDescriptorOffset + kPointerSize;
10689 10605
10690 private: 10606 private:
10691 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorInfo); 10607 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorInfo);
10692 }; 10608 };
10693 10609
10694 10610
10695 // An accessor must have a getter, but can have no setter. 10611 // An accessor must have a getter, but can have no setter.
10696 // 10612 //
10697 // When setting a property, V8 searches accessors in prototypes. 10613 // When setting a property, V8 searches accessors in prototypes.
10698 // If an accessor was found and it does not have a setter, 10614 // If an accessor was found and it does not have a setter,
10699 // the request is ignored. 10615 // the request is ignored.
10700 // 10616 //
10701 // If the accessor in the prototype has the READ_ONLY property attribute, then 10617 // If the accessor in the prototype has the READ_ONLY property attribute, then
10702 // a new value is added to the derived object when the property is set. 10618 // a new value is added to the derived object when the property is set.
10703 // This shadows the accessor in the prototype. 10619 // This shadows the accessor in the prototype.
10704 class ExecutableAccessorInfo: public AccessorInfo { 10620 class ExecutableAccessorInfo: public AccessorInfo {
10705 public: 10621 public:
10706 DECL_ACCESSORS(getter, Object) 10622 DECL_ACCESSORS(getter, Object)
10707 DECL_ACCESSORS(setter, Object) 10623 DECL_ACCESSORS(setter, Object)
10708 DECL_ACCESSORS(data, Object) 10624 DECL_ACCESSORS(data, Object)
10709 10625
10710 static inline ExecutableAccessorInfo* cast(Object* obj); 10626 DECLARE_CAST(ExecutableAccessorInfo)
10711 10627
10712 // Dispatched behavior. 10628 // Dispatched behavior.
10713 DECLARE_PRINTER(ExecutableAccessorInfo) 10629 DECLARE_PRINTER(ExecutableAccessorInfo)
10714 DECLARE_VERIFIER(ExecutableAccessorInfo) 10630 DECLARE_VERIFIER(ExecutableAccessorInfo)
10715 10631
10716 static const int kGetterOffset = AccessorInfo::kSize; 10632 static const int kGetterOffset = AccessorInfo::kSize;
10717 static const int kSetterOffset = kGetterOffset + kPointerSize; 10633 static const int kSetterOffset = kGetterOffset + kPointerSize;
10718 static const int kDataOffset = kSetterOffset + kPointerSize; 10634 static const int kDataOffset = kSetterOffset + kPointerSize;
10719 static const int kSize = kDataOffset + kPointerSize; 10635 static const int kSize = kDataOffset + kPointerSize;
10720 10636
(...skipping 15 matching lines...) Expand all
10736 class AccessorPair: public Struct { 10652 class AccessorPair: public Struct {
10737 public: 10653 public:
10738 DECL_ACCESSORS(getter, Object) 10654 DECL_ACCESSORS(getter, Object)
10739 DECL_ACCESSORS(setter, Object) 10655 DECL_ACCESSORS(setter, Object)
10740 DECL_ACCESSORS(access_flags, Smi) 10656 DECL_ACCESSORS(access_flags, Smi)
10741 10657
10742 inline void set_access_flags(v8::AccessControl access_control); 10658 inline void set_access_flags(v8::AccessControl access_control);
10743 inline bool all_can_read(); 10659 inline bool all_can_read();
10744 inline bool all_can_write(); 10660 inline bool all_can_write();
10745 10661
10746 static inline AccessorPair* cast(Object* obj); 10662 DECLARE_CAST(AccessorPair)
10747 10663
10748 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair); 10664 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair);
10749 10665
10750 Object* get(AccessorComponent component) { 10666 Object* get(AccessorComponent component) {
10751 return component == ACCESSOR_GETTER ? getter() : setter(); 10667 return component == ACCESSOR_GETTER ? getter() : setter();
10752 } 10668 }
10753 10669
10754 void set(AccessorComponent component, Object* value) { 10670 void set(AccessorComponent component, Object* value) {
10755 if (component == ACCESSOR_GETTER) { 10671 if (component == ACCESSOR_GETTER) {
10756 set_getter(value); 10672 set_getter(value);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
10797 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair); 10713 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair);
10798 }; 10714 };
10799 10715
10800 10716
10801 class AccessCheckInfo: public Struct { 10717 class AccessCheckInfo: public Struct {
10802 public: 10718 public:
10803 DECL_ACCESSORS(named_callback, Object) 10719 DECL_ACCESSORS(named_callback, Object)
10804 DECL_ACCESSORS(indexed_callback, Object) 10720 DECL_ACCESSORS(indexed_callback, Object)
10805 DECL_ACCESSORS(data, Object) 10721 DECL_ACCESSORS(data, Object)
10806 10722
10807 static inline AccessCheckInfo* cast(Object* obj); 10723 DECLARE_CAST(AccessCheckInfo)
10808 10724
10809 // Dispatched behavior. 10725 // Dispatched behavior.
10810 DECLARE_PRINTER(AccessCheckInfo) 10726 DECLARE_PRINTER(AccessCheckInfo)
10811 DECLARE_VERIFIER(AccessCheckInfo) 10727 DECLARE_VERIFIER(AccessCheckInfo)
10812 10728
10813 static const int kNamedCallbackOffset = HeapObject::kHeaderSize; 10729 static const int kNamedCallbackOffset = HeapObject::kHeaderSize;
10814 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize; 10730 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize;
10815 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize; 10731 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize;
10816 static const int kSize = kDataOffset + kPointerSize; 10732 static const int kSize = kDataOffset + kPointerSize;
10817 10733
10818 private: 10734 private:
10819 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo); 10735 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo);
10820 }; 10736 };
10821 10737
10822 10738
10823 class InterceptorInfo: public Struct { 10739 class InterceptorInfo: public Struct {
10824 public: 10740 public:
10825 DECL_ACCESSORS(getter, Object) 10741 DECL_ACCESSORS(getter, Object)
10826 DECL_ACCESSORS(setter, Object) 10742 DECL_ACCESSORS(setter, Object)
10827 DECL_ACCESSORS(query, Object) 10743 DECL_ACCESSORS(query, Object)
10828 DECL_ACCESSORS(deleter, Object) 10744 DECL_ACCESSORS(deleter, Object)
10829 DECL_ACCESSORS(enumerator, Object) 10745 DECL_ACCESSORS(enumerator, Object)
10830 DECL_ACCESSORS(data, Object) 10746 DECL_ACCESSORS(data, Object)
10831 10747
10832 static inline InterceptorInfo* cast(Object* obj); 10748 DECLARE_CAST(InterceptorInfo)
10833 10749
10834 // Dispatched behavior. 10750 // Dispatched behavior.
10835 DECLARE_PRINTER(InterceptorInfo) 10751 DECLARE_PRINTER(InterceptorInfo)
10836 DECLARE_VERIFIER(InterceptorInfo) 10752 DECLARE_VERIFIER(InterceptorInfo)
10837 10753
10838 static const int kGetterOffset = HeapObject::kHeaderSize; 10754 static const int kGetterOffset = HeapObject::kHeaderSize;
10839 static const int kSetterOffset = kGetterOffset + kPointerSize; 10755 static const int kSetterOffset = kGetterOffset + kPointerSize;
10840 static const int kQueryOffset = kSetterOffset + kPointerSize; 10756 static const int kQueryOffset = kSetterOffset + kPointerSize;
10841 static const int kDeleterOffset = kQueryOffset + kPointerSize; 10757 static const int kDeleterOffset = kQueryOffset + kPointerSize;
10842 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; 10758 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize;
10843 static const int kDataOffset = kEnumeratorOffset + kPointerSize; 10759 static const int kDataOffset = kEnumeratorOffset + kPointerSize;
10844 static const int kSize = kDataOffset + kPointerSize; 10760 static const int kSize = kDataOffset + kPointerSize;
10845 10761
10846 private: 10762 private:
10847 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); 10763 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo);
10848 }; 10764 };
10849 10765
10850 10766
10851 class CallHandlerInfo: public Struct { 10767 class CallHandlerInfo: public Struct {
10852 public: 10768 public:
10853 DECL_ACCESSORS(callback, Object) 10769 DECL_ACCESSORS(callback, Object)
10854 DECL_ACCESSORS(data, Object) 10770 DECL_ACCESSORS(data, Object)
10855 10771
10856 static inline CallHandlerInfo* cast(Object* obj); 10772 DECLARE_CAST(CallHandlerInfo)
10857 10773
10858 // Dispatched behavior. 10774 // Dispatched behavior.
10859 DECLARE_PRINTER(CallHandlerInfo) 10775 DECLARE_PRINTER(CallHandlerInfo)
10860 DECLARE_VERIFIER(CallHandlerInfo) 10776 DECLARE_VERIFIER(CallHandlerInfo)
10861 10777
10862 static const int kCallbackOffset = HeapObject::kHeaderSize; 10778 static const int kCallbackOffset = HeapObject::kHeaderSize;
10863 static const int kDataOffset = kCallbackOffset + kPointerSize; 10779 static const int kDataOffset = kCallbackOffset + kPointerSize;
10864 static const int kSize = kDataOffset + kPointerSize; 10780 static const int kSize = kDataOffset + kPointerSize;
10865 10781
10866 private: 10782 private:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
10908 // Following properties use flag bits. 10824 // Following properties use flag bits.
10909 DECL_BOOLEAN_ACCESSORS(hidden_prototype) 10825 DECL_BOOLEAN_ACCESSORS(hidden_prototype)
10910 DECL_BOOLEAN_ACCESSORS(undetectable) 10826 DECL_BOOLEAN_ACCESSORS(undetectable)
10911 // If the bit is set, object instances created by this function 10827 // If the bit is set, object instances created by this function
10912 // requires access check. 10828 // requires access check.
10913 DECL_BOOLEAN_ACCESSORS(needs_access_check) 10829 DECL_BOOLEAN_ACCESSORS(needs_access_check)
10914 DECL_BOOLEAN_ACCESSORS(read_only_prototype) 10830 DECL_BOOLEAN_ACCESSORS(read_only_prototype)
10915 DECL_BOOLEAN_ACCESSORS(remove_prototype) 10831 DECL_BOOLEAN_ACCESSORS(remove_prototype)
10916 DECL_BOOLEAN_ACCESSORS(do_not_cache) 10832 DECL_BOOLEAN_ACCESSORS(do_not_cache)
10917 10833
10918 static inline FunctionTemplateInfo* cast(Object* obj); 10834 DECLARE_CAST(FunctionTemplateInfo)
10919 10835
10920 // Dispatched behavior. 10836 // Dispatched behavior.
10921 DECLARE_PRINTER(FunctionTemplateInfo) 10837 DECLARE_PRINTER(FunctionTemplateInfo)
10922 DECLARE_VERIFIER(FunctionTemplateInfo) 10838 DECLARE_VERIFIER(FunctionTemplateInfo)
10923 10839
10924 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize; 10840 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize;
10925 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize; 10841 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize;
10926 static const int kPrototypeTemplateOffset = 10842 static const int kPrototypeTemplateOffset =
10927 kCallCodeOffset + kPointerSize; 10843 kCallCodeOffset + kPointerSize;
10928 static const int kParentTemplateOffset = 10844 static const int kParentTemplateOffset =
(...skipping 28 matching lines...) Expand all
10957 10873
10958 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); 10874 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
10959 }; 10875 };
10960 10876
10961 10877
10962 class ObjectTemplateInfo: public TemplateInfo { 10878 class ObjectTemplateInfo: public TemplateInfo {
10963 public: 10879 public:
10964 DECL_ACCESSORS(constructor, Object) 10880 DECL_ACCESSORS(constructor, Object)
10965 DECL_ACCESSORS(internal_field_count, Object) 10881 DECL_ACCESSORS(internal_field_count, Object)
10966 10882
10967 static inline ObjectTemplateInfo* cast(Object* obj); 10883 DECLARE_CAST(ObjectTemplateInfo)
10968 10884
10969 // Dispatched behavior. 10885 // Dispatched behavior.
10970 DECLARE_PRINTER(ObjectTemplateInfo) 10886 DECLARE_PRINTER(ObjectTemplateInfo)
10971 DECLARE_VERIFIER(ObjectTemplateInfo) 10887 DECLARE_VERIFIER(ObjectTemplateInfo)
10972 10888
10973 static const int kConstructorOffset = TemplateInfo::kHeaderSize; 10889 static const int kConstructorOffset = TemplateInfo::kHeaderSize;
10974 static const int kInternalFieldCountOffset = 10890 static const int kInternalFieldCountOffset =
10975 kConstructorOffset + kPointerSize; 10891 kConstructorOffset + kPointerSize;
10976 static const int kSize = kInternalFieldCountOffset + kPointerSize; 10892 static const int kSize = kInternalFieldCountOffset + kPointerSize;
10977 }; 10893 };
10978 10894
10979 10895
10980 class SignatureInfo: public Struct { 10896 class SignatureInfo: public Struct {
10981 public: 10897 public:
10982 DECL_ACCESSORS(receiver, Object) 10898 DECL_ACCESSORS(receiver, Object)
10983 DECL_ACCESSORS(args, Object) 10899 DECL_ACCESSORS(args, Object)
10984 10900
10985 static inline SignatureInfo* cast(Object* obj); 10901 DECLARE_CAST(SignatureInfo)
10986 10902
10987 // Dispatched behavior. 10903 // Dispatched behavior.
10988 DECLARE_PRINTER(SignatureInfo) 10904 DECLARE_PRINTER(SignatureInfo)
10989 DECLARE_VERIFIER(SignatureInfo) 10905 DECLARE_VERIFIER(SignatureInfo)
10990 10906
10991 static const int kReceiverOffset = Struct::kHeaderSize; 10907 static const int kReceiverOffset = Struct::kHeaderSize;
10992 static const int kArgsOffset = kReceiverOffset + kPointerSize; 10908 static const int kArgsOffset = kReceiverOffset + kPointerSize;
10993 static const int kSize = kArgsOffset + kPointerSize; 10909 static const int kSize = kArgsOffset + kPointerSize;
10994 10910
10995 private: 10911 private:
10996 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo); 10912 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo);
10997 }; 10913 };
10998 10914
10999 10915
11000 class TypeSwitchInfo: public Struct { 10916 class TypeSwitchInfo: public Struct {
11001 public: 10917 public:
11002 DECL_ACCESSORS(types, Object) 10918 DECL_ACCESSORS(types, Object)
11003 10919
11004 static inline TypeSwitchInfo* cast(Object* obj); 10920 DECLARE_CAST(TypeSwitchInfo)
11005 10921
11006 // Dispatched behavior. 10922 // Dispatched behavior.
11007 DECLARE_PRINTER(TypeSwitchInfo) 10923 DECLARE_PRINTER(TypeSwitchInfo)
11008 DECLARE_VERIFIER(TypeSwitchInfo) 10924 DECLARE_VERIFIER(TypeSwitchInfo)
11009 10925
11010 static const int kTypesOffset = Struct::kHeaderSize; 10926 static const int kTypesOffset = Struct::kHeaderSize;
11011 static const int kSize = kTypesOffset + kPointerSize; 10927 static const int kSize = kTypesOffset + kPointerSize;
11012 }; 10928 };
11013 10929
11014 10930
(...skipping 24 matching lines...) Expand all
11039 int source_position, int statement_position, 10955 int source_position, int statement_position,
11040 Handle<Object> break_point_object); 10956 Handle<Object> break_point_object);
11041 // Get the break point objects for a code position. 10957 // Get the break point objects for a code position.
11042 Object* GetBreakPointObjects(int code_position); 10958 Object* GetBreakPointObjects(int code_position);
11043 // Find the break point info holding this break point object. 10959 // Find the break point info holding this break point object.
11044 static Object* FindBreakPointInfo(Handle<DebugInfo> debug_info, 10960 static Object* FindBreakPointInfo(Handle<DebugInfo> debug_info,
11045 Handle<Object> break_point_object); 10961 Handle<Object> break_point_object);
11046 // Get the number of break points for this function. 10962 // Get the number of break points for this function.
11047 int GetBreakPointCount(); 10963 int GetBreakPointCount();
11048 10964
11049 static inline DebugInfo* cast(Object* obj); 10965 DECLARE_CAST(DebugInfo)
11050 10966
11051 // Dispatched behavior. 10967 // Dispatched behavior.
11052 DECLARE_PRINTER(DebugInfo) 10968 DECLARE_PRINTER(DebugInfo)
11053 DECLARE_VERIFIER(DebugInfo) 10969 DECLARE_VERIFIER(DebugInfo)
11054 10970
11055 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; 10971 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize;
11056 static const int kOriginalCodeIndex = kSharedFunctionInfoIndex + kPointerSize; 10972 static const int kOriginalCodeIndex = kSharedFunctionInfoIndex + kPointerSize;
11057 static const int kPatchedCodeIndex = kOriginalCodeIndex + kPointerSize; 10973 static const int kPatchedCodeIndex = kOriginalCodeIndex + kPointerSize;
11058 static const int kActiveBreakPointsCountIndex = 10974 static const int kActiveBreakPointsCountIndex =
11059 kPatchedCodeIndex + kPointerSize; 10975 kPatchedCodeIndex + kPointerSize;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
11093 Handle<Object> break_point_object); 11009 Handle<Object> break_point_object);
11094 // Set a break point. 11010 // Set a break point.
11095 static void SetBreakPoint(Handle<BreakPointInfo> info, 11011 static void SetBreakPoint(Handle<BreakPointInfo> info,
11096 Handle<Object> break_point_object); 11012 Handle<Object> break_point_object);
11097 // Check if break point info has this break point object. 11013 // Check if break point info has this break point object.
11098 static bool HasBreakPointObject(Handle<BreakPointInfo> info, 11014 static bool HasBreakPointObject(Handle<BreakPointInfo> info,
11099 Handle<Object> break_point_object); 11015 Handle<Object> break_point_object);
11100 // Get the number of break points for this code position. 11016 // Get the number of break points for this code position.
11101 int GetBreakPointCount(); 11017 int GetBreakPointCount();
11102 11018
11103 static inline BreakPointInfo* cast(Object* obj); 11019 DECLARE_CAST(BreakPointInfo)
11104 11020
11105 // Dispatched behavior. 11021 // Dispatched behavior.
11106 DECLARE_PRINTER(BreakPointInfo) 11022 DECLARE_PRINTER(BreakPointInfo)
11107 DECLARE_VERIFIER(BreakPointInfo) 11023 DECLARE_VERIFIER(BreakPointInfo)
11108 11024
11109 static const int kCodePositionIndex = Struct::kHeaderSize; 11025 static const int kCodePositionIndex = Struct::kHeaderSize;
11110 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize; 11026 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize;
11111 static const int kStatementPositionIndex = 11027 static const int kStatementPositionIndex =
11112 kSourcePositionIndex + kPointerSize; 11028 kSourcePositionIndex + kPointerSize;
11113 static const int kBreakPointObjectsIndex = 11029 static const int kBreakPointObjectsIndex =
11114 kStatementPositionIndex + kPointerSize; 11030 kStatementPositionIndex + kPointerSize;
11115 static const int kSize = kBreakPointObjectsIndex + kPointerSize; 11031 static const int kSize = kBreakPointObjectsIndex + kPointerSize;
11116 11032
11117 private: 11033 private:
11118 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); 11034 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo);
11119 }; 11035 };
11120 11036
11121 11037
11122 #undef DECL_BOOLEAN_ACCESSORS 11038 #undef DECL_BOOLEAN_ACCESSORS
11123 #undef DECL_ACCESSORS 11039 #undef DECL_ACCESSORS
11040 #undef DECLARE_CAST
11124 #undef DECLARE_VERIFIER 11041 #undef DECLARE_VERIFIER
11125 11042
11126 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \ 11043 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \
11127 V(kStringTable, "string_table", "(Internalized strings)") \ 11044 V(kStringTable, "string_table", "(Internalized strings)") \
11128 V(kExternalStringsTable, "external_strings_table", "(External strings)") \ 11045 V(kExternalStringsTable, "external_strings_table", "(External strings)") \
11129 V(kStrongRootList, "strong_root_list", "(Strong roots)") \ 11046 V(kStrongRootList, "strong_root_list", "(Strong roots)") \
11130 V(kSmiRootList, "smi_root_list", "(Smi roots)") \ 11047 V(kSmiRootList, "smi_root_list", "(Smi roots)") \
11131 V(kInternalizedString, "internalized_string", "(Internal string)") \ 11048 V(kInternalizedString, "internalized_string", "(Internal string)") \
11132 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \ 11049 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \
11133 V(kTop, "top", "(Isolate)") \ 11050 V(kTop, "top", "(Isolate)") \
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
11248 } else { 11165 } else {
11249 value &= ~(1 << bit_position); 11166 value &= ~(1 << bit_position);
11250 } 11167 }
11251 return value; 11168 return value;
11252 } 11169 }
11253 }; 11170 };
11254 11171
11255 } } // namespace v8::internal 11172 } } // namespace v8::internal
11256 11173
11257 #endif // V8_OBJECTS_H_ 11174 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698