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 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2290 // Check whether this object references another object | 2290 // Check whether this object references another object |
2291 bool ReferencesObject(Object* obj); | 2291 bool ReferencesObject(Object* obj); |
2292 | 2292 |
2293 // Casting. | 2293 // Casting. |
2294 static inline JSObject* cast(Object* obj); | 2294 static inline JSObject* cast(Object* obj); |
2295 | 2295 |
2296 // Disalow further properties to be added to the object. | 2296 // Disalow further properties to be added to the object. |
2297 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2297 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
2298 MUST_USE_RESULT MaybeObject* PreventExtensions(); | 2298 MUST_USE_RESULT MaybeObject* PreventExtensions(); |
2299 | 2299 |
2300 // ES5 Object.freeze | |
2301 MUST_USE_RESULT MaybeObject* Freeze(Isolate* isolate); | |
2302 | |
2303 // Copy object | 2300 // Copy object |
2304 MUST_USE_RESULT MaybeObject* DeepCopy(Isolate* isolate); | 2301 MUST_USE_RESULT MaybeObject* DeepCopy(Isolate* isolate); |
2305 | 2302 |
2306 // Dispatched behavior. | 2303 // Dispatched behavior. |
2307 void JSObjectShortPrint(StringStream* accumulator); | 2304 void JSObjectShortPrint(StringStream* accumulator); |
2308 DECLARE_PRINTER(JSObject) | 2305 DECLARE_PRINTER(JSObject) |
2309 DECLARE_VERIFIER(JSObject) | 2306 DECLARE_VERIFIER(JSObject) |
2310 #ifdef OBJECT_PRINT | 2307 #ifdef OBJECT_PRINT |
2311 inline void PrintProperties() { | 2308 inline void PrintProperties() { |
2312 PrintProperties(stdout); | 2309 PrintProperties(stdout); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2830 MUST_USE_RESULT MaybeObject* Merge(int verbatim, | 2827 MUST_USE_RESULT MaybeObject* Merge(int verbatim, |
2831 int valid, | 2828 int valid, |
2832 int new_size, | 2829 int new_size, |
2833 DescriptorArray* other); | 2830 DescriptorArray* other); |
2834 | 2831 |
2835 bool IsMoreGeneralThan(int verbatim, | 2832 bool IsMoreGeneralThan(int verbatim, |
2836 int valid, | 2833 int valid, |
2837 int new_size, | 2834 int new_size, |
2838 DescriptorArray* other); | 2835 DescriptorArray* other); |
2839 | 2836 |
2840 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index) { | 2837 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index); |
2841 return CopyUpToAddAttributes(enumeration_index, NONE); | |
2842 } | |
2843 | |
2844 MUST_USE_RESULT MaybeObject* CopyUpToAddAttributes( | |
2845 int enumeration_index, | |
2846 PropertyAttributes attributes); | |
2847 | 2838 |
2848 // Sort the instance descriptors by the hash codes of their keys. | 2839 // Sort the instance descriptors by the hash codes of their keys. |
2849 void Sort(); | 2840 void Sort(); |
2850 | 2841 |
2851 // Search the instance descriptors for given name. | 2842 // Search the instance descriptors for given name. |
2852 INLINE(int Search(Name* name, int number_of_own_descriptors)); | 2843 INLINE(int Search(Name* name, int number_of_own_descriptors)); |
2853 | 2844 |
2854 // As the above, but uses DescriptorLookupCache and updates it when | 2845 // As the above, but uses DescriptorLookupCache and updates it when |
2855 // necessary. | 2846 // necessary. |
2856 INLINE(int SearchWithCache(Name* name, Map* map)); | 2847 INLINE(int SearchWithCache(Name* name, Map* map)); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3371 void SetNextEnumerationIndex(int index) { | 3362 void SetNextEnumerationIndex(int index) { |
3372 ASSERT(index != 0); | 3363 ASSERT(index != 0); |
3373 this->set(kNextEnumerationIndexIndex, Smi::FromInt(index)); | 3364 this->set(kNextEnumerationIndexIndex, Smi::FromInt(index)); |
3374 } | 3365 } |
3375 | 3366 |
3376 int NextEnumerationIndex() { | 3367 int NextEnumerationIndex() { |
3377 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); | 3368 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); |
3378 } | 3369 } |
3379 | 3370 |
3380 // Returns a new array for dictionary usage. Might return Failure. | 3371 // Returns a new array for dictionary usage. Might return Failure. |
3381 MUST_USE_RESULT static MaybeObject* Allocate( | 3372 MUST_USE_RESULT static MaybeObject* Allocate(Heap* heap, |
3382 Heap* heap, | 3373 int at_least_space_for); |
3383 int at_least_space_for, | |
3384 PretenureFlag pretenure = NOT_TENURED); | |
3385 | 3374 |
3386 // Ensure enough space for n additional elements. | 3375 // Ensure enough space for n additional elements. |
3387 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); | 3376 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); |
3388 | 3377 |
3389 #ifdef OBJECT_PRINT | 3378 #ifdef OBJECT_PRINT |
3390 inline void Print() { | 3379 inline void Print() { |
3391 Print(stdout); | 3380 Print(stdout); |
3392 } | 3381 } |
3393 void Print(FILE* out); | 3382 void Print(FILE* out); |
3394 #endif | 3383 #endif |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5075 inline void set_bit_field3(int value); | 5064 inline void set_bit_field3(int value); |
5076 | 5065 |
5077 class EnumLengthBits: public BitField<int, 0, 11> {}; | 5066 class EnumLengthBits: public BitField<int, 0, 11> {}; |
5078 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {}; | 5067 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {}; |
5079 class IsShared: public BitField<bool, 22, 1> {}; | 5068 class IsShared: public BitField<bool, 22, 1> {}; |
5080 class FunctionWithPrototype: public BitField<bool, 23, 1> {}; | 5069 class FunctionWithPrototype: public BitField<bool, 23, 1> {}; |
5081 class DictionaryMap: public BitField<bool, 24, 1> {}; | 5070 class DictionaryMap: public BitField<bool, 24, 1> {}; |
5082 class OwnsDescriptors: public BitField<bool, 25, 1> {}; | 5071 class OwnsDescriptors: public BitField<bool, 25, 1> {}; |
5083 class IsObserved: public BitField<bool, 26, 1> {}; | 5072 class IsObserved: public BitField<bool, 26, 1> {}; |
5084 class Deprecated: public BitField<bool, 27, 1> {}; | 5073 class Deprecated: public BitField<bool, 27, 1> {}; |
5085 class IsFrozen: public BitField<bool, 28, 1> {}; | |
5086 | 5074 |
5087 // Tells whether the object in the prototype property will be used | 5075 // Tells whether the object in the prototype property will be used |
5088 // for instances created from this function. If the prototype | 5076 // for instances created from this function. If the prototype |
5089 // property is set to a value that is not a JSObject, the prototype | 5077 // property is set to a value that is not a JSObject, the prototype |
5090 // property will not be used to create instances of the function. | 5078 // property will not be used to create instances of the function. |
5091 // See ECMA-262, 13.2.2. | 5079 // See ECMA-262, 13.2.2. |
5092 inline void set_non_instance_prototype(bool value); | 5080 inline void set_non_instance_prototype(bool value); |
5093 inline bool has_non_instance_prototype(); | 5081 inline bool has_non_instance_prototype(); |
5094 | 5082 |
5095 // Tells whether function has special prototype property. If not, prototype | 5083 // Tells whether function has special prototype property. If not, prototype |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5378 ASSERT(length <= NumberOfOwnDescriptors()); | 5366 ASSERT(length <= NumberOfOwnDescriptors()); |
5379 } | 5367 } |
5380 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); | 5368 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); |
5381 } | 5369 } |
5382 | 5370 |
5383 inline bool CanTrackAllocationSite(); | 5371 inline bool CanTrackAllocationSite(); |
5384 inline bool owns_descriptors(); | 5372 inline bool owns_descriptors(); |
5385 inline void set_owns_descriptors(bool is_shared); | 5373 inline void set_owns_descriptors(bool is_shared); |
5386 inline bool is_observed(); | 5374 inline bool is_observed(); |
5387 inline void set_is_observed(bool is_observed); | 5375 inline void set_is_observed(bool is_observed); |
5388 inline void freeze(); | |
5389 inline bool is_frozen(); | |
5390 inline void deprecate(); | 5376 inline void deprecate(); |
5391 inline bool is_deprecated(); | 5377 inline bool is_deprecated(); |
5392 inline bool CanBeDeprecated(); | 5378 inline bool CanBeDeprecated(); |
5393 // Returns a non-deprecated version of the input. If the input was not | 5379 // Returns a non-deprecated version of the input. If the input was not |
5394 // deprecated, it is directly returned. Otherwise, the non-deprecated version | 5380 // deprecated, it is directly returned. Otherwise, the non-deprecated version |
5395 // is found by re-transitioning from the root of the transition tree using the | 5381 // is found by re-transitioning from the root of the transition tree using the |
5396 // descriptor array of the map. Returns NULL if no updated map is found. | 5382 // descriptor array of the map. Returns NULL if no updated map is found. |
5397 Map* CurrentMapForDeprecated(); | 5383 Map* CurrentMapForDeprecated(); |
5398 | 5384 |
5399 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); | 5385 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); |
5400 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); | 5386 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); |
5401 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 5387 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
5402 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( | 5388 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( |
5403 DescriptorArray* descriptors, | 5389 DescriptorArray* descriptors, |
| 5390 Name* name, |
5404 TransitionFlag flag, | 5391 TransitionFlag flag, |
5405 Name* name = NULL, | 5392 int descriptor_index); |
5406 SimpleTransitionFlag simple_flag = FULL_TRANSITION); | |
5407 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( | 5393 MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( |
5408 int new_descriptor, | 5394 int new_descriptor, |
5409 DescriptorArray* descriptors); | 5395 DescriptorArray* descriptors); |
5410 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, | 5396 MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, |
5411 Descriptor* descriptor); | 5397 Descriptor* descriptor); |
5412 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, | 5398 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, |
5413 TransitionFlag flag); | 5399 TransitionFlag flag); |
5414 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, | 5400 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, |
5415 TransitionFlag flag); | 5401 TransitionFlag flag); |
5416 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( | 5402 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( |
(...skipping 4203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9620 } else { | 9606 } else { |
9621 value &= ~(1 << bit_position); | 9607 value &= ~(1 << bit_position); |
9622 } | 9608 } |
9623 return value; | 9609 return value; |
9624 } | 9610 } |
9625 }; | 9611 }; |
9626 | 9612 |
9627 } } // namespace v8::internal | 9613 } } // namespace v8::internal |
9628 | 9614 |
9629 #endif // V8_OBJECTS_H_ | 9615 #endif // V8_OBJECTS_H_ |
OLD | NEW |