| 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 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 bool BooleanValue(); // ECMA-262 9.2. | 1156 bool BooleanValue(); // ECMA-262 9.2. |
| 1157 | 1157 |
| 1158 // Convert to a JSObject if needed. | 1158 // Convert to a JSObject if needed. |
| 1159 // native_context is used when creating wrapper object. | 1159 // native_context is used when creating wrapper object. |
| 1160 static inline MaybeHandle<JSReceiver> ToObject(Isolate* isolate, | 1160 static inline MaybeHandle<JSReceiver> ToObject(Isolate* isolate, |
| 1161 Handle<Object> object); | 1161 Handle<Object> object); |
| 1162 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, | 1162 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, |
| 1163 Handle<Object> object, | 1163 Handle<Object> object, |
| 1164 Handle<Context> context); | 1164 Handle<Context> context); |
| 1165 | 1165 |
| 1166 // Converts this to a Smi if possible. | |
| 1167 MUST_USE_RESULT static inline MaybeHandle<Smi> ToSmi(Isolate* isolate, | |
| 1168 Handle<Object> object); | |
| 1169 | |
| 1170 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( | 1166 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( |
| 1171 LookupIterator* it, LanguageMode language_mode = SLOPPY); | 1167 LookupIterator* it, LanguageMode language_mode = SLOPPY); |
| 1172 | 1168 |
| 1173 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | 1169 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
| 1174 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1170 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1175 Handle<Object> object, Handle<Name> name, Handle<Object> value, | 1171 Handle<Object> object, Handle<Name> name, Handle<Object> value, |
| 1176 LanguageMode language_mode, | 1172 LanguageMode language_mode, |
| 1177 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 1173 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 1178 | 1174 |
| 1179 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( | 1175 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 static void EnsureCanContainElements( | 2008 static void EnsureCanContainElements( |
| 2013 Handle<JSObject> object, | 2009 Handle<JSObject> object, |
| 2014 Arguments* arguments, | 2010 Arguments* arguments, |
| 2015 uint32_t first_arg, | 2011 uint32_t first_arg, |
| 2016 uint32_t arg_count, | 2012 uint32_t arg_count, |
| 2017 EnsureElementsMode mode); | 2013 EnsureElementsMode mode); |
| 2018 | 2014 |
| 2019 // Would we convert a fast elements array to dictionary mode given | 2015 // Would we convert a fast elements array to dictionary mode given |
| 2020 // an access at key? | 2016 // an access at key? |
| 2021 bool WouldConvertToSlowElements(uint32_t index); | 2017 bool WouldConvertToSlowElements(uint32_t index); |
| 2022 inline bool WouldConvertToSlowElements(Handle<Object> key); | |
| 2023 | 2018 |
| 2024 // Computes the new capacity when expanding the elements of a JSObject. | 2019 // Computes the new capacity when expanding the elements of a JSObject. |
| 2025 static uint32_t NewElementsCapacity(uint32_t old_capacity) { | 2020 static uint32_t NewElementsCapacity(uint32_t old_capacity) { |
| 2026 // (old_capacity + 50%) + 16 | 2021 // (old_capacity + 50%) + 16 |
| 2027 return old_capacity + (old_capacity >> 1) + 16; | 2022 return old_capacity + (old_capacity >> 1) + 16; |
| 2028 } | 2023 } |
| 2029 | 2024 |
| 2030 // These methods do not perform access checks! | 2025 // These methods do not perform access checks! |
| 2031 static void UpdateAllocationSite(Handle<JSObject> object, | 2026 static void UpdateAllocationSite(Handle<JSObject> object, |
| 2032 ElementsKind to_kind); | 2027 ElementsKind to_kind); |
| (...skipping 8791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10824 } else { | 10819 } else { |
| 10825 value &= ~(1 << bit_position); | 10820 value &= ~(1 << bit_position); |
| 10826 } | 10821 } |
| 10827 return value; | 10822 return value; |
| 10828 } | 10823 } |
| 10829 }; | 10824 }; |
| 10830 | 10825 |
| 10831 } } // namespace v8::internal | 10826 } } // namespace v8::internal |
| 10832 | 10827 |
| 10833 #endif // V8_OBJECTS_H_ | 10828 #endif // V8_OBJECTS_H_ |
| OLD | NEW |