[GetIsolate] Use RORoots for Oddball checks
Replace Is<oddball>(GetIsolate()) calls with a no-parameter version that goes through ReadOnlyRoots, and add a version that takes a ReadOnlyRoots if that is available in the parent (but Isolate isn't). Also opportunistically clean up a few places where ReadOnlyRoots are available but we still pass in an Isolate parameter. TBR=yangguo@chromium.org Bug: v8:7786 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: Icc0b8a7d8f9c6b84c0ec8fe771fcfb75c9dc5468 Reviewed-on: https://chromium-review.googlesource.com/1126302 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Dan Elphick <delphick@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#54245}
This commit is contained in:
parent
2a3cfb5a0c
commit
f8e76e4b97
29
src/api.cc
29
src/api.cc
@ -3459,10 +3459,7 @@ bool ValueDeserializer::ReadRawBytes(size_t length, const void** data) {
|
||||
|
||||
bool Value::FullIsUndefined() const {
|
||||
i::Handle<i::Object> object = Utils::OpenHandle(this);
|
||||
bool result = false;
|
||||
if (!object->IsSmi()) {
|
||||
result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate());
|
||||
}
|
||||
bool result = object->IsUndefined();
|
||||
DCHECK_EQ(result, QuickIsUndefined());
|
||||
return result;
|
||||
}
|
||||
@ -3470,10 +3467,7 @@ bool Value::FullIsUndefined() const {
|
||||
|
||||
bool Value::FullIsNull() const {
|
||||
i::Handle<i::Object> object = Utils::OpenHandle(this);
|
||||
bool result = false;
|
||||
if (!object->IsSmi()) {
|
||||
result = object->IsNull(i::HeapObject::cast(*object)->GetIsolate());
|
||||
}
|
||||
bool result = object->IsNull();
|
||||
DCHECK_EQ(result, QuickIsNull());
|
||||
return result;
|
||||
}
|
||||
@ -3482,14 +3476,14 @@ bool Value::FullIsNull() const {
|
||||
bool Value::IsTrue() const {
|
||||
i::Handle<i::Object> object = Utils::OpenHandle(this);
|
||||
if (object->IsSmi()) return false;
|
||||
return object->IsTrue(i::HeapObject::cast(*object)->GetIsolate());
|
||||
return object->IsTrue();
|
||||
}
|
||||
|
||||
|
||||
bool Value::IsFalse() const {
|
||||
i::Handle<i::Object> object = Utils::OpenHandle(this);
|
||||
if (object->IsSmi()) return false;
|
||||
return object->IsFalse(i::HeapObject::cast(*object)->GetIsolate());
|
||||
return object->IsFalse();
|
||||
}
|
||||
|
||||
|
||||
@ -5196,8 +5190,8 @@ MaybeLocal<Object> Function::NewInstanceWithSideEffectType(
|
||||
i::JSFunction::cast(*self)->shared()->get_api_func_data()->call_code();
|
||||
if (obj->IsCallHandlerInfo()) {
|
||||
i::CallHandlerInfo* handler_info = i::CallHandlerInfo::cast(obj);
|
||||
if (!handler_info->IsSideEffectFreeCallHandlerInfo(isolate)) {
|
||||
handler_info->SetNextCallHasNoSideEffect(isolate);
|
||||
if (!handler_info->IsSideEffectFreeCallHandlerInfo()) {
|
||||
handler_info->SetNextCallHasNoSideEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5212,10 +5206,10 @@ MaybeLocal<Object> Function::NewInstanceWithSideEffectType(
|
||||
i::CallHandlerInfo* handler_info = i::CallHandlerInfo::cast(obj);
|
||||
if (has_pending_exception) {
|
||||
// Restore the map if an exception prevented restoration.
|
||||
handler_info->NextCallHasNoSideEffect(isolate);
|
||||
handler_info->NextCallHasNoSideEffect();
|
||||
} else {
|
||||
DCHECK(handler_info->IsSideEffectCallHandlerInfo(isolate) ||
|
||||
handler_info->IsSideEffectFreeCallHandlerInfo(isolate));
|
||||
DCHECK(handler_info->IsSideEffectCallHandlerInfo() ||
|
||||
handler_info->IsSideEffectFreeCallHandlerInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5929,7 +5923,7 @@ double Number::Value() const {
|
||||
|
||||
bool Boolean::Value() const {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
||||
return obj->IsTrue(i::HeapObject::cast(*obj)->GetIsolate());
|
||||
return obj->IsTrue();
|
||||
}
|
||||
|
||||
|
||||
@ -6032,8 +6026,7 @@ void v8::Object::SetAlignedPointerInInternalFields(int argc, int indices[],
|
||||
|
||||
static void* ExternalValue(i::Object* obj) {
|
||||
// Obscure semantics for undefined, but somehow checked in our unit tests...
|
||||
if (!obj->IsSmi() &&
|
||||
obj->IsUndefined(i::HeapObject::cast(obj)->GetIsolate())) {
|
||||
if (obj->IsUndefined()) {
|
||||
return nullptr;
|
||||
}
|
||||
i::Object* foreign = i::JSObject::cast(obj)->GetEmbedderField(0);
|
||||
|
@ -58,7 +58,7 @@ void Context::set_previous(Context* context) { set(PREVIOUS_INDEX, context); }
|
||||
|
||||
Object* Context::next_context_link() { return get(Context::NEXT_CONTEXT_LINK); }
|
||||
|
||||
bool Context::has_extension() { return !extension()->IsTheHole(GetIsolate()); }
|
||||
bool Context::has_extension() { return !extension()->IsTheHole(); }
|
||||
HeapObject* Context::extension() {
|
||||
return HeapObject::cast(get(EXTENSION_INDEX));
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ JSObject* Context::extension_object() {
|
||||
DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext() ||
|
||||
IsEvalContext() || IsCatchContext());
|
||||
HeapObject* object = extension();
|
||||
if (object->IsTheHole(GetIsolate())) return nullptr;
|
||||
if (object->IsTheHole()) return nullptr;
|
||||
DCHECK(object->IsJSContextExtensionObject() ||
|
||||
(IsNativeContext() && object->IsJSGlobalObject()));
|
||||
return JSObject::cast(object);
|
||||
|
@ -954,8 +954,7 @@ DebugInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
|
||||
}
|
||||
|
||||
// static
|
||||
bool DebugEvaluate::CallbackHasNoSideEffect(Isolate* isolate,
|
||||
Object* callback_info) {
|
||||
bool DebugEvaluate::CallbackHasNoSideEffect(Object* callback_info) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
if (callback_info->IsAccessorInfo()) {
|
||||
// List of whitelisted internal accessors can be found in accessors.h.
|
||||
@ -974,7 +973,7 @@ bool DebugEvaluate::CallbackHasNoSideEffect(Isolate* isolate,
|
||||
}
|
||||
} else if (callback_info->IsCallHandlerInfo()) {
|
||||
CallHandlerInfo* info = CallHandlerInfo::cast(callback_info);
|
||||
if (info->IsSideEffectFreeCallHandlerInfo(isolate)) return true;
|
||||
if (info->IsSideEffectFreeCallHandlerInfo()) return true;
|
||||
if (FLAG_trace_side_effect_free_debug_evaluate) {
|
||||
PrintF("[debug-evaluate] API CallHandlerInfo may cause side effect.\n");
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class DebugEvaluate : public AllStatic {
|
||||
|
||||
static DebugInfo::SideEffectState FunctionGetSideEffectState(
|
||||
Isolate* isolate, Handle<SharedFunctionInfo> info);
|
||||
static bool CallbackHasNoSideEffect(Isolate* isolate, Object* callback_info);
|
||||
static bool CallbackHasNoSideEffect(Object* callback_info);
|
||||
static void ApplySideEffectChecks(Handle<BytecodeArray> bytecode_array);
|
||||
|
||||
private:
|
||||
|
@ -2285,13 +2285,12 @@ bool Debug::PerformSideEffectCheck(Handle<JSFunction> function,
|
||||
bool Debug::PerformSideEffectCheckForCallback(Handle<Object> callback_info) {
|
||||
DCHECK_EQ(isolate_->debug_execution_mode(), DebugInfo::kSideEffects);
|
||||
if (!callback_info.is_null() && callback_info->IsCallHandlerInfo() &&
|
||||
i::CallHandlerInfo::cast(*callback_info)
|
||||
->NextCallHasNoSideEffect(isolate_)) {
|
||||
i::CallHandlerInfo::cast(*callback_info)->NextCallHasNoSideEffect()) {
|
||||
return true;
|
||||
}
|
||||
// TODO(7515): always pass a valid callback info object.
|
||||
if (!callback_info.is_null() &&
|
||||
DebugEvaluate::CallbackHasNoSideEffect(isolate_, *callback_info)) {
|
||||
DebugEvaluate::CallbackHasNoSideEffect(*callback_info)) {
|
||||
return true;
|
||||
}
|
||||
side_effect_check_failed_ = true;
|
||||
|
@ -454,26 +454,24 @@ static void TraceTopFrame(Isolate* isolate) {
|
||||
static void SortIndices(
|
||||
Isolate* isolate, Handle<FixedArray> indices, uint32_t sort_size,
|
||||
WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER) {
|
||||
struct {
|
||||
bool operator()(const base::AtomicElement<Object*>& elementA,
|
||||
const base::AtomicElement<Object*>& elementB) {
|
||||
const Object* a = elementA.value();
|
||||
const Object* b = elementB.value();
|
||||
if (a->IsSmi() || !a->IsUndefined(HeapObject::cast(a)->GetIsolate())) {
|
||||
if (!b->IsSmi() && b->IsUndefined(HeapObject::cast(b)->GetIsolate())) {
|
||||
return true;
|
||||
}
|
||||
return a->Number() < b->Number();
|
||||
}
|
||||
return !b->IsSmi() && b->IsUndefined(HeapObject::cast(b)->GetIsolate());
|
||||
}
|
||||
} cmp;
|
||||
// Use AtomicElement wrapper to ensure that std::sort uses atomic load and
|
||||
// store operations that are safe for concurrent marking.
|
||||
base::AtomicElement<Object*>* start =
|
||||
reinterpret_cast<base::AtomicElement<Object*>*>(
|
||||
indices->GetFirstElementAddress());
|
||||
std::sort(start, start + sort_size, cmp);
|
||||
std::sort(start, start + sort_size,
|
||||
[isolate](const base::AtomicElement<Object*>& elementA,
|
||||
const base::AtomicElement<Object*>& elementB) {
|
||||
const Object* a = elementA.value();
|
||||
const Object* b = elementB.value();
|
||||
if (a->IsSmi() || !a->IsUndefined(isolate)) {
|
||||
if (!b->IsSmi() && b->IsUndefined(isolate)) {
|
||||
return true;
|
||||
}
|
||||
return a->Number() < b->Number();
|
||||
}
|
||||
return !b->IsSmi() && b->IsUndefined(isolate);
|
||||
});
|
||||
if (write_barrier_mode != SKIP_WRITE_BARRIER) {
|
||||
FIXED_ARRAY_ELEMENTS_WRITE_BARRIER(isolate->heap(), *indices, 0, sort_size);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void Log::MessageBuilder::AppendSymbolName(Symbol* symbol) {
|
||||
DCHECK(symbol);
|
||||
OFStream& os = log_->os_;
|
||||
os << "symbol(";
|
||||
if (!symbol->name()->IsUndefined(symbol->GetIsolate())) {
|
||||
if (!symbol->name()->IsUndefined()) {
|
||||
os << "\"";
|
||||
AppendDetailed(String::cast(symbol->name()), false);
|
||||
os << "\" ";
|
||||
|
@ -114,7 +114,7 @@ class CodeEventLogger::NameBuffer {
|
||||
} else {
|
||||
Symbol* symbol = Symbol::cast(name);
|
||||
AppendBytes("symbol(");
|
||||
if (!symbol->name()->IsUndefined(symbol->GetIsolate())) {
|
||||
if (!symbol->name()->IsUndefined()) {
|
||||
AppendBytes("\"");
|
||||
AppendString(String::cast(symbol->name()));
|
||||
AppendBytes("\" ");
|
||||
|
@ -208,45 +208,49 @@ bool HeapObject::IsExternal(Isolate* isolate) const {
|
||||
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF)
|
||||
#undef IS_TYPE_FUNCTION_DEF
|
||||
|
||||
#define IS_TYPE_FUNCTION_DEF(Type, Value) \
|
||||
bool Object::Is##Type(Isolate* isolate) const { \
|
||||
return this == ReadOnlyRoots(isolate).Value(); \
|
||||
} \
|
||||
bool HeapObject::Is##Type(Isolate* isolate) const { \
|
||||
return this == ReadOnlyRoots(isolate).Value(); \
|
||||
}
|
||||
#define IS_TYPE_FUNCTION_DEF(Type, Value) \
|
||||
bool Object::Is##Type(Isolate* isolate) const { \
|
||||
return Is##Type(ReadOnlyRoots(isolate->heap())); \
|
||||
} \
|
||||
bool Object::Is##Type(ReadOnlyRoots roots) const { \
|
||||
return this == roots.Value(); \
|
||||
} \
|
||||
bool Object::Is##Type() const { \
|
||||
return IsHeapObject() && HeapObject::cast(this)->Is##Type(); \
|
||||
} \
|
||||
bool HeapObject::Is##Type(Isolate* isolate) const { \
|
||||
return Object::Is##Type(isolate); \
|
||||
} \
|
||||
bool HeapObject::Is##Type(ReadOnlyRoots roots) const { \
|
||||
return Object::Is##Type(roots); \
|
||||
} \
|
||||
bool HeapObject::Is##Type() const { return Is##Type(GetReadOnlyRoots()); }
|
||||
ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
|
||||
#undef IS_TYPE_FUNCTION_DEF
|
||||
|
||||
bool Object::IsNullOrUndefined(Isolate* isolate) const {
|
||||
ReadOnlyRoots roots(isolate);
|
||||
return this == roots.null_value() || this == roots.undefined_value();
|
||||
return IsNullOrUndefined(ReadOnlyRoots(isolate));
|
||||
}
|
||||
|
||||
bool Object::IsNullOrUndefined(ReadOnlyRoots roots) const {
|
||||
return IsNull(roots) || IsUndefined(roots);
|
||||
}
|
||||
|
||||
bool Object::IsNullOrUndefined() const {
|
||||
return IsHeapObject() && HeapObject::cast(this)->IsNullOrUndefined();
|
||||
}
|
||||
|
||||
bool HeapObject::IsNullOrUndefined(Isolate* isolate) const {
|
||||
ReadOnlyRoots roots(isolate);
|
||||
return this == roots.null_value() || this == roots.undefined_value();
|
||||
return Object::IsNullOrUndefined(isolate);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#define IS_TYPE_FUNCTION_DEF(Type, Value) \
|
||||
bool Object::Is##Type() const { \
|
||||
return IsHeapObject() && HeapObject::cast(this)->Is##Type(); \
|
||||
} \
|
||||
bool HeapObject::Is##Type() const { \
|
||||
return IsOddball() && Oddball::cast(this)->kind() == Oddball::k##Type; \
|
||||
}
|
||||
ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
|
||||
#undef IS_TYPE_FUNCTION_DEF
|
||||
|
||||
bool Object::IsNullOrUndefined() const {
|
||||
return this->IsNull() || this->IsUndefined();
|
||||
bool HeapObject::IsNullOrUndefined(ReadOnlyRoots roots) const {
|
||||
return Object::IsNullOrUndefined(roots);
|
||||
}
|
||||
|
||||
bool HeapObject::IsNullOrUndefined() const {
|
||||
return this->IsNull() || this->IsUndefined();
|
||||
return IsNullOrUndefined(GetReadOnlyRoots());
|
||||
}
|
||||
#endif
|
||||
|
||||
bool HeapObject::IsString() const {
|
||||
return map()->instance_type() < FIRST_NONSTRING_TYPE;
|
||||
@ -718,8 +722,7 @@ Representation Object::OptimalRepresentation() {
|
||||
return Representation::Smi();
|
||||
} else if (FLAG_track_double_fields && IsHeapNumber()) {
|
||||
return Representation::Double();
|
||||
} else if (FLAG_track_computed_fields &&
|
||||
IsUninitialized(HeapObject::cast(this)->GetIsolate())) {
|
||||
} else if (FLAG_track_computed_fields && IsUninitialized()) {
|
||||
return Representation::None();
|
||||
} else if (FLAG_track_heap_object_fields) {
|
||||
DCHECK(IsHeapObject());
|
||||
@ -1633,7 +1636,7 @@ void JSObject::WriteToField(int descriptor, PropertyDetails details,
|
||||
FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor);
|
||||
if (details.representation().IsDouble()) {
|
||||
// Nothing more to be done.
|
||||
if (value->IsUninitialized(this->GetIsolate())) {
|
||||
if (value->IsUninitialized()) {
|
||||
return;
|
||||
}
|
||||
// Manipulating the signaling NaN used for the hole and uninitialized
|
||||
@ -1724,10 +1727,8 @@ void Object::VerifyApiCallResultType() {
|
||||
#if DEBUG
|
||||
if (IsSmi()) return;
|
||||
DCHECK(IsHeapObject());
|
||||
Isolate* isolate = HeapObject::cast(this)->GetIsolate();
|
||||
if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() ||
|
||||
IsBigInt() || IsUndefined(isolate) || IsTrue(isolate) ||
|
||||
IsFalse(isolate) || IsNull(isolate))) {
|
||||
IsBigInt() || IsUndefined() || IsTrue() || IsFalse() || IsNull())) {
|
||||
FATAL("API call returned invalid object");
|
||||
}
|
||||
#endif // DEBUG
|
||||
@ -2591,7 +2592,7 @@ void JSFunction::SetOptimizationMarker(OptimizationMarker marker) {
|
||||
}
|
||||
|
||||
bool JSFunction::has_feedback_vector() const {
|
||||
return !feedback_cell()->value()->IsUndefined(GetIsolate());
|
||||
return !feedback_cell()->value()->IsUndefined();
|
||||
}
|
||||
|
||||
Context* JSFunction::context() {
|
||||
@ -2636,11 +2637,9 @@ bool JSFunction::has_initial_map() {
|
||||
|
||||
bool JSFunction::has_instance_prototype() {
|
||||
DCHECK(has_prototype_slot());
|
||||
return has_initial_map() ||
|
||||
!prototype_or_initial_map()->IsTheHole(GetIsolate());
|
||||
return has_initial_map() || !prototype_or_initial_map()->IsTheHole();
|
||||
}
|
||||
|
||||
|
||||
bool JSFunction::has_prototype() {
|
||||
DCHECK(has_prototype_slot());
|
||||
return map()->has_non_instance_prototype() || has_instance_prototype();
|
||||
@ -3123,12 +3122,10 @@ void AccessorPair::set(AccessorComponent component, Object* value) {
|
||||
|
||||
|
||||
void AccessorPair::SetComponents(Object* getter, Object* setter) {
|
||||
Isolate* isolate = GetIsolate();
|
||||
if (!getter->IsNull(isolate)) set_getter(getter);
|
||||
if (!setter->IsNull(isolate)) set_setter(setter);
|
||||
if (!getter->IsNull()) set_getter(getter);
|
||||
if (!setter->IsNull()) set_setter(setter);
|
||||
}
|
||||
|
||||
|
||||
bool AccessorPair::Equals(AccessorPair* pair) {
|
||||
return (this == pair) || pair->Equals(getter(), setter());
|
||||
}
|
||||
@ -3145,7 +3142,7 @@ bool AccessorPair::ContainsAccessor() {
|
||||
|
||||
|
||||
bool AccessorPair::IsJSAccessor(Object* obj) {
|
||||
return obj->IsCallable() || obj->IsUndefined(GetIsolate());
|
||||
return obj->IsCallable() || obj->IsUndefined();
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
|
@ -256,7 +256,7 @@ void HeapObject::HeapObjectPrint(Isolate* isolate,
|
||||
Foreign::cast(this)->ForeignPrint(os);
|
||||
break;
|
||||
case CALL_HANDLER_INFO_TYPE:
|
||||
CallHandlerInfo::cast(this)->CallHandlerInfoPrint(isolate, os);
|
||||
CallHandlerInfo::cast(this)->CallHandlerInfoPrint(os);
|
||||
break;
|
||||
case SHARED_FUNCTION_INFO_TYPE:
|
||||
SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(os);
|
||||
@ -268,7 +268,7 @@ void HeapObject::HeapObjectPrint(Isolate* isolate,
|
||||
Cell::cast(this)->CellPrint(os);
|
||||
break;
|
||||
case PROPERTY_CELL_TYPE:
|
||||
PropertyCell::cast(this)->PropertyCellPrint(isolate, os);
|
||||
PropertyCell::cast(this)->PropertyCellPrint(os);
|
||||
break;
|
||||
case WEAK_CELL_TYPE:
|
||||
WeakCell::cast(this)->WeakCellPrint(os);
|
||||
@ -503,8 +503,7 @@ void PrintDictionaryElements(std::ostream& os, FixedArrayBase* elements) {
|
||||
dict->Print(os);
|
||||
}
|
||||
|
||||
void PrintSloppyArgumentElements(Isolate* isolate, std::ostream& os,
|
||||
ElementsKind kind,
|
||||
void PrintSloppyArgumentElements(std::ostream& os, ElementsKind kind,
|
||||
SloppyArgumentsElements* elements) {
|
||||
FixedArray* arguments_store = elements->arguments();
|
||||
os << "\n 0: context: " << Brief(elements->context())
|
||||
@ -515,7 +514,7 @@ void PrintSloppyArgumentElements(Isolate* isolate, std::ostream& os,
|
||||
Object* mapped_entry = elements->get_mapped_entry(i);
|
||||
os << "\n " << raw_index << ": param(" << i
|
||||
<< "): " << Brief(mapped_entry);
|
||||
if (mapped_entry->IsTheHole(isolate)) {
|
||||
if (mapped_entry->IsTheHole()) {
|
||||
os << " in the arguments_store[" << i << "]";
|
||||
} else {
|
||||
os << " in the context";
|
||||
@ -535,7 +534,7 @@ void PrintSloppyArgumentElements(Isolate* isolate, std::ostream& os,
|
||||
|
||||
} // namespace
|
||||
|
||||
void JSObject::PrintElements(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
void JSObject::PrintElements(std::ostream& os) { // NOLINT
|
||||
// Don't call GetElementsKind, its validation code can cause the printer to
|
||||
// fail when debugging.
|
||||
os << " - elements: " << Brief(elements()) << " {";
|
||||
@ -572,7 +571,7 @@ void JSObject::PrintElements(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
break;
|
||||
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
PrintSloppyArgumentElements(isolate, os, map()->elements_kind(),
|
||||
PrintSloppyArgumentElements(os, map()->elements_kind(),
|
||||
SloppyArgumentsElements::cast(elements()));
|
||||
break;
|
||||
case NO_ELEMENTS:
|
||||
@ -608,7 +607,7 @@ static void JSObjectPrintHeader(Isolate* isolate, std::ostream& os,
|
||||
}
|
||||
}
|
||||
|
||||
static void JSObjectPrintBody(Isolate* isolate, std::ostream& os,
|
||||
static void JSObjectPrintBody(std::ostream& os,
|
||||
JSObject* obj, // NOLINT
|
||||
bool print_elements = true) {
|
||||
os << "\n - properties: ";
|
||||
@ -620,7 +619,7 @@ static void JSObjectPrintBody(Isolate* isolate, std::ostream& os,
|
||||
if (obj->PrintProperties(os)) os << "\n ";
|
||||
os << "}\n";
|
||||
if (print_elements && obj->elements()->length() > 0) {
|
||||
obj->PrintElements(isolate, os);
|
||||
obj->PrintElements(os);
|
||||
}
|
||||
int embedder_fields = obj->GetEmbedderFieldCount();
|
||||
if (embedder_fields > 0) {
|
||||
@ -634,7 +633,7 @@ static void JSObjectPrintBody(Isolate* isolate, std::ostream& os,
|
||||
|
||||
void JSObject::JSObjectPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, nullptr);
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSGeneratorObject::JSGeneratorObjectPrint(Isolate* isolate,
|
||||
@ -691,7 +690,7 @@ void JSGeneratorObject::JSGeneratorObjectPrint(Isolate* isolate,
|
||||
void JSArray::JSArrayPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSArray");
|
||||
os << "\n - length: " << Brief(this->length());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSPromise::JSPromisePrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
@ -710,7 +709,7 @@ void JSRegExp::JSRegExpPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSRegExp");
|
||||
os << "\n - data: " << Brief(data());
|
||||
os << "\n - source: " << Brief(source());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSRegExpStringIterator::JSRegExpStringIteratorPrint(
|
||||
@ -722,7 +721,7 @@ void JSRegExpStringIterator::JSRegExpStringIteratorPrint(
|
||||
os << "\n - done: " << done();
|
||||
os << "\n - global: " << global();
|
||||
os << "\n - unicode: " << unicode();
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void Symbol::SymbolPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
@ -1104,7 +1103,7 @@ void FeedbackNexus::Print(std::ostream& os) { // NOLINT
|
||||
void JSValue::JSValuePrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSValue");
|
||||
os << "\n - value: " << Brief(value());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSMessageObject::JSMessageObjectPrint(Isolate* isolate,
|
||||
@ -1116,7 +1115,7 @@ void JSMessageObject::JSMessageObjectPrint(Isolate* isolate,
|
||||
os << "\n - end_position: " << end_position();
|
||||
os << "\n - script: " << Brief(script());
|
||||
os << "\n - stack_frames: " << Brief(stack_frames());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
|
||||
@ -1183,7 +1182,7 @@ void JSDate::JSDatePrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
sec()->IsSmi() ? Smi::ToInt(sec()) : -1);
|
||||
os << buf.start();
|
||||
}
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
|
||||
@ -1199,13 +1198,13 @@ void JSProxy::JSProxyPrint(std::ostream& os) { // NOLINT
|
||||
void JSSet::JSSetPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSSet");
|
||||
os << " - table: " << Brief(table());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSMap::JSMapPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSMap");
|
||||
os << " - table: " << Brief(table());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSCollectionIterator::JSCollectionIteratorPrint(
|
||||
@ -1230,13 +1229,13 @@ void JSMapIterator::JSMapIteratorPrint(Isolate* isolate,
|
||||
void JSWeakMap::JSWeakMapPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSWeakMap");
|
||||
os << "\n - table: " << Brief(table());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSWeakSet::JSWeakSetPrint(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSWeakSet");
|
||||
os << "\n - table: " << Brief(table());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSArrayBuffer::JSArrayBufferPrint(Isolate* isolate,
|
||||
@ -1250,7 +1249,7 @@ void JSArrayBuffer::JSArrayBufferPrint(Isolate* isolate,
|
||||
if (is_shared()) os << "\n - shared";
|
||||
if (is_wasm_memory()) os << "\n - is_wasm_memory";
|
||||
if (is_growable()) os << "\n - growable";
|
||||
JSObjectPrintBody(isolate, os, this, !was_neutered());
|
||||
JSObjectPrintBody(os, this, !was_neutered());
|
||||
}
|
||||
|
||||
void JSTypedArray::JSTypedArrayPrint(Isolate* isolate,
|
||||
@ -1261,7 +1260,7 @@ void JSTypedArray::JSTypedArrayPrint(Isolate* isolate,
|
||||
os << "\n - byte_length: " << Brief(byte_length());
|
||||
os << "\n - length: " << Brief(length());
|
||||
if (WasNeutered()) os << "\n - neutered";
|
||||
JSObjectPrintBody(isolate, os, this, !WasNeutered());
|
||||
JSObjectPrintBody(os, this, !WasNeutered());
|
||||
}
|
||||
|
||||
void JSArrayIterator::JSArrayIteratorPrint(Isolate* isolate,
|
||||
@ -1270,7 +1269,7 @@ void JSArrayIterator::JSArrayIteratorPrint(Isolate* isolate,
|
||||
os << "\n - iterated_object: " << Brief(iterated_object());
|
||||
os << "\n - next_index: " << Brief(next_index());
|
||||
os << "\n - kind: " << kind();
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSDataView::JSDataViewPrint(Isolate* isolate,
|
||||
@ -1280,7 +1279,7 @@ void JSDataView::JSDataViewPrint(Isolate* isolate,
|
||||
os << "\n - byte_offset: " << Brief(byte_offset());
|
||||
os << "\n - byte_length: " << Brief(byte_length());
|
||||
if (WasNeutered()) os << "\n - neutered";
|
||||
JSObjectPrintBody(isolate, os, this, !WasNeutered());
|
||||
JSObjectPrintBody(os, this, !WasNeutered());
|
||||
}
|
||||
|
||||
void JSBoundFunction::JSBoundFunctionPrint(Isolate* isolate,
|
||||
@ -1289,7 +1288,7 @@ void JSBoundFunction::JSBoundFunctionPrint(Isolate* isolate,
|
||||
os << "\n - bound_target_function: " << Brief(bound_target_function());
|
||||
os << "\n - bound_this: " << Brief(bound_this());
|
||||
os << "\n - bound_arguments: " << Brief(bound_arguments());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSFunction::JSFunctionPrint(Isolate* isolate,
|
||||
@ -1343,7 +1342,7 @@ void JSFunction::JSFunctionPrint(Isolate* isolate,
|
||||
os << "\n - WASM function index " << function->function_index();
|
||||
}
|
||||
shared()->PrintSourceCode(os);
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
os << "\n - feedback vector: ";
|
||||
if (!shared()->HasFeedbackMetadata()) {
|
||||
os << "feedback metadata is not available in SFI\n";
|
||||
@ -1426,7 +1425,7 @@ void JSGlobalProxy::JSGlobalProxyPrint(Isolate* isolate,
|
||||
if (!isolate->bootstrapper()->IsActive()) {
|
||||
os << "\n - native context: " << Brief(native_context());
|
||||
}
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void JSGlobalObject::JSGlobalObjectPrint(Isolate* isolate,
|
||||
@ -1436,7 +1435,7 @@ void JSGlobalObject::JSGlobalObjectPrint(Isolate* isolate,
|
||||
os << "\n - native context: " << Brief(native_context());
|
||||
}
|
||||
os << "\n - global proxy: " << Brief(global_proxy());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void Cell::CellPrint(std::ostream& os) { // NOLINT
|
||||
@ -1445,8 +1444,7 @@ void Cell::CellPrint(std::ostream& os) { // NOLINT
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
void PropertyCell::PropertyCellPrint(Isolate* isolate,
|
||||
std::ostream& os) { // NOLINT
|
||||
void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT
|
||||
HeapObject::PrintHeader(os, "PropertyCell");
|
||||
os << "\n - name: ";
|
||||
name()->NamePrint(os);
|
||||
@ -1455,7 +1453,7 @@ void PropertyCell::PropertyCellPrint(Isolate* isolate,
|
||||
property_details().PrintAsSlowTo(os);
|
||||
PropertyCellType cell_type = property_details().cell_type();
|
||||
os << "\n - cell_type: ";
|
||||
if (value()->IsTheHole(isolate)) {
|
||||
if (value()->IsTheHole()) {
|
||||
switch (cell_type) {
|
||||
case PropertyCellType::kUninitialized:
|
||||
os << "Uninitialized";
|
||||
@ -1652,7 +1650,7 @@ void JSModuleNamespace::JSModuleNamespacePrint(Isolate* isolate,
|
||||
std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "JSModuleNamespace");
|
||||
os << "\n - module: " << Brief(module());
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
}
|
||||
|
||||
void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) { // NOLINT
|
||||
@ -1747,7 +1745,7 @@ void WasmExportedFunctionData::WasmExportedFunctionDataPrint(
|
||||
void WasmModuleObject::WasmModuleObjectPrint(Isolate* isolate,
|
||||
std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(isolate, os, this, "WasmModuleObject");
|
||||
JSObjectPrintBody(isolate, os, this);
|
||||
JSObjectPrintBody(os, this);
|
||||
os << "\n - module: " << module();
|
||||
os << "\n - native module: " << native_module();
|
||||
os << "\n - export wrappers: " << Brief(export_wrappers());
|
||||
@ -1810,14 +1808,13 @@ void AccessCheckInfo::AccessCheckInfoPrint(std::ostream& os) { // NOLINT
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
void CallHandlerInfo::CallHandlerInfoPrint(Isolate* isolate,
|
||||
std::ostream& os) { // NOLINT
|
||||
void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT
|
||||
HeapObject::PrintHeader(os, "CallHandlerInfo");
|
||||
os << "\n - callback: " << Brief(callback());
|
||||
os << "\n - js_callback: " << Brief(js_callback());
|
||||
os << "\n - data: " << Brief(data());
|
||||
os << "\n - side_effect_free: "
|
||||
<< (IsSideEffectFreeCallHandlerInfo(isolate) ? "true" : "false");
|
||||
<< (IsSideEffectFreeCallHandlerInfo() ? "true" : "false");
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
@ -2073,8 +2070,7 @@ void LayoutDescriptor::Print(std::ostream& os) { // NOLINT
|
||||
} else if (IsSmi()) {
|
||||
os << "fast";
|
||||
PrintBitMask(os, static_cast<uint32_t>(Smi::ToInt(this)));
|
||||
} else if (IsOddball() &&
|
||||
IsUninitialized(HeapObject::cast(this)->GetIsolate())) {
|
||||
} else if (IsOddball() && IsUninitialized()) {
|
||||
os << "<uninitialized>";
|
||||
} else {
|
||||
os << "slow";
|
||||
|
@ -179,8 +179,7 @@ MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
|
||||
MaybeHandle<JSReceiver> Object::ConvertReceiver(Isolate* isolate,
|
||||
Handle<Object> object) {
|
||||
if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object);
|
||||
if (*object == ReadOnlyRoots(isolate).null_value() ||
|
||||
object->IsUndefined(isolate)) {
|
||||
if (object->IsNullOrUndefined(isolate)) {
|
||||
return isolate->global_proxy();
|
||||
}
|
||||
return Object::ToObject(isolate, object);
|
||||
@ -2784,7 +2783,7 @@ void String::PrintUC16(std::ostream& os, int start, int end) { // NOLINT
|
||||
void JSObject::JSObjectShortPrint(StringStream* accumulator) {
|
||||
switch (map()->instance_type()) {
|
||||
case JS_ARRAY_TYPE: {
|
||||
double length = JSArray::cast(this)->length()->IsUndefined(GetIsolate())
|
||||
double length = JSArray::cast(this)->length()->IsUndefined()
|
||||
? 0
|
||||
: JSArray::cast(this)->length()->Number();
|
||||
accumulator->Add("<JSArray[%u]>", static_cast<uint32_t>(length));
|
||||
@ -3280,7 +3279,6 @@ bool JSObject::IsUnmodifiedApiObject(Object** o) {
|
||||
void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
|
||||
Heap* heap = GetHeap();
|
||||
ReadOnlyRoots roots(heap);
|
||||
Isolate* isolate = heap->isolate();
|
||||
if (!heap->Contains(this)) {
|
||||
os << "!!!INVALID POINTER!!!";
|
||||
return;
|
||||
@ -3476,15 +3474,15 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
|
||||
break;
|
||||
}
|
||||
case ODDBALL_TYPE: {
|
||||
if (IsUndefined(isolate)) {
|
||||
if (IsUndefined()) {
|
||||
os << "<undefined>";
|
||||
} else if (IsTheHole(isolate)) {
|
||||
} else if (IsTheHole()) {
|
||||
os << "<the_hole>";
|
||||
} else if (IsNull(isolate)) {
|
||||
} else if (IsNull()) {
|
||||
os << "<null>";
|
||||
} else if (IsTrue(isolate)) {
|
||||
} else if (IsTrue()) {
|
||||
os << "<true>";
|
||||
} else if (IsFalse(isolate)) {
|
||||
} else if (IsFalse()) {
|
||||
os << "<false>";
|
||||
} else {
|
||||
os << "<Odd Oddball: ";
|
||||
@ -3558,7 +3556,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
|
||||
os << "callback= " << Brief(info->callback());
|
||||
os << ", js_callback= " << Brief(info->js_callback());
|
||||
os << ", data= " << Brief(info->data());
|
||||
if (info->IsSideEffectFreeCallHandlerInfo(isolate)) {
|
||||
if (info->IsSideEffectFreeCallHandlerInfo()) {
|
||||
os << ", side_effect_free= true>";
|
||||
} else {
|
||||
os << ", side_effect_free= false>";
|
||||
@ -13516,7 +13514,7 @@ bool Script::GetPositionInfo(int position, PositionInfo* info,
|
||||
->GetPositionInfo(static_cast<uint32_t>(position), info);
|
||||
}
|
||||
|
||||
if (line_ends()->IsUndefined(GetIsolate())) {
|
||||
if (line_ends()->IsUndefined()) {
|
||||
// Slow mode: we do not have line_ends. We have to iterate through source.
|
||||
if (!GetPositionInfoSlow(this, position, info)) return false;
|
||||
} else {
|
||||
@ -18213,7 +18211,7 @@ Handle<Derived> ObjectHashTableBase<Derived, Shape>::Remove(
|
||||
DCHECK(table->IsKey(table->GetIsolate(), *key));
|
||||
|
||||
Object* hash = key->GetHash();
|
||||
if (hash->IsUndefined(table->GetIsolate())) {
|
||||
if (hash->IsUndefined()) {
|
||||
*was_present = false;
|
||||
return table;
|
||||
}
|
||||
|
@ -943,22 +943,18 @@ class Object {
|
||||
|
||||
V8_INLINE bool IsExternal(Isolate* isolate) const;
|
||||
|
||||
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
|
||||
V8_INLINE bool Is##Type(Isolate* isolate) const;
|
||||
// Oddball checks are faster when they are raw pointer comparisons, so the
|
||||
// isolate/read-only roots overloads should be preferred where possible.
|
||||
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
|
||||
V8_INLINE bool Is##Type(Isolate* isolate) const; \
|
||||
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
|
||||
V8_INLINE bool Is##Type() const;
|
||||
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
|
||||
#undef IS_TYPE_FUNCTION_DECL
|
||||
|
||||
V8_INLINE bool IsNullOrUndefined(Isolate* isolate) const;
|
||||
|
||||
// Non-isolate version of oddball check. This is slower than the above check,
|
||||
// so it should only be used for DCHECKS.
|
||||
#ifdef DEBUG
|
||||
#define IS_TYPE_FUNCTION_DECL(Type, Value) V8_INLINE bool Is##Type() const;
|
||||
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
|
||||
#undef IS_TYPE_FUNCTION_DECL
|
||||
|
||||
V8_INLINE bool IsNullOrUndefined(ReadOnlyRoots roots) const;
|
||||
V8_INLINE bool IsNullOrUndefined() const;
|
||||
#endif
|
||||
|
||||
// A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
|
||||
// a keyed store is of the form a[expression] = foo.
|
||||
@ -1548,22 +1544,18 @@ class HeapObject: public Object {
|
||||
|
||||
V8_INLINE bool IsExternal(Isolate* isolate) const;
|
||||
|
||||
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
|
||||
V8_INLINE bool Is##Type(Isolate* isolate) const;
|
||||
// Oddball checks are faster when they are raw pointer comparisons, so the
|
||||
// isolate/read-only roots overloads should be preferred where possible.
|
||||
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
|
||||
V8_INLINE bool Is##Type(Isolate* isolate) const; \
|
||||
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
|
||||
V8_INLINE bool Is##Type() const;
|
||||
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
|
||||
#undef IS_TYPE_FUNCTION_DECL
|
||||
|
||||
V8_INLINE bool IsNullOrUndefined(Isolate* isolate) const;
|
||||
|
||||
// Non-isolate version of oddball check. This is slower than the above check,
|
||||
// so it should only be used for DCHECKS.
|
||||
#ifdef DEBUG
|
||||
#define IS_TYPE_FUNCTION_DECL(Type, Value) V8_INLINE bool Is##Type() const;
|
||||
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
|
||||
#undef IS_TYPE_FUNCTION_DECL
|
||||
|
||||
V8_INLINE bool IsNullOrUndefined(ReadOnlyRoots roots) const;
|
||||
V8_INLINE bool IsNullOrUndefined() const;
|
||||
#endif
|
||||
|
||||
#define DECL_STRUCT_PREDICATE(NAME, Name, name) V8_INLINE bool Is##Name() const;
|
||||
STRUCT_LIST(DECL_STRUCT_PREDICATE)
|
||||
@ -2481,7 +2473,7 @@ class JSObject: public JSReceiver {
|
||||
DECL_VERIFIER(JSObject)
|
||||
#ifdef OBJECT_PRINT
|
||||
bool PrintProperties(std::ostream& os); // NOLINT
|
||||
void PrintElements(Isolate* isolate, std::ostream& os); // NOLINT
|
||||
void PrintElements(std::ostream& os); // NOLINT
|
||||
#endif
|
||||
#if defined(DEBUG) || defined(OBJECT_PRINT)
|
||||
void PrintTransitions(std::ostream& os); // NOLINT
|
||||
@ -4010,7 +4002,7 @@ class PropertyCell : public HeapObject {
|
||||
DECL_CAST(PropertyCell)
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER_WITH_ISOLATE(PropertyCell)
|
||||
DECL_PRINTER(PropertyCell)
|
||||
DECL_VERIFIER(PropertyCell)
|
||||
|
||||
// Layout description.
|
||||
|
@ -101,29 +101,29 @@ ACCESSORS(CallHandlerInfo, callback, Object, kCallbackOffset)
|
||||
ACCESSORS(CallHandlerInfo, js_callback, Object, kJsCallbackOffset)
|
||||
ACCESSORS(CallHandlerInfo, data, Object, kDataOffset)
|
||||
|
||||
bool CallHandlerInfo::IsSideEffectFreeCallHandlerInfo(Isolate* isolate) const {
|
||||
ReadOnlyRoots roots(isolate);
|
||||
bool CallHandlerInfo::IsSideEffectFreeCallHandlerInfo() const {
|
||||
ReadOnlyRoots roots = GetReadOnlyRoots();
|
||||
DCHECK(map() == roots.side_effect_call_handler_info_map() ||
|
||||
map() == roots.side_effect_free_call_handler_info_map() ||
|
||||
map() == roots.next_call_side_effect_free_call_handler_info_map());
|
||||
return map() == roots.side_effect_free_call_handler_info_map();
|
||||
}
|
||||
|
||||
bool CallHandlerInfo::IsSideEffectCallHandlerInfo(Isolate* isolate) const {
|
||||
ReadOnlyRoots roots(isolate);
|
||||
bool CallHandlerInfo::IsSideEffectCallHandlerInfo() const {
|
||||
ReadOnlyRoots roots = GetReadOnlyRoots();
|
||||
DCHECK(map() == roots.side_effect_call_handler_info_map() ||
|
||||
map() == roots.side_effect_free_call_handler_info_map() ||
|
||||
map() == roots.next_call_side_effect_free_call_handler_info_map());
|
||||
return map() == roots.side_effect_call_handler_info_map();
|
||||
}
|
||||
|
||||
void CallHandlerInfo::SetNextCallHasNoSideEffect(Isolate* isolate) {
|
||||
set_map(ReadOnlyRoots(isolate)
|
||||
.next_call_side_effect_free_call_handler_info_map());
|
||||
void CallHandlerInfo::SetNextCallHasNoSideEffect() {
|
||||
set_map(
|
||||
GetReadOnlyRoots().next_call_side_effect_free_call_handler_info_map());
|
||||
}
|
||||
|
||||
bool CallHandlerInfo::NextCallHasNoSideEffect(Isolate* isolate) {
|
||||
ReadOnlyRoots roots(isolate);
|
||||
bool CallHandlerInfo::NextCallHasNoSideEffect() {
|
||||
ReadOnlyRoots roots = GetReadOnlyRoots();
|
||||
if (map() == roots.next_call_side_effect_free_call_handler_info_map()) {
|
||||
set_map(roots.side_effect_call_handler_info_map());
|
||||
return true;
|
||||
|
@ -186,15 +186,15 @@ class CallHandlerInfo : public Tuple3 {
|
||||
|
||||
DECL_CAST(CallHandlerInfo)
|
||||
|
||||
inline bool IsSideEffectFreeCallHandlerInfo(Isolate* isolate) const;
|
||||
inline bool IsSideEffectCallHandlerInfo(Isolate* isolate) const;
|
||||
inline void SetNextCallHasNoSideEffect(Isolate* isolate);
|
||||
inline bool IsSideEffectFreeCallHandlerInfo() const;
|
||||
inline bool IsSideEffectCallHandlerInfo() const;
|
||||
inline void SetNextCallHasNoSideEffect();
|
||||
// Returns whether or not the next call can be side effect free.
|
||||
// Calling this will change the state back to having a side effect.
|
||||
inline bool NextCallHasNoSideEffect(Isolate* isolate);
|
||||
inline bool NextCallHasNoSideEffect();
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER_WITH_ISOLATE(CallHandlerInfo)
|
||||
DECL_PRINTER(CallHandlerInfo)
|
||||
DECL_VERIFIER(CallHandlerInfo)
|
||||
|
||||
Address redirected_callback() const;
|
||||
|
@ -119,26 +119,37 @@ void FixedArray::NoWriteBarrierSet(FixedArray* array, int index,
|
||||
}
|
||||
|
||||
void FixedArray::set_undefined(int index) {
|
||||
set_undefined(GetIsolate(), index);
|
||||
set_undefined(GetReadOnlyRoots(), index);
|
||||
}
|
||||
|
||||
void FixedArray::set_undefined(Isolate* isolate, int index) {
|
||||
FixedArray::NoWriteBarrierSet(this, index,
|
||||
ReadOnlyRoots(isolate).undefined_value());
|
||||
set_undefined(ReadOnlyRoots(isolate), index);
|
||||
}
|
||||
|
||||
void FixedArray::set_null(int index) { set_null(GetIsolate(), index); }
|
||||
void FixedArray::set_undefined(ReadOnlyRoots ro_roots, int index) {
|
||||
FixedArray::NoWriteBarrierSet(this, index, ro_roots.undefined_value());
|
||||
}
|
||||
|
||||
void FixedArray::set_null(int index) { set_null(GetReadOnlyRoots(), index); }
|
||||
|
||||
void FixedArray::set_null(Isolate* isolate, int index) {
|
||||
FixedArray::NoWriteBarrierSet(this, index,
|
||||
ReadOnlyRoots(isolate).null_value());
|
||||
set_null(ReadOnlyRoots(isolate), index);
|
||||
}
|
||||
|
||||
void FixedArray::set_the_hole(int index) { set_the_hole(GetIsolate(), index); }
|
||||
void FixedArray::set_null(ReadOnlyRoots ro_roots, int index) {
|
||||
FixedArray::NoWriteBarrierSet(this, index, ro_roots.null_value());
|
||||
}
|
||||
|
||||
void FixedArray::set_the_hole(int index) {
|
||||
set_the_hole(GetReadOnlyRoots(), index);
|
||||
}
|
||||
|
||||
void FixedArray::set_the_hole(Isolate* isolate, int index) {
|
||||
FixedArray::NoWriteBarrierSet(this, index,
|
||||
ReadOnlyRoots(isolate).the_hole_value());
|
||||
set_the_hole(ReadOnlyRoots(isolate), index);
|
||||
}
|
||||
|
||||
void FixedArray::set_the_hole(ReadOnlyRoots ro_roots, int index) {
|
||||
FixedArray::NoWriteBarrierSet(this, index, ro_roots.the_hole_value());
|
||||
}
|
||||
|
||||
void FixedArray::FillWithHoles(int from, int to) {
|
||||
|
@ -190,6 +190,10 @@ class FixedArray : public FixedArrayBase {
|
||||
private:
|
||||
STATIC_ASSERT(kHeaderSize == Internals::kFixedArrayHeaderSize);
|
||||
|
||||
inline void set_undefined(ReadOnlyRoots ro_roots, int index);
|
||||
inline void set_null(ReadOnlyRoots ro_roots, int index);
|
||||
inline void set_the_hole(ReadOnlyRoots ro_roots, int index);
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray);
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@ ACCESSORS(JSRegExp, last_index, Object, kLastIndexOffset)
|
||||
|
||||
JSRegExp::Type JSRegExp::TypeTag() {
|
||||
Object* data = this->data();
|
||||
if (data->IsUndefined(GetIsolate())) return JSRegExp::NOT_COMPILED;
|
||||
if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
|
||||
Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
|
||||
return static_cast<JSRegExp::Type>(smi->value());
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ void Map::set_prototype_info(Object* value, WriteBarrierMode mode) {
|
||||
void Map::SetBackPointer(Object* value, WriteBarrierMode mode) {
|
||||
CHECK_GE(instance_type(), FIRST_JS_RECEIVER_TYPE);
|
||||
CHECK(value->IsMap());
|
||||
CHECK(GetBackPointer()->IsUndefined(GetIsolate()));
|
||||
CHECK(GetBackPointer()->IsUndefined());
|
||||
CHECK_IMPLIES(value->IsMap(), Map::cast(value)->GetConstructor() ==
|
||||
constructor_or_backpointer());
|
||||
set_constructor_or_backpointer(value, mode);
|
||||
|
@ -143,12 +143,12 @@ Handle<FixedArray> OrderedHashSet::ConvertToKeysArray(
|
||||
return FixedArray::ShrinkOrEmpty(result, length);
|
||||
}
|
||||
|
||||
HeapObject* OrderedHashSet::GetEmpty(Isolate* isolate) {
|
||||
return ReadOnlyRoots(isolate).empty_ordered_hash_set();
|
||||
HeapObject* OrderedHashSet::GetEmpty(ReadOnlyRoots ro_roots) {
|
||||
return ro_roots.empty_ordered_hash_set();
|
||||
}
|
||||
|
||||
HeapObject* OrderedHashMap::GetEmpty(Isolate* isolate) {
|
||||
return ReadOnlyRoots(isolate).empty_ordered_hash_map();
|
||||
HeapObject* OrderedHashMap::GetEmpty(ReadOnlyRoots ro_roots) {
|
||||
return ro_roots.empty_ordered_hash_map();
|
||||
}
|
||||
|
||||
template <class Derived, int entrysize>
|
||||
@ -715,7 +715,7 @@ void OrderedHashTableIterator<Derived, TableType>::Transition() {
|
||||
template <class Derived, class TableType>
|
||||
bool OrderedHashTableIterator<Derived, TableType>::HasMore() {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
Isolate* isolate = this->GetIsolate();
|
||||
ReadOnlyRoots ro_roots = GetReadOnlyRoots();
|
||||
|
||||
Transition();
|
||||
|
||||
@ -723,7 +723,7 @@ bool OrderedHashTableIterator<Derived, TableType>::HasMore() {
|
||||
int index = Smi::ToInt(this->index());
|
||||
int used_capacity = table->UsedCapacity();
|
||||
|
||||
while (index < used_capacity && table->KeyAt(index)->IsTheHole(isolate)) {
|
||||
while (index < used_capacity && table->KeyAt(index)->IsTheHole(ro_roots)) {
|
||||
index++;
|
||||
}
|
||||
|
||||
@ -731,7 +731,7 @@ bool OrderedHashTableIterator<Derived, TableType>::HasMore() {
|
||||
|
||||
if (index < used_capacity) return true;
|
||||
|
||||
set_table(TableType::GetEmpty(isolate));
|
||||
set_table(TableType::GetEmpty(ro_roots));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ class OrderedHashSet : public OrderedHashTable<OrderedHashSet, 1> {
|
||||
static Handle<FixedArray> ConvertToKeysArray(Isolate* isolate,
|
||||
Handle<OrderedHashSet> table,
|
||||
GetKeysConversion convert);
|
||||
static HeapObject* GetEmpty(Isolate* isolate);
|
||||
static HeapObject* GetEmpty(ReadOnlyRoots ro_roots);
|
||||
static inline int GetMapRootIndex();
|
||||
static inline bool Is(Handle<HeapObject> table);
|
||||
};
|
||||
@ -248,7 +248,7 @@ class OrderedHashMap : public OrderedHashTable<OrderedHashMap, 2> {
|
||||
|
||||
static Object* GetHash(Isolate* isolate, Object* key);
|
||||
|
||||
static HeapObject* GetEmpty(Isolate* isolate);
|
||||
static HeapObject* GetEmpty(ReadOnlyRoots ro_roots);
|
||||
static inline int GetMapRootIndex();
|
||||
static inline bool Is(Handle<HeapObject> table);
|
||||
|
||||
|
@ -604,7 +604,7 @@ void SharedFunctionInfo::set_inferred_name(String* inferred_name) {
|
||||
|
||||
bool SharedFunctionInfo::IsUserJavaScript() {
|
||||
Object* script_obj = script();
|
||||
if (script_obj->IsUndefined(GetIsolate())) return false;
|
||||
if (script_obj->IsUndefined()) return false;
|
||||
Script* script = Script::cast(script_obj);
|
||||
return script->IsUserJavaScript();
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ wasm::InterpreterHandle* GetInterpreterHandle(WasmDebugInfo* debug_info) {
|
||||
|
||||
wasm::InterpreterHandle* GetInterpreterHandleOrNull(WasmDebugInfo* debug_info) {
|
||||
Object* handle_obj = debug_info->interpreter_handle();
|
||||
if (handle_obj->IsUndefined(debug_info->GetIsolate())) return nullptr;
|
||||
if (handle_obj->IsUndefined()) return nullptr;
|
||||
return Managed<wasm::InterpreterHandle>::cast(handle_obj)->raw();
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,10 @@ CAST_ACCESSOR(WasmMemoryObject)
|
||||
CAST_ACCESSOR(WasmModuleObject)
|
||||
CAST_ACCESSOR(WasmTableObject)
|
||||
|
||||
#define OPTIONAL_ACCESSORS(holder, name, type, offset) \
|
||||
bool holder::has_##name() { \
|
||||
return !READ_FIELD(this, offset)->IsUndefined(GetIsolate()); \
|
||||
} \
|
||||
#define OPTIONAL_ACCESSORS(holder, name, type, offset) \
|
||||
bool holder::has_##name() { \
|
||||
return !READ_FIELD(this, offset)->IsUndefined(); \
|
||||
} \
|
||||
ACCESSORS(holder, name, type, offset)
|
||||
|
||||
#define READ_PRIMITIVE_FIELD(p, type, offset) \
|
||||
|
@ -13405,7 +13405,7 @@ TEST(CallHandlerAsFunctionHasNoSideEffectNotSupported) {
|
||||
i::Heap* heap = reinterpret_cast<i::Isolate*>(isolate)->heap();
|
||||
i::CallHandlerInfo* handler_info =
|
||||
i::CallHandlerInfo::cast(cons->instance_call_handler());
|
||||
CHECK(!handler_info->IsSideEffectFreeCallHandlerInfo(CcTest::i_isolate()));
|
||||
CHECK(!handler_info->IsSideEffectFreeCallHandlerInfo());
|
||||
handler_info->set_map(
|
||||
i::ReadOnlyRoots(heap).side_effect_free_call_handler_info_map());
|
||||
CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj()"), true).IsEmpty());
|
||||
|
Loading…
Reference in New Issue
Block a user