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