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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 | 1190 |
1191 | 1191 |
1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, | 1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, |
1193 Handle<Object> object, | 1193 Handle<Object> object, |
1194 const char* name) { | 1194 const char* name) { |
1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); | 1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); |
1196 return GetProperty(object, str); | 1196 return GetProperty(object, str); |
1197 } | 1197 } |
1198 | 1198 |
1199 | 1199 |
1200 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy, | |
1201 Handle<JSReceiver> receiver, | |
1202 uint32_t index, | |
1203 Handle<Object> value, | |
1204 LanguageMode language_mode) { | |
1205 Isolate* isolate = proxy->GetIsolate(); | |
1206 Handle<String> name = isolate->factory()->Uint32ToString(index); | |
1207 return SetPropertyWithHandler(proxy, receiver, name, value, language_mode); | |
1208 } | |
1209 | |
1210 | |
1211 #define FIELD_ADDR(p, offset) \ | 1200 #define FIELD_ADDR(p, offset) \ |
1212 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 1201 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
1213 | 1202 |
1214 #define FIELD_ADDR_CONST(p, offset) \ | 1203 #define FIELD_ADDR_CONST(p, offset) \ |
1215 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) | 1204 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) |
1216 | 1205 |
1217 #define READ_FIELD(p, offset) \ | 1206 #define READ_FIELD(p, offset) \ |
1218 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) | 1207 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) |
1219 | 1208 |
1220 #define ACQUIRE_READ_FIELD(p, offset) \ | 1209 #define ACQUIRE_READ_FIELD(p, offset) \ |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 } | 2198 } |
2210 } | 2199 } |
2211 | 2200 |
2212 | 2201 |
2213 bool JSObject::HasFastProperties() { | 2202 bool JSObject::HasFastProperties() { |
2214 DCHECK(properties()->IsDictionary() == map()->is_dictionary_map()); | 2203 DCHECK(properties()->IsDictionary() == map()->is_dictionary_map()); |
2215 return !properties()->IsDictionary(); | 2204 return !properties()->IsDictionary(); |
2216 } | 2205 } |
2217 | 2206 |
2218 | 2207 |
2219 MaybeHandle<Object> JSObject::SetOwnElement(Handle<JSObject> object, | |
2220 uint32_t index, | |
2221 Handle<Object> value, | |
2222 LanguageMode language_mode) { | |
2223 return JSObject::SetOwnElement(object, index, value, NONE, language_mode); | |
2224 } | |
2225 | |
2226 | |
2227 bool Map::TooManyFastProperties(StoreFromKeyed store_mode) { | 2208 bool Map::TooManyFastProperties(StoreFromKeyed store_mode) { |
2228 if (unused_property_fields() != 0) return false; | 2209 if (unused_property_fields() != 0) return false; |
2229 if (is_prototype_map()) return false; | 2210 if (is_prototype_map()) return false; |
2230 int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12; | 2211 int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12; |
2231 int limit = Max(minimum, inobject_properties()); | 2212 int limit = Max(minimum, inobject_properties()); |
2232 int external = NumberOfFields() - inobject_properties(); | 2213 int external = NumberOfFields() - inobject_properties(); |
2233 return external > limit; | 2214 return external > limit; |
2234 } | 2215 } |
2235 | 2216 |
2236 | 2217 |
(...skipping 4532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6769 | 6750 |
6770 | 6751 |
6771 bool AccessorInfo::IsCompatibleReceiver(Object* receiver) { | 6752 bool AccessorInfo::IsCompatibleReceiver(Object* receiver) { |
6772 if (!HasExpectedReceiverType()) return true; | 6753 if (!HasExpectedReceiverType()) return true; |
6773 if (!receiver->IsJSObject()) return false; | 6754 if (!receiver->IsJSObject()) return false; |
6774 return FunctionTemplateInfo::cast(expected_receiver_type()) | 6755 return FunctionTemplateInfo::cast(expected_receiver_type()) |
6775 ->IsTemplateFor(JSObject::cast(receiver)->map()); | 6756 ->IsTemplateFor(JSObject::cast(receiver)->map()); |
6776 } | 6757 } |
6777 | 6758 |
6778 | 6759 |
6779 // static | |
6780 void ExecutableAccessorInfo::ClearSetter(Handle<ExecutableAccessorInfo> info) { | |
6781 auto foreign = info->GetIsolate()->factory()->NewForeign( | |
6782 reinterpret_cast<v8::internal::Address>( | |
6783 reinterpret_cast<intptr_t>(nullptr))); | |
6784 info->set_setter(*foreign); | |
6785 } | |
6786 | |
6787 | |
6788 template<typename Derived, typename Shape, typename Key> | 6760 template<typename Derived, typename Shape, typename Key> |
6789 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, | 6761 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, |
6790 Handle<Object> key, | 6762 Handle<Object> key, |
6791 Handle<Object> value) { | 6763 Handle<Object> value) { |
6792 this->SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); | 6764 this->SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); |
6793 } | 6765 } |
6794 | 6766 |
6795 | 6767 |
6796 template<typename Derived, typename Shape, typename Key> | 6768 template<typename Derived, typename Shape, typename Key> |
6797 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, | 6769 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7375 #undef READ_SHORT_FIELD | 7347 #undef READ_SHORT_FIELD |
7376 #undef WRITE_SHORT_FIELD | 7348 #undef WRITE_SHORT_FIELD |
7377 #undef READ_BYTE_FIELD | 7349 #undef READ_BYTE_FIELD |
7378 #undef WRITE_BYTE_FIELD | 7350 #undef WRITE_BYTE_FIELD |
7379 #undef NOBARRIER_READ_BYTE_FIELD | 7351 #undef NOBARRIER_READ_BYTE_FIELD |
7380 #undef NOBARRIER_WRITE_BYTE_FIELD | 7352 #undef NOBARRIER_WRITE_BYTE_FIELD |
7381 | 7353 |
7382 } } // namespace v8::internal | 7354 } } // namespace v8::internal |
7383 | 7355 |
7384 #endif // V8_OBJECTS_INL_H_ | 7356 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |