| 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 "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1476 Handle<Object> object, | 1476 Handle<Object> object, |
| 1477 Handle<Context> context); | 1477 Handle<Context> context); |
| 1478 | 1478 |
| 1479 // Converts this to a Smi if possible. | 1479 // Converts this to a Smi if possible. |
| 1480 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, | 1480 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, |
| 1481 Handle<Object> object); | 1481 Handle<Object> object); |
| 1482 | 1482 |
| 1483 void Lookup(Handle<Name> name, LookupResult* result); | 1483 void Lookup(Handle<Name> name, LookupResult* result); |
| 1484 | 1484 |
| 1485 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); | 1485 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); |
| 1486 |
| 1487 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
| 1488 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1489 Handle<Object> object, Handle<Name> key, Handle<Object> value, |
| 1490 StrictMode strict_mode, |
| 1491 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 1492 |
| 1486 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1493 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1487 LookupIterator* it, Handle<Object> value, StrictMode strict_mode, | 1494 LookupIterator* it, Handle<Object> value, StrictMode strict_mode, |
| 1488 StoreFromKeyed store_mode); | 1495 StoreFromKeyed store_mode); |
| 1489 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( | 1496 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
| 1490 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); | 1497 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); |
| 1491 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( | 1498 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( |
| 1492 LookupIterator* it, Handle<Object> value); | 1499 LookupIterator* it, Handle<Object> value); |
| 1493 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( | 1500 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( |
| 1494 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, | 1501 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 1495 StrictMode strict_mode, StoreFromKeyed store_mode); | 1502 StrictMode strict_mode, StoreFromKeyed store_mode); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 | 1941 |
| 1935 // Internal properties (e.g. the hidden properties dictionary) might | 1942 // Internal properties (e.g. the hidden properties dictionary) might |
| 1936 // be added even though the receiver is non-extensible. | 1943 // be added even though the receiver is non-extensible. |
| 1937 enum ExtensibilityCheck { | 1944 enum ExtensibilityCheck { |
| 1938 PERFORM_EXTENSIBILITY_CHECK, | 1945 PERFORM_EXTENSIBILITY_CHECK, |
| 1939 OMIT_EXTENSIBILITY_CHECK | 1946 OMIT_EXTENSIBILITY_CHECK |
| 1940 }; | 1947 }; |
| 1941 | 1948 |
| 1942 DECLARE_CAST(JSReceiver) | 1949 DECLARE_CAST(JSReceiver) |
| 1943 | 1950 |
| 1944 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | |
| 1945 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | |
| 1946 Handle<JSReceiver> object, | |
| 1947 Handle<Name> key, | |
| 1948 Handle<Object> value, | |
| 1949 StrictMode strict_mode, | |
| 1950 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | |
| 1951 MUST_USE_RESULT static MaybeHandle<Object> SetElement( | 1951 MUST_USE_RESULT static MaybeHandle<Object> SetElement( |
| 1952 Handle<JSReceiver> object, | 1952 Handle<JSReceiver> object, |
| 1953 uint32_t index, | 1953 uint32_t index, |
| 1954 Handle<Object> value, | 1954 Handle<Object> value, |
| 1955 PropertyAttributes attributes, | 1955 PropertyAttributes attributes, |
| 1956 StrictMode strict_mode); | 1956 StrictMode strict_mode); |
| 1957 | 1957 |
| 1958 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. | 1958 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. |
| 1959 static inline bool HasProperty(Handle<JSReceiver> object, Handle<Name> name); | 1959 static inline bool HasProperty(Handle<JSReceiver> object, Handle<Name> name); |
| 1960 static inline bool HasOwnProperty(Handle<JSReceiver>, Handle<Name> name); | 1960 static inline bool HasOwnProperty(Handle<JSReceiver>, Handle<Name> name); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 | 2016 |
| 2017 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; | 2017 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; |
| 2018 | 2018 |
| 2019 // Computes the enumerable keys for a JSObject. Used for implementing | 2019 // Computes the enumerable keys for a JSObject. Used for implementing |
| 2020 // "for (n in object) { }". | 2020 // "for (n in object) { }". |
| 2021 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( | 2021 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( |
| 2022 Handle<JSReceiver> object, | 2022 Handle<JSReceiver> object, |
| 2023 KeyCollectionType type); | 2023 KeyCollectionType type); |
| 2024 | 2024 |
| 2025 private: | 2025 private: |
| 2026 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | |
| 2027 Handle<JSReceiver> receiver, | |
| 2028 LookupResult* result, | |
| 2029 Handle<Name> key, | |
| 2030 Handle<Object> value, | |
| 2031 StrictMode strict_mode, | |
| 2032 StoreFromKeyed store_from_keyed); | |
| 2033 | |
| 2034 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 2026 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
| 2035 }; | 2027 }; |
| 2036 | 2028 |
| 2037 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable. | 2029 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable. |
| 2038 class ObjectHashTable; | 2030 class ObjectHashTable; |
| 2039 | 2031 |
| 2040 // Forward declaration for JSObject::Copy. | 2032 // Forward declaration for JSObject::Copy. |
| 2041 class AllocationSite; | 2033 class AllocationSite; |
| 2042 | 2034 |
| 2043 | 2035 |
| (...skipping 9163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11207 } else { | 11199 } else { |
| 11208 value &= ~(1 << bit_position); | 11200 value &= ~(1 << bit_position); |
| 11209 } | 11201 } |
| 11210 return value; | 11202 return value; |
| 11211 } | 11203 } |
| 11212 }; | 11204 }; |
| 11213 | 11205 |
| 11214 } } // namespace v8::internal | 11206 } } // namespace v8::internal |
| 11215 | 11207 |
| 11216 #endif // V8_OBJECTS_H_ | 11208 #endif // V8_OBJECTS_H_ |
| OLD | NEW |