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