| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 // Tells whether the name is present int the array. | 1649 // Tells whether the name is present int the array. |
| 1650 bool Contains(String* name) { return kNotFound != Search(name); } | 1650 bool Contains(String* name) { return kNotFound != Search(name); } |
| 1651 | 1651 |
| 1652 // Perform a binary search in the instance descriptors represented | 1652 // Perform a binary search in the instance descriptors represented |
| 1653 // by this fixed array. low and high are descriptor indices. If there | 1653 // by this fixed array. low and high are descriptor indices. If there |
| 1654 // are three instance descriptors in this array it should be called | 1654 // are three instance descriptors in this array it should be called |
| 1655 // with low=0 and high=2. | 1655 // with low=0 and high=2. |
| 1656 int BinarySearch(String* name, int low, int high); | 1656 int BinarySearch(String* name, int low, int high); |
| 1657 | 1657 |
| 1658 // Perform a linear search in the instance descriptors represented | 1658 // Perform a linear search in the instance descriptors represented |
| 1659 // by this fixed array. len is the number of descriptor indeces that are | 1659 // by this fixed array. len is the number of descriptor indices that are |
| 1660 // valid. Does not require the descriptors to be sorted. | 1660 // valid. Does not require the descriptors to be sorted. |
| 1661 int LinearSearch(String* name, int len); | 1661 int LinearSearch(String* name, int len); |
| 1662 | 1662 |
| 1663 // Allocates a DescriptorArray, but returns the singleton | 1663 // Allocates a DescriptorArray, but returns the singleton |
| 1664 // empty descriptor array object if number_of_descriptors is 0. | 1664 // empty descriptor array object if number_of_descriptors is 0. |
| 1665 static Object* Allocate(int number_of_descriptors); | 1665 static Object* Allocate(int number_of_descriptors); |
| 1666 | 1666 |
| 1667 // Casting. | 1667 // Casting. |
| 1668 static inline DescriptorArray* cast(Object* obj); | 1668 static inline DescriptorArray* cast(Object* obj); |
| 1669 | 1669 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 // a dictionary. | 1786 // a dictionary. |
| 1787 void ElementRemoved() { SetNumberOfElements(NumberOfElements() - 1); } | 1787 void ElementRemoved() { SetNumberOfElements(NumberOfElements() - 1); } |
| 1788 void ElementsRemoved(int n) { SetNumberOfElements(NumberOfElements() - n); } | 1788 void ElementsRemoved(int n) { SetNumberOfElements(NumberOfElements() - n); } |
| 1789 | 1789 |
| 1790 // Returns a new array for dictionary usage. Might return Failure. | 1790 // Returns a new array for dictionary usage. Might return Failure. |
| 1791 static Object* Allocate(int at_least_space_for); | 1791 static Object* Allocate(int at_least_space_for); |
| 1792 | 1792 |
| 1793 // Returns the key at entry. | 1793 // Returns the key at entry. |
| 1794 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } | 1794 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } |
| 1795 | 1795 |
| 1796 // Tells wheter k is a real key. Null and undefined are not allowed | 1796 // Tells whether k is a real key. Null and undefined are not allowed |
| 1797 // as keys and can be used to indicate missing or deleted elements. | 1797 // as keys and can be used to indicate missing or deleted elements. |
| 1798 bool IsKey(Object* k) { | 1798 bool IsKey(Object* k) { |
| 1799 return !k->IsNull() && !k->IsUndefined(); | 1799 return !k->IsNull() && !k->IsUndefined(); |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 // Garbage collection support. | 1802 // Garbage collection support. |
| 1803 void IteratePrefix(ObjectVisitor* visitor); | 1803 void IteratePrefix(ObjectVisitor* visitor); |
| 1804 void IterateElements(ObjectVisitor* visitor); | 1804 void IterateElements(ObjectVisitor* visitor); |
| 1805 | 1805 |
| 1806 // Casting. | 1806 // Casting. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 uint32_t hash); | 2053 uint32_t hash); |
| 2054 | 2054 |
| 2055 // Sets the entry to (key, value) pair. | 2055 // Sets the entry to (key, value) pair. |
| 2056 inline void SetEntry(int entry, | 2056 inline void SetEntry(int entry, |
| 2057 Object* key, | 2057 Object* key, |
| 2058 Object* value, | 2058 Object* value, |
| 2059 PropertyDetails details); | 2059 PropertyDetails details); |
| 2060 | 2060 |
| 2061 void UpdateMaxNumberKey(uint32_t key); | 2061 void UpdateMaxNumberKey(uint32_t key); |
| 2062 | 2062 |
| 2063 // Generate new enumneration indices to avoid enumeration insdex overflow. | 2063 // Generate new enumeration indices to avoid enumeration index overflow. |
| 2064 Object* GenerateNewEnumerationIndices(); | 2064 Object* GenerateNewEnumerationIndices(); |
| 2065 | 2065 |
| 2066 static const int kMaxNumberKeyIndex = kPrefixStartIndex; | 2066 static const int kMaxNumberKeyIndex = kPrefixStartIndex; |
| 2067 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; | 2067 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; |
| 2068 | 2068 |
| 2069 DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary); | 2069 DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary); |
| 2070 }; | 2070 }; |
| 2071 | 2071 |
| 2072 | 2072 |
| 2073 // ByteArray represents fixed sized byte arrays. Used by the outside world, | 2073 // ByteArray represents fixed sized byte arrays. Used by the outside world, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 | 2226 |
| 2227 // Returns the address of the first relocation info (read backwards!). | 2227 // Returns the address of the first relocation info (read backwards!). |
| 2228 inline byte* relocation_start(); | 2228 inline byte* relocation_start(); |
| 2229 | 2229 |
| 2230 // Code entry point. | 2230 // Code entry point. |
| 2231 inline byte* entry(); | 2231 inline byte* entry(); |
| 2232 | 2232 |
| 2233 // Returns true if pc is inside this object's instructions. | 2233 // Returns true if pc is inside this object's instructions. |
| 2234 inline bool contains(byte* pc); | 2234 inline bool contains(byte* pc); |
| 2235 | 2235 |
| 2236 // Returns the adddress of the scope information. | 2236 // Returns the address of the scope information. |
| 2237 inline byte* sinfo_start(); | 2237 inline byte* sinfo_start(); |
| 2238 | 2238 |
| 2239 // Convert inline cache target from address to code object before GC. | 2239 // Convert inline cache target from address to code object before GC. |
| 2240 void ConvertICTargetsFromAddressToObject(); | 2240 void ConvertICTargetsFromAddressToObject(); |
| 2241 | 2241 |
| 2242 // Convert inline cache target from code object to address after GC | 2242 // Convert inline cache target from code object to address after GC |
| 2243 void ConvertICTargetsFromObjectToAddress(); | 2243 void ConvertICTargetsFromObjectToAddress(); |
| 2244 | 2244 |
| 2245 // Relocate the code by delta bytes. Called to signal that this code | 2245 // Relocate the code by delta bytes. Called to signal that this code |
| 2246 // object has been moved by delta bytes. | 2246 // object has been moved by delta bytes. |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3767 | 3767 |
| 3768 // Layout description. | 3768 // Layout description. |
| 3769 static const int kLengthOffset = JSObject::kHeaderSize; | 3769 static const int kLengthOffset = JSObject::kHeaderSize; |
| 3770 static const int kSize = kLengthOffset + kPointerSize; | 3770 static const int kSize = kLengthOffset + kPointerSize; |
| 3771 | 3771 |
| 3772 private: | 3772 private: |
| 3773 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); | 3773 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); |
| 3774 }; | 3774 }; |
| 3775 | 3775 |
| 3776 | 3776 |
| 3777 // An accesor must have a getter, but can have no setter. | 3777 // An accessor must have a getter, but can have no setter. |
| 3778 // | 3778 // |
| 3779 // When setting a property, V8 searches accessors in prototypes. | 3779 // When setting a property, V8 searches accessors in prototypes. |
| 3780 // If an accessor was found and it does not have a setter, | 3780 // If an accessor was found and it does not have a setter, |
| 3781 // the request is ignored. | 3781 // the request is ignored. |
| 3782 // | 3782 // |
| 3783 // To allow shadow an accessor property, the accessor can | 3783 // To allow shadow an accessor property, the accessor can |
| 3784 // have READ_ONLY property attribute so that a new value | 3784 // have READ_ONLY property attribute so that a new value |
| 3785 // is added to the local object to shadow the accessor | 3785 // is added to the local object to shadow the accessor |
| 3786 // in prototypes. | 3786 // in prototypes. |
| 3787 class AccessorInfo: public Struct { | 3787 class AccessorInfo: public Struct { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4030 #ifdef DEBUG | 4030 #ifdef DEBUG |
| 4031 void TypeSwitchInfoPrint(); | 4031 void TypeSwitchInfoPrint(); |
| 4032 void TypeSwitchInfoVerify(); | 4032 void TypeSwitchInfoVerify(); |
| 4033 #endif | 4033 #endif |
| 4034 | 4034 |
| 4035 static const int kTypesOffset = Struct::kHeaderSize; | 4035 static const int kTypesOffset = Struct::kHeaderSize; |
| 4036 static const int kSize = kTypesOffset + kPointerSize; | 4036 static const int kSize = kTypesOffset + kPointerSize; |
| 4037 }; | 4037 }; |
| 4038 | 4038 |
| 4039 | 4039 |
| 4040 // The DebugInfo class holds additional information for a function beeing | 4040 // The DebugInfo class holds additional information for a function being |
| 4041 // debugged. | 4041 // debugged. |
| 4042 class DebugInfo: public Struct { | 4042 class DebugInfo: public Struct { |
| 4043 public: | 4043 public: |
| 4044 // The shared function info for the source beeing debugged. | 4044 // The shared function info for the source being debugged. |
| 4045 DECL_ACCESSORS(shared, SharedFunctionInfo) | 4045 DECL_ACCESSORS(shared, SharedFunctionInfo) |
| 4046 // Code object for the original code. | 4046 // Code object for the original code. |
| 4047 DECL_ACCESSORS(original_code, Code) | 4047 DECL_ACCESSORS(original_code, Code) |
| 4048 // Code object for the patched code. This code object is the code object | 4048 // Code object for the patched code. This code object is the code object |
| 4049 // currently active for the function. | 4049 // currently active for the function. |
| 4050 DECL_ACCESSORS(code, Code) | 4050 DECL_ACCESSORS(code, Code) |
| 4051 // Fixed array holding status information for each active break point. | 4051 // Fixed array holding status information for each active break point. |
| 4052 DECL_ACCESSORS(break_points, FixedArray) | 4052 DECL_ACCESSORS(break_points, FixedArray) |
| 4053 | 4053 |
| 4054 // Check if there is a break point at a code position. | 4054 // Check if there is a break point at a code position. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4218 } else { | 4218 } else { |
| 4219 value &= ~(1 << bit_position); | 4219 value &= ~(1 << bit_position); |
| 4220 } | 4220 } |
| 4221 return value; | 4221 return value; |
| 4222 } | 4222 } |
| 4223 }; | 4223 }; |
| 4224 | 4224 |
| 4225 } } // namespace v8::internal | 4225 } } // namespace v8::internal |
| 4226 | 4226 |
| 4227 #endif // V8_OBJECTS_H_ | 4227 #endif // V8_OBJECTS_H_ |
| OLD | NEW |