OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include "allocation.h" | 8 #include "allocation.h" |
9 #include "assert-scope.h" | 9 #include "assert-scope.h" |
10 #include "builtins.h" | 10 #include "builtins.h" |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 // unexisting elements below limit from position zero of the elements. | 2122 // unexisting elements below limit from position zero of the elements. |
2123 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, | 2123 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
2124 uint32_t limit); | 2124 uint32_t limit); |
2125 | 2125 |
2126 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithCallback( | 2126 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithCallback( |
2127 Handle<JSObject> object, | 2127 Handle<JSObject> object, |
2128 Handle<Object> receiver, | 2128 Handle<Object> receiver, |
2129 Handle<Object> structure, | 2129 Handle<Object> structure, |
2130 Handle<Name> name); | 2130 Handle<Name> name); |
2131 | 2131 |
2132 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithCallback( | |
2133 Handle<JSObject> object, | |
2134 Handle<Object> structure, | |
2135 Handle<Name> name, | |
2136 Handle<Object> value, | |
2137 Handle<JSObject> holder, | |
2138 StrictMode strict_mode); | |
2139 | |
2140 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( | 2132 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( |
2141 Handle<JSObject> object, | 2133 Handle<JSObject> object, |
2142 Handle<Name> name, | 2134 Handle<Name> name, |
2143 Handle<Object> value, | 2135 Handle<Object> value, |
2144 PropertyAttributes attributes, | 2136 PropertyAttributes attributes, |
2145 StrictMode strict_mode); | 2137 StrictMode strict_mode); |
2146 | 2138 |
2147 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult( | 2139 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult( |
2148 Handle<JSObject> object, | 2140 Handle<JSObject> object, |
2149 LookupResult* result, | 2141 LookupResult* result, |
2150 Handle<Name> name, | 2142 Handle<Name> name, |
2151 Handle<Object> value, | 2143 Handle<Object> value, |
2152 PropertyAttributes attributes, | 2144 PropertyAttributes attributes, |
2153 StrictMode strict_mode, | 2145 StrictMode strict_mode, |
2154 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 2146 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
2155 | 2147 |
| 2148 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to |
| 2149 // grant an exemption to ExecutableAccessor callbacks in some cases. |
| 2150 enum ExecutableAccessorInfoHandling { |
| 2151 DEFAULT_HANDLING, |
| 2152 DONT_FORCE_FIELD |
| 2153 }; |
| 2154 |
2156 MUST_USE_RESULT static MaybeHandle<Object> SetLocalPropertyIgnoreAttributes( | 2155 MUST_USE_RESULT static MaybeHandle<Object> SetLocalPropertyIgnoreAttributes( |
2157 Handle<JSObject> object, | 2156 Handle<JSObject> object, |
2158 Handle<Name> key, | 2157 Handle<Name> key, |
2159 Handle<Object> value, | 2158 Handle<Object> value, |
2160 PropertyAttributes attributes, | 2159 PropertyAttributes attributes, |
2161 ValueType value_type = OPTIMAL_REPRESENTATION, | 2160 ValueType value_type = OPTIMAL_REPRESENTATION, |
2162 StoreMode mode = ALLOW_AS_CONSTANT, | 2161 StoreMode mode = ALLOW_AS_CONSTANT, |
2163 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2162 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
2164 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 2163 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 2164 ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING); |
2165 | 2165 |
2166 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); | 2166 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); |
2167 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); | 2167 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); |
2168 | 2168 |
2169 // Try to follow an existing transition to a field with attributes NONE. The | 2169 // Try to follow an existing transition to a field with attributes NONE. The |
2170 // return value indicates whether the transition was successful. | 2170 // return value indicates whether the transition was successful. |
2171 static inline Handle<Map> FindTransitionToField(Handle<Map> map, | 2171 static inline Handle<Map> FindTransitionToField(Handle<Map> map, |
2172 Handle<Name> key); | 2172 Handle<Name> key); |
2173 | 2173 |
2174 // Extend the receiver with a single fast property appeared first in the | 2174 // Extend the receiver with a single fast property appeared first in the |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 Handle<Object> old_value); | 2660 Handle<Object> old_value); |
2661 | 2661 |
2662 private: | 2662 private: |
2663 friend class DictionaryElementsAccessor; | 2663 friend class DictionaryElementsAccessor; |
2664 friend class JSReceiver; | 2664 friend class JSReceiver; |
2665 friend class Object; | 2665 friend class Object; |
2666 | 2666 |
2667 static void UpdateAllocationSite(Handle<JSObject> object, | 2667 static void UpdateAllocationSite(Handle<JSObject> object, |
2668 ElementsKind to_kind); | 2668 ElementsKind to_kind); |
2669 | 2669 |
| 2670 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithCallback( |
| 2671 Handle<JSObject> object, |
| 2672 Handle<Object> structure, |
| 2673 Handle<Name> name, |
| 2674 Handle<Object> value, |
| 2675 Handle<JSObject> holder, |
| 2676 StrictMode strict_mode); |
| 2677 |
2670 // Used from Object::GetProperty(). | 2678 // Used from Object::GetProperty(). |
2671 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( | 2679 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( |
2672 Handle<JSObject> object, | 2680 Handle<JSObject> object, |
2673 Handle<Object> receiver, | 2681 Handle<Object> receiver, |
2674 LookupResult* result, | 2682 LookupResult* result, |
2675 Handle<Name> name, | 2683 Handle<Name> name, |
2676 PropertyAttributes* attributes); | 2684 PropertyAttributes* attributes); |
2677 | 2685 |
2678 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithCallback( | 2686 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithCallback( |
2679 Handle<JSObject> object, | 2687 Handle<JSObject> object, |
(...skipping 7904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10584 | 10592 |
10585 // Dispatched behavior. | 10593 // Dispatched behavior. |
10586 DECLARE_PRINTER(ExecutableAccessorInfo) | 10594 DECLARE_PRINTER(ExecutableAccessorInfo) |
10587 DECLARE_VERIFIER(ExecutableAccessorInfo) | 10595 DECLARE_VERIFIER(ExecutableAccessorInfo) |
10588 | 10596 |
10589 static const int kGetterOffset = AccessorInfo::kSize; | 10597 static const int kGetterOffset = AccessorInfo::kSize; |
10590 static const int kSetterOffset = kGetterOffset + kPointerSize; | 10598 static const int kSetterOffset = kGetterOffset + kPointerSize; |
10591 static const int kDataOffset = kSetterOffset + kPointerSize; | 10599 static const int kDataOffset = kSetterOffset + kPointerSize; |
10592 static const int kSize = kDataOffset + kPointerSize; | 10600 static const int kSize = kDataOffset + kPointerSize; |
10593 | 10601 |
| 10602 inline void clear_setter(); |
| 10603 |
10594 private: | 10604 private: |
10595 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); | 10605 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); |
10596 }; | 10606 }; |
10597 | 10607 |
10598 | 10608 |
10599 // Support for JavaScript accessors: A pair of a getter and a setter. Each | 10609 // Support for JavaScript accessors: A pair of a getter and a setter. Each |
10600 // accessor can either be | 10610 // accessor can either be |
10601 // * a pointer to a JavaScript function or proxy: a real accessor | 10611 // * a pointer to a JavaScript function or proxy: a real accessor |
10602 // * undefined: considered an accessor by the spec, too, strangely enough | 10612 // * undefined: considered an accessor by the spec, too, strangely enough |
10603 // * the hole: an accessor which has not been set | 10613 // * the hole: an accessor which has not been set |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11119 } else { | 11129 } else { |
11120 value &= ~(1 << bit_position); | 11130 value &= ~(1 << bit_position); |
11121 } | 11131 } |
11122 return value; | 11132 return value; |
11123 } | 11133 } |
11124 }; | 11134 }; |
11125 | 11135 |
11126 } } // namespace v8::internal | 11136 } } // namespace v8::internal |
11127 | 11137 |
11128 #endif // V8_OBJECTS_H_ | 11138 #endif // V8_OBJECTS_H_ |
OLD | NEW |