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 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2541 inline void Get(int descriptor_number, Descriptor* desc); | 2541 inline void Get(int descriptor_number, Descriptor* desc); |
2542 inline void Set(int descriptor_number, | 2542 inline void Set(int descriptor_number, |
2543 Descriptor* desc, | 2543 Descriptor* desc, |
2544 const WhitenessWitness&); | 2544 const WhitenessWitness&); |
2545 // Append automatically sets the enumeration index. This should only be used | 2545 // Append automatically sets the enumeration index. This should only be used |
2546 // to add descriptors in bulk at the end, followed by sorting the descriptor | 2546 // to add descriptors in bulk at the end, followed by sorting the descriptor |
2547 // array. | 2547 // array. |
2548 inline void Append(Descriptor* desc, | 2548 inline void Append(Descriptor* desc, |
2549 const WhitenessWitness&); | 2549 const WhitenessWitness&); |
2550 | 2550 |
2551 // Transfer a complete descriptor from the src descriptor array to the dst | |
2552 // one, dropping map transitions in CALLBACKS. | |
2553 static void CopyFrom(Handle<DescriptorArray> dst, | |
2554 int dst_index, | |
2555 Handle<DescriptorArray> src, | |
2556 int src_index, | |
2557 const WhitenessWitness& witness); | |
2558 | |
2559 // Transfer a complete descriptor from the src descriptor array to this | 2551 // Transfer a complete descriptor from the src descriptor array to this |
2560 // descriptor array, dropping map transitions in CALLBACKS. | 2552 // descriptor array. |
2561 MUST_USE_RESULT MaybeObject* CopyFrom(int dst_index, | 2553 void CopyFrom(int dst_index, |
2562 DescriptorArray* src, | 2554 DescriptorArray* src, |
2563 int src_index, | 2555 int src_index, |
2564 const WhitenessWitness&); | 2556 const WhitenessWitness&); |
2565 | 2557 |
2566 // Copy the descriptor array, insert a new descriptor and optionally | 2558 // Copy the descriptor array, insert a new descriptor and optionally |
2567 // remove map transitions. If the descriptor is already present, it is | 2559 // remove map transitions. If the descriptor is already present, it is |
2568 // replaced. If a replaced descriptor is a real property (not a transition | 2560 // replaced. If a replaced descriptor is a real property (not a transition |
2569 // or null), its enumeration index is kept as is. | 2561 // or null), its enumeration index is kept as is. |
2570 // If adding a real property, map transitions must be removed. If adding | 2562 // If adding a real property, map transitions must be removed. If adding |
2571 // a transition, they must not be removed. All null descriptors are removed. | 2563 // a transition, they must not be removed. All null descriptors are removed. |
2572 MUST_USE_RESULT MaybeObject* CopyInsert(Descriptor* descriptor); | 2564 MUST_USE_RESULT MaybeObject* CopyInsert(Descriptor* descriptor); |
2573 MUST_USE_RESULT MaybeObject* CopyAdd(Descriptor* descriptor); | 2565 MUST_USE_RESULT MaybeObject* CopyAdd(Descriptor* descriptor); |
2574 MUST_USE_RESULT MaybeObject* CopyReplace(Descriptor* descriptor, | 2566 MUST_USE_RESULT MaybeObject* CopyReplace(Descriptor* descriptor, |
(...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4808 | 4800 |
4809 static bool IsValidElementsTransition(ElementsKind from_kind, | 4801 static bool IsValidElementsTransition(ElementsKind from_kind, |
4810 ElementsKind to_kind); | 4802 ElementsKind to_kind); |
4811 | 4803 |
4812 inline bool HasTransitionArray(); | 4804 inline bool HasTransitionArray(); |
4813 inline bool HasElementsTransition(); | 4805 inline bool HasElementsTransition(); |
4814 inline Map* elements_transition_map(); | 4806 inline Map* elements_transition_map(); |
4815 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( | 4807 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( |
4816 Map* transitioned_map); | 4808 Map* transitioned_map); |
4817 inline TransitionArray* transitions(); | 4809 inline TransitionArray* transitions(); |
4818 inline void SetTransition(int index, Object* value); | 4810 inline void SetTransition(int index, Map* target); |
4819 MUST_USE_RESULT inline MaybeObject* AddTransition(String* key, Object* value); | 4811 MUST_USE_RESULT inline MaybeObject* AddTransition(String* key, Map* target); |
4820 MUST_USE_RESULT inline MaybeObject* set_transitions( | 4812 MUST_USE_RESULT inline MaybeObject* set_transitions( |
4821 TransitionArray* transitions); | 4813 TransitionArray* transitions); |
4822 inline void ClearTransitions(Heap* heap, | 4814 inline void ClearTransitions(Heap* heap, |
4823 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 4815 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
4824 | 4816 |
4825 // Tells whether the map is attached to SharedFunctionInfo | 4817 // Tells whether the map is attached to SharedFunctionInfo |
4826 // (for inobject slack tracking). | 4818 // (for inobject slack tracking). |
4827 inline void set_attached_to_shared_function_info(bool value); | 4819 inline void set_attached_to_shared_function_info(bool value); |
4828 | 4820 |
4829 inline bool attached_to_shared_function_info(); | 4821 inline bool attached_to_shared_function_info(); |
(...skipping 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8340 // * undefined: considered an accessor by the spec, too, strangely enough | 8332 // * undefined: considered an accessor by the spec, too, strangely enough |
8341 // * the hole: an accessor which has not been set | 8333 // * the hole: an accessor which has not been set |
8342 // * a pointer to a map: a transition used to ensure map sharing | 8334 // * a pointer to a map: a transition used to ensure map sharing |
8343 class AccessorPair: public Struct { | 8335 class AccessorPair: public Struct { |
8344 public: | 8336 public: |
8345 DECL_ACCESSORS(getter, Object) | 8337 DECL_ACCESSORS(getter, Object) |
8346 DECL_ACCESSORS(setter, Object) | 8338 DECL_ACCESSORS(setter, Object) |
8347 | 8339 |
8348 static inline AccessorPair* cast(Object* obj); | 8340 static inline AccessorPair* cast(Object* obj); |
8349 | 8341 |
8350 MUST_USE_RESULT MaybeObject* CopyWithoutTransitions(); | 8342 MUST_USE_RESULT MaybeObject* Copy(); |
8351 | 8343 |
8352 Object* get(AccessorComponent component) { | 8344 Object* get(AccessorComponent component) { |
8353 return component == ACCESSOR_GETTER ? getter() : setter(); | 8345 return component == ACCESSOR_GETTER ? getter() : setter(); |
8354 } | 8346 } |
8355 | 8347 |
8356 void set(AccessorComponent component, Object* value) { | 8348 void set(AccessorComponent component, Object* value) { |
8357 if (component == ACCESSOR_GETTER) { | 8349 if (component == ACCESSOR_GETTER) { |
8358 set_getter(value); | 8350 set_getter(value); |
8359 } else { | 8351 } else { |
8360 set_setter(value); | 8352 set_setter(value); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8889 } else { | 8881 } else { |
8890 value &= ~(1 << bit_position); | 8882 value &= ~(1 << bit_position); |
8891 } | 8883 } |
8892 return value; | 8884 return value; |
8893 } | 8885 } |
8894 }; | 8886 }; |
8895 | 8887 |
8896 } } // namespace v8::internal | 8888 } } // namespace v8::internal |
8897 | 8889 |
8898 #endif // V8_OBJECTS_H_ | 8890 #endif // V8_OBJECTS_H_ |
OLD | NEW |