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

Side by Side Diff: src/objects.h

Issue 18842: Experimental: periodic merge of the bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mksnapshot.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 void LookupRealNamedProperty(String* name, LookupResult* result); 1291 void LookupRealNamedProperty(String* name, LookupResult* result);
1292 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result); 1292 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result);
1293 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result); 1293 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result);
1294 void LookupCallback(String* name, LookupResult* result); 1294 void LookupCallback(String* name, LookupResult* result);
1295 1295
1296 // Returns the number of properties on this object filtering out properties 1296 // Returns the number of properties on this object filtering out properties
1297 // with the specified attributes (ignoring interceptors). 1297 // with the specified attributes (ignoring interceptors).
1298 int NumberOfLocalProperties(PropertyAttributes filter); 1298 int NumberOfLocalProperties(PropertyAttributes filter);
1299 // Returns the number of enumerable properties (ignoring interceptors). 1299 // Returns the number of enumerable properties (ignoring interceptors).
1300 int NumberOfEnumProperties(); 1300 int NumberOfEnumProperties();
1301 // Fill in details for properties into storage. 1301 // Fill in details for properties into storage starting at the specified
1302 void GetLocalPropertyNames(FixedArray* storage); 1302 // index.
1303 void GetLocalPropertyNames(FixedArray* storage, int index);
1303 1304
1304 // Returns the number of properties on this object filtering out properties 1305 // Returns the number of properties on this object filtering out properties
1305 // with the specified attributes (ignoring interceptors). 1306 // with the specified attributes (ignoring interceptors).
1306 int NumberOfLocalElements(PropertyAttributes filter); 1307 int NumberOfLocalElements(PropertyAttributes filter);
1307 // Returns the number of enumerable elements (ignoring interceptors). 1308 // Returns the number of enumerable elements (ignoring interceptors).
1308 int NumberOfEnumElements(); 1309 int NumberOfEnumElements();
1309 // Returns the number of elements on this object filtering out elements 1310 // Returns the number of elements on this object filtering out elements
1310 // with the specified attributes (ignoring interceptors). 1311 // with the specified attributes (ignoring interceptors).
1311 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); 1312 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter);
1312 // Count and fill in the enumerable elements into storage. 1313 // Count and fill in the enumerable elements into storage.
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 // Tells whether the name is present int the array. 1650 // Tells whether the name is present int the array.
1650 bool Contains(String* name) { return kNotFound != Search(name); } 1651 bool Contains(String* name) { return kNotFound != Search(name); }
1651 1652
1652 // Perform a binary search in the instance descriptors represented 1653 // Perform a binary search in the instance descriptors represented
1653 // by this fixed array. low and high are descriptor indices. If there 1654 // by this fixed array. low and high are descriptor indices. If there
1654 // are three instance descriptors in this array it should be called 1655 // are three instance descriptors in this array it should be called
1655 // with low=0 and high=2. 1656 // with low=0 and high=2.
1656 int BinarySearch(String* name, int low, int high); 1657 int BinarySearch(String* name, int low, int high);
1657 1658
1658 // Perform a linear search in the instance descriptors represented 1659 // Perform a linear search in the instance descriptors represented
1659 // by this fixed array. len is the number of descriptor indeces that are 1660 // by this fixed array. len is the number of descriptor indices that are
1660 // valid. Does not require the descriptors to be sorted. 1661 // valid. Does not require the descriptors to be sorted.
1661 int LinearSearch(String* name, int len); 1662 int LinearSearch(String* name, int len);
1662 1663
1663 // Allocates a DescriptorArray, but returns the singleton 1664 // Allocates a DescriptorArray, but returns the singleton
1664 // empty descriptor array object if number_of_descriptors is 0. 1665 // empty descriptor array object if number_of_descriptors is 0.
1665 static Object* Allocate(int number_of_descriptors); 1666 static Object* Allocate(int number_of_descriptors);
1666 1667
1667 // Casting. 1668 // Casting.
1668 static inline DescriptorArray* cast(Object* obj); 1669 static inline DescriptorArray* cast(Object* obj);
1669 1670
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 // a dictionary. 1787 // a dictionary.
1787 void ElementRemoved() { SetNumberOfElements(NumberOfElements() - 1); } 1788 void ElementRemoved() { SetNumberOfElements(NumberOfElements() - 1); }
1788 void ElementsRemoved(int n) { SetNumberOfElements(NumberOfElements() - n); } 1789 void ElementsRemoved(int n) { SetNumberOfElements(NumberOfElements() - n); }
1789 1790
1790 // Returns a new array for dictionary usage. Might return Failure. 1791 // Returns a new array for dictionary usage. Might return Failure.
1791 static Object* Allocate(int at_least_space_for); 1792 static Object* Allocate(int at_least_space_for);
1792 1793
1793 // Returns the key at entry. 1794 // Returns the key at entry.
1794 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } 1795 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); }
1795 1796
1796 // Tells wheter k is a real key. Null and undefined are not allowed 1797 // 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. 1798 // as keys and can be used to indicate missing or deleted elements.
1798 bool IsKey(Object* k) { 1799 bool IsKey(Object* k) {
1799 return !k->IsNull() && !k->IsUndefined(); 1800 return !k->IsNull() && !k->IsUndefined();
1800 } 1801 }
1801 1802
1802 // Garbage collection support. 1803 // Garbage collection support.
1803 void IteratePrefix(ObjectVisitor* visitor); 1804 void IteratePrefix(ObjectVisitor* visitor);
1804 void IterateElements(ObjectVisitor* visitor); 1805 void IterateElements(ObjectVisitor* visitor);
1805 1806
1806 // Casting. 1807 // Casting.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 uint32_t hash); 2054 uint32_t hash);
2054 2055
2055 // Sets the entry to (key, value) pair. 2056 // Sets the entry to (key, value) pair.
2056 inline void SetEntry(int entry, 2057 inline void SetEntry(int entry,
2057 Object* key, 2058 Object* key,
2058 Object* value, 2059 Object* value,
2059 PropertyDetails details); 2060 PropertyDetails details);
2060 2061
2061 void UpdateMaxNumberKey(uint32_t key); 2062 void UpdateMaxNumberKey(uint32_t key);
2062 2063
2063 // Generate new enumneration indices to avoid enumeration insdex overflow. 2064 // Generate new enumeration indices to avoid enumeration index overflow.
2064 Object* GenerateNewEnumerationIndices(); 2065 Object* GenerateNewEnumerationIndices();
2065 2066
2066 static const int kMaxNumberKeyIndex = kPrefixStartIndex; 2067 static const int kMaxNumberKeyIndex = kPrefixStartIndex;
2067 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; 2068 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
2068 2069
2069 DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary); 2070 DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary);
2070 }; 2071 };
2071 2072
2072 2073
2073 // ByteArray represents fixed sized byte arrays. Used by the outside world, 2074 // ByteArray represents fixed sized byte arrays. Used by the outside world,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 2225
2225 // Returns the address of the first relocation info (read backwards!). 2226 // Returns the address of the first relocation info (read backwards!).
2226 inline byte* relocation_start(); 2227 inline byte* relocation_start();
2227 2228
2228 // Code entry point. 2229 // Code entry point.
2229 inline byte* entry(); 2230 inline byte* entry();
2230 2231
2231 // Returns true if pc is inside this object's instructions. 2232 // Returns true if pc is inside this object's instructions.
2232 inline bool contains(byte* pc); 2233 inline bool contains(byte* pc);
2233 2234
2234 // Returns the adddress of the scope information. 2235 // Returns the address of the scope information.
2235 inline byte* sinfo_start(); 2236 inline byte* sinfo_start();
2236 2237
2237 // Convert inline cache target from address to code object before GC. 2238 // Convert inline cache target from address to code object before GC.
2238 void ConvertICTargetsFromAddressToObject(); 2239 void ConvertICTargetsFromAddressToObject();
2239 2240
2240 // Convert inline cache target from code object to address after GC 2241 // Convert inline cache target from code object to address after GC
2241 void ConvertICTargetsFromObjectToAddress(); 2242 void ConvertICTargetsFromObjectToAddress();
2242 2243
2243 // Relocate the code by delta bytes. Called to signal that this code 2244 // Relocate the code by delta bytes. Called to signal that this code
2244 // object has been moved by delta bytes. 2245 // object has been moved by delta bytes.
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 2956
2956 inline Type TypeTag(); 2957 inline Type TypeTag();
2957 inline Flags GetFlags(); 2958 inline Flags GetFlags();
2958 inline String* Pattern(); 2959 inline String* Pattern();
2959 inline Object* DataAt(int index); 2960 inline Object* DataAt(int index);
2960 2961
2961 static inline JSRegExp* cast(Object* obj); 2962 static inline JSRegExp* cast(Object* obj);
2962 2963
2963 // Dispatched behavior. 2964 // Dispatched behavior.
2964 #ifdef DEBUG 2965 #ifdef DEBUG
2965 void JSRegExpPrint();
2966 void JSRegExpVerify(); 2966 void JSRegExpVerify();
2967 #endif 2967 #endif
2968 2968
2969 static const int kDataOffset = JSObject::kHeaderSize; 2969 static const int kDataOffset = JSObject::kHeaderSize;
2970 static const int kSize = kDataOffset + kIntSize; 2970 static const int kSize = kDataOffset + kIntSize;
2971 2971
2972 static const int kTagIndex = 0; 2972 static const int kTagIndex = 0;
2973 static const int kSourceIndex = kTagIndex + 1; 2973 static const int kSourceIndex = kTagIndex + 1;
2974 static const int kFlagsIndex = kSourceIndex + 1; 2974 static const int kFlagsIndex = kSourceIndex + 1;
2975 // These three are the same since the same entry is shared for 2975 // These three are the same since the same entry is shared for
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 // use the length() and set_length methods. 3121 // use the length() and set_length methods.
3122 inline uint32_t length_field(); 3122 inline uint32_t length_field();
3123 inline void set_length_field(uint32_t value); 3123 inline void set_length_field(uint32_t value);
3124 3124
3125 // Get and set individual two byte chars in the string. 3125 // Get and set individual two byte chars in the string.
3126 inline void Set(StringShape shape, int index, uint16_t value); 3126 inline void Set(StringShape shape, int index, uint16_t value);
3127 // Get individual two byte char in the string. Repeated calls 3127 // Get individual two byte char in the string. Repeated calls
3128 // to this method are not efficient unless the string is flat. 3128 // to this method are not efficient unless the string is flat.
3129 inline uint16_t Get(StringShape shape, int index); 3129 inline uint16_t Get(StringShape shape, int index);
3130 3130
3131 // Flatten the top level ConsString that is hiding behind this 3131 // Try to flatten the top level ConsString that is hiding behind this
3132 // string. This is a no-op unless the string is a ConsString or a 3132 // string. This is a no-op unless the string is a ConsString or a
3133 // SlicedString. Flatten mutates the ConsString and might return a 3133 // SlicedString. Flatten mutates the ConsString and might return a
3134 // failure. 3134 // failure.
3135 Object* Flatten(StringShape shape); 3135 Object* TryFlatten(StringShape shape);
3136 // Try to flatten the string. Do not allow handling of allocation 3136
3137 // failures. After calling TryFlatten, the string could still be a 3137 // Try to flatten the string. Checks first inline to see if it is necessary.
3138 // ConsString. 3138 // Do not handle allocation failures. After calling TryFlattenIfNotFlat, the
3139 inline void TryFlatten(StringShape shape); 3139 // string could still be a ConsString, in which case a failure is returned.
3140 // Use FlattenString from Handles.cc to be sure to flatten.
3141 inline Object* TryFlattenIfNotFlat(StringShape shape);
3140 3142
3141 Vector<const char> ToAsciiVector(); 3143 Vector<const char> ToAsciiVector();
3142 Vector<const uc16> ToUC16Vector(); 3144 Vector<const uc16> ToUC16Vector();
3143 3145
3144 // Mark the string as an undetectable object. It only applies to 3146 // Mark the string as an undetectable object. It only applies to
3145 // ascii and two byte string types. 3147 // ascii and two byte string types.
3146 bool MarkAsUndetectable(); 3148 bool MarkAsUndetectable();
3147 3149
3148 // Slice the string and return a substring. 3150 // Slice the string and return a substring.
3149 Object* Slice(int from, int to); 3151 Object* Slice(int from, int to);
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 3767
3766 // Layout description. 3768 // Layout description.
3767 static const int kLengthOffset = JSObject::kHeaderSize; 3769 static const int kLengthOffset = JSObject::kHeaderSize;
3768 static const int kSize = kLengthOffset + kPointerSize; 3770 static const int kSize = kLengthOffset + kPointerSize;
3769 3771
3770 private: 3772 private:
3771 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); 3773 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray);
3772 }; 3774 };
3773 3775
3774 3776
3775 // An accesor must have a getter, but can have no setter. 3777 // An accessor must have a getter, but can have no setter.
3776 // 3778 //
3777 // When setting a property, V8 searches accessors in prototypes. 3779 // When setting a property, V8 searches accessors in prototypes.
3778 // 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,
3779 // the request is ignored. 3781 // the request is ignored.
3780 // 3782 //
3781 // To allow shadow an accessor property, the accessor can 3783 // To allow shadow an accessor property, the accessor can
3782 // have READ_ONLY property attribute so that a new value 3784 // have READ_ONLY property attribute so that a new value
3783 // is added to the local object to shadow the accessor 3785 // is added to the local object to shadow the accessor
3784 // in prototypes. 3786 // in prototypes.
3785 class AccessorInfo: public Struct { 3787 class AccessorInfo: public Struct {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
4028 #ifdef DEBUG 4030 #ifdef DEBUG
4029 void TypeSwitchInfoPrint(); 4031 void TypeSwitchInfoPrint();
4030 void TypeSwitchInfoVerify(); 4032 void TypeSwitchInfoVerify();
4031 #endif 4033 #endif
4032 4034
4033 static const int kTypesOffset = Struct::kHeaderSize; 4035 static const int kTypesOffset = Struct::kHeaderSize;
4034 static const int kSize = kTypesOffset + kPointerSize; 4036 static const int kSize = kTypesOffset + kPointerSize;
4035 }; 4037 };
4036 4038
4037 4039
4038 // The DebugInfo class holds additional information for a function beeing 4040 // The DebugInfo class holds additional information for a function being
4039 // debugged. 4041 // debugged.
4040 class DebugInfo: public Struct { 4042 class DebugInfo: public Struct {
4041 public: 4043 public:
4042 // The shared function info for the source beeing debugged. 4044 // The shared function info for the source being debugged.
4043 DECL_ACCESSORS(shared, SharedFunctionInfo) 4045 DECL_ACCESSORS(shared, SharedFunctionInfo)
4044 // Code object for the original code. 4046 // Code object for the original code.
4045 DECL_ACCESSORS(original_code, Code) 4047 DECL_ACCESSORS(original_code, Code)
4046 // 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
4047 // currently active for the function. 4049 // currently active for the function.
4048 DECL_ACCESSORS(code, Code) 4050 DECL_ACCESSORS(code, Code)
4049 // Fixed array holding status information for each active break point. 4051 // Fixed array holding status information for each active break point.
4050 DECL_ACCESSORS(break_points, FixedArray) 4052 DECL_ACCESSORS(break_points, FixedArray)
4051 4053
4052 // 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
4216 } else { 4218 } else {
4217 value &= ~(1 << bit_position); 4219 value &= ~(1 << bit_position);
4218 } 4220 }
4219 return value; 4221 return value;
4220 } 4222 }
4221 }; 4223 };
4222 4224
4223 } } // namespace v8::internal 4225 } } // namespace v8::internal
4224 4226
4225 #endif // V8_OBJECTS_H_ 4227 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mksnapshot.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698