Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index a169372be16830d8e246fcaeecf51199deb54bd7..284901f583239da3531d8de5fad4eed98af71c0e 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -628,7 +628,7 @@ MaybeHandle<Object> Object::InstanceOf(Isolate* isolate, Handle<Object> object, |
JSReceiver::GetMethod(Handle<JSReceiver>::cast(callable), |
isolate->factory()->has_instance_symbol()), |
Object); |
- if (!inst_of_handler->IsUndefined()) { |
+ if (!inst_of_handler->IsUndefined(isolate)) { |
// Call the {inst_of_handler} on the {callable}. |
Handle<Object> result; |
ASSIGN_RETURN_ON_EXCEPTION( |
@@ -692,7 +692,7 @@ MaybeHandle<Object> Object::GetMethod(Handle<JSReceiver> receiver, |
Isolate* isolate = receiver->GetIsolate(); |
ASSIGN_RETURN_ON_EXCEPTION(isolate, func, |
JSReceiver::GetProperty(receiver, name), Object); |
- if (func->IsNull() || func->IsUndefined()) { |
+ if (func->IsNull() || func->IsUndefined(isolate)) { |
return isolate->factory()->undefined_value(); |
} |
if (!func->IsCallable()) { |
@@ -887,7 +887,7 @@ MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, |
isolate, trap, |
Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name), Object); |
// 7. If trap is undefined, then |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
// 7.a Return target.[[Get]](P, Receiver). |
LookupIterator it = |
LookupIterator::PropertyOrElement(isolate, receiver, name, target); |
@@ -927,8 +927,8 @@ MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, |
// 10.b.i. If trapResult is not undefined, throw a TypeError exception. |
inconsistent = PropertyDescriptor::IsAccessorDescriptor(&target_desc) && |
!target_desc.configurable() && |
- target_desc.get()->IsUndefined() && |
- !trap_result->IsUndefined(); |
+ target_desc.get()->IsUndefined(isolate) && |
+ !trap_result->IsUndefined(isolate); |
if (inconsistent) { |
THROW_NEW_ERROR( |
isolate, |
@@ -1020,7 +1020,7 @@ Object* FunctionTemplateInfo::GetCompatibleReceiver(Isolate* isolate, |
if (!receiver->IsJSObject()) return isolate->heap()->null_value(); |
Object* recv_type = this->signature(); |
// No signature, return holder. |
- if (recv_type->IsUndefined()) return receiver; |
+ if (recv_type->IsUndefined(isolate)) return receiver; |
FunctionTemplateInfo* signature = FunctionTemplateInfo::cast(recv_type); |
// Check the receiver. |
for (PrototypeIterator iter(isolate, JSObject::cast(receiver), |
@@ -1099,7 +1099,7 @@ MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) { |
ASSIGN_RETURN_ON_EXCEPTION(isolate, trap, GetMethod(handler, trap_name), |
Object); |
// 6. If trap is undefined, then return target.[[GetPrototypeOf]](). |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
return JSReceiver::GetPrototype(isolate, target); |
} |
// 7. Let handlerProto be ? Call(trap, handler, «target»). |
@@ -1446,10 +1446,12 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object, |
int entry = property_dictionary->FindEntry(name); |
if (entry == GlobalDictionary::kNotFound) { |
- auto cell = object->GetIsolate()->factory()->NewPropertyCell(); |
+ Isolate* isolate = object->GetIsolate(); |
+ auto cell = isolate->factory()->NewPropertyCell(); |
cell->set_value(*value); |
- auto cell_type = value->IsUndefined() ? PropertyCellType::kUndefined |
- : PropertyCellType::kConstant; |
+ auto cell_type = value->IsUndefined(isolate) |
+ ? PropertyCellType::kUndefined |
+ : PropertyCellType::kConstant; |
details = details.set_cell_type(cell_type); |
value = cell; |
property_dictionary = |
@@ -1688,7 +1690,7 @@ MaybeHandle<Object> Object::ArraySpeciesConstructor( |
} |
} |
} |
- if (constructor->IsUndefined()) { |
+ if (constructor->IsUndefined(isolate)) { |
return default_species; |
} else { |
if (!constructor->IsConstructor()) { |
@@ -2722,8 +2724,9 @@ void JSObject::AddSlowProperty(Handle<JSObject> object, |
} else { |
auto cell = isolate->factory()->NewPropertyCell(); |
cell->set_value(*value); |
- auto cell_type = value->IsUndefined() ? PropertyCellType::kUndefined |
- : PropertyCellType::kConstant; |
+ auto cell_type = value->IsUndefined(isolate) |
+ ? PropertyCellType::kUndefined |
+ : PropertyCellType::kConstant; |
details = details.set_cell_type(cell_type); |
value = cell; |
@@ -3303,17 +3306,18 @@ static inline bool EqualImmutableValues(Object* obj1, Object* obj2) { |
// proper sharing of descriptor arrays. |
void Map::ReplaceDescriptors(DescriptorArray* new_descriptors, |
LayoutDescriptor* new_layout_descriptor) { |
+ Isolate* isolate = GetIsolate(); |
// Don't overwrite the empty descriptor array or initial map's descriptors. |
- if (NumberOfOwnDescriptors() == 0 || GetBackPointer()->IsUndefined()) { |
+ if (NumberOfOwnDescriptors() == 0 || GetBackPointer()->IsUndefined(isolate)) { |
return; |
} |
DescriptorArray* to_replace = instance_descriptors(); |
- GetHeap()->incremental_marking()->IterateBlackObject(to_replace); |
+ isolate->heap()->incremental_marking()->IterateBlackObject(to_replace); |
Map* current = this; |
while (current->instance_descriptors() == to_replace) { |
Object* next = current->GetBackPointer(); |
- if (next->IsUndefined()) break; // Stop overwriting at initial map. |
+ if (next->IsUndefined(isolate)) break; // Stop overwriting at initial map. |
current->SetEnumLength(kInvalidEnumCacheSentinel); |
current->UpdateDescriptors(new_descriptors, new_layout_descriptor); |
current = Map::cast(next); |
@@ -3324,9 +3328,10 @@ void Map::ReplaceDescriptors(DescriptorArray* new_descriptors, |
Map* Map::FindRootMap() { |
Map* result = this; |
+ Isolate* isolate = GetIsolate(); |
while (true) { |
Object* back = result->GetBackPointer(); |
- if (back->IsUndefined()) { |
+ if (back->IsUndefined(isolate)) { |
// Initial map always owns descriptors and doesn't have unused entries |
// in the descriptor array. |
DCHECK(result->owns_descriptors()); |
@@ -3384,9 +3389,10 @@ Map* Map::FindFieldOwner(int descriptor) { |
DisallowHeapAllocation no_allocation; |
DCHECK_EQ(DATA, instance_descriptors()->GetDetails(descriptor).type()); |
Map* result = this; |
+ Isolate* isolate = GetIsolate(); |
while (true) { |
Object* back = result->GetBackPointer(); |
- if (back->IsUndefined()) break; |
+ if (back->IsUndefined(isolate)) break; |
Map* parent = Map::cast(back); |
if (parent->NumberOfOwnDescriptors() <= descriptor) break; |
result = parent; |
@@ -4190,7 +4196,7 @@ Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it, |
DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); |
Handle<InterceptorInfo> interceptor(it->GetInterceptor()); |
- if (interceptor->setter()->IsUndefined()) return Just(false); |
+ if (interceptor->setter()->IsUndefined(isolate)) return Just(false); |
Handle<JSObject> holder = it->GetHolder<JSObject>(); |
bool result; |
@@ -4501,7 +4507,7 @@ Maybe<bool> Object::SetDataProperty(LookupIterator* it, Handle<Object> value) { |
Handle<Object> to_assign = value; |
// Convert the incoming value to a number for storing into typed arrays. |
if (it->IsElement() && receiver->HasFixedTypedArrayElements()) { |
- if (!value->IsNumber() && !value->IsUndefined()) { |
+ if (!value->IsNumber() && !value->IsUndefined(it->isolate())) { |
ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
it->isolate(), to_assign, Object::ToNumber(value), Nothing<bool>()); |
// We have to recheck the length. However, it can only change if the |
@@ -4640,13 +4646,14 @@ void Map::EnsureDescriptorSlack(Handle<Map> map, int slack) { |
new_descriptors->CopyEnumCacheFrom(*descriptors); |
} |
+ Isolate* isolate = map->GetIsolate(); |
// Replace descriptors by new_descriptors in all maps that share it. |
- map->GetHeap()->incremental_marking()->IterateBlackObject(*descriptors); |
+ isolate->heap()->incremental_marking()->IterateBlackObject(*descriptors); |
Map* current = *map; |
while (current->instance_descriptors() == *descriptors) { |
Object* next = current->GetBackPointer(); |
- if (next->IsUndefined()) break; // Stop overwriting at initial map. |
+ if (next->IsUndefined(isolate)) break; // Stop overwriting at initial map. |
current->UpdateDescriptors(*new_descriptors, layout_descriptor); |
current = Map::cast(next); |
} |
@@ -4964,7 +4971,7 @@ Maybe<bool> JSProxy::HasProperty(Isolate* isolate, Handle<JSProxy> proxy, |
isolate->factory()->has_string()), |
Nothing<bool>()); |
// 7. If trap is undefined, then |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
// 7a. Return target.[[HasProperty]](P). |
return JSReceiver::HasProperty(target, name); |
} |
@@ -5030,7 +5037,7 @@ Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name, |
Handle<Object> trap; |
ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
isolate, trap, Object::GetMethod(handler, trap_name), Nothing<bool>()); |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
LookupIterator it = |
LookupIterator::PropertyOrElement(isolate, receiver, name, target); |
return Object::SetSuperProperty(&it, value, language_mode, |
@@ -5066,7 +5073,7 @@ Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name, |
} |
inconsistent = PropertyDescriptor::IsAccessorDescriptor(&target_desc) && |
!target_desc.configurable() && |
- target_desc.set()->IsUndefined(); |
+ target_desc.set()->IsUndefined(isolate); |
if (inconsistent) { |
isolate->Throw(*isolate->factory()->NewTypeError( |
MessageTemplate::kProxySetFrozenAccessor, name)); |
@@ -5099,7 +5106,7 @@ Maybe<bool> JSProxy::DeletePropertyOrElement(Handle<JSProxy> proxy, |
Handle<Object> trap; |
ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
isolate, trap, Object::GetMethod(handler, trap_name), Nothing<bool>()); |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
return JSReceiver::DeletePropertyOrElement(target, name, language_mode); |
} |
@@ -5493,7 +5500,7 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( |
} |
PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, |
*holder, Object::DONT_THROW); |
- if (!interceptor->query()->IsUndefined()) { |
+ if (!interceptor->query()->IsUndefined(isolate)) { |
Handle<Object> result; |
if (it->IsElement()) { |
uint32_t index = it->index(); |
@@ -5513,7 +5520,7 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( |
CHECK(result->ToInt32(&value)); |
return Just(static_cast<PropertyAttributes>(value)); |
} |
- } else if (!interceptor->getter()->IsUndefined()) { |
+ } else if (!interceptor->getter()->IsUndefined(isolate)) { |
// TODO(verwaest): Use GetPropertyWithInterceptor? |
Handle<Object> result; |
if (it->IsElement()) { |
@@ -5933,7 +5940,7 @@ Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it, |
DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); |
Handle<InterceptorInfo> interceptor(it->GetInterceptor()); |
- if (interceptor->deleter()->IsUndefined()) return Nothing<bool>(); |
+ if (interceptor->deleter()->IsUndefined(isolate)) return Nothing<bool>(); |
Handle<JSObject> holder = it->GetHolder<JSObject>(); |
Handle<Object> receiver = it->GetReceiver(); |
@@ -6870,7 +6877,7 @@ Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy, |
Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name), |
Nothing<bool>()); |
// 7. If trap is undefined, then: |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
// 7a. Return target.[[DefineOwnProperty]](P, Desc). |
return JSReceiver::DefineOwnProperty(isolate, target, key, desc, |
should_throw); |
@@ -7088,7 +7095,7 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name), |
Nothing<bool>()); |
// 7. If trap is undefined, then |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
// 7a. Return target.[[GetOwnProperty]](P). |
return JSReceiver::GetOwnPropertyDescriptor(isolate, target, name, desc); |
} |
@@ -7101,7 +7108,8 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
Nothing<bool>()); |
// 9. If Type(trapResultObj) is neither Object nor Undefined, throw a |
// TypeError exception. |
- if (!trap_result_obj->IsJSReceiver() && !trap_result_obj->IsUndefined()) { |
+ if (!trap_result_obj->IsJSReceiver() && |
+ !trap_result_obj->IsUndefined(isolate)) { |
isolate->Throw(*isolate->factory()->NewTypeError( |
MessageTemplate::kProxyGetOwnPropertyDescriptorInvalid, name)); |
return Nothing<bool>(); |
@@ -7112,7 +7120,7 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
JSReceiver::GetOwnPropertyDescriptor(isolate, target, name, &target_desc); |
MAYBE_RETURN(found, Nothing<bool>()); |
// 11. If trapResultObj is undefined, then |
- if (trap_result_obj->IsUndefined()) { |
+ if (trap_result_obj->IsUndefined(isolate)) { |
// 11a. If targetDesc is undefined, return undefined. |
if (!found.FromJust()) return Just(false); |
// 11b. If targetDesc.[[Configurable]] is false, throw a TypeError |
@@ -7177,19 +7185,20 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
bool JSObject::ReferencesObjectFromElements(FixedArray* elements, |
ElementsKind kind, |
Object* object) { |
+ Isolate* isolate = elements->GetIsolate(); |
if (IsFastObjectElementsKind(kind) || kind == FAST_STRING_WRAPPER_ELEMENTS) { |
int length = IsJSArray() |
? Smi::cast(JSArray::cast(this)->length())->value() |
: elements->length(); |
for (int i = 0; i < length; ++i) { |
Object* element = elements->get(i); |
- if (!element->IsTheHole() && element == object) return true; |
+ if (!element->IsTheHole(isolate) && element == object) return true; |
} |
} else { |
DCHECK(kind == DICTIONARY_ELEMENTS || kind == SLOW_STRING_WRAPPER_ELEMENTS); |
Object* key = |
SeededNumberDictionary::cast(elements)->SlowReverseLookup(object); |
- if (!key->IsUndefined()) return true; |
+ if (!key->IsUndefined(isolate)) return true; |
} |
return false; |
} |
@@ -7213,7 +7222,7 @@ bool JSObject::ReferencesObject(Object* obj) { |
// Check if the object is among the named properties. |
Object* key = SlowReverseLookup(obj); |
- if (!key->IsUndefined()) { |
+ if (!key->IsUndefined(heap->isolate())) { |
return true; |
} |
@@ -7251,7 +7260,7 @@ bool JSObject::ReferencesObject(Object* obj) { |
int length = parameter_map->length(); |
for (int i = 2; i < length; ++i) { |
Object* value = parameter_map->get(i); |
- if (!value->IsTheHole() && value == obj) return true; |
+ if (!value->IsTheHole(heap->isolate()) && value == obj) return true; |
} |
// Check the arguments. |
FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
@@ -7438,7 +7447,7 @@ Maybe<bool> JSProxy::PreventExtensions(Handle<JSProxy> proxy, |
Handle<Object> trap; |
ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
isolate, trap, Object::GetMethod(handler, trap_name), Nothing<bool>()); |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
return JSReceiver::PreventExtensions(target, should_throw); |
} |
@@ -7540,7 +7549,7 @@ Maybe<bool> JSProxy::IsExtensible(Handle<JSProxy> proxy) { |
Handle<Object> trap; |
ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
isolate, trap, Object::GetMethod(handler, trap_name), Nothing<bool>()); |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
return JSReceiver::IsExtensible(target); |
} |
@@ -7992,7 +8001,7 @@ MaybeHandle<Object> JSReceiver::ToPrimitive(Handle<JSReceiver> receiver, |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, exotic_to_prim, |
GetMethod(receiver, isolate->factory()->to_primitive_symbol()), Object); |
- if (!exotic_to_prim->IsUndefined()) { |
+ if (!exotic_to_prim->IsUndefined(isolate)) { |
Handle<Object> hint_string; |
switch (hint) { |
case ToPrimitiveHint::kDefault: |
@@ -8370,10 +8379,10 @@ MaybeHandle<Object> JSObject::DefineAccessor(LookupIterator* it, |
return it->factory()->undefined_value(); |
} |
- DCHECK(getter->IsCallable() || getter->IsUndefined() || getter->IsNull() || |
- getter->IsFunctionTemplateInfo()); |
- DCHECK(setter->IsCallable() || setter->IsUndefined() || setter->IsNull() || |
- getter->IsFunctionTemplateInfo()); |
+ DCHECK(getter->IsCallable() || getter->IsUndefined(isolate) || |
+ getter->IsNull() || getter->IsFunctionTemplateInfo()); |
+ DCHECK(setter->IsCallable() || setter->IsUndefined(isolate) || |
+ setter->IsNull() || getter->IsFunctionTemplateInfo()); |
it->TransitionToAccessorProperty(getter, setter, attributes); |
return isolate->factory()->undefined_value(); |
@@ -8491,7 +8500,8 @@ Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode, |
Isolate* isolate = fast_map->GetIsolate(); |
Handle<Object> maybe_cache(isolate->native_context()->normalized_map_cache(), |
isolate); |
- bool use_cache = !fast_map->is_prototype_map() && !maybe_cache->IsUndefined(); |
+ bool use_cache = |
+ !fast_map->is_prototype_map() && !maybe_cache->IsUndefined(isolate); |
Handle<NormalizedMapCache> cache; |
if (use_cache) cache = Handle<NormalizedMapCache>::cast(maybe_cache); |
@@ -10024,7 +10034,9 @@ MaybeHandle<String> Name::ToFunctionName(Handle<Name> name) { |
// ES6 section 9.2.11 SetFunctionName, step 4. |
Isolate* const isolate = name->GetIsolate(); |
Handle<Object> description(Handle<Symbol>::cast(name)->name(), isolate); |
- if (description->IsUndefined()) return isolate->factory()->empty_string(); |
+ if (description->IsUndefined(isolate)) { |
+ return isolate->factory()->empty_string(); |
+ } |
IncrementalStringBuilder builder(isolate); |
builder.AppendCharacter('['); |
builder.AppendString(Handle<String>::cast(description)); |
@@ -12406,12 +12418,11 @@ int Script::GetEvalPosition() { |
} |
void Script::InitLineEnds(Handle<Script> script) { |
- if (!script->line_ends()->IsUndefined()) return; |
- |
Isolate* isolate = script->GetIsolate(); |
+ if (!script->line_ends()->IsUndefined(isolate)) return; |
if (!script->source()->IsString()) { |
- DCHECK(script->source()->IsUndefined()); |
+ DCHECK(script->source()->IsUndefined(isolate)); |
Handle<FixedArray> empty = isolate->factory()->NewFixedArray(0); |
script->set_line_ends(*empty); |
DCHECK(script->line_ends()->IsFixedArray()); |
@@ -12567,7 +12578,7 @@ Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { |
Handle<JSObject> Script::GetWrapper(Handle<Script> script) { |
Isolate* isolate = script->GetIsolate(); |
- if (!script->wrapper()->IsUndefined()) { |
+ if (!script->wrapper()->IsUndefined(isolate)) { |
DCHECK(script->wrapper()->IsWeakCell()); |
Handle<WeakCell> cell(WeakCell::cast(script->wrapper())); |
if (!cell->cleared()) { |
@@ -12732,8 +12743,9 @@ bool SharedFunctionInfo::PassesFilter(const char* raw_filter) { |
} |
bool SharedFunctionInfo::HasSourceCode() const { |
- return !script()->IsUndefined() && |
- !reinterpret_cast<Script*>(script())->source()->IsUndefined(); |
+ Isolate* isolate = GetIsolate(); |
+ return !script()->IsUndefined(isolate) && |
+ !reinterpret_cast<Script*>(script())->source()->IsUndefined(isolate); |
} |
@@ -14524,7 +14536,7 @@ Maybe<bool> JSProxy::SetPrototype(Handle<JSProxy> proxy, Handle<Object> value, |
Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name), |
Nothing<bool>()); |
// 7. If trap is undefined, then return target.[[SetPrototypeOf]](). |
- if (trap->IsUndefined()) { |
+ if (trap->IsUndefined(isolate)) { |
return JSReceiver::SetPrototype(target, value, from_javascript, |
should_throw); |
} |
@@ -15167,7 +15179,7 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it, |
DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); |
Handle<InterceptorInfo> interceptor = it->GetInterceptor(); |
- if (interceptor->getter()->IsUndefined()) { |
+ if (interceptor->getter()->IsUndefined(isolate)) { |
return isolate->factory()->undefined_value(); |
} |
@@ -15863,21 +15875,20 @@ int NameDictionaryBase<Derived, Shape>::FindEntry(Handle<Name> key) { |
uint32_t capacity = this->Capacity(); |
uint32_t entry = Derived::FirstProbe(key->Hash(), capacity); |
uint32_t count = 1; |
- |
+ Isolate* isolate = this->GetIsolate(); |
while (true) { |
int index = Derived::EntryToIndex(entry); |
Object* element = this->get(index); |
- if (element->IsUndefined()) break; // Empty entry. |
+ if (element->IsUndefined(isolate)) break; // Empty entry. |
if (*key == element) return entry; |
- if (!element->IsUniqueName() && |
- !element->IsTheHole() && |
+ if (!element->IsUniqueName() && !element->IsTheHole(isolate) && |
Name::cast(element)->Equals(*key)) { |
// Replace a key that is a non-internalized string by the equivalent |
// internalized string for faster further lookups. |
this->set(index, *key); |
return entry; |
} |
- DCHECK(element->IsTheHole() || !Name::cast(element)->Equals(*key)); |
+ DCHECK(element->IsTheHole(isolate) || !Name::cast(element)->Equals(*key)); |
entry = Derived::NextProbe(entry, count++, capacity); |
} |
return Derived::kNotFound; |
@@ -16297,7 +16308,7 @@ Handle<Object> JSObject::PrepareSlowElementsForSort( |
uint32_t key = NumberToUint32(k); |
if (key < limit) { |
- if (value->IsUndefined()) { |
+ if (value->IsUndefined(isolate)) { |
undefs++; |
} else if (pos > static_cast<uint32_t>(Smi::kMaxValue)) { |
// Adding an entry with the key beyond smi-range requires |
@@ -16447,10 +16458,10 @@ Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object, |
// number of stores of non-undefined, non-the-hole values. |
for (unsigned int i = 0; i < undefs; i++) { |
Object* current = elements->get(i); |
- if (current->IsTheHole()) { |
+ if (current->IsTheHole(isolate)) { |
holes--; |
undefs--; |
- } else if (current->IsUndefined()) { |
+ } else if (current->IsUndefined(isolate)) { |
undefs--; |
} else { |
continue; |
@@ -16458,10 +16469,10 @@ Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object, |
// Position i needs to be filled. |
while (undefs > i) { |
current = elements->get(undefs); |
- if (current->IsTheHole()) { |
+ if (current->IsTheHole(isolate)) { |
holes--; |
undefs--; |
- } else if (current->IsUndefined()) { |
+ } else if (current->IsUndefined(isolate)) { |
undefs--; |
} else { |
elements->set(i, current, write_barrier); |
@@ -17328,7 +17339,7 @@ Object* ObjectHashTable::Lookup(Handle<Object> key) { |
// If the object does not have an identity hash, it was never used as a key. |
Object* hash = key->GetHash(); |
- if (hash->IsUndefined()) { |
+ if (hash->IsUndefined(isolate)) { |
return isolate->heap()->the_hole_value(); |
} |
return Lookup(isolate, key, Smi::cast(hash)->value()); |
@@ -17728,7 +17739,8 @@ void OrderedHashTableIterator<Derived, TableType>::Transition() { |
template<class Derived, class TableType> |
bool OrderedHashTableIterator<Derived, TableType>::HasMore() { |
DisallowHeapAllocation no_allocation; |
- if (this->table()->IsUndefined()) return false; |
+ Isolate* isolate = this->GetIsolate(); |
+ if (this->table()->IsUndefined(isolate)) return false; |
Transition(); |
@@ -17736,7 +17748,7 @@ bool OrderedHashTableIterator<Derived, TableType>::HasMore() { |
int index = Smi::cast(this->index())->value(); |
int used_capacity = table->UsedCapacity(); |
- while (index < used_capacity && table->KeyAt(index)->IsTheHole()) { |
+ while (index < used_capacity && table->KeyAt(index)->IsTheHole(isolate)) { |
index++; |
} |
@@ -17744,7 +17756,7 @@ bool OrderedHashTableIterator<Derived, TableType>::HasMore() { |
if (index < used_capacity) return true; |
- set_table(GetHeap()->undefined_value()); |
+ set_table(isolate->heap()->undefined_value()); |
return false; |
} |
@@ -17901,7 +17913,7 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, int code_offset, |
Isolate* isolate = debug_info->GetIsolate(); |
Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_offset), |
isolate); |
- if (!break_point_info->IsUndefined()) { |
+ if (!break_point_info->IsUndefined(isolate)) { |
BreakPointInfo::SetBreakPoint( |
Handle<BreakPointInfo>::cast(break_point_info), |
break_point_object); |
@@ -17912,7 +17924,7 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, int code_offset, |
// break points before. Try to find a free slot. |
int index = kNoBreakPointInfo; |
for (int i = 0; i < debug_info->break_points()->length(); i++) { |
- if (debug_info->break_points()->get(i)->IsUndefined()) { |
+ if (debug_info->break_points()->get(i)->IsUndefined(isolate)) { |
index = i; |
break; |
} |
@@ -17949,8 +17961,9 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info, int code_offset, |
// Get the break point objects for a code offset. |
Handle<Object> DebugInfo::GetBreakPointObjects(int code_offset) { |
Object* break_point_info = GetBreakPointInfo(code_offset); |
- if (break_point_info->IsUndefined()) { |
- return GetIsolate()->factory()->undefined_value(); |
+ Isolate* isolate = GetIsolate(); |
+ if (break_point_info->IsUndefined(isolate)) { |
+ return isolate->factory()->undefined_value(); |
} |
return Handle<Object>( |
BreakPointInfo::cast(break_point_info)->break_point_objects(), |
@@ -17960,10 +17973,11 @@ Handle<Object> DebugInfo::GetBreakPointObjects(int code_offset) { |
// Get the total number of break points. |
int DebugInfo::GetBreakPointCount() { |
- if (break_points()->IsUndefined()) return 0; |
+ Isolate* isolate = GetIsolate(); |
+ if (break_points()->IsUndefined(isolate)) return 0; |
int count = 0; |
for (int i = 0; i < break_points()->length(); i++) { |
- if (!break_points()->get(i)->IsUndefined()) { |
+ if (!break_points()->get(i)->IsUndefined(isolate)) { |
BreakPointInfo* break_point_info = |
BreakPointInfo::cast(break_points()->get(i)); |
count += break_point_info->GetBreakPointCount(); |
@@ -17976,9 +17990,9 @@ int DebugInfo::GetBreakPointCount() { |
Handle<Object> DebugInfo::FindBreakPointInfo( |
Handle<DebugInfo> debug_info, Handle<Object> break_point_object) { |
Isolate* isolate = debug_info->GetIsolate(); |
- if (!debug_info->break_points()->IsUndefined()) { |
+ if (!debug_info->break_points()->IsUndefined(isolate)) { |
for (int i = 0; i < debug_info->break_points()->length(); i++) { |
- if (!debug_info->break_points()->get(i)->IsUndefined()) { |
+ if (!debug_info->break_points()->get(i)->IsUndefined(isolate)) { |
Handle<BreakPointInfo> break_point_info = Handle<BreakPointInfo>( |
BreakPointInfo::cast(debug_info->break_points()->get(i)), isolate); |
if (BreakPointInfo::HasBreakPointObject(break_point_info, |
@@ -17995,9 +18009,10 @@ Handle<Object> DebugInfo::FindBreakPointInfo( |
// Find the index of the break point info object for the specified code |
// position. |
int DebugInfo::GetBreakPointInfoIndex(int code_offset) { |
- if (break_points()->IsUndefined()) return kNoBreakPointInfo; |
+ Isolate* isolate = GetIsolate(); |
+ if (break_points()->IsUndefined(isolate)) return kNoBreakPointInfo; |
for (int i = 0; i < break_points()->length(); i++) { |
- if (!break_points()->get(i)->IsUndefined()) { |
+ if (!break_points()->get(i)->IsUndefined(isolate)) { |
BreakPointInfo* break_point_info = |
BreakPointInfo::cast(break_points()->get(i)); |
if (break_point_info->code_offset() == code_offset) { |
@@ -18014,7 +18029,7 @@ void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info, |
Handle<Object> break_point_object) { |
Isolate* isolate = break_point_info->GetIsolate(); |
// If there are no break points just ignore. |
- if (break_point_info->break_point_objects()->IsUndefined()) return; |
+ if (break_point_info->break_point_objects()->IsUndefined(isolate)) return; |
// If there is a single break point clear it if it is the same. |
if (!break_point_info->break_point_objects()->IsFixedArray()) { |
if (break_point_info->break_point_objects() == *break_point_object) { |
@@ -18050,7 +18065,7 @@ void BreakPointInfo::SetBreakPoint(Handle<BreakPointInfo> break_point_info, |
Isolate* isolate = break_point_info->GetIsolate(); |
// If there was no break point objects before just set it. |
- if (break_point_info->break_point_objects()->IsUndefined()) { |
+ if (break_point_info->break_point_objects()->IsUndefined(isolate)) { |
break_point_info->set_break_point_objects(*break_point_object); |
return; |
} |
@@ -18431,7 +18446,7 @@ Handle<PropertyCell> PropertyCell::InvalidateEntry( |
auto new_cell = isolate->factory()->NewPropertyCell(); |
new_cell->set_value(cell->value()); |
dictionary->ValueAtPut(entry, *new_cell); |
- bool is_the_hole = cell->value()->IsTheHole(); |
+ bool is_the_hole = cell->value()->IsTheHole(isolate); |
// Cell is officially mutable henceforth. |
PropertyDetails details = cell->property_details(); |
details = details.set_cell_type(is_the_hole ? PropertyCellType::kInvalidated |
@@ -18475,12 +18490,13 @@ PropertyCellType PropertyCell::UpdatedType(Handle<PropertyCell> cell, |
Handle<Object> value, |
PropertyDetails details) { |
PropertyCellType type = details.cell_type(); |
- DCHECK(!value->IsTheHole()); |
- if (cell->value()->IsTheHole()) { |
+ Isolate* isolate = cell->GetIsolate(); |
+ DCHECK(!value->IsTheHole(isolate)); |
+ if (cell->value()->IsTheHole(isolate)) { |
switch (type) { |
// Only allow a cell to transition once into constant state. |
case PropertyCellType::kUninitialized: |
- if (value->IsUndefined()) return PropertyCellType::kUndefined; |
+ if (value->IsUndefined(isolate)) return PropertyCellType::kUndefined; |
return PropertyCellType::kConstant; |
case PropertyCellType::kInvalidated: |
return PropertyCellType::kMutable; |
@@ -18510,7 +18526,8 @@ PropertyCellType PropertyCell::UpdatedType(Handle<PropertyCell> cell, |
void PropertyCell::UpdateCell(Handle<GlobalDictionary> dictionary, int entry, |
Handle<Object> value, PropertyDetails details) { |
- DCHECK(!value->IsTheHole()); |
+ Isolate* isolate = dictionary->GetIsolate(); |
+ DCHECK(!value->IsTheHole(isolate)); |
DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); |
Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry))); |
const PropertyDetails original_details = cell->property_details(); |
@@ -18521,7 +18538,7 @@ void PropertyCell::UpdateCell(Handle<GlobalDictionary> dictionary, int entry, |
PropertyCellType old_type = original_details.cell_type(); |
// Preserve the enumeration index unless the property was deleted or never |
// initialized. |
- if (cell->value()->IsTheHole()) { |
+ if (cell->value()->IsTheHole(isolate)) { |
index = dictionary->NextEnumerationIndex(); |
dictionary->SetNextEnumerationIndex(index + 1); |
// Negative lookup cells must be invalidated. |
@@ -18541,7 +18558,6 @@ void PropertyCell::UpdateCell(Handle<GlobalDictionary> dictionary, int entry, |
// Deopt when transitioning from a constant type. |
if (!invalidate && (old_type != new_type || |
original_details.IsReadOnly() != details.IsReadOnly())) { |
- Isolate* isolate = dictionary->GetIsolate(); |
cell->dependent_code()->DeoptimizeDependentCodeGroup( |
isolate, DependentCode::kPropertyCellChangedGroup); |
} |