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 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 public: | 1793 public: |
1794 DECLARE_CAST(JSReceiver) | 1794 DECLARE_CAST(JSReceiver) |
1795 | 1795 |
1796 // ES6 section 7.1.1 ToPrimitive | 1796 // ES6 section 7.1.1 ToPrimitive |
1797 MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive( | 1797 MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive( |
1798 Handle<JSReceiver> receiver, | 1798 Handle<JSReceiver> receiver, |
1799 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); | 1799 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); |
1800 MUST_USE_RESULT static MaybeHandle<Object> OrdinaryToPrimitive( | 1800 MUST_USE_RESULT static MaybeHandle<Object> OrdinaryToPrimitive( |
1801 Handle<JSReceiver> receiver, OrdinaryToPrimitiveHint hint); | 1801 Handle<JSReceiver> receiver, OrdinaryToPrimitiveHint hint); |
1802 | 1802 |
| 1803 static MaybeHandle<Context> GetFunctionRealm(Handle<JSReceiver> receiver); |
| 1804 |
1803 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | 1805 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
1804 MUST_USE_RESULT static Maybe<bool> HasProperty(LookupIterator* it); | 1806 MUST_USE_RESULT static Maybe<bool> HasProperty(LookupIterator* it); |
1805 MUST_USE_RESULT static inline Maybe<bool> HasProperty( | 1807 MUST_USE_RESULT static inline Maybe<bool> HasProperty( |
1806 Handle<JSReceiver> object, Handle<Name> name); | 1808 Handle<JSReceiver> object, Handle<Name> name); |
1807 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, | 1809 MUST_USE_RESULT static inline Maybe<bool> HasOwnProperty(Handle<JSReceiver>, |
1808 Handle<Name> name); | 1810 Handle<Name> name); |
1809 MUST_USE_RESULT static inline Maybe<bool> HasElement( | 1811 MUST_USE_RESULT static inline Maybe<bool> HasElement( |
1810 Handle<JSReceiver> object, uint32_t index); | 1812 Handle<JSReceiver> object, uint32_t index); |
1811 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( | 1813 MUST_USE_RESULT static inline Maybe<bool> HasOwnElement( |
1812 Handle<JSReceiver> object, uint32_t index); | 1814 Handle<JSReceiver> object, uint32_t index); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 // properties is a FixedArray in the fast case and a Dictionary in the | 1950 // properties is a FixedArray in the fast case and a Dictionary in the |
1949 // slow case. | 1951 // slow case. |
1950 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 1952 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
1951 inline void initialize_properties(); | 1953 inline void initialize_properties(); |
1952 inline bool HasFastProperties(); | 1954 inline bool HasFastProperties(); |
1953 // Gets slow properties for non-global objects. | 1955 // Gets slow properties for non-global objects. |
1954 inline NameDictionary* property_dictionary(); | 1956 inline NameDictionary* property_dictionary(); |
1955 // Gets global object properties. | 1957 // Gets global object properties. |
1956 inline GlobalDictionary* global_dictionary(); | 1958 inline GlobalDictionary* global_dictionary(); |
1957 | 1959 |
| 1960 static MaybeHandle<Context> GetFunctionRealm(Handle<JSObject> object); |
| 1961 |
1958 // [elements]: The elements (properties with names that are integers). | 1962 // [elements]: The elements (properties with names that are integers). |
1959 // | 1963 // |
1960 // Elements can be in two general modes: fast and slow. Each mode | 1964 // Elements can be in two general modes: fast and slow. Each mode |
1961 // corrensponds to a set of object representations of elements that | 1965 // corrensponds to a set of object representations of elements that |
1962 // have something in common. | 1966 // have something in common. |
1963 // | 1967 // |
1964 // In the fast mode elements is a FixedArray and so each element can | 1968 // In the fast mode elements is a FixedArray and so each element can |
1965 // be quickly accessed. This fact is used in the generated code. The | 1969 // be quickly accessed. This fact is used in the generated code. The |
1966 // elements array can have one of three maps in this mode: | 1970 // elements array can have one of three maps in this mode: |
1967 // fixed_array_map, sloppy_arguments_elements_map or | 1971 // fixed_array_map, sloppy_arguments_elements_map or |
(...skipping 5226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7194 // [shared]: The information about the function that | 7198 // [shared]: The information about the function that |
7195 // can be shared by instances. | 7199 // can be shared by instances. |
7196 DECL_ACCESSORS(shared, SharedFunctionInfo) | 7200 DECL_ACCESSORS(shared, SharedFunctionInfo) |
7197 | 7201 |
7198 // [context]: The context for this function. | 7202 // [context]: The context for this function. |
7199 inline Context* context(); | 7203 inline Context* context(); |
7200 inline void set_context(Object* context); | 7204 inline void set_context(Object* context); |
7201 inline JSObject* global_proxy(); | 7205 inline JSObject* global_proxy(); |
7202 inline Context* native_context(); | 7206 inline Context* native_context(); |
7203 | 7207 |
| 7208 static MaybeHandle<Context> GetFunctionRealm(Handle<JSFunction> function); |
| 7209 |
7204 // [code]: The generated code object for this function. Executed | 7210 // [code]: The generated code object for this function. Executed |
7205 // when the function is invoked, e.g. foo() or new foo(). See | 7211 // when the function is invoked, e.g. foo() or new foo(). See |
7206 // [[Call]] and [[Construct]] description in ECMA-262, section | 7212 // [[Call]] and [[Construct]] description in ECMA-262, section |
7207 // 8.6.2, page 27. | 7213 // 8.6.2, page 27. |
7208 inline Code* code(); | 7214 inline Code* code(); |
7209 inline void set_code(Code* code); | 7215 inline void set_code(Code* code); |
7210 inline void set_code_no_write_barrier(Code* code); | 7216 inline void set_code_no_write_barrier(Code* code); |
7211 inline void ReplaceCode(Code* code); | 7217 inline void ReplaceCode(Code* code); |
7212 | 7218 |
7213 // Tells whether this function inlines the given shared function info. | 7219 // Tells whether this function inlines the given shared function info. |
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9488 // The JSProxy describes EcmaScript Harmony proxies | 9494 // The JSProxy describes EcmaScript Harmony proxies |
9489 class JSProxy: public JSReceiver { | 9495 class JSProxy: public JSReceiver { |
9490 public: | 9496 public: |
9491 // [handler]: The handler property. | 9497 // [handler]: The handler property. |
9492 DECL_ACCESSORS(handler, Object) | 9498 DECL_ACCESSORS(handler, Object) |
9493 // [target]: The target property. | 9499 // [target]: The target property. |
9494 DECL_ACCESSORS(target, Object) | 9500 DECL_ACCESSORS(target, Object) |
9495 // [hash]: The hash code property (undefined if not initialized yet). | 9501 // [hash]: The hash code property (undefined if not initialized yet). |
9496 DECL_ACCESSORS(hash, Object) | 9502 DECL_ACCESSORS(hash, Object) |
9497 | 9503 |
| 9504 static MaybeHandle<Context> GetFunctionRealm(Handle<JSProxy> proxy); |
| 9505 |
9498 inline bool has_handler(); | 9506 inline bool has_handler(); |
9499 | 9507 |
9500 DECLARE_CAST(JSProxy) | 9508 DECLARE_CAST(JSProxy) |
9501 | 9509 |
9502 static bool IsRevoked(Handle<JSProxy> proxy); | 9510 static bool IsRevoked(Handle<JSProxy> proxy); |
9503 | 9511 |
9504 // ES6 9.5.1 | 9512 // ES6 9.5.1 |
9505 static MaybeHandle<Object> GetPrototype(Handle<JSProxy> receiver); | 9513 static MaybeHandle<Object> GetPrototype(Handle<JSProxy> receiver); |
9506 | 9514 |
9507 // ES6 9.5.3 | 9515 // ES6 9.5.3 |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10719 } | 10727 } |
10720 return value; | 10728 return value; |
10721 } | 10729 } |
10722 }; | 10730 }; |
10723 | 10731 |
10724 | 10732 |
10725 } // NOLINT, false-positive due to second-order macros. | 10733 } // NOLINT, false-positive due to second-order macros. |
10726 } // NOLINT, false-positive due to second-order macros. | 10734 } // NOLINT, false-positive due to second-order macros. |
10727 | 10735 |
10728 #endif // V8_OBJECTS_H_ | 10736 #endif // V8_OBJECTS_H_ |
OLD | NEW |