Line data Source code
1 : // Copyright 2018 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_OBJECTS_JS_OBJECTS_INL_H_
6 : #define V8_OBJECTS_JS_OBJECTS_INL_H_
7 :
8 : #include "src/objects/js-objects.h"
9 :
10 : #include "src/feedback-vector.h"
11 : #include "src/field-index-inl.h"
12 : #include "src/heap/heap-write-barrier.h"
13 : #include "src/keys.h"
14 : #include "src/lookup-inl.h"
15 : #include "src/objects/embedder-data-slot-inl.h"
16 : #include "src/objects/feedback-cell-inl.h"
17 : #include "src/objects/hash-table-inl.h"
18 : #include "src/objects/heap-number-inl.h"
19 : #include "src/objects/property-array-inl.h"
20 : #include "src/objects/shared-function-info.h"
21 : #include "src/objects/slots.h"
22 : #include "src/objects/smi-inl.h"
23 : #include "src/prototype-inl.h"
24 :
25 : // Has to be the last include (doesn't have include guards):
26 : #include "src/objects/object-macros.h"
27 :
28 : namespace v8 {
29 : namespace internal {
30 :
31 848054138 : OBJECT_CONSTRUCTORS_IMPL(JSReceiver, HeapObject)
32 1171938200 : OBJECT_CONSTRUCTORS_IMPL(JSObject, JSReceiver)
33 420 : OBJECT_CONSTRUCTORS_IMPL(JSAsyncFromSyncIterator, JSObject)
34 4646 : OBJECT_CONSTRUCTORS_IMPL(JSBoundFunction, JSObject)
35 749010 : OBJECT_CONSTRUCTORS_IMPL(JSDate, JSObject)
36 462176182 : OBJECT_CONSTRUCTORS_IMPL(JSFunction, JSObject)
37 180709364 : OBJECT_CONSTRUCTORS_IMPL(JSGlobalObject, JSObject)
38 21440976 : OBJECT_CONSTRUCTORS_IMPL(JSGlobalProxy, JSObject)
39 39324 : JSIteratorResult::JSIteratorResult(Address ptr) : JSObject(ptr) {}
40 2842080 : OBJECT_CONSTRUCTORS_IMPL(JSMessageObject, JSObject)
41 0 : OBJECT_CONSTRUCTORS_IMPL(JSStringIterator, JSObject)
42 1081678 : OBJECT_CONSTRUCTORS_IMPL(JSValue, JSObject)
43 :
44 113758 : NEVER_READ_ONLY_SPACE_IMPL(JSReceiver)
45 :
46 210 : CAST_ACCESSOR(JSAsyncFromSyncIterator)
47 2323 : CAST_ACCESSOR(JSBoundFunction)
48 374505 : CAST_ACCESSOR(JSDate)
49 231098165 : CAST_ACCESSOR(JSFunction)
50 90354696 : CAST_ACCESSOR(JSGlobalObject)
51 10720488 : CAST_ACCESSOR(JSGlobalProxy)
52 19662 : CAST_ACCESSOR(JSIteratorResult)
53 1421040 : CAST_ACCESSOR(JSMessageObject)
54 585977148 : CAST_ACCESSOR(JSObject)
55 424027084 : CAST_ACCESSOR(JSReceiver)
56 0 : CAST_ACCESSOR(JSStringIterator)
57 540839 : CAST_ACCESSOR(JSValue)
58 :
59 17909761 : MaybeHandle<Object> JSReceiver::GetProperty(Isolate* isolate,
60 : Handle<JSReceiver> receiver,
61 : Handle<Name> name) {
62 17909761 : LookupIterator it(isolate, receiver, name, receiver);
63 27984141 : if (!it.IsFound()) return it.factory()->undefined_value();
64 7835379 : return Object::GetProperty(&it);
65 : }
66 :
67 50331064 : MaybeHandle<Object> JSReceiver::GetElement(Isolate* isolate,
68 : Handle<JSReceiver> receiver,
69 : uint32_t index) {
70 : LookupIterator it(isolate, receiver, index, receiver);
71 99895651 : if (!it.IsFound()) return it.factory()->undefined_value();
72 766477 : return Object::GetProperty(&it);
73 : }
74 :
75 5682801 : Handle<Object> JSReceiver::GetDataProperty(Handle<JSReceiver> object,
76 : Handle<Name> name) {
77 : LookupIterator it(object, name, object,
78 5682801 : LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
79 8019038 : if (!it.IsFound()) return it.factory()->undefined_value();
80 3346564 : return GetDataProperty(&it);
81 : }
82 :
83 3259955 : MaybeHandle<Object> JSReceiver::GetPrototype(Isolate* isolate,
84 : Handle<JSReceiver> receiver) {
85 : // We don't expect access checks to be needed on JSProxy objects.
86 : DCHECK(!receiver->IsAccessCheckNeeded() || receiver->IsJSObject());
87 : PrototypeIterator iter(isolate, receiver, kStartAtReceiver,
88 3259955 : PrototypeIterator::END_AT_NON_HIDDEN);
89 3242935 : do {
90 3266587 : if (!iter.AdvanceFollowingProxies()) return MaybeHandle<Object>();
91 3242935 : } while (!iter.IsAtEnd());
92 3236303 : return PrototypeIterator::GetCurrent(iter);
93 : }
94 :
95 302662 : MaybeHandle<Object> JSReceiver::GetProperty(Isolate* isolate,
96 : Handle<JSReceiver> receiver,
97 : const char* name) {
98 302662 : Handle<String> str = isolate->factory()->InternalizeUtf8String(name);
99 302662 : return GetProperty(isolate, receiver, str);
100 : }
101 :
102 : // static
103 972 : V8_WARN_UNUSED_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys(
104 : Handle<JSReceiver> object) {
105 : return KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly,
106 : ALL_PROPERTIES,
107 1663 : GetKeysConversion::kConvertToString);
108 : }
109 :
110 10294436 : bool JSObject::PrototypeHasNoElements(Isolate* isolate, JSObject object) {
111 : DisallowHeapAllocation no_gc;
112 : HeapObject prototype = HeapObject::cast(object->map()->prototype());
113 : ReadOnlyRoots roots(isolate);
114 : HeapObject null = roots.null_value();
115 : FixedArrayBase empty_fixed_array = roots.empty_fixed_array();
116 : FixedArrayBase empty_slow_element_dictionary =
117 : roots.empty_slow_element_dictionary();
118 50522985 : while (prototype != null) {
119 : Map map = prototype->map();
120 29944925 : if (map->IsCustomElementsReceiverMap()) return false;
121 29942694 : FixedArrayBase elements = JSObject::cast(prototype)->elements();
122 29942681 : if (elements != empty_fixed_array &&
123 : elements != empty_slow_element_dictionary) {
124 : return false;
125 : }
126 : prototype = HeapObject::cast(map->prototype());
127 : }
128 : return true;
129 : }
130 :
131 543253905 : ACCESSORS(JSReceiver, raw_properties_or_hash, Object, kPropertiesOrHashOffset)
132 :
133 386122141 : FixedArrayBase JSObject::elements() const {
134 386122141 : Object array = READ_FIELD(*this, kElementsOffset);
135 386122178 : return FixedArrayBase::cast(array);
136 : }
137 :
138 90695 : void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) {
139 90695 : JSObject::ValidateElements(*object);
140 : ElementsKind elements_kind = object->map()->elements_kind();
141 90695 : if (!IsObjectElementsKind(elements_kind)) {
142 0 : if (IsHoleyElementsKind(elements_kind)) {
143 0 : TransitionElementsKind(object, HOLEY_ELEMENTS);
144 : } else {
145 0 : TransitionElementsKind(object, PACKED_ELEMENTS);
146 : }
147 : }
148 90695 : }
149 :
150 : template <typename TSlot>
151 524108 : void JSObject::EnsureCanContainElements(Handle<JSObject> object, TSlot objects,
152 : uint32_t count,
153 : EnsureElementsMode mode) {
154 : static_assert(std::is_same<TSlot, FullObjectSlot>::value ||
155 : std::is_same<TSlot, ObjectSlot>::value,
156 : "Only ObjectSlot and FullObjectSlot are expected here");
157 524108 : ElementsKind current_kind = object->GetElementsKind();
158 : ElementsKind target_kind = current_kind;
159 : {
160 : DisallowHeapAllocation no_allocation;
161 : DCHECK(mode != ALLOW_COPIED_DOUBLE_ELEMENTS);
162 : bool is_holey = IsHoleyElementsKind(current_kind);
163 1048216 : if (current_kind == HOLEY_ELEMENTS) return;
164 1048168 : Object the_hole = object->GetReadOnlyRoots().the_hole_value();
165 29833388 : for (uint32_t i = 0; i < count; ++i, ++objects) {
166 14392610 : Object current = *objects;
167 14392610 : if (current == the_hole) {
168 : is_holey = true;
169 : target_kind = GetHoleyElementsKind(target_kind);
170 12901536 : } else if (!current->IsSmi()) {
171 10346809 : if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS && current->IsNumber()) {
172 1729815 : if (IsSmiElementsKind(target_kind)) {
173 208 : if (is_holey) {
174 : target_kind = HOLEY_DOUBLE_ELEMENTS;
175 : } else {
176 : target_kind = PACKED_DOUBLE_ELEMENTS;
177 : }
178 : }
179 3625468 : } else if (is_holey) {
180 : target_kind = HOLEY_ELEMENTS;
181 0 : break;
182 : } else {
183 : target_kind = PACKED_ELEMENTS;
184 : }
185 : }
186 : }
187 : }
188 524084 : if (target_kind != current_kind) {
189 94706 : TransitionElementsKind(object, target_kind);
190 : }
191 : }
192 :
193 93636 : void JSObject::EnsureCanContainElements(Handle<JSObject> object,
194 : Handle<FixedArrayBase> elements,
195 : uint32_t length,
196 : EnsureElementsMode mode) {
197 93636 : ReadOnlyRoots roots = object->GetReadOnlyRoots();
198 93636 : if (elements->map() != roots.fixed_double_array_map()) {
199 : DCHECK(elements->map() == roots.fixed_array_map() ||
200 : elements->map() == roots.fixed_cow_array_map());
201 93636 : if (mode == ALLOW_COPIED_DOUBLE_ELEMENTS) {
202 : mode = DONT_ALLOW_DOUBLE_ELEMENTS;
203 : }
204 : ObjectSlot objects =
205 187272 : Handle<FixedArray>::cast(elements)->GetFirstElementAddress();
206 93636 : EnsureCanContainElements(object, objects, length, mode);
207 : return;
208 : }
209 :
210 : DCHECK(mode == ALLOW_COPIED_DOUBLE_ELEMENTS);
211 0 : if (object->GetElementsKind() == HOLEY_SMI_ELEMENTS) {
212 0 : TransitionElementsKind(object, HOLEY_DOUBLE_ELEMENTS);
213 0 : } else if (object->GetElementsKind() == PACKED_SMI_ELEMENTS) {
214 : Handle<FixedDoubleArray> double_array =
215 0 : Handle<FixedDoubleArray>::cast(elements);
216 0 : for (uint32_t i = 0; i < length; ++i) {
217 0 : if (double_array->is_the_hole(i)) {
218 0 : TransitionElementsKind(object, HOLEY_DOUBLE_ELEMENTS);
219 0 : return;
220 : }
221 : }
222 0 : TransitionElementsKind(object, PACKED_DOUBLE_ELEMENTS);
223 : }
224 : }
225 :
226 939781 : void JSObject::SetMapAndElements(Handle<JSObject> object, Handle<Map> new_map,
227 : Handle<FixedArrayBase> value) {
228 939781 : JSObject::MigrateToMap(object, new_map);
229 : DCHECK((object->map()->has_fast_smi_or_object_elements() ||
230 : (*value == object->GetReadOnlyRoots().empty_fixed_array()) ||
231 : object->map()->has_fast_string_wrapper_elements()) ==
232 : (value->map() == object->GetReadOnlyRoots().fixed_array_map() ||
233 : value->map() == object->GetReadOnlyRoots().fixed_cow_array_map()));
234 : DCHECK((*value == object->GetReadOnlyRoots().empty_fixed_array()) ||
235 : (object->map()->has_fast_double_elements() ==
236 : value->IsFixedDoubleArray()));
237 939781 : object->set_elements(*value);
238 939781 : }
239 :
240 8049333 : void JSObject::set_elements(FixedArrayBase value, WriteBarrierMode mode) {
241 8049333 : WRITE_FIELD(*this, kElementsOffset, value);
242 21426811 : CONDITIONAL_WRITE_BARRIER(*this, kElementsOffset, value, mode);
243 8049338 : }
244 :
245 37820752 : void JSObject::initialize_elements() {
246 37820752 : FixedArrayBase elements = map()->GetInitialElements();
247 37820764 : WRITE_FIELD(*this, kElementsOffset, elements);
248 37820764 : }
249 :
250 621078 : InterceptorInfo JSObject::GetIndexedInterceptor() {
251 621078 : return map()->GetIndexedInterceptor();
252 : }
253 :
254 1530911 : InterceptorInfo JSObject::GetNamedInterceptor() {
255 1530911 : return map()->GetNamedInterceptor();
256 : }
257 :
258 : int JSObject::GetHeaderSize() const { return GetHeaderSize(map()); }
259 :
260 3331986 : int JSObject::GetHeaderSize(const Map map) {
261 : // Check for the most common kind of JavaScript object before
262 : // falling into the generic switch. This speeds up the internal
263 : // field operations considerably on average.
264 : InstanceType instance_type = map->instance_type();
265 : return instance_type == JS_OBJECT_TYPE
266 : ? JSObject::kHeaderSize
267 4948821 : : GetHeaderSize(instance_type, map->has_prototype_slot());
268 : }
269 :
270 : // static
271 : int JSObject::GetEmbedderFieldsStartOffset(const Map map) {
272 : // Embedder fields are located after the header size rounded up to the
273 : // kSystemPointerSize, whereas in-object properties are at the end of the
274 : // object.
275 1764341 : int header_size = GetHeaderSize(map);
276 : if (kTaggedSize == kSystemPointerSize) {
277 : DCHECK(IsAligned(header_size, kSystemPointerSize));
278 : return header_size;
279 : } else {
280 : return RoundUp(header_size, kSystemPointerSize);
281 : }
282 : }
283 :
284 1764341 : int JSObject::GetEmbedderFieldsStartOffset() {
285 1764344 : return GetEmbedderFieldsStartOffset(map());
286 : }
287 :
288 : // static
289 1567645 : int JSObject::GetEmbedderFieldCount(const Map map) {
290 : int instance_size = map->instance_size();
291 1567645 : if (instance_size == kVariableSizeSentinel) return 0;
292 : // Embedder fields are located after the header size rounded up to the
293 : // kSystemPointerSize, whereas in-object properties are at the end of the
294 : // object. We don't have to round up the header size here because division by
295 : // kEmbedderDataSlotSizeInTaggedSlots will swallow potential padding in case
296 : // of (kTaggedSize != kSystemPointerSize) anyway.
297 1567646 : return (((instance_size - GetHeaderSize(map)) >> kTaggedSizeLog2) -
298 1567645 : map->GetInObjectProperties()) /
299 1567646 : kEmbedderDataSlotSizeInTaggedSlots;
300 : }
301 :
302 690600 : int JSObject::GetEmbedderFieldCount() const {
303 690600 : return GetEmbedderFieldCount(map());
304 : }
305 :
306 1764245 : int JSObject::GetEmbedderFieldOffset(int index) {
307 : DCHECK_LT(static_cast<unsigned>(index),
308 : static_cast<unsigned>(GetEmbedderFieldCount()));
309 1764340 : return GetEmbedderFieldsStartOffset() + (kEmbedderDataSlotSize * index);
310 : }
311 :
312 937429 : Object JSObject::GetEmbedderField(int index) {
313 937432 : return EmbedderDataSlot(*this, index).load_tagged();
314 : }
315 :
316 824723 : void JSObject::SetEmbedderField(int index, Object value) {
317 : EmbedderDataSlot::store_tagged(*this, index, value);
318 824724 : }
319 :
320 : void JSObject::SetEmbedderField(int index, Smi value) {
321 : EmbedderDataSlot(*this, index).store_smi(value);
322 : }
323 :
324 92698562 : bool JSObject::IsUnboxedDoubleField(FieldIndex index) {
325 : if (!FLAG_unbox_double_fields) return false;
326 92698562 : return map()->IsUnboxedDoubleField(index);
327 : }
328 :
329 : // Access fast-case object properties at index. The use of these routines
330 : // is needed to correctly distinguish between properties stored in-object and
331 : // properties stored in the properties array.
332 93767359 : Object JSObject::RawFastPropertyAt(FieldIndex index) {
333 : DCHECK(!IsUnboxedDoubleField(index));
334 93767359 : if (index.is_inobject()) {
335 10885244 : return READ_FIELD(*this, index.offset());
336 : } else {
337 82882115 : return property_array()->get(index.outobject_array_index());
338 : }
339 : }
340 :
341 : double JSObject::RawFastDoublePropertyAt(FieldIndex index) {
342 : DCHECK(IsUnboxedDoubleField(index));
343 21154 : return READ_DOUBLE_FIELD(*this, index.offset());
344 : }
345 :
346 : uint64_t JSObject::RawFastDoublePropertyAsBitsAt(FieldIndex index) {
347 : DCHECK(IsUnboxedDoubleField(index));
348 3657 : return READ_UINT64_FIELD(*this, index.offset());
349 : }
350 :
351 66438278 : void JSObject::RawFastPropertyAtPut(FieldIndex index, Object value) {
352 66438278 : if (index.is_inobject()) {
353 : int offset = index.offset();
354 47341302 : WRITE_FIELD(*this, offset, value);
355 94682602 : WRITE_BARRIER(*this, offset, value);
356 : } else {
357 19096976 : property_array()->set(index.outobject_array_index(), value);
358 : }
359 66438281 : }
360 :
361 : void JSObject::RawFastDoublePropertyAsBitsAtPut(FieldIndex index,
362 : uint64_t bits) {
363 : // Double unboxing is enabled only on 64-bit platforms without pointer
364 : // compression.
365 : DCHECK_EQ(kDoubleSize, kTaggedSize);
366 44900 : Address field_addr = FIELD_ADDR(*this, index.offset());
367 : base::Relaxed_Store(reinterpret_cast<base::AtomicWord*>(field_addr),
368 44900 : static_cast<base::AtomicWord>(bits));
369 : }
370 :
371 314250 : void JSObject::FastPropertyAtPut(FieldIndex index, Object value) {
372 314250 : if (IsUnboxedDoubleField(index)) {
373 : DCHECK(value->IsMutableHeapNumber());
374 : // Ensure that all bits of the double value are preserved.
375 : RawFastDoublePropertyAsBitsAtPut(
376 : index, MutableHeapNumber::cast(value)->value_as_bits());
377 : } else {
378 314245 : RawFastPropertyAtPut(index, value);
379 : }
380 314250 : }
381 :
382 55930777 : void JSObject::WriteToField(int descriptor, PropertyDetails details,
383 : Object value) {
384 : DCHECK_EQ(kField, details.location());
385 : DCHECK_EQ(kData, details.kind());
386 : DisallowHeapAllocation no_gc;
387 55930777 : FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
388 55930792 : if (details.representation().IsDouble()) {
389 : // Nothing more to be done.
390 49545 : if (value->IsUninitialized()) {
391 1267 : return;
392 : }
393 : // Manipulating the signaling NaN used for the hole and uninitialized
394 : // double field sentinel in C++, e.g. with bit_cast or value()/set_value(),
395 : // will change its value on ia32 (the x87 stack is used to return values
396 : // and stores to the stack silently clear the signalling bit).
397 : uint64_t bits;
398 48278 : if (value->IsSmi()) {
399 6376 : bits = bit_cast<uint64_t>(static_cast<double>(Smi::ToInt(value)));
400 : } else {
401 : DCHECK(value->IsHeapNumber());
402 : bits = HeapNumber::cast(value)->value_as_bits();
403 : }
404 48278 : if (IsUnboxedDoubleField(index)) {
405 : RawFastDoublePropertyAsBitsAtPut(index, bits);
406 : } else {
407 7822 : auto box = MutableHeapNumber::cast(RawFastPropertyAt(index));
408 : box->set_value_as_bits(bits);
409 : }
410 : } else {
411 55881247 : RawFastPropertyAtPut(index, value);
412 : }
413 : }
414 :
415 554390 : int JSObject::GetInObjectPropertyOffset(int index) {
416 554390 : return map()->GetInObjectPropertyOffset(index);
417 : }
418 :
419 : Object JSObject::InObjectPropertyAt(int index) {
420 0 : int offset = GetInObjectPropertyOffset(index);
421 0 : return READ_FIELD(*this, offset);
422 : }
423 :
424 554390 : Object JSObject::InObjectPropertyAtPut(int index, Object value,
425 : WriteBarrierMode mode) {
426 : // Adjust for the number of properties stored in the object.
427 554390 : int offset = GetInObjectPropertyOffset(index);
428 554390 : WRITE_FIELD(*this, offset, value);
429 749676 : CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode);
430 554390 : return value;
431 : }
432 :
433 20748846 : void JSObject::InitializeBody(Map map, int start_offset,
434 : Object pre_allocated_value, Object filler_value) {
435 : DCHECK_IMPLIES(filler_value->IsHeapObject(),
436 : !ObjectInYoungGeneration(filler_value));
437 : DCHECK_IMPLIES(pre_allocated_value->IsHeapObject(),
438 : !ObjectInYoungGeneration(pre_allocated_value));
439 : int size = map->instance_size();
440 : int offset = start_offset;
441 20748846 : if (filler_value != pre_allocated_value) {
442 : int end_of_pre_allocated_offset =
443 240573 : size - (map->UnusedPropertyFields() * kTaggedSize);
444 : DCHECK_LE(kHeaderSize, end_of_pre_allocated_offset);
445 599503 : while (offset < end_of_pre_allocated_offset) {
446 118357 : WRITE_FIELD(*this, offset, pre_allocated_value);
447 118357 : offset += kTaggedSize;
448 : }
449 : }
450 135546311 : while (offset < size) {
451 114797465 : WRITE_FIELD(*this, offset, filler_value);
452 114797465 : offset += kTaggedSize;
453 : }
454 20748846 : }
455 :
456 : Object JSBoundFunction::raw_bound_target_function() const {
457 : return READ_FIELD(*this, kBoundTargetFunctionOffset);
458 : }
459 :
460 10539 : ACCESSORS(JSBoundFunction, bound_target_function, JSReceiver,
461 : kBoundTargetFunctionOffset)
462 3203 : ACCESSORS(JSBoundFunction, bound_this, Object, kBoundThisOffset)
463 8931 : ACCESSORS(JSBoundFunction, bound_arguments, FixedArray, kBoundArgumentsOffset)
464 :
465 248072358 : ACCESSORS(JSFunction, raw_feedback_cell, FeedbackCell, kFeedbackCellOffset)
466 :
467 53368234 : ACCESSORS(JSGlobalObject, native_context, NativeContext, kNativeContextOffset)
468 582960 : ACCESSORS(JSGlobalObject, global_proxy, JSObject, kGlobalProxyOffset)
469 :
470 6483633 : ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset)
471 :
472 11816102 : FeedbackVector JSFunction::feedback_vector() const {
473 : DCHECK(has_feedback_vector());
474 23632215 : return FeedbackVector::cast(raw_feedback_cell()->value());
475 : }
476 :
477 : // Code objects that are marked for deoptimization are not considered to be
478 : // optimized. This is because the JSFunction might have been already
479 : // deoptimized but its code() still needs to be unlinked, which will happen on
480 : // its next activation.
481 : // TODO(jupvfranco): rename this function. Maybe RunOptimizedCode,
482 : // or IsValidOptimizedCode.
483 3698722 : bool JSFunction::IsOptimized() {
484 15105877 : return is_compiled() && code()->kind() == Code::OPTIMIZED_FUNCTION &&
485 8192031 : !code()->marked_for_deoptimization();
486 : }
487 :
488 576464 : bool JSFunction::HasOptimizedCode() {
489 1148495 : return IsOptimized() ||
490 2864613 : (has_feedback_vector() && feedback_vector()->has_optimized_code() &&
491 1157564 : !feedback_vector()->optimized_code()->marked_for_deoptimization());
492 : }
493 :
494 481437 : bool JSFunction::HasOptimizationMarker() {
495 481437 : return has_feedback_vector() && feedback_vector()->has_optimization_marker();
496 : }
497 :
498 : void JSFunction::ClearOptimizationMarker() {
499 : DCHECK(has_feedback_vector());
500 329060 : feedback_vector()->ClearOptimizationMarker();
501 : }
502 :
503 : // Optimized code marked for deoptimization will tier back down to running
504 : // interpreted on its next activation, and already doesn't count as IsOptimized.
505 6054 : bool JSFunction::IsInterpreted() {
506 29645 : return is_compiled() && (code()->is_interpreter_trampoline_builtin() ||
507 16984 : (code()->kind() == Code::OPTIMIZED_FUNCTION &&
508 17591 : code()->marked_for_deoptimization()));
509 : }
510 :
511 : bool JSFunction::ChecksOptimizationMarker() {
512 : return code()->checks_optimization_marker();
513 : }
514 :
515 155586 : bool JSFunction::IsMarkedForOptimization() {
516 311164 : return has_feedback_vector() && feedback_vector()->optimization_marker() ==
517 155594 : OptimizationMarker::kCompileOptimized;
518 : }
519 :
520 148275 : bool JSFunction::IsMarkedForConcurrentOptimization() {
521 296550 : return has_feedback_vector() &&
522 444825 : feedback_vector()->optimization_marker() ==
523 148275 : OptimizationMarker::kCompileOptimizedConcurrent;
524 : }
525 :
526 198488 : bool JSFunction::IsInOptimizationQueue() {
527 396952 : return has_feedback_vector() && feedback_vector()->optimization_marker() ==
528 198512 : OptimizationMarker::kInOptimizationQueue;
529 : }
530 :
531 307041 : void JSFunction::CompleteInobjectSlackTrackingIfActive() {
532 614082 : if (!has_prototype_slot()) return;
533 323684 : if (has_initial_map() && initial_map()->IsInobjectSlackTrackingInProgress()) {
534 115201 : initial_map()->CompleteInobjectSlackTracking(GetIsolate());
535 : }
536 : }
537 :
538 199 : AbstractCode JSFunction::abstract_code() {
539 199 : if (IsInterpreted()) {
540 292 : return AbstractCode::cast(shared()->GetBytecodeArray());
541 : } else {
542 106 : return AbstractCode::cast(code());
543 : }
544 : }
545 :
546 13976324 : Code JSFunction::code() const {
547 27952650 : return Code::cast(RELAXED_READ_FIELD(*this, kCodeOffset));
548 : }
549 :
550 15762695 : void JSFunction::set_code(Code value) {
551 : DCHECK(!ObjectInYoungGeneration(value));
552 15762695 : RELAXED_WRITE_FIELD(*this, kCodeOffset, value);
553 15762695 : MarkingBarrier(*this, RawField(kCodeOffset), value);
554 15762695 : }
555 :
556 : void JSFunction::set_code_no_write_barrier(Code value) {
557 : DCHECK(!ObjectInYoungGeneration(value));
558 : RELAXED_WRITE_FIELD(*this, kCodeOffset, value);
559 : }
560 :
561 165582801 : SharedFunctionInfo JSFunction::shared() const {
562 : return SharedFunctionInfo::cast(
563 331165618 : RELAXED_READ_FIELD(*this, kSharedFunctionInfoOffset));
564 : }
565 :
566 14065851 : void JSFunction::set_shared(SharedFunctionInfo value, WriteBarrierMode mode) {
567 : // Release semantics to support acquire read in NeedsResetDueToFlushedBytecode
568 14065851 : RELEASE_WRITE_FIELD(*this, kSharedFunctionInfoOffset, value);
569 42197551 : CONDITIONAL_WRITE_BARRIER(*this, kSharedFunctionInfoOffset, value, mode);
570 14065848 : }
571 :
572 : void JSFunction::ClearOptimizedCodeSlot(const char* reason) {
573 : if (has_feedback_vector() && feedback_vector()->has_optimized_code()) {
574 : if (FLAG_trace_opt) {
575 : PrintF("[evicting entry from optimizing code feedback slot (%s) for ",
576 : reason);
577 : ShortPrint();
578 : PrintF("]\n");
579 : }
580 : feedback_vector()->ClearOptimizedCode();
581 : }
582 : }
583 :
584 4705 : void JSFunction::SetOptimizationMarker(OptimizationMarker marker) {
585 : DCHECK(has_feedback_vector());
586 : DCHECK(ChecksOptimizationMarker());
587 : DCHECK(!HasOptimizedCode());
588 :
589 492048 : feedback_vector()->SetOptimizationMarker(marker);
590 4705 : }
591 :
592 24555374 : bool JSFunction::has_feedback_vector() const {
593 73665254 : return shared()->is_compiled() &&
594 73665272 : !raw_feedback_cell()->value()->IsUndefined();
595 : }
596 :
597 25834401 : Context JSFunction::context() {
598 51668800 : return Context::cast(READ_FIELD(*this, kContextOffset));
599 : }
600 :
601 401248 : bool JSFunction::has_context() const {
602 1203744 : return READ_FIELD(*this, kContextOffset)->IsContext();
603 : }
604 :
605 1090795 : JSGlobalProxy JSFunction::global_proxy() { return context()->global_proxy(); }
606 :
607 45171 : NativeContext JSFunction::native_context() {
608 7911035 : return context()->native_context();
609 : }
610 :
611 14065554 : void JSFunction::set_context(Object value) {
612 : DCHECK(value->IsUndefined() || value->IsContext());
613 14065554 : WRITE_FIELD(*this, kContextOffset, value);
614 28131111 : WRITE_BARRIER(*this, kContextOffset, value);
615 14065555 : }
616 :
617 160142468 : ACCESSORS_CHECKED(JSFunction, prototype_or_initial_map, Object,
618 : kPrototypeOrInitialMapOffset, map()->has_prototype_slot())
619 :
620 23489606 : bool JSFunction::has_prototype_slot() const {
621 23489606 : return map()->has_prototype_slot();
622 : }
623 :
624 75261085 : Map JSFunction::initial_map() { return Map::cast(prototype_or_initial_map()); }
625 :
626 41472700 : bool JSFunction::has_initial_map() {
627 : DCHECK(has_prototype_slot());
628 82945435 : return prototype_or_initial_map()->IsMap();
629 : }
630 :
631 6736242 : bool JSFunction::has_instance_prototype() {
632 : DCHECK(has_prototype_slot());
633 8260836 : return has_initial_map() || !prototype_or_initial_map()->IsTheHole();
634 : }
635 :
636 6450643 : bool JSFunction::has_prototype() {
637 : DCHECK(has_prototype_slot());
638 6450643 : return map()->has_non_instance_prototype() || has_instance_prototype();
639 : }
640 :
641 7398737 : bool JSFunction::has_prototype_property() {
642 14799049 : return (has_prototype_slot() && IsConstructor()) ||
643 8420713 : IsGeneratorFunction(shared()->kind());
644 : }
645 :
646 7398739 : bool JSFunction::PrototypeRequiresRuntimeLookup() {
647 13777074 : return !has_prototype_property() || map()->has_non_instance_prototype();
648 : }
649 :
650 5020741 : Object JSFunction::instance_prototype() {
651 : DCHECK(has_instance_prototype());
652 9738955 : if (has_initial_map()) return initial_map()->prototype();
653 : // When there is no initial map and the prototype is a JSReceiver, the
654 : // initial map field is used for the prototype field.
655 : return prototype_or_initial_map();
656 : }
657 :
658 4203330 : Object JSFunction::prototype() {
659 : DCHECK(has_prototype());
660 : // If the function's prototype property has been set to a non-JSReceiver
661 : // value, that value is stored in the constructor field of the map.
662 4203330 : if (map()->has_non_instance_prototype()) {
663 13404 : Object prototype = map()->GetConstructor();
664 : // The map must have a prototype in that field, not a back pointer.
665 : DCHECK(!prototype->IsMap());
666 : DCHECK(!prototype->IsFunctionTemplateInfo());
667 13404 : return prototype;
668 : }
669 4189926 : return instance_prototype();
670 : }
671 :
672 4347949 : bool JSFunction::is_compiled() const {
673 17098783 : return code()->builtin_index() != Builtins::kCompileLazy &&
674 12750834 : shared()->is_compiled();
675 : }
676 :
677 62178962 : bool JSFunction::NeedsResetDueToFlushedBytecode() {
678 62178962 : if (!FLAG_flush_bytecode) return false;
679 :
680 : // Do a raw read for shared and code fields here since this function may be
681 : // called on a concurrent thread and the JSFunction might not be fully
682 : // initialized yet.
683 124375284 : Object maybe_shared = ACQUIRE_READ_FIELD(*this, kSharedFunctionInfoOffset);
684 124375284 : Object maybe_code = RELAXED_READ_FIELD(*this, kCodeOffset);
685 :
686 124200442 : if (!maybe_shared->IsSharedFunctionInfo() || !maybe_code->IsCode()) {
687 : return false;
688 : }
689 :
690 61875530 : SharedFunctionInfo shared = SharedFunctionInfo::cast(maybe_shared);
691 : Code code = Code::cast(maybe_code);
692 67046585 : return !shared->is_compiled() &&
693 61808486 : code->builtin_index() != Builtins::kCompileLazy;
694 : }
695 :
696 1519660 : void JSFunction::ResetIfBytecodeFlushed() {
697 1519660 : if (NeedsResetDueToFlushedBytecode()) {
698 : // Bytecode was flushed and function is now uncompiled, reset JSFunction
699 : // by setting code to CompileLazy and clearing the feedback vector.
700 8658 : set_code(GetIsolate()->builtins()->builtin(i::Builtins::kCompileLazy));
701 : raw_feedback_cell()->set_value(
702 8658 : ReadOnlyRoots(GetIsolate()).undefined_value());
703 : }
704 1519663 : }
705 :
706 586143 : ACCESSORS(JSValue, value, Object, kValueOffset)
707 :
708 873648 : ACCESSORS(JSDate, value, Object, kValueOffset)
709 487686 : ACCESSORS(JSDate, cache_stamp, Object, kCacheStampOffset)
710 35505 : ACCESSORS(JSDate, year, Object, kYearOffset)
711 34857 : ACCESSORS(JSDate, month, Object, kMonthOffset)
712 34686 : ACCESSORS(JSDate, day, Object, kDayOffset)
713 34614 : ACCESSORS(JSDate, weekday, Object, kWeekdayOffset)
714 37764 : ACCESSORS(JSDate, hour, Object, kHourOffset)
715 35460 : ACCESSORS(JSDate, min, Object, kMinOffset)
716 34839 : ACCESSORS(JSDate, sec, Object, kSecOffset)
717 :
718 : MessageTemplate JSMessageObject::type() const {
719 8402 : Object value = READ_FIELD(*this, kTypeOffset);
720 4201 : return MessageTemplateFromInt(Smi::ToInt(value));
721 : }
722 : void JSMessageObject::set_type(MessageTemplate value) {
723 1360616 : WRITE_FIELD(*this, kTypeOffset, Smi::FromInt(static_cast<int>(value)));
724 : }
725 6839455 : ACCESSORS(JSMessageObject, argument, Object, kArgumentsOffset)
726 6965566 : ACCESSORS(JSMessageObject, script, Script, kScriptOffset)
727 6805150 : ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset)
728 1498152 : SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset)
729 1389308 : SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
730 1409532 : SMI_ACCESSORS(JSMessageObject, error_level, kErrorLevelOffset)
731 :
732 336357436 : ElementsKind JSObject::GetElementsKind() const {
733 : ElementsKind kind = map()->elements_kind();
734 : #if VERIFY_HEAP && DEBUG
735 : FixedArrayBase fixed_array =
736 : FixedArrayBase::unchecked_cast(READ_FIELD(*this, kElementsOffset));
737 :
738 : // If a GC was caused while constructing this object, the elements
739 : // pointer may point to a one pointer filler map.
740 : if (ElementsAreSafeToExamine()) {
741 : Map map = fixed_array->map();
742 : if (IsSmiOrObjectElementsKind(kind)) {
743 : DCHECK(map == GetReadOnlyRoots().fixed_array_map() ||
744 : map == GetReadOnlyRoots().fixed_cow_array_map());
745 : } else if (IsDoubleElementsKind(kind)) {
746 : DCHECK(fixed_array->IsFixedDoubleArray() ||
747 : fixed_array == GetReadOnlyRoots().empty_fixed_array());
748 : } else if (kind == DICTIONARY_ELEMENTS) {
749 : DCHECK(fixed_array->IsFixedArray());
750 : DCHECK(fixed_array->IsDictionary());
751 : } else {
752 : DCHECK(kind > DICTIONARY_ELEMENTS);
753 : }
754 : DCHECK(!IsSloppyArgumentsElementsKind(kind) ||
755 : (elements()->IsFixedArray() && elements()->length() >= 2));
756 : }
757 : #endif
758 336357436 : return kind;
759 : }
760 :
761 1568438 : bool JSObject::HasObjectElements() {
762 3555029 : return IsObjectElementsKind(GetElementsKind());
763 : }
764 :
765 2106739 : bool JSObject::HasSmiElements() { return IsSmiElementsKind(GetElementsKind()); }
766 :
767 1350000 : bool JSObject::HasSmiOrObjectElements() {
768 2704376 : return IsSmiOrObjectElementsKind(GetElementsKind());
769 : }
770 :
771 1353067 : bool JSObject::HasDoubleElements() {
772 3451824 : return IsDoubleElementsKind(GetElementsKind());
773 : }
774 :
775 4953452 : bool JSObject::HasHoleyElements() {
776 9906904 : return IsHoleyElementsKind(GetElementsKind());
777 : }
778 :
779 90758 : bool JSObject::HasFastElements() {
780 2393231 : return IsFastElementsKind(GetElementsKind());
781 : }
782 :
783 121412 : bool JSObject::HasFastPackedElements() {
784 242824 : return IsFastPackedElementsKind(GetElementsKind());
785 : }
786 :
787 613 : bool JSObject::HasDictionaryElements() {
788 494518 : return GetElementsKind() == DICTIONARY_ELEMENTS;
789 : }
790 :
791 : bool JSObject::HasFastArgumentsElements() {
792 : return GetElementsKind() == FAST_SLOPPY_ARGUMENTS_ELEMENTS;
793 : }
794 :
795 : bool JSObject::HasSlowArgumentsElements() {
796 157194 : return GetElementsKind() == SLOW_SLOPPY_ARGUMENTS_ELEMENTS;
797 : }
798 :
799 63 : bool JSObject::HasSloppyArgumentsElements() {
800 917058 : return IsSloppyArgumentsElementsKind(GetElementsKind());
801 : }
802 :
803 : bool JSObject::HasStringWrapperElements() {
804 123857 : return IsStringWrapperElementsKind(GetElementsKind());
805 : }
806 :
807 : bool JSObject::HasFastStringWrapperElements() {
808 1082788 : return GetElementsKind() == FAST_STRING_WRAPPER_ELEMENTS;
809 : }
810 :
811 : bool JSObject::HasSlowStringWrapperElements() {
812 235228 : return GetElementsKind() == SLOW_STRING_WRAPPER_ELEMENTS;
813 : }
814 :
815 1538532 : bool JSObject::HasFixedTypedArrayElements() {
816 : DCHECK(!elements().is_null());
817 1538532 : return map()->has_fixed_typed_array_elements();
818 : }
819 :
820 : #define FIXED_TYPED_ELEMENTS_CHECK(Type, type, TYPE, ctype) \
821 : bool JSObject::HasFixed##Type##Elements() { \
822 : FixedArrayBase array = elements(); \
823 : return array->map()->instance_type() == FIXED_##TYPE##_ARRAY_TYPE; \
824 : }
825 :
826 900 : TYPED_ARRAYS(FIXED_TYPED_ELEMENTS_CHECK)
827 :
828 : #undef FIXED_TYPED_ELEMENTS_CHECK
829 :
830 6359572 : bool JSObject::HasNamedInterceptor() { return map()->has_named_interceptor(); }
831 :
832 1227788 : bool JSObject::HasIndexedInterceptor() {
833 1227788 : return map()->has_indexed_interceptor();
834 : }
835 :
836 : void JSGlobalObject::set_global_dictionary(GlobalDictionary dictionary) {
837 : DCHECK(IsJSGlobalObject());
838 90781 : set_raw_properties_or_hash(dictionary);
839 : }
840 :
841 78038307 : GlobalDictionary JSGlobalObject::global_dictionary() {
842 : DCHECK(!HasFastProperties());
843 : DCHECK(IsJSGlobalObject());
844 78038299 : return GlobalDictionary::cast(raw_properties_or_hash());
845 : }
846 :
847 14393 : NumberDictionary JSObject::element_dictionary() {
848 : DCHECK(HasDictionaryElements() || HasSlowStringWrapperElements());
849 28786 : return NumberDictionary::cast(elements());
850 : }
851 :
852 14064228 : void JSReceiver::initialize_properties() {
853 14064228 : ReadOnlyRoots roots = GetReadOnlyRoots();
854 : DCHECK(!ObjectInYoungGeneration(roots.empty_fixed_array()));
855 : DCHECK(!ObjectInYoungGeneration(roots.empty_property_dictionary()));
856 14064227 : if (map()->is_dictionary_map()) {
857 29 : WRITE_FIELD(*this, kPropertiesOrHashOffset,
858 : roots.empty_property_dictionary());
859 : } else {
860 14064200 : WRITE_FIELD(*this, kPropertiesOrHashOffset, roots.empty_fixed_array());
861 : }
862 14064229 : }
863 :
864 104217549 : bool JSReceiver::HasFastProperties() const {
865 : DCHECK(
866 : raw_properties_or_hash()->IsSmi() ||
867 : (raw_properties_or_hash()->IsDictionary() == map()->is_dictionary_map()));
868 104217549 : return !map()->is_dictionary_map();
869 : }
870 :
871 10448907 : NameDictionary JSReceiver::property_dictionary() const {
872 : DCHECK(!IsJSGlobalObject());
873 : DCHECK(!HasFastProperties());
874 :
875 10448907 : Object prop = raw_properties_or_hash();
876 10448907 : if (prop->IsSmi()) {
877 18 : return GetReadOnlyRoots().empty_property_dictionary();
878 : }
879 :
880 : return NameDictionary::cast(prop);
881 : }
882 :
883 : // TODO(gsathya): Pass isolate directly to this function and access
884 : // the heap from this.
885 119848753 : PropertyArray JSReceiver::property_array() const {
886 : DCHECK(HasFastProperties());
887 :
888 119848753 : Object prop = raw_properties_or_hash();
889 239695577 : if (prop->IsSmi() || prop == GetReadOnlyRoots().empty_fixed_array()) {
890 17833762 : return GetReadOnlyRoots().empty_property_array();
891 : }
892 :
893 : return PropertyArray::cast(prop);
894 : }
895 :
896 650737 : Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
897 : Handle<Name> name) {
898 : LookupIterator it = LookupIterator::PropertyOrElement(object->GetIsolate(),
899 650737 : object, name, object);
900 650737 : return HasProperty(&it);
901 : }
902 :
903 7144 : Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object,
904 : uint32_t index) {
905 14288 : if (object->IsJSModuleNamespace()) return Just(false);
906 :
907 14288 : if (object->IsJSObject()) { // Shortcut.
908 : LookupIterator it(object->GetIsolate(), object, index, object,
909 : LookupIterator::OWN);
910 7063 : return HasProperty(&it);
911 : }
912 :
913 : Maybe<PropertyAttributes> attributes =
914 81 : JSReceiver::GetOwnPropertyAttributes(object, index);
915 81 : MAYBE_RETURN(attributes, Nothing<bool>());
916 81 : return Just(attributes.FromJust() != ABSENT);
917 : }
918 :
919 6895066 : Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes(
920 : Handle<JSReceiver> object, Handle<Name> name) {
921 : LookupIterator it = LookupIterator::PropertyOrElement(object->GetIsolate(),
922 6895066 : object, name, object);
923 6895066 : return GetPropertyAttributes(&it);
924 : }
925 :
926 628086 : Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
927 : Handle<JSReceiver> object, Handle<Name> name) {
928 : LookupIterator it = LookupIterator::PropertyOrElement(
929 628086 : object->GetIsolate(), object, name, object, LookupIterator::OWN);
930 628086 : return GetPropertyAttributes(&it);
931 : }
932 :
933 81 : Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
934 : Handle<JSReceiver> object, uint32_t index) {
935 : LookupIterator it(object->GetIsolate(), object, index, object,
936 : LookupIterator::OWN);
937 81 : return GetPropertyAttributes(&it);
938 : }
939 :
940 1745534 : Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) {
941 : LookupIterator it(object->GetIsolate(), object, index, object);
942 1745534 : return HasProperty(&it);
943 : }
944 :
945 : Maybe<PropertyAttributes> JSReceiver::GetElementAttributes(
946 : Handle<JSReceiver> object, uint32_t index) {
947 : Isolate* isolate = object->GetIsolate();
948 : LookupIterator it(isolate, object, index, object);
949 : return GetPropertyAttributes(&it);
950 : }
951 :
952 : Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttributes(
953 : Handle<JSReceiver> object, uint32_t index) {
954 : Isolate* isolate = object->GetIsolate();
955 : LookupIterator it(isolate, object, index, object, LookupIterator::OWN);
956 : return GetPropertyAttributes(&it);
957 : }
958 :
959 : bool JSGlobalObject::IsDetached() {
960 : return JSGlobalProxy::cast(global_proxy())->IsDetachedFrom(*this);
961 : }
962 :
963 494318 : bool JSGlobalProxy::IsDetachedFrom(JSGlobalObject global) const {
964 : const PrototypeIterator iter(this->GetIsolate(), *this);
965 494318 : return iter.GetCurrent() != global;
966 : }
967 :
968 : inline int JSGlobalProxy::SizeWithEmbedderFields(int embedder_field_count) {
969 : DCHECK_GE(embedder_field_count, 0);
970 89711 : return kSize + embedder_field_count * kEmbedderDataSlotSize;
971 : }
972 :
973 92346 : ACCESSORS(JSIteratorResult, value, Object, kValueOffset)
974 90855 : ACCESSORS(JSIteratorResult, done, Object, kDoneOffset)
975 :
976 1050 : ACCESSORS(JSAsyncFromSyncIterator, sync_iterator, JSReceiver,
977 : kSyncIteratorOffset)
978 1050 : ACCESSORS(JSAsyncFromSyncIterator, next, Object, kNextOffset)
979 :
980 0 : ACCESSORS(JSStringIterator, string, String, kStringOffset)
981 0 : SMI_ACCESSORS(JSStringIterator, index, kNextIndexOffset)
982 :
983 5316355 : static inline bool ShouldConvertToSlowElements(JSObject object,
984 : uint32_t capacity,
985 : uint32_t index,
986 : uint32_t* new_capacity) {
987 : STATIC_ASSERT(JSObject::kMaxUncheckedOldFastElementsLength <=
988 : JSObject::kMaxUncheckedFastElementsLength);
989 5316355 : if (index < capacity) {
990 4756363 : *new_capacity = capacity;
991 4756363 : return false;
992 : }
993 559992 : if (index - capacity >= JSObject::kMaxGap) return true;
994 616754 : *new_capacity = JSObject::NewElementsCapacity(index + 1);
995 : DCHECK_LT(index, *new_capacity);
996 : // TODO(ulan): Check if it works with young large objects.
997 616754 : if (*new_capacity <= JSObject::kMaxUncheckedOldFastElementsLength ||
998 44279 : (*new_capacity <= JSObject::kMaxUncheckedFastElementsLength &&
999 44279 : ObjectInYoungGeneration(object))) {
1000 : return false;
1001 : }
1002 : // If the fast-case backing storage takes up much more memory than a
1003 : // dictionary backing storage would, the object should have slow elements.
1004 1577 : int used_elements = object->GetFastElementsUsage();
1005 : uint32_t size_threshold = NumberDictionary::kPreferFastElementsSizeFactor *
1006 1577 : NumberDictionary::ComputeCapacity(used_elements) *
1007 1577 : NumberDictionary::kEntrySize;
1008 1577 : return size_threshold <= *new_capacity;
1009 : }
1010 :
1011 : } // namespace internal
1012 : } // namespace v8
1013 :
1014 : #include "src/objects/object-macros-undef.h"
1015 :
1016 : #endif // V8_OBJECTS_JS_OBJECTS_INL_H_
|