OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 inline bool IsStringObjectWithCharacterAt(uint32_t index); | 1514 inline bool IsStringObjectWithCharacterAt(uint32_t index); |
1515 | 1515 |
1516 #ifdef VERIFY_HEAP | 1516 #ifdef VERIFY_HEAP |
1517 // Verify a pointer is a valid object pointer. | 1517 // Verify a pointer is a valid object pointer. |
1518 static void VerifyPointer(Object* p); | 1518 static void VerifyPointer(Object* p); |
1519 #endif | 1519 #endif |
1520 | 1520 |
1521 inline void VerifyApiCallResultType(); | 1521 inline void VerifyApiCallResultType(); |
1522 | 1522 |
1523 // Prints this object without details. | 1523 // Prints this object without details. |
1524 inline void ShortPrint() { | 1524 void ShortPrint(FILE* out = stdout); |
1525 ShortPrint(stdout); | |
1526 } | |
1527 void ShortPrint(FILE* out); | |
1528 | 1525 |
1529 // Prints this object without details to a message accumulator. | 1526 // Prints this object without details to a message accumulator. |
1530 void ShortPrint(StringStream* accumulator); | 1527 void ShortPrint(StringStream* accumulator); |
1531 | 1528 |
1532 // Casting: This cast is only needed to satisfy macros in objects-inl.h. | 1529 // Casting: This cast is only needed to satisfy macros in objects-inl.h. |
1533 static Object* cast(Object* value) { return value; } | 1530 static Object* cast(Object* value) { return value; } |
1534 | 1531 |
1535 // Layout description. | 1532 // Layout description. |
1536 static const int kHeaderSize = 0; // Object does not take up any space. | 1533 static const int kHeaderSize = 0; // Object does not take up any space. |
1537 | 1534 |
(...skipping 18 matching lines...) Expand all Loading... |
1556 | 1553 |
1557 static inline Smi* FromIntptr(intptr_t value); | 1554 static inline Smi* FromIntptr(intptr_t value); |
1558 | 1555 |
1559 // Returns whether value can be represented in a Smi. | 1556 // Returns whether value can be represented in a Smi. |
1560 static inline bool IsValid(intptr_t value); | 1557 static inline bool IsValid(intptr_t value); |
1561 | 1558 |
1562 // Casting. | 1559 // Casting. |
1563 static inline Smi* cast(Object* object); | 1560 static inline Smi* cast(Object* object); |
1564 | 1561 |
1565 // Dispatched behavior. | 1562 // Dispatched behavior. |
1566 inline void SmiPrint() { | 1563 void SmiPrint(FILE* out = stdout); |
1567 SmiPrint(stdout); | |
1568 } | |
1569 void SmiPrint(FILE* out); | |
1570 void SmiPrint(StringStream* accumulator); | 1564 void SmiPrint(StringStream* accumulator); |
1571 | 1565 |
1572 DECLARE_VERIFIER(Smi) | 1566 DECLARE_VERIFIER(Smi) |
1573 | 1567 |
1574 static const int kMinValue = | 1568 static const int kMinValue = |
1575 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); | 1569 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); |
1576 static const int kMaxValue = -(kMinValue + 1); | 1570 static const int kMaxValue = -(kMinValue + 1); |
1577 | 1571 |
1578 private: | 1572 private: |
1579 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); | 1573 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 static inline Failure* RetryAfterGC(); // NEW_SPACE | 1624 static inline Failure* RetryAfterGC(); // NEW_SPACE |
1631 static inline Failure* Exception(); | 1625 static inline Failure* Exception(); |
1632 static inline Failure* InternalError(); | 1626 static inline Failure* InternalError(); |
1633 // TODO(jkummerow): The value is temporary instrumentation. Remove it | 1627 // TODO(jkummerow): The value is temporary instrumentation. Remove it |
1634 // when it has served its purpose. | 1628 // when it has served its purpose. |
1635 static inline Failure* OutOfMemoryException(intptr_t value); | 1629 static inline Failure* OutOfMemoryException(intptr_t value); |
1636 // Casting. | 1630 // Casting. |
1637 static inline Failure* cast(MaybeObject* object); | 1631 static inline Failure* cast(MaybeObject* object); |
1638 | 1632 |
1639 // Dispatched behavior. | 1633 // Dispatched behavior. |
1640 inline void FailurePrint() { | 1634 void FailurePrint(FILE* out = stdout); |
1641 FailurePrint(stdout); | |
1642 } | |
1643 void FailurePrint(FILE* out); | |
1644 void FailurePrint(StringStream* accumulator); | 1635 void FailurePrint(StringStream* accumulator); |
1645 | 1636 |
1646 DECLARE_VERIFIER(Failure) | 1637 DECLARE_VERIFIER(Failure) |
1647 | 1638 |
1648 private: | 1639 private: |
1649 inline intptr_t value() const; | 1640 inline intptr_t value() const; |
1650 static inline Failure* Construct(Type type, intptr_t value = 0); | 1641 static inline Failure* Construct(Type type, intptr_t value = 0); |
1651 | 1642 |
1652 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); | 1643 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); |
1653 }; | 1644 }; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 // must be able to present a reference to an DisallowHeapAllocation | 1753 // must be able to present a reference to an DisallowHeapAllocation |
1763 // object as a sign that they are not going to use this function | 1754 // object as a sign that they are not going to use this function |
1764 // from code that allocates and thus invalidates the returned write | 1755 // from code that allocates and thus invalidates the returned write |
1765 // barrier mode. | 1756 // barrier mode. |
1766 inline WriteBarrierMode GetWriteBarrierMode( | 1757 inline WriteBarrierMode GetWriteBarrierMode( |
1767 const DisallowHeapAllocation& promise); | 1758 const DisallowHeapAllocation& promise); |
1768 | 1759 |
1769 // Dispatched behavior. | 1760 // Dispatched behavior. |
1770 void HeapObjectShortPrint(StringStream* accumulator); | 1761 void HeapObjectShortPrint(StringStream* accumulator); |
1771 #ifdef OBJECT_PRINT | 1762 #ifdef OBJECT_PRINT |
1772 inline void HeapObjectPrint() { | |
1773 HeapObjectPrint(stdout); | |
1774 } | |
1775 void HeapObjectPrint(FILE* out); | |
1776 void PrintHeader(FILE* out, const char* id); | 1763 void PrintHeader(FILE* out, const char* id); |
1777 #endif | 1764 #endif |
| 1765 DECLARE_PRINTER(HeapObject) |
1778 DECLARE_VERIFIER(HeapObject) | 1766 DECLARE_VERIFIER(HeapObject) |
1779 #ifdef VERIFY_HEAP | 1767 #ifdef VERIFY_HEAP |
1780 inline void VerifyObjectField(int offset); | 1768 inline void VerifyObjectField(int offset); |
1781 inline void VerifySmiField(int offset); | 1769 inline void VerifySmiField(int offset); |
1782 | 1770 |
1783 // Verify a pointer is a valid HeapObject pointer that points to object | 1771 // Verify a pointer is a valid HeapObject pointer that points to object |
1784 // areas in the heap. | 1772 // areas in the heap. |
1785 static void VerifyHeapPointer(Object* p); | 1773 static void VerifyHeapPointer(Object* p); |
1786 #endif | 1774 #endif |
1787 | 1775 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 // [value]: number value. | 1839 // [value]: number value. |
1852 inline double value(); | 1840 inline double value(); |
1853 inline void set_value(double value); | 1841 inline void set_value(double value); |
1854 | 1842 |
1855 // Casting. | 1843 // Casting. |
1856 static inline HeapNumber* cast(Object* obj); | 1844 static inline HeapNumber* cast(Object* obj); |
1857 | 1845 |
1858 // Dispatched behavior. | 1846 // Dispatched behavior. |
1859 bool HeapNumberBooleanValue(); | 1847 bool HeapNumberBooleanValue(); |
1860 | 1848 |
1861 inline void HeapNumberPrint() { | 1849 void HeapNumberPrint(FILE* out = stdout); |
1862 HeapNumberPrint(stdout); | |
1863 } | |
1864 void HeapNumberPrint(FILE* out); | |
1865 void HeapNumberPrint(StringStream* accumulator); | 1850 void HeapNumberPrint(StringStream* accumulator); |
1866 DECLARE_VERIFIER(HeapNumber) | 1851 DECLARE_VERIFIER(HeapNumber) |
1867 | 1852 |
1868 inline int get_exponent(); | 1853 inline int get_exponent(); |
1869 inline int get_sign(); | 1854 inline int get_sign(); |
1870 | 1855 |
1871 // Layout description. | 1856 // Layout description. |
1872 static const int kValueOffset = HeapObject::kHeaderSize; | 1857 static const int kValueOffset = HeapObject::kHeaderSize; |
1873 // IEEE doubles are two 32 bit words. The first is just mantissa, the second | 1858 // IEEE doubles are two 32 bit words. The first is just mantissa, the second |
1874 // is a mixture of sign, exponent and mantissa. Our current platforms are all | 1859 // is a mixture of sign, exponent and mantissa. Our current platforms are all |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2620 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
2636 | 2621 |
2637 // Copy object | 2622 // Copy object |
2638 MUST_USE_RESULT MaybeObject* DeepCopy(Isolate* isolate); | 2623 MUST_USE_RESULT MaybeObject* DeepCopy(Isolate* isolate); |
2639 | 2624 |
2640 // Dispatched behavior. | 2625 // Dispatched behavior. |
2641 void JSObjectShortPrint(StringStream* accumulator); | 2626 void JSObjectShortPrint(StringStream* accumulator); |
2642 DECLARE_PRINTER(JSObject) | 2627 DECLARE_PRINTER(JSObject) |
2643 DECLARE_VERIFIER(JSObject) | 2628 DECLARE_VERIFIER(JSObject) |
2644 #ifdef OBJECT_PRINT | 2629 #ifdef OBJECT_PRINT |
2645 inline void PrintProperties() { | 2630 void PrintProperties(FILE* out = stdout); |
2646 PrintProperties(stdout); | 2631 void PrintElements(FILE* out = stdout); |
2647 } | 2632 void PrintTransitions(FILE* out = stdout); |
2648 void PrintProperties(FILE* out); | |
2649 | |
2650 inline void PrintElements() { | |
2651 PrintElements(stdout); | |
2652 } | |
2653 void PrintElements(FILE* out); | |
2654 inline void PrintTransitions() { | |
2655 PrintTransitions(stdout); | |
2656 } | |
2657 void PrintTransitions(FILE* out); | |
2658 #endif | 2633 #endif |
2659 | 2634 |
2660 void PrintElementsTransition( | 2635 void PrintElementsTransition( |
2661 FILE* file, ElementsKind from_kind, FixedArrayBase* from_elements, | 2636 FILE* file, ElementsKind from_kind, FixedArrayBase* from_elements, |
2662 ElementsKind to_kind, FixedArrayBase* to_elements); | 2637 ElementsKind to_kind, FixedArrayBase* to_elements); |
2663 | 2638 |
2664 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map); | 2639 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map); |
2665 | 2640 |
2666 #ifdef DEBUG | 2641 #ifdef DEBUG |
2667 // Structure for collecting spill information about JSObjects. | 2642 // Structure for collecting spill information about JSObjects. |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3242 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize; | 3217 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize; |
3243 | 3218 |
3244 // Layout of descriptor. | 3219 // Layout of descriptor. |
3245 static const int kDescriptorKey = 0; | 3220 static const int kDescriptorKey = 0; |
3246 static const int kDescriptorDetails = 1; | 3221 static const int kDescriptorDetails = 1; |
3247 static const int kDescriptorValue = 2; | 3222 static const int kDescriptorValue = 2; |
3248 static const int kDescriptorSize = 3; | 3223 static const int kDescriptorSize = 3; |
3249 | 3224 |
3250 #ifdef OBJECT_PRINT | 3225 #ifdef OBJECT_PRINT |
3251 // Print all the descriptors. | 3226 // Print all the descriptors. |
3252 inline void PrintDescriptors() { | 3227 void PrintDescriptors(FILE* out = stdout); |
3253 PrintDescriptors(stdout); | |
3254 } | |
3255 void PrintDescriptors(FILE* out); | |
3256 #endif | 3228 #endif |
3257 | 3229 |
3258 #ifdef DEBUG | 3230 #ifdef DEBUG |
3259 // Is the descriptor array sorted and without duplicates? | 3231 // Is the descriptor array sorted and without duplicates? |
3260 bool IsSortedNoDuplicates(int valid_descriptors = -1); | 3232 bool IsSortedNoDuplicates(int valid_descriptors = -1); |
3261 | 3233 |
3262 // Is the descriptor array consistent with the back pointers in targets? | 3234 // Is the descriptor array consistent with the back pointers in targets? |
3263 bool IsConsistentWithBackPointers(Map* current_map); | 3235 bool IsConsistentWithBackPointers(Map* current_map); |
3264 | 3236 |
3265 // Are two DescriptorArrays equal? | 3237 // Are two DescriptorArrays equal? |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3738 // Returns a new array for dictionary usage. Might return Failure. | 3710 // Returns a new array for dictionary usage. Might return Failure. |
3739 MUST_USE_RESULT static MaybeObject* Allocate( | 3711 MUST_USE_RESULT static MaybeObject* Allocate( |
3740 Heap* heap, | 3712 Heap* heap, |
3741 int at_least_space_for, | 3713 int at_least_space_for, |
3742 PretenureFlag pretenure = NOT_TENURED); | 3714 PretenureFlag pretenure = NOT_TENURED); |
3743 | 3715 |
3744 // Ensure enough space for n additional elements. | 3716 // Ensure enough space for n additional elements. |
3745 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); | 3717 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); |
3746 | 3718 |
3747 #ifdef OBJECT_PRINT | 3719 #ifdef OBJECT_PRINT |
3748 inline void Print() { | 3720 void Print(FILE* out = stdout); |
3749 Print(stdout); | |
3750 } | |
3751 void Print(FILE* out); | |
3752 #endif | 3721 #endif |
3753 // Returns the key (slow). | 3722 // Returns the key (slow). |
3754 Object* SlowReverseLookup(Object* value); | 3723 Object* SlowReverseLookup(Object* value); |
3755 | 3724 |
3756 // Sets the entry to (key, value) pair. | 3725 // Sets the entry to (key, value) pair. |
3757 inline void SetEntry(int entry, | 3726 inline void SetEntry(int entry, |
3758 Object* key, | 3727 Object* key, |
3759 Object* value); | 3728 Object* value); |
3760 inline void SetEntry(int entry, | 3729 inline void SetEntry(int entry, |
3761 Object* key, | 3730 Object* key, |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4823 | 4792 |
4824 typedef int ExtraICState; | 4793 typedef int ExtraICState; |
4825 | 4794 |
4826 static const ExtraICState kNoExtraICState = 0; | 4795 static const ExtraICState kNoExtraICState = 0; |
4827 | 4796 |
4828 #ifdef ENABLE_DISASSEMBLER | 4797 #ifdef ENABLE_DISASSEMBLER |
4829 // Printing | 4798 // Printing |
4830 static const char* ICState2String(InlineCacheState state); | 4799 static const char* ICState2String(InlineCacheState state); |
4831 static const char* StubType2String(StubType type); | 4800 static const char* StubType2String(StubType type); |
4832 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); | 4801 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); |
4833 inline void Disassemble(const char* name) { | 4802 void Disassemble(const char* name, FILE* out = stdout); |
4834 Disassemble(name, stdout); | |
4835 } | |
4836 void Disassemble(const char* name, FILE* out); | |
4837 #endif // ENABLE_DISASSEMBLER | 4803 #endif // ENABLE_DISASSEMBLER |
4838 | 4804 |
4839 // [instruction_size]: Size of the native instructions | 4805 // [instruction_size]: Size of the native instructions |
4840 inline int instruction_size(); | 4806 inline int instruction_size(); |
4841 inline void set_instruction_size(int value); | 4807 inline void set_instruction_size(int value); |
4842 | 4808 |
4843 // [relocation_info]: Code relocation information | 4809 // [relocation_info]: Code relocation information |
4844 DECL_ACCESSORS(relocation_info, ByteArray) | 4810 DECL_ACCESSORS(relocation_info, ByteArray) |
4845 void InvalidateRelocation(); | 4811 void InvalidateRelocation(); |
4846 | 4812 |
(...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7124 void SetInstanceClassName(String* name); | 7090 void SetInstanceClassName(String* name); |
7125 | 7091 |
7126 // Returns if this function has been compiled to native code yet. | 7092 // Returns if this function has been compiled to native code yet. |
7127 inline bool is_compiled(); | 7093 inline bool is_compiled(); |
7128 | 7094 |
7129 // [next_function_link]: Field for linking functions. This list is treated as | 7095 // [next_function_link]: Field for linking functions. This list is treated as |
7130 // a weak list by the GC. | 7096 // a weak list by the GC. |
7131 DECL_ACCESSORS(next_function_link, Object) | 7097 DECL_ACCESSORS(next_function_link, Object) |
7132 | 7098 |
7133 // Prints the name of the function using PrintF. | 7099 // Prints the name of the function using PrintF. |
7134 inline void PrintName() { | 7100 void PrintName(FILE* out = stdout); |
7135 PrintName(stdout); | |
7136 } | |
7137 void PrintName(FILE* out); | |
7138 | 7101 |
7139 // Casting. | 7102 // Casting. |
7140 static inline JSFunction* cast(Object* obj); | 7103 static inline JSFunction* cast(Object* obj); |
7141 | 7104 |
7142 // Iterates the objects, including code objects indirectly referenced | 7105 // Iterates the objects, including code objects indirectly referenced |
7143 // through pointers to the first instruction in the code object. | 7106 // through pointers to the first instruction in the code object. |
7144 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); | 7107 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); |
7145 | 7108 |
7146 // Dispatched behavior. | 7109 // Dispatched behavior. |
7147 DECLARE_PRINTER(JSFunction) | 7110 DECLARE_PRINTER(JSFunction) |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8372 static inline String* cast(Object* obj); | 8335 static inline String* cast(Object* obj); |
8373 | 8336 |
8374 void PrintOn(FILE* out); | 8337 void PrintOn(FILE* out); |
8375 | 8338 |
8376 // For use during stack traces. Performs rudimentary sanity check. | 8339 // For use during stack traces. Performs rudimentary sanity check. |
8377 bool LooksValid(); | 8340 bool LooksValid(); |
8378 | 8341 |
8379 // Dispatched behavior. | 8342 // Dispatched behavior. |
8380 void StringShortPrint(StringStream* accumulator); | 8343 void StringShortPrint(StringStream* accumulator); |
8381 #ifdef OBJECT_PRINT | 8344 #ifdef OBJECT_PRINT |
8382 inline void StringPrint() { | |
8383 StringPrint(stdout); | |
8384 } | |
8385 void StringPrint(FILE* out); | |
8386 | |
8387 char* ToAsciiArray(); | 8345 char* ToAsciiArray(); |
8388 #endif | 8346 #endif |
| 8347 DECLARE_PRINTER(String) |
8389 DECLARE_VERIFIER(String) | 8348 DECLARE_VERIFIER(String) |
8390 | 8349 |
8391 inline bool IsFlat(); | 8350 inline bool IsFlat(); |
8392 | 8351 |
8393 // Layout description. | 8352 // Layout description. |
8394 static const int kLengthOffset = Name::kSize; | 8353 static const int kLengthOffset = Name::kSize; |
8395 static const int kSize = kLengthOffset + kPointerSize; | 8354 static const int kSize = kLengthOffset + kPointerSize; |
8396 | 8355 |
8397 // Maximum number of characters to consider when trying to convert a string | 8356 // Maximum number of characters to consider when trying to convert a string |
8398 // value into an array index. | 8357 // value into an array index. |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10275 } else { | 10234 } else { |
10276 value &= ~(1 << bit_position); | 10235 value &= ~(1 << bit_position); |
10277 } | 10236 } |
10278 return value; | 10237 return value; |
10279 } | 10238 } |
10280 }; | 10239 }; |
10281 | 10240 |
10282 } } // namespace v8::internal | 10241 } } // namespace v8::internal |
10283 | 10242 |
10284 #endif // V8_OBJECTS_H_ | 10243 #endif // V8_OBJECTS_H_ |
OLD | NEW |