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