| 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 <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 | 1026 |
| 1027 INLINE(bool IsStruct() const); | 1027 INLINE(bool IsStruct() const); |
| 1028 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ | 1028 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ |
| 1029 INLINE(bool Is##Name() const); | 1029 INLINE(bool Is##Name() const); |
| 1030 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 1030 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
| 1031 #undef DECLARE_STRUCT_PREDICATE | 1031 #undef DECLARE_STRUCT_PREDICATE |
| 1032 | 1032 |
| 1033 // ES6, section 7.2.3 IsCallable. | 1033 // ES6, section 7.2.3 IsCallable. |
| 1034 INLINE(bool IsCallable() const); | 1034 INLINE(bool IsCallable() const); |
| 1035 | 1035 |
| 1036 // ES6, section 7.2.4 IsConstructor. |
| 1037 INLINE(bool IsConstructor() const); |
| 1038 |
| 1036 INLINE(bool IsSpecObject()) const; | 1039 INLINE(bool IsSpecObject()) const; |
| 1037 INLINE(bool IsTemplateInfo()) const; | 1040 INLINE(bool IsTemplateInfo()) const; |
| 1038 INLINE(bool IsNameDictionary() const); | 1041 INLINE(bool IsNameDictionary() const); |
| 1039 INLINE(bool IsGlobalDictionary() const); | 1042 INLINE(bool IsGlobalDictionary() const); |
| 1040 INLINE(bool IsSeededNumberDictionary() const); | 1043 INLINE(bool IsSeededNumberDictionary() const); |
| 1041 INLINE(bool IsUnseededNumberDictionary() const); | 1044 INLINE(bool IsUnseededNumberDictionary() const); |
| 1042 INLINE(bool IsOrderedHashSet() const); | 1045 INLINE(bool IsOrderedHashSet() const); |
| 1043 INLINE(bool IsOrderedHashMap() const); | 1046 INLINE(bool IsOrderedHashMap() const); |
| 1044 static bool IsPromise(Handle<Object> object); | 1047 static bool IsPromise(Handle<Object> object); |
| 1045 | 1048 |
| (...skipping 4309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5355 static const int kRetainingCounterEnd = 0; | 5358 static const int kRetainingCounterEnd = 0; |
| 5356 | 5359 |
| 5357 // Tells whether the object in the prototype property will be used | 5360 // Tells whether the object in the prototype property will be used |
| 5358 // for instances created from this function. If the prototype | 5361 // for instances created from this function. If the prototype |
| 5359 // property is set to a value that is not a JSObject, the prototype | 5362 // property is set to a value that is not a JSObject, the prototype |
| 5360 // property will not be used to create instances of the function. | 5363 // property will not be used to create instances of the function. |
| 5361 // See ECMA-262, 13.2.2. | 5364 // See ECMA-262, 13.2.2. |
| 5362 inline void set_non_instance_prototype(bool value); | 5365 inline void set_non_instance_prototype(bool value); |
| 5363 inline bool has_non_instance_prototype(); | 5366 inline bool has_non_instance_prototype(); |
| 5364 | 5367 |
| 5365 // Tells whether function has special prototype property. If not, prototype | 5368 // Tells whether the instance has a [[Construct]] internal method. |
| 5366 // property will not be created when accessed (will return undefined), | 5369 // This property is implemented according to ES6, section 7.2.4. |
| 5367 // and construction from this function will not be allowed. | 5370 inline void set_is_constructor(bool value); |
| 5368 inline void set_function_with_prototype(bool value); | 5371 inline bool is_constructor() const; |
| 5369 inline bool function_with_prototype(); | |
| 5370 | 5372 |
| 5371 // Tells whether the instance with this map should be ignored by the | 5373 // Tells whether the instance with this map should be ignored by the |
| 5372 // Object.getPrototypeOf() function and the __proto__ accessor. | 5374 // Object.getPrototypeOf() function and the __proto__ accessor. |
| 5373 inline void set_is_hidden_prototype(); | 5375 inline void set_is_hidden_prototype(); |
| 5374 inline bool is_hidden_prototype() const; | 5376 inline bool is_hidden_prototype() const; |
| 5375 | 5377 |
| 5376 // Records and queries whether the instance has a named interceptor. | 5378 // Records and queries whether the instance has a named interceptor. |
| 5377 inline void set_has_named_interceptor(); | 5379 inline void set_has_named_interceptor(); |
| 5378 inline bool has_named_interceptor(); | 5380 inline bool has_named_interceptor(); |
| 5379 | 5381 |
| 5380 // Records and queries whether the instance has an indexed interceptor. | 5382 // Records and queries whether the instance has an indexed interceptor. |
| 5381 inline void set_has_indexed_interceptor(); | 5383 inline void set_has_indexed_interceptor(); |
| 5382 inline bool has_indexed_interceptor(); | 5384 inline bool has_indexed_interceptor(); |
| 5383 | 5385 |
| 5384 // Tells whether the instance is undetectable. | 5386 // Tells whether the instance is undetectable. |
| 5385 // An undetectable object is a special class of JSObject: 'typeof' operator | 5387 // An undetectable object is a special class of JSObject: 'typeof' operator |
| 5386 // returns undefined, ToBoolean returns false. Otherwise it behaves like | 5388 // returns undefined, ToBoolean returns false. Otherwise it behaves like |
| 5387 // a normal JS object. It is useful for implementing undetectable | 5389 // a normal JS object. It is useful for implementing undetectable |
| 5388 // document.all in Firefox & Safari. | 5390 // document.all in Firefox & Safari. |
| 5389 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549. | 5391 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549. |
| 5390 inline void set_is_undetectable(); | 5392 inline void set_is_undetectable(); |
| 5391 inline bool is_undetectable(); | 5393 inline bool is_undetectable(); |
| 5392 | 5394 |
| 5393 // Tells whether the instance has a call-as-function handler. | 5395 // Tells whether the instance has a call-as-function handler. |
| 5394 inline void set_is_observed(); | 5396 inline void set_is_observed(); |
| 5395 inline bool is_observed(); | 5397 inline bool is_observed(); |
| 5396 | 5398 |
| 5397 // Tells whether the instance has a [[Call]] internal field. | 5399 // Tells whether the instance has a [[Call]] internal method. |
| 5398 // This property is implemented according to ES6, section 7.2.3. | 5400 // This property is implemented according to ES6, section 7.2.3. |
| 5399 inline void set_is_callable(); | 5401 inline void set_is_callable(); |
| 5400 inline bool is_callable() const; | 5402 inline bool is_callable() const; |
| 5401 | 5403 |
| 5402 inline void set_is_strong(); | 5404 inline void set_is_strong(); |
| 5403 inline bool is_strong(); | 5405 inline bool is_strong(); |
| 5404 inline void set_is_extensible(bool value); | 5406 inline void set_is_extensible(bool value); |
| 5405 inline bool is_extensible(); | 5407 inline bool is_extensible(); |
| 5406 inline void set_is_prototype_map(bool value); | 5408 inline void set_is_prototype_map(bool value); |
| 5407 inline bool is_prototype_map() const; | 5409 inline bool is_prototype_map() const; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5716 // elements_kind that's found in |candidates|, or null handle if no match is | 5718 // elements_kind that's found in |candidates|, or null handle if no match is |
| 5717 // found at all. | 5719 // found at all. |
| 5718 static Handle<Map> FindTransitionedMap(Handle<Map> map, | 5720 static Handle<Map> FindTransitionedMap(Handle<Map> map, |
| 5719 MapHandleList* candidates); | 5721 MapHandleList* candidates); |
| 5720 | 5722 |
| 5721 inline bool CanTransition(); | 5723 inline bool CanTransition(); |
| 5722 | 5724 |
| 5723 inline bool IsPrimitiveMap(); | 5725 inline bool IsPrimitiveMap(); |
| 5724 inline bool IsJSObjectMap(); | 5726 inline bool IsJSObjectMap(); |
| 5725 inline bool IsJSArrayMap(); | 5727 inline bool IsJSArrayMap(); |
| 5728 inline bool IsJSFunctionMap(); |
| 5726 inline bool IsStringMap(); | 5729 inline bool IsStringMap(); |
| 5727 inline bool IsJSProxyMap(); | 5730 inline bool IsJSProxyMap(); |
| 5728 inline bool IsJSGlobalProxyMap(); | 5731 inline bool IsJSGlobalProxyMap(); |
| 5729 inline bool IsJSGlobalObjectMap(); | 5732 inline bool IsJSGlobalObjectMap(); |
| 5730 inline bool IsGlobalObjectMap(); | 5733 inline bool IsGlobalObjectMap(); |
| 5731 | 5734 |
| 5732 inline bool CanOmitMapChecks(); | 5735 inline bool CanOmitMapChecks(); |
| 5733 | 5736 |
| 5734 static void AddDependentCode(Handle<Map> map, | 5737 static void AddDependentCode(Handle<Map> map, |
| 5735 DependentCode::DependencyGroup group, | 5738 DependentCode::DependencyGroup group, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5820 Internals::kMapInstanceTypeAndBitFieldOffset); | 5823 Internals::kMapInstanceTypeAndBitFieldOffset); |
| 5821 | 5824 |
| 5822 // Bit positions for bit field. | 5825 // Bit positions for bit field. |
| 5823 static const int kHasNonInstancePrototype = 0; | 5826 static const int kHasNonInstancePrototype = 0; |
| 5824 static const int kIsCallable = 1; | 5827 static const int kIsCallable = 1; |
| 5825 static const int kHasNamedInterceptor = 2; | 5828 static const int kHasNamedInterceptor = 2; |
| 5826 static const int kHasIndexedInterceptor = 3; | 5829 static const int kHasIndexedInterceptor = 3; |
| 5827 static const int kIsUndetectable = 4; | 5830 static const int kIsUndetectable = 4; |
| 5828 static const int kIsObserved = 5; | 5831 static const int kIsObserved = 5; |
| 5829 static const int kIsAccessCheckNeeded = 6; | 5832 static const int kIsAccessCheckNeeded = 6; |
| 5830 class FunctionWithPrototype: public BitField<bool, 7, 1> {}; | 5833 static const int kIsConstructor = 7; |
| 5831 | 5834 |
| 5832 // Bit positions for bit field 2 | 5835 // Bit positions for bit field 2 |
| 5833 static const int kIsExtensible = 0; | 5836 static const int kIsExtensible = 0; |
| 5834 // Bit 1 is free. | 5837 // Bit 1 is free. |
| 5835 class IsPrototypeMapBits : public BitField<bool, 2, 1> {}; | 5838 class IsPrototypeMapBits : public BitField<bool, 2, 1> {}; |
| 5836 class ElementsKindBits: public BitField<ElementsKind, 3, 5> {}; | 5839 class ElementsKindBits: public BitField<ElementsKind, 3, 5> {}; |
| 5837 | 5840 |
| 5838 // Derived values from bit field 2 | 5841 // Derived values from bit field 2 |
| 5839 static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>( | 5842 static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>( |
| 5840 (FAST_ELEMENTS + 1) << Map::ElementsKindBits::kShift) - 1; | 5843 (FAST_ELEMENTS + 1) << Map::ElementsKindBits::kShift) - 1; |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7135 Handle<Object> value); | 7138 Handle<Object> value); |
| 7136 | 7139 |
| 7137 // Creates a new closure for the fucntion with the same bindings, | 7140 // Creates a new closure for the fucntion with the same bindings, |
| 7138 // bound values, and prototype. An equivalent of spec operations | 7141 // bound values, and prototype. An equivalent of spec operations |
| 7139 // ``CloneMethod`` and ``CloneBoundFunction``. | 7142 // ``CloneMethod`` and ``CloneBoundFunction``. |
| 7140 static Handle<JSFunction> CloneClosure(Handle<JSFunction> function); | 7143 static Handle<JSFunction> CloneClosure(Handle<JSFunction> function); |
| 7141 | 7144 |
| 7142 // After prototype is removed, it will not be created when accessed, and | 7145 // After prototype is removed, it will not be created when accessed, and |
| 7143 // [[Construct]] from this function will not be allowed. | 7146 // [[Construct]] from this function will not be allowed. |
| 7144 bool RemovePrototype(); | 7147 bool RemovePrototype(); |
| 7145 inline bool should_have_prototype(); | |
| 7146 | 7148 |
| 7147 // Accessor for this function's initial map's [[class]] | 7149 // Accessor for this function's initial map's [[class]] |
| 7148 // property. This is primarily used by ECMA native functions. This | 7150 // property. This is primarily used by ECMA native functions. This |
| 7149 // method sets the class_name field of this function's initial map | 7151 // method sets the class_name field of this function's initial map |
| 7150 // to a given value. It creates an initial map if this function does | 7152 // to a given value. It creates an initial map if this function does |
| 7151 // not have one. Note that this method does not copy the initial map | 7153 // not have one. Note that this method does not copy the initial map |
| 7152 // if it has one already, but simply replaces it with the new value. | 7154 // if it has one already, but simply replaces it with the new value. |
| 7153 // Instances created afterwards will have a map whose [[class]] is | 7155 // Instances created afterwards will have a map whose [[class]] is |
| 7154 // set to 'value', but there is no guarantees on instances created | 7156 // set to 'value', but there is no guarantees on instances created |
| 7155 // before. | 7157 // before. |
| (...skipping 3415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10571 | 10573 |
| 10572 Isolate* isolate_; | 10574 Isolate* isolate_; |
| 10573 Handle<FixedArray> keys_; | 10575 Handle<FixedArray> keys_; |
| 10574 Handle<OrderedHashSet> set_; | 10576 Handle<OrderedHashSet> set_; |
| 10575 int length_; | 10577 int length_; |
| 10576 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10578 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
| 10577 }; | 10579 }; |
| 10578 } } // namespace v8::internal | 10580 } } // namespace v8::internal |
| 10579 | 10581 |
| 10580 #endif // V8_OBJECTS_H_ | 10582 #endif // V8_OBJECTS_H_ |
| OLD | NEW |