From 313e33a709ba5b40fbdc6e41371098c00bb099d1 Mon Sep 17 00:00:00 2001 From: Toon Verwaest Date: Thu, 15 Feb 2018 06:26:29 +0100 Subject: [PATCH] Remove %_ClassOf and SharedFunctionInfo::instance_class_name instance_class_name takes up space unnecessarily, and %_ClassOf and class_name implement [[Class]] which isn't part of ES2015+ anymore. Bug: Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I3a73f732ad83a616817fde9992f4e4d584638fa8 Reviewed-on: https://chromium-review.googlesource.com/776683 Reviewed-by: Benedikt Meurer Commit-Queue: Toon Verwaest Cr-Commit-Position: refs/heads/master@{#51309} --- src/api.cc | 63 +-- src/bootstrapper.cc | 46 +- src/builtins/builtins-conversion-gen.cc | 7 - src/builtins/builtins-definitions.h | 1 - src/builtins/builtins-object-gen.cc | 4 +- src/builtins/builtins.cc | 1 - src/code-stub-assembler.cc | 65 --- src/code-stub-assembler.h | 2 - src/compiler/code-assembler.h | 4 + src/compiler/effect-control-linearizer.cc | 15 - src/compiler/effect-control-linearizer.h | 1 - src/compiler/js-intrinsic-lowering.cc | 12 - src/compiler/js-intrinsic-lowering.h | 3 - src/compiler/js-operator.h | 1 - src/compiler/linkage.cc | 1 - src/compiler/opcodes.h | 1 - src/compiler/simplified-lowering.cc | 1 - src/compiler/simplified-operator.cc | 1 - src/compiler/simplified-operator.h | 1 - src/compiler/typer.cc | 6 - src/compiler/verifier.cc | 4 - src/debug/debug-evaluate.cc | 2 +- src/debug/mirrors.js | 12 +- src/factory.cc | 4 - src/heap-symbols.h | 412 +++++++++--------- .../interpreter-intrinsics-generator.cc | 6 - src/interpreter/interpreter-intrinsics.h | 1 - src/objects-debug.cc | 1 - src/objects-inl.h | 20 +- src/objects-printer.cc | 2 - src/objects.cc | 80 +++- src/objects.h | 8 +- src/objects/shared-function-info-inl.h | 2 - src/objects/shared-function-info.h | 4 - src/profiler/heap-snapshot-generator.cc | 3 - src/runtime/runtime-collections.cc | 12 + src/runtime/runtime-error.cc | 6 + src/runtime/runtime-generator.cc | 6 + src/runtime/runtime-internal.cc | 6 + src/runtime/runtime.h | 5 + src/wasm/wasm-js.cc | 1 - .../test-interpreter-intrinsics.cc | 21 - test/mjsunit/es6/array-iterator.js | 4 - test/mjsunit/es6/classof-proxy.js | 27 -- test/mjsunit/es6/collection-iterator.js | 2 - test/mjsunit/es6/collections.js | 11 - test/mjsunit/es6/generators-objects.js | 1 - test/mjsunit/es6/symbols.js | 2 - test/mjsunit/es6/typedarray-every.js | 1 - test/mjsunit/es6/typedarray-foreach.js | 1 - test/mjsunit/harmony/private.js | 2 - test/mjsunit/regress/regress-5010.js | 9 - test/mjsunit/regress/regress-995.js | 8 - test/unittests/compiler/typer-unittest.cc | 1 - 54 files changed, 372 insertions(+), 551 deletions(-) delete mode 100644 test/mjsunit/es6/classof-proxy.js delete mode 100644 test/mjsunit/regress/regress-5010.js diff --git a/src/api.cc b/src/api.cc index 1131d8d525..31fc12ecd2 100644 --- a/src/api.cc +++ b/src/api.cc @@ -3554,24 +3554,22 @@ bool Value::IsWebAssemblyCompiledModule() const { js_obj->map()->GetConstructor(); } -#define VALUE_IS_SPECIFIC_TYPE(Type, Class) \ - bool Value::Is##Type() const { \ - i::Handle obj = Utils::OpenHandle(this); \ - if (!obj->IsHeapObject()) return false; \ - i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); \ - return obj->HasSpecificClassOf(isolate->heap()->Class##_string()); \ +#define VALUE_IS_SPECIFIC_TYPE(Type, Check) \ + bool Value::Is##Type() const { \ + i::Handle obj = Utils::OpenHandle(this); \ + return obj->Is##Check(); \ } -VALUE_IS_SPECIFIC_TYPE(ArgumentsObject, Arguments) -VALUE_IS_SPECIFIC_TYPE(BooleanObject, Boolean) -VALUE_IS_SPECIFIC_TYPE(NumberObject, Number) -VALUE_IS_SPECIFIC_TYPE(StringObject, String) -VALUE_IS_SPECIFIC_TYPE(SymbolObject, Symbol) -VALUE_IS_SPECIFIC_TYPE(Date, Date) -VALUE_IS_SPECIFIC_TYPE(Map, Map) -VALUE_IS_SPECIFIC_TYPE(Set, Set) -VALUE_IS_SPECIFIC_TYPE(WeakMap, WeakMap) -VALUE_IS_SPECIFIC_TYPE(WeakSet, WeakSet) +VALUE_IS_SPECIFIC_TYPE(ArgumentsObject, JSArgumentsObject) +VALUE_IS_SPECIFIC_TYPE(BooleanObject, BooleanWrapper) +VALUE_IS_SPECIFIC_TYPE(NumberObject, NumberWrapper) +VALUE_IS_SPECIFIC_TYPE(StringObject, StringWrapper) +VALUE_IS_SPECIFIC_TYPE(SymbolObject, SymbolWrapper) +VALUE_IS_SPECIFIC_TYPE(Date, JSDate) +VALUE_IS_SPECIFIC_TYPE(Map, JSMap) +VALUE_IS_SPECIFIC_TYPE(Set, JSSet) +VALUE_IS_SPECIFIC_TYPE(WeakMap, JSWeakMap) +VALUE_IS_SPECIFIC_TYPE(WeakSet, JSWeakSet) #undef VALUE_IS_SPECIFIC_TYPE @@ -3963,55 +3961,36 @@ void v8::SharedArrayBuffer::CheckCast(Value* that) { void v8::Date::CheckCast(v8::Value* that) { i::Handle obj = Utils::OpenHandle(that); - i::Isolate* isolate = nullptr; - if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate(); - Utils::ApiCheck(isolate != nullptr && - obj->HasSpecificClassOf(isolate->heap()->Date_string()), - "v8::Date::Cast()", "Could not convert to date"); + Utils::ApiCheck(obj->IsJSDate(), "v8::Date::Cast()", + "Could not convert to date"); } void v8::StringObject::CheckCast(v8::Value* that) { i::Handle obj = Utils::OpenHandle(that); - i::Isolate* isolate = nullptr; - if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate(); - Utils::ApiCheck(isolate != nullptr && - obj->HasSpecificClassOf(isolate->heap()->String_string()), - "v8::StringObject::Cast()", + Utils::ApiCheck(obj->IsStringWrapper(), "v8::StringObject::Cast()", "Could not convert to StringObject"); } void v8::SymbolObject::CheckCast(v8::Value* that) { i::Handle obj = Utils::OpenHandle(that); - i::Isolate* isolate = nullptr; - if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate(); - Utils::ApiCheck(isolate != nullptr && - obj->HasSpecificClassOf(isolate->heap()->Symbol_string()), - "v8::SymbolObject::Cast()", + Utils::ApiCheck(obj->IsSymbolWrapper(), "v8::SymbolObject::Cast()", "Could not convert to SymbolObject"); } void v8::NumberObject::CheckCast(v8::Value* that) { i::Handle obj = Utils::OpenHandle(that); - i::Isolate* isolate = nullptr; - if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate(); - Utils::ApiCheck(isolate != nullptr && - obj->HasSpecificClassOf(isolate->heap()->Number_string()), - "v8::NumberObject::Cast()", + Utils::ApiCheck(obj->IsNumberWrapper(), "v8::NumberObject::Cast()", "Could not convert to NumberObject"); } void v8::BooleanObject::CheckCast(v8::Value* that) { i::Handle obj = Utils::OpenHandle(that); - i::Isolate* isolate = nullptr; - if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate(); - Utils::ApiCheck( - isolate != nullptr && - obj->HasSpecificClassOf(isolate->heap()->Boolean_string()), - "v8::BooleanObject::Cast()", "Could not convert to BooleanObject"); + Utils::ApiCheck(obj->IsBooleanWrapper(), "v8::BooleanObject::Cast()", + "Could not convert to BooleanObject"); } diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 5ec86938d4..fa430cfd9b 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -369,15 +369,15 @@ V8_NOINLINE Handle SimpleCreateSharedFunctionInfo( } // Construct case. -V8_NOINLINE Handle SimpleCreateSharedFunctionInfo( - Isolate* isolate, Builtins::Name builtin_id, Handle name, - Handle instance_class_name, int len) { +V8_NOINLINE Handle +SimpleCreateConstructorSharedFunctionInfo(Isolate* isolate, + Builtins::Name builtin_id, + Handle name, int len) { Handle code = isolate->builtins()->builtin_handle(builtin_id); const bool kIsConstructor = true; Handle shared = isolate->factory()->NewSharedFunctionInfo( name, code, kIsConstructor, kNormalFunction, builtin_id); shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub)); - shared->set_instance_class_name(*instance_class_name); shared->set_internal_formal_parameter_count(len); shared->set_length(len); return shared; @@ -389,9 +389,6 @@ V8_NOINLINE void InstallFunction(Handle target, Handle function_name, PropertyAttributes attributes = DONT_ENUM) { JSObject::AddProperty(target, property_name, function, attributes); - if (target->IsJSGlobalObject()) { - function->shared()->set_instance_class_name(*function_name); - } } V8_NOINLINE void InstallFunction(Handle target, @@ -1279,8 +1276,6 @@ Handle Genesis::CreateNewGlobals( isolate(), global_constructor, factory()->the_hole_value(), ApiNatives::GlobalProxyType); } - Handle global_name = factory()->global_string(); - global_proxy_function->shared()->set_instance_class_name(*global_name); global_proxy_function->initial_map()->set_is_access_check_needed(true); global_proxy_function->initial_map()->set_has_hidden_prototype(true); global_proxy_function->initial_map()->set_may_have_interesting_symbols(true); @@ -1347,7 +1342,6 @@ static void InstallError(Isolate* isolate, Handle global, Handle error_fun = InstallFunction( global, name, JS_ERROR_TYPE, JSObject::kHeaderSize, 0, factory->the_hole_value(), Builtins::kErrorConstructor, DONT_ENUM); - error_fun->shared()->set_instance_class_name(*factory->Error_string()); error_fun->shared()->DontAdaptArguments(); error_fun->shared()->SetConstructStub( *BUILTIN_CODE(isolate, ErrorConstructor)); @@ -1772,8 +1766,6 @@ void Genesis::InitializeGlobal(Handle global_object, JS_FAST_ARRAY_VALUE_ITERATOR_TYPE, JSArrayIterator::kSize, 0, array_iterator_prototype, Builtins::kIllegal); array_iterator_function->shared()->set_native(false); - array_iterator_function->shared()->set_instance_class_name( - isolate->heap()->ArrayIterator_string()); native_context()->set_initial_array_iterator_prototype( *array_iterator_prototype); @@ -2359,9 +2351,9 @@ void Genesis::InitializeGlobal(Handle global_object, } { - Handle info = SimpleCreateSharedFunctionInfo( + Handle info = SimpleCreateConstructorSharedFunctionInfo( isolate, Builtins::kPromiseGetCapabilitiesExecutor, - factory->empty_string(), factory->Object_string(), 2); + factory->empty_string(), 2); native_context()->set_promise_get_capabilities_executor_shared_fun(*info); } @@ -2374,7 +2366,6 @@ void Genesis::InitializeGlobal(Handle global_object, Handle shared(promise_fun->shared(), isolate); shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub)); - shared->set_instance_class_name(isolate->heap()->Object_string()); shared->set_internal_formal_parameter_count(1); shared->set_length(1); @@ -2470,7 +2461,6 @@ void Genesis::InitializeGlobal(Handle global_object, Handle shared(regexp_fun->shared(), isolate); shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub)); - shared->set_instance_class_name(isolate->heap()->RegExp_string()); shared->set_internal_formal_parameter_count(2); shared->set_length(2); @@ -2920,7 +2910,7 @@ void Genesis::InitializeGlobal(Handle global_object, #endif // V8_INTL_SUPPORT { // -- A r r a y B u f f e r - Handle name = factory->InternalizeUtf8String("ArrayBuffer"); + Handle name = factory->ArrayBuffer_string(); Handle array_buffer_fun = CreateArrayBuffer(name, ARRAY_BUFFER); JSObject::AddProperty(global, name, array_buffer_fun, DONT_ENUM); InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, @@ -2936,7 +2926,7 @@ void Genesis::InitializeGlobal(Handle global_object, } { // -- S h a r e d A r r a y B u f f e r - Handle name = factory->InternalizeUtf8String("SharedArrayBuffer"); + Handle name = factory->SharedArrayBuffer_string(); Handle shared_array_buffer_fun = CreateArrayBuffer(name, SHARED_ARRAY_BUFFER); InstallWithIntrinsicDefaultProto(isolate, shared_array_buffer_fun, @@ -3161,7 +3151,6 @@ void Genesis::InitializeGlobal(Handle global_object, Handle shared(js_map_fun->shared(), isolate); shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub)); - shared->set_instance_class_name(isolate->heap()->Map_string()); shared->DontAdaptArguments(); shared->set_length(0); @@ -3220,7 +3209,6 @@ void Genesis::InitializeGlobal(Handle global_object, Handle shared(js_set_fun->shared(), isolate); shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub)); - shared->set_instance_class_name(isolate->heap()->Set_string()); shared->DontAdaptArguments(); shared->set_length(0); @@ -3317,7 +3305,6 @@ void Genesis::InitializeGlobal(Handle global_object, Handle shared(cons->shared(), isolate); shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub)); - shared->set_instance_class_name(isolate->heap()->WeakMap_string()); shared->DontAdaptArguments(); shared->set_length(0); @@ -3349,7 +3336,6 @@ void Genesis::InitializeGlobal(Handle global_object, Handle shared(cons->shared(), isolate); shared->SetConstructStub(*BUILTIN_CODE(isolate, JSBuiltinsConstructStub)); - shared->set_instance_class_name(isolate->heap()->WeakSet_string()); shared->DontAdaptArguments(); shared->set_length(0); @@ -3495,16 +3481,12 @@ void Genesis::InitializeGlobal(Handle global_object, } { // --- sloppy arguments map - // Make sure we can recognize argument objects at runtime. - // This is done by introducing an anonymous function with - // class_name equals 'Arguments'. Handle arguments_string = factory->Arguments_string(); NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithPrototype( arguments_string, BUILTIN_CODE(isolate, Illegal), isolate->initial_object_prototype(), JS_ARGUMENTS_TYPE, JSSloppyArgumentsObject::kSize, 2, Builtins::kIllegal, MUTABLE); Handle function = factory->NewFunction(args); - function->shared()->set_instance_class_name(*arguments_string); Handle map(function->initial_map()); // Create the descriptor array for the arguments object. @@ -3595,8 +3577,6 @@ void Genesis::InitializeGlobal(Handle global_object, CreateFunction(isolate, factory->empty_string(), JS_CONTEXT_EXTENSION_OBJECT_TYPE, JSObject::kHeaderSize, 0, factory->the_hole_value(), Builtins::kIllegal); - Handle name = factory->InternalizeUtf8String("context_extension"); - context_extension_fun->shared()->set_instance_class_name(*name); native_context()->set_context_extension_function(*context_extension_fun); } @@ -3962,7 +3942,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, } { // -- S e t I t e r a t o r - Handle name = factory->InternalizeUtf8String("Set Iterator"); + Handle name = factory->SetIterator_string(); // Setup %SetIteratorPrototype%. Handle prototype = @@ -3984,7 +3964,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, InstallFunction(container, "SetIterator", JS_SET_VALUE_ITERATOR_TYPE, JSSetIterator::kSize, 0, prototype, Builtins::kIllegal); set_iterator_function->shared()->set_native(false); - set_iterator_function->shared()->set_instance_class_name(*name); Handle set_value_iterator_map(set_iterator_function->initial_map(), isolate); @@ -3998,7 +3977,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, } { // -- M a p I t e r a t o r - Handle name = factory->InternalizeUtf8String("Map Iterator"); + Handle name = factory->MapIterator_string(); // Setup %MapIteratorPrototype%. Handle prototype = @@ -4020,7 +3999,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, InstallFunction(container, "MapIterator", JS_MAP_KEY_ITERATOR_TYPE, JSMapIterator::kSize, 0, prototype, Builtins::kIllegal); map_iterator_function->shared()->set_native(false); - map_iterator_function->shared()->set_instance_class_name(*name); Handle map_key_iterator_map(map_iterator_function->initial_map(), isolate); @@ -4039,11 +4017,10 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, } { // -- S c r i p t - Handle name = factory->InternalizeUtf8String("Script"); + Handle name = factory->Script_string(); Handle script_fun = InstallFunction( container, name, JS_VALUE_TYPE, JSValue::kSize, 0, factory->the_hole_value(), Builtins::kUnsupportedThrower, DONT_ENUM); - script_fun->shared()->set_instance_class_name(*name); native_context->set_script_function(*script_fun); Handle script_map = Handle(script_fun->initial_map()); @@ -4535,7 +4512,6 @@ Handle Genesis::CreateArrayBuffer( array_buffer_fun->shared()->SetConstructStub(*code); array_buffer_fun->shared()->DontAdaptArguments(); array_buffer_fun->shared()->set_length(1); - array_buffer_fun->shared()->set_instance_class_name(*name); // Install the "constructor" property on the {prototype}. JSObject::AddProperty(prototype, factory()->constructor_string(), diff --git a/src/builtins/builtins-conversion-gen.cc b/src/builtins/builtins-conversion-gen.cc index 58de8f8b26..824bf04702 100644 --- a/src/builtins/builtins-conversion-gen.cc +++ b/src/builtins/builtins-conversion-gen.cc @@ -390,13 +390,6 @@ TF_BUILTIN(ToObject, CodeStubAssembler) { Return(object); } -// Deprecated ES5 [[Class]] internal property (used to implement %_ClassOf). -TF_BUILTIN(ClassOf, CodeStubAssembler) { - Node* object = Parameter(TypeofDescriptor::kObject); - - Return(ClassOf(object)); -} - // ES6 section 12.5.5 typeof operator TF_BUILTIN(Typeof, CodeStubAssembler) { Node* object = Parameter(TypeofDescriptor::kObject); diff --git a/src/builtins/builtins-definitions.h b/src/builtins/builtins-definitions.h index 1f715b9500..998b944257 100644 --- a/src/builtins/builtins-definitions.h +++ b/src/builtins/builtins-definitions.h @@ -193,7 +193,6 @@ namespace internal { TFC(ToInteger, TypeConversion, 1) \ TFC(ToInteger_TruncateMinusZero, TypeConversion, 1) \ TFC(ToLength, TypeConversion, 1) \ - TFC(ClassOf, Typeof, 1) \ TFC(Typeof, Typeof, 1) \ TFC(GetSuperConstructor, Typeof, 1) \ \ diff --git a/src/builtins/builtins-object-gen.cc b/src/builtins/builtins-object-gen.cc index 600517a8b8..bed534977c 100644 --- a/src/builtins/builtins-object-gen.cc +++ b/src/builtins/builtins-object-gen.cc @@ -672,9 +672,7 @@ TF_BUILTIN(ObjectPrototypeToString, ObjectBuiltinsAssembler) { Branch(IsString(var_tag.value()), &if_tagisstring, &if_tagisnotstring); BIND(&if_tagisnotstring); { - var_tag.Bind( - CallStub(Builtins::CallableFor(isolate(), Builtins::kClassOf), - context, receiver)); + var_tag.Bind(CallRuntime(Runtime::kClassOf, context, receiver)); Goto(&if_tagisstring); } BIND(&if_tagisstring); diff --git a/src/builtins/builtins.cc b/src/builtins/builtins.cc index 07d5ce0c8f..ad8dd8bc4e 100644 --- a/src/builtins/builtins.cc +++ b/src/builtins/builtins.cc @@ -280,7 +280,6 @@ bool Builtins::IsIsolateIndependent(int index) { case kContinueToJavaScriptBuiltinWithResult: #ifndef DEBUG #if !V8_TARGET_ARCH_IA32 - case kClassOf: case kConstructFunction: case kTypeof: case kWeakMapLookupHashIndex: diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc index 539fc78265..54defd7939 100644 --- a/src/code-stub-assembler.cc +++ b/src/code-stub-assembler.cc @@ -9803,71 +9803,6 @@ TNode CodeStubAssembler::HasProperty(SloppyTNode object, return result.value(); } -Node* CodeStubAssembler::ClassOf(Node* value) { - VARIABLE(var_result, MachineRepresentation::kTaggedPointer); - Label if_function_template_info(this, Label::kDeferred), - if_no_class_name(this, Label::kDeferred), - if_function(this, Label::kDeferred), if_object(this, Label::kDeferred), - if_primitive(this, Label::kDeferred), return_result(this); - - // Check if {value} is a Smi. - GotoIf(TaggedIsSmi(value), &if_primitive); - - Node* value_map = LoadMap(value); - Node* value_instance_type = LoadMapInstanceType(value_map); - - // Check if {value} is a JSFunction or JSBoundFunction. - STATIC_ASSERT(LAST_TYPE == LAST_FUNCTION_TYPE); - GotoIf(Uint32LessThanOrEqual(Int32Constant(FIRST_FUNCTION_TYPE), - value_instance_type), - &if_function); - - // Check if {value} is a primitive HeapObject. - STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); - GotoIfNot(IsJSReceiverInstanceType(value_instance_type), &if_primitive); - - // Load the {value}s constructor, and check that it's a JSFunction. - Node* constructor = LoadMapConstructor(value_map); - GotoIf(HasInstanceType(constructor, FUNCTION_TEMPLATE_INFO_TYPE), - &if_function_template_info); - GotoIfNot(IsJSFunction(constructor), &if_object); - - // Return the instance class name for the {constructor}. - Node* shared_info = - LoadObjectField(constructor, JSFunction::kSharedFunctionInfoOffset); - Node* instance_class_name = LoadObjectField( - shared_info, SharedFunctionInfo::kInstanceClassNameOffset); - var_result.Bind(instance_class_name); - Goto(&return_result); - - // For remote objects the constructor might be given as FTI. - BIND(&if_function_template_info); - Node* class_name = - LoadObjectField(constructor, FunctionTemplateInfo::kClassNameOffset); - GotoIf(IsUndefined(class_name), &if_no_class_name); - var_result.Bind(class_name); - Goto(&return_result); - - BIND(&if_no_class_name); - var_result.Bind(LoadRoot(Heap::kempty_stringRootIndex)); - Goto(&return_result); - - BIND(&if_function); - var_result.Bind(LoadRoot(Heap::kFunction_stringRootIndex)); - Goto(&return_result); - - BIND(&if_object); - var_result.Bind(LoadRoot(Heap::kObject_stringRootIndex)); - Goto(&return_result); - - BIND(&if_primitive); - var_result.Bind(NullConstant()); - Goto(&return_result); - - BIND(&return_result); - return var_result.value(); -} - Node* CodeStubAssembler::Typeof(Node* value) { VARIABLE(result_var, MachineRepresentation::kTagged); diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h index 91647b8e56..6d68656973 100644 --- a/src/code-stub-assembler.h +++ b/src/code-stub-assembler.h @@ -1865,8 +1865,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { SloppyTNode context, HasPropertyLookupMode mode); - Node* ClassOf(Node* object); - Node* Typeof(Node* value); Node* GetSuperConstructor(Node* value, Node* context); diff --git a/src/compiler/code-assembler.h b/src/compiler/code-assembler.h index e05c61cfb0..9812798d48 100644 --- a/src/compiler/code-assembler.h +++ b/src/compiler/code-assembler.h @@ -197,6 +197,7 @@ enum class ObjectType { class AccessCheckNeeded; class ClassBoilerplate; +class BooleanWrapper; class CompilationCacheTable; class Constructor; class Filler; @@ -208,8 +209,11 @@ class JSSloppyArgumentsObject; class MapCache; class MutableHeapNumber; class NativeContext; +class NumberWrapper; +class ScriptWrapper; class SloppyArgumentsElements; class StringWrapper; +class SymbolWrapper; class Undetectable; class UniqueName; class WasmMemoryObject; diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc index c5d371ec34..5ca11f637b 100644 --- a/src/compiler/effect-control-linearizer.cc +++ b/src/compiler/effect-control-linearizer.cc @@ -806,9 +806,6 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node, case IrOpcode::kTypeOf: result = LowerTypeOf(node); break; - case IrOpcode::kClassOf: - result = LowerClassOf(node); - break; case IrOpcode::kNewDoubleElements: result = LowerNewDoubleElements(node); break; @@ -2385,18 +2382,6 @@ Node* EffectControlLinearizer::LowerTypeOf(Node* node) { __ NoContextConstant()); } -Node* EffectControlLinearizer::LowerClassOf(Node* node) { - Node* obj = node->InputAt(0); - Callable const callable = - Builtins::CallableFor(isolate(), Builtins::kClassOf); - Operator::Properties const properties = Operator::kEliminatable; - CallDescriptor::Flags const flags = CallDescriptor::kNoAllocate; - auto call_descriptor = Linkage::GetStubCallDescriptor( - isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties); - return __ Call(call_descriptor, __ HeapConstant(callable.code()), obj, - __ NoContextConstant()); -} - Node* EffectControlLinearizer::LowerToBoolean(Node* node) { Node* obj = node->InputAt(0); Callable const callable = diff --git a/src/compiler/effect-control-linearizer.h b/src/compiler/effect-control-linearizer.h index 3b241caab8..bb13c1773f 100644 --- a/src/compiler/effect-control-linearizer.h +++ b/src/compiler/effect-control-linearizer.h @@ -136,7 +136,6 @@ class V8_EXPORT_PRIVATE EffectControlLinearizer { void LowerCheckEqualsInternalizedString(Node* node, Node* frame_state); void LowerCheckEqualsSymbol(Node* node, Node* frame_state); Node* LowerTypeOf(Node* node); - Node* LowerClassOf(Node* node); Node* LowerToBoolean(Node* node); Node* LowerPlainPrimitiveToNumber(Node* node); Node* LowerPlainPrimitiveToWord32(Node* node); diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc index f7f4f35548..d9742e47d9 100644 --- a/src/compiler/js-intrinsic-lowering.cc +++ b/src/compiler/js-intrinsic-lowering.cc @@ -94,8 +94,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) { AccessBuilder::ForJSTypedArrayLength()); case Runtime::kInlineTheHole: return ReduceTheHole(node); - case Runtime::kInlineClassOf: - return ReduceClassOf(node); case Runtime::kInlineStringMaxLength: return ReduceStringMaxLength(node); default: @@ -381,16 +379,6 @@ Reduction JSIntrinsicLowering::ReduceTheHole(Node* node) { return Replace(value); } -Reduction JSIntrinsicLowering::ReduceClassOf(Node* node) { - RelaxEffectsAndControls(node); - // The ClassOf operator has a single value input and control input. - Node* control_input = NodeProperties::GetControlInput(node, 0); - node->TrimInputCount(2); - node->ReplaceInput(1, control_input); - NodeProperties::ChangeOp(node, simplified()->ClassOf()); - return Changed(node); -} - Reduction JSIntrinsicLowering::ReduceStringMaxLength(Node* node) { Node* value = jsgraph()->Constant(String::kMaxLength); ReplaceWithValue(node, value); diff --git a/src/compiler/js-intrinsic-lowering.h b/src/compiler/js-intrinsic-lowering.h index 7cad7fb4a0..18fe1248c7 100644 --- a/src/compiler/js-intrinsic-lowering.h +++ b/src/compiler/js-intrinsic-lowering.h @@ -73,9 +73,6 @@ class V8_EXPORT_PRIVATE JSIntrinsicLowering final // converted to proper CodeStubAssembler based builtins. Reduction ReduceTheHole(Node* node); - // TODO(turbofan): JavaScript builtins support; drop once all uses of - // %_ClassOf in JavaScript builtins are eliminated. - Reduction ReduceClassOf(Node* node); Reduction ReduceStringMaxLength(Node* node); Reduction Change(Node* node, const Operator* op); diff --git a/src/compiler/js-operator.h b/src/compiler/js-operator.h index c75605e5ab..ae44313325 100644 --- a/src/compiler/js-operator.h +++ b/src/compiler/js-operator.h @@ -729,7 +729,6 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final const Operator* LoadModule(int32_t cell_index); const Operator* StoreModule(int32_t cell_index); - const Operator* ClassOf(); const Operator* HasInPrototypeChain(); const Operator* InstanceOf(const VectorSlotPair& feedback); const Operator* OrdinaryHasInstance(); diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc index 14153d015b..7ccad439d9 100644 --- a/src/compiler/linkage.cc +++ b/src/compiler/linkage.cc @@ -179,7 +179,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) { return false; // Some inline intrinsics are also safe to call without a FrameState. - case Runtime::kInlineClassOf: case Runtime::kInlineCreateIterResultObject: case Runtime::kInlineGeneratorClose: case Runtime::kInlineGeneratorGetInputOrDebugPos: diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h index b1e38e9669..af94a91669 100644 --- a/src/compiler/opcodes.h +++ b/src/compiler/opcodes.h @@ -366,7 +366,6 @@ V(ConvertReceiver) \ V(ConvertTaggedHoleToUndefined) \ V(TypeOf) \ - V(ClassOf) \ V(Allocate) \ V(AllocateRaw) \ V(LoadFieldByIndex) \ diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index f66012d87b..97012cd66d 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -2324,7 +2324,6 @@ class RepresentationSelector { MachineRepresentation::kTaggedPointer); return; } - case IrOpcode::kClassOf: case IrOpcode::kTypeOf: { return VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTaggedPointer); diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc index 696cb2c967..00a9a39a45 100644 --- a/src/compiler/simplified-operator.cc +++ b/src/compiler/simplified-operator.cc @@ -677,7 +677,6 @@ bool operator==(CheckMinusZeroParameters const& lhs, V(StringToLowerCaseIntl, Operator::kNoProperties, 1, 0) \ V(StringToUpperCaseIntl, Operator::kNoProperties, 1, 0) \ V(TypeOf, Operator::kNoProperties, 1, 1) \ - V(ClassOf, Operator::kNoProperties, 1, 1) \ V(PlainPrimitiveToNumber, Operator::kNoProperties, 1, 0) \ V(PlainPrimitiveToWord32, Operator::kNoProperties, 1, 0) \ V(PlainPrimitiveToFloat64, Operator::kNoProperties, 1, 0) \ diff --git a/src/compiler/simplified-operator.h b/src/compiler/simplified-operator.h index 147257bd15..cafb5a1b49 100644 --- a/src/compiler/simplified-operator.h +++ b/src/compiler/simplified-operator.h @@ -514,7 +514,6 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final const Operator* SameValue(); const Operator* TypeOf(); - const Operator* ClassOf(); const Operator* ToBoolean(); diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc index cb0532420f..a46ff4c672 100644 --- a/src/compiler/typer.cc +++ b/src/compiler/typer.cc @@ -1150,10 +1150,6 @@ Type* Typer::Visitor::TypeJSNegate(Node* node) { return TypeUnaryOp(node, Negate); } -Type* Typer::Visitor::TypeClassOf(Node* node) { - return Type::InternalizedStringOrNull(); -} - Type* Typer::Visitor::TypeTypeOf(Node* node) { return Type::InternalizedString(); } @@ -1772,8 +1768,6 @@ Type* Typer::Visitor::TypeJSCallRuntime(Node* node) { return TypeUnaryOp(node, ToObject); case Runtime::kInlineToString: return TypeUnaryOp(node, ToString); - case Runtime::kInlineClassOf: - return Type::InternalizedStringOrNull(); case Runtime::kHasInPrototypeChain: return Type::Boolean(); default: diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc index 5a9b08436f..0b25e7c53a 100644 --- a/src/compiler/verifier.cc +++ b/src/compiler/verifier.cc @@ -745,10 +745,6 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) { // Type is Boolean. CheckTypeIs(node, Type::Boolean()); break; - case IrOpcode::kClassOf: - // Type is InternaliedString \/ Null. - CheckTypeIs(node, Type::InternalizedStringOrNull()); - break; case IrOpcode::kTypeOf: // Type is InternalizedString. CheckTypeIs(node, Type::InternalizedString()); diff --git a/src/debug/debug-evaluate.cc b/src/debug/debug-evaluate.cc index c5c709c88a..f9735144ec 100644 --- a/src/debug/debug-evaluate.cc +++ b/src/debug/debug-evaluate.cc @@ -292,7 +292,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) { V(IsJSWeakSet) \ V(IsRegExp) \ V(IsTypedArray) \ - V(ClassOf) \ /* Loads */ \ V(LoadLookupSlotForCall) \ /* Arrays */ \ @@ -328,6 +327,7 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) { /* Collections */ \ V(GenericHash) \ /* Called from builtins */ \ + V(ClassOf) \ V(StringAdd) \ V(StringParseFloat) \ V(StringParseInt) \ diff --git a/src/debug/mirrors.js b/src/debug/mirrors.js index 15d5e64258..85052b3cae 100644 --- a/src/debug/mirrors.js +++ b/src/debug/mirrors.js @@ -54,11 +54,11 @@ macro IS_DATE(arg) endmacro macro IS_ERROR(arg) -(%_ClassOf(arg) === 'Error') +(%IsJSError(arg)) endmacro macro IS_GENERATOR(arg) -(%_ClassOf(arg) === 'Generator') +(%IsJSGeneratorObject(arg)) endmacro macro IS_MAP(arg) @@ -66,11 +66,11 @@ macro IS_MAP(arg) endmacro macro IS_MAP_ITERATOR(arg) -(%_ClassOf(arg) === 'Map Iterator') +(%IsJSMapIterator(arg)) endmacro macro IS_SCRIPT(arg) -(%_ClassOf(arg) === 'Script') +(%IsScriptWrapper(arg)) endmacro macro IS_SET(arg) @@ -78,7 +78,7 @@ macro IS_SET(arg) endmacro macro IS_SET_ITERATOR(arg) -(%_ClassOf(arg) === 'Set Iterator') +(%IsJSSetIterator(arg)) endmacro // Must match PropertyFilter in property-details.h @@ -638,7 +638,7 @@ inherits(ObjectMirror, ValueMirror); ObjectMirror.prototype.className = function() { - return %_ClassOf(this.value_); + return %ClassOf(this.value_); }; diff --git a/src/factory.cc b/src/factory.cc index 7327ba8761..35ce11e177 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -2489,9 +2489,6 @@ Handle Factory::NewSharedFunctionInfo( NewSharedFunctionInfo(name, code, IsConstructable(kind), kind); shared->set_scope_info(*scope_info); shared->set_outer_scope_info(*the_hole_value()); - if (IsGeneratorFunction(kind)) { - shared->set_instance_class_name(isolate()->heap()->Generator_string()); - } return shared; } @@ -2561,7 +2558,6 @@ Handle Factory::NewSharedFunctionInfo( is_constructor ? isolate()->builtins()->JSConstructStubGeneric() : BUILTIN_CODE(isolate(), ConstructedNonConstructable); share->SetConstructStub(*construct_stub); - share->set_instance_class_name(*Object_string()); share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); share->set_debug_info(Smi::kZero, SKIP_WRITE_BARRIER); share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); diff --git a/src/heap-symbols.h b/src/heap-symbols.h index 2002d29751..0eeee54edd 100644 --- a/src/heap-symbols.h +++ b/src/heap-symbols.h @@ -5,205 +5,219 @@ #ifndef V8_HEAP_SYMBOLS_H_ #define V8_HEAP_SYMBOLS_H_ -#define INTERNALIZED_STRING_LIST(V) \ - V(anonymous_function_string, "(anonymous function)") \ - V(anonymous_string, "anonymous") \ - V(add_string, "add") \ - V(apply_string, "apply") \ - V(arguments_string, "arguments") \ - V(Arguments_string, "Arguments") \ - V(arguments_to_string, "[object Arguments]") \ - V(Array_string, "Array") \ - V(ArrayIterator_string, "Array Iterator") \ - V(assign_string, "assign") \ - V(async_string, "async") \ - V(await_string, "await") \ - V(array_to_string, "[object Array]") \ - V(boolean_to_string, "[object Boolean]") \ - V(date_to_string, "[object Date]") \ - V(error_to_string, "[object Error]") \ - V(function_to_string, "[object Function]") \ - V(number_to_string, "[object Number]") \ - V(object_to_string, "[object Object]") \ - V(regexp_to_string, "[object RegExp]") \ - V(string_to_string, "[object String]") \ - V(bigint_string, "bigint") \ - V(BigInt_string, "BigInt") \ - V(bind_string, "bind") \ - V(boolean_string, "boolean") \ - V(Boolean_string, "Boolean") \ - V(bound__string, "bound ") \ - V(buffer_string, "buffer") \ - V(byte_length_string, "byteLength") \ - V(byte_offset_string, "byteOffset") \ - V(call_string, "call") \ - V(callee_string, "callee") \ - V(caller_string, "caller") \ - V(cell_value_string, "%cell_value") \ - V(char_at_string, "CharAt") \ - V(closure_string, "(closure)") \ - V(column_string, "column") \ - V(configurable_string, "configurable") \ - V(constructor_string, "constructor") \ - V(construct_string, "construct") \ - V(create_string, "create") \ - V(currency_string, "currency") \ - V(Date_string, "Date") \ - V(dayperiod_string, "dayperiod") \ - V(day_string, "day") \ - V(decimal_string, "decimal") \ - V(default_string, "default") \ - V(defineProperty_string, "defineProperty") \ - V(deleteProperty_string, "deleteProperty") \ - V(did_handle_string, "didHandle") \ - V(display_name_string, "displayName") \ - V(done_string, "done") \ - V(dotAll_string, "dotAll") \ - V(dot_catch_string, ".catch") \ - V(dot_for_string, ".for") \ - V(dot_generator_object_string, ".generator_object") \ - V(dot_iterator_string, ".iterator") \ - V(dot_result_string, ".result") \ - V(dot_switch_tag_string, ".switch_tag") \ - V(dot_string, ".") \ - V(exec_string, "exec") \ - V(entries_string, "entries") \ - V(enqueue_string, "enqueue") \ - V(enumerable_string, "enumerable") \ - V(era_string, "era") \ - V(Error_string, "Error") \ - V(eval_string, "eval") \ - V(EvalError_string, "EvalError") \ - V(false_string, "false") \ - V(flags_string, "flags") \ - V(fraction_string, "fraction") \ - V(function_string, "function") \ - V(Function_string, "Function") \ - V(Generator_string, "Generator") \ - V(getOwnPropertyDescriptor_string, "getOwnPropertyDescriptor") \ - V(getOwnPropertyDescriptors_string, "getOwnPropertyDescriptors") \ - V(getPrototypeOf_string, "getPrototypeOf") \ - V(get_string, "get") \ - V(get_space_string, "get ") \ - V(global_string, "global") \ - V(group_string, "group") \ - V(groups_string, "groups") \ - V(has_string, "has") \ - V(hour_string, "hour") \ - V(ignoreCase_string, "ignoreCase") \ - V(illegal_access_string, "illegal access") \ - V(illegal_argument_string, "illegal argument") \ - V(index_string, "index") \ - V(infinity_string, "infinity") \ - V(Infinity_string, "Infinity") \ - V(integer_string, "integer") \ - V(input_string, "input") \ - V(isExtensible_string, "isExtensible") \ - V(isView_string, "isView") \ - V(KeyedLoadMonomorphic_string, "KeyedLoadMonomorphic") \ - V(KeyedStoreMonomorphic_string, "KeyedStoreMonomorphic") \ - V(keys_string, "keys") \ - V(lastIndex_string, "lastIndex") \ - V(length_string, "length") \ - V(let_string, "let") \ - V(line_string, "line") \ - V(literal_string, "literal") \ - V(Map_string, "Map") \ - V(message_string, "message") \ - V(minus_Infinity_string, "-Infinity") \ - V(minus_zero_string, "-0") \ - V(minusSign_string, "minusSign") \ - V(minute_string, "minute") \ - V(Module_string, "Module") \ - V(month_string, "month") \ - V(multiline_string, "multiline") \ - V(name_string, "name") \ - V(native_string, "native") \ - V(nan_string, "nan") \ - V(NaN_string, "NaN") \ - V(new_target_string, ".new.target") \ - V(next_string, "next") \ - V(NFC_string, "NFC") \ - V(NFD_string, "NFD") \ - V(NFKC_string, "NFKC") \ - V(NFKD_string, "NFKD") \ - V(not_equal, "not-equal") \ - V(null_string, "null") \ - V(null_to_string, "[object Null]") \ - V(number_string, "number") \ - V(Number_string, "Number") \ - V(object_string, "object") \ - V(Object_string, "Object") \ - V(ok, "ok") \ - V(one_string, "1") \ - V(ownKeys_string, "ownKeys") \ - V(percentSign_string, "percentSign") \ - V(plusSign_string, "plusSign") \ - V(position_string, "position") \ - V(preventExtensions_string, "preventExtensions") \ - V(Promise_string, "Promise") \ - V(PromiseResolveThenableJob_string, "PromiseResolveThenableJob") \ - V(promise_string, "promise") \ - V(proto_string, "__proto__") \ - V(prototype_string, "prototype") \ - V(proxy_string, "proxy") \ - V(Proxy_string, "Proxy") \ - V(query_colon_string, "(?:)") \ - V(RangeError_string, "RangeError") \ - V(raw_string, "raw") \ - V(ReferenceError_string, "ReferenceError") \ - V(RegExp_string, "RegExp") \ - V(reject_string, "reject") \ - V(resolve_string, "resolve") \ - V(return_string, "return") \ - V(revoke_string, "revoke") \ - V(script_string, "script") \ - V(second_string, "second") \ - V(setPrototypeOf_string, "setPrototypeOf") \ - V(set_space_string, "set ") \ - V(set_string, "set") \ - V(Set_string, "Set") \ - V(source_string, "source") \ - V(sourceText_string, "sourceText") \ - V(stack_string, "stack") \ - V(stackTraceLimit_string, "stackTraceLimit") \ - V(star_default_star_string, "*default*") \ - V(sticky_string, "sticky") \ - V(string_string, "string") \ - V(String_string, "String") \ - V(symbol_string, "symbol") \ - V(Symbol_string, "Symbol") \ - V(symbol_species_string, "[Symbol.species]") \ - V(SyntaxError_string, "SyntaxError") \ - V(then_string, "then") \ - V(this_function_string, ".this_function") \ - V(this_string, "this") \ - V(throw_string, "throw") \ - V(timed_out, "timed-out") \ - V(timeZoneName_string, "timeZoneName") \ - V(toJSON_string, "toJSON") \ - V(toString_string, "toString") \ - V(true_string, "true") \ - V(TypeError_string, "TypeError") \ - V(type_string, "type") \ - V(CompileError_string, "CompileError") \ - V(LinkError_string, "LinkError") \ - V(RuntimeError_string, "RuntimeError") \ - V(undefined_string, "undefined") \ - V(undefined_to_string, "[object Undefined]") \ - V(unicode_string, "unicode") \ - V(use_asm_string, "use asm") \ - V(use_strict_string, "use strict") \ - V(URIError_string, "URIError") \ - V(valueOf_string, "valueOf") \ - V(values_string, "values") \ - V(value_string, "value") \ - V(WeakMap_string, "WeakMap") \ - V(WeakSet_string, "WeakSet") \ - V(weekday_string, "weekday") \ - V(will_handle_string, "willHandle") \ - V(writable_string, "writable") \ - V(year_string, "year") \ +#define INTERNALIZED_STRING_LIST(V) \ + V(add_string, "add") \ + V(anonymous_function_string, "(anonymous function)") \ + V(anonymous_string, "anonymous") \ + V(apply_string, "apply") \ + V(Arguments_string, "Arguments") \ + V(arguments_string, "arguments") \ + V(arguments_to_string, "[object Arguments]") \ + V(Array_string, "Array") \ + V(array_to_string, "[object Array]") \ + V(ArrayBuffer_string, "ArrayBuffer") \ + V(ArrayIterator_string, "Array Iterator") \ + V(assign_string, "assign") \ + V(async_string, "async") \ + V(await_string, "await") \ + V(BigInt_string, "BigInt") \ + V(bigint_string, "bigint") \ + V(bind_string, "bind") \ + V(Boolean_string, "Boolean") \ + V(boolean_string, "boolean") \ + V(boolean_to_string, "[object Boolean]") \ + V(bound__string, "bound ") \ + V(buffer_string, "buffer") \ + V(byte_length_string, "byteLength") \ + V(byte_offset_string, "byteOffset") \ + V(call_string, "call") \ + V(callee_string, "callee") \ + V(caller_string, "caller") \ + V(cell_value_string, "%cell_value") \ + V(char_at_string, "CharAt") \ + V(closure_string, "(closure)") \ + V(column_string, "column") \ + V(CompileError_string, "CompileError") \ + V(configurable_string, "configurable") \ + V(construct_string, "construct") \ + V(constructor_string, "constructor") \ + V(create_string, "create") \ + V(currency_string, "currency") \ + V(Date_string, "Date") \ + V(date_to_string, "[object Date]") \ + V(day_string, "day") \ + V(dayperiod_string, "dayperiod") \ + V(decimal_string, "decimal") \ + V(default_string, "default") \ + V(defineProperty_string, "defineProperty") \ + V(deleteProperty_string, "deleteProperty") \ + V(did_handle_string, "didHandle") \ + V(display_name_string, "displayName") \ + V(done_string, "done") \ + V(dot_catch_string, ".catch") \ + V(dot_for_string, ".for") \ + V(dot_generator_object_string, ".generator_object") \ + V(dot_iterator_string, ".iterator") \ + V(dot_result_string, ".result") \ + V(dot_string, ".") \ + V(dot_switch_tag_string, ".switch_tag") \ + V(dotAll_string, "dotAll") \ + V(enqueue_string, "enqueue") \ + V(entries_string, "entries") \ + V(enumerable_string, "enumerable") \ + V(era_string, "era") \ + V(Error_string, "Error") \ + V(error_to_string, "[object Error]") \ + V(eval_string, "eval") \ + V(EvalError_string, "EvalError") \ + V(exec_string, "exec") \ + V(false_string, "false") \ + V(flags_string, "flags") \ + V(Float32Array_string, "Float32Array") \ + V(Float64Array_string, "Float64Array") \ + V(fraction_string, "fraction") \ + V(Function_string, "Function") \ + V(function_string, "function") \ + V(function_to_string, "[object Function]") \ + V(Generator_string, "Generator") \ + V(get_space_string, "get ") \ + V(get_string, "get") \ + V(getOwnPropertyDescriptor_string, "getOwnPropertyDescriptor") \ + V(getOwnPropertyDescriptors_string, "getOwnPropertyDescriptors") \ + V(getPrototypeOf_string, "getPrototypeOf") \ + V(global_string, "global") \ + V(group_string, "group") \ + V(groups_string, "groups") \ + V(has_string, "has") \ + V(hour_string, "hour") \ + V(ignoreCase_string, "ignoreCase") \ + V(illegal_access_string, "illegal access") \ + V(illegal_argument_string, "illegal argument") \ + V(index_string, "index") \ + V(Infinity_string, "Infinity") \ + V(infinity_string, "infinity") \ + V(input_string, "input") \ + V(Int16Array_string, "Int16Array") \ + V(Int32Array_string, "Int32Array") \ + V(Int8Array_string, "Int8Array") \ + V(integer_string, "integer") \ + V(isExtensible_string, "isExtensible") \ + V(isView_string, "isView") \ + V(KeyedLoadMonomorphic_string, "KeyedLoadMonomorphic") \ + V(KeyedStoreMonomorphic_string, "KeyedStoreMonomorphic") \ + V(keys_string, "keys") \ + V(lastIndex_string, "lastIndex") \ + V(length_string, "length") \ + V(let_string, "let") \ + V(line_string, "line") \ + V(LinkError_string, "LinkError") \ + V(literal_string, "literal") \ + V(Map_string, "Map") \ + V(MapIterator_string, "Map Iterator") \ + V(message_string, "message") \ + V(minus_Infinity_string, "-Infinity") \ + V(minus_zero_string, "-0") \ + V(minusSign_string, "minusSign") \ + V(minute_string, "minute") \ + V(Module_string, "Module") \ + V(month_string, "month") \ + V(multiline_string, "multiline") \ + V(name_string, "name") \ + V(NaN_string, "NaN") \ + V(nan_string, "nan") \ + V(native_string, "native") \ + V(new_target_string, ".new.target") \ + V(next_string, "next") \ + V(NFC_string, "NFC") \ + V(NFD_string, "NFD") \ + V(NFKC_string, "NFKC") \ + V(NFKD_string, "NFKD") \ + V(not_equal, "not-equal") \ + V(null_string, "null") \ + V(null_to_string, "[object Null]") \ + V(Number_string, "Number") \ + V(number_string, "number") \ + V(number_to_string, "[object Number]") \ + V(Object_string, "Object") \ + V(object_string, "object") \ + V(object_to_string, "[object Object]") \ + V(ok, "ok") \ + V(one_string, "1") \ + V(ownKeys_string, "ownKeys") \ + V(percentSign_string, "percentSign") \ + V(plusSign_string, "plusSign") \ + V(position_string, "position") \ + V(preventExtensions_string, "preventExtensions") \ + V(Promise_string, "Promise") \ + V(promise_string, "promise") \ + V(PromiseResolveThenableJob_string, "PromiseResolveThenableJob") \ + V(proto_string, "__proto__") \ + V(prototype_string, "prototype") \ + V(proxy_string, "proxy") \ + V(Proxy_string, "Proxy") \ + V(query_colon_string, "(?:)") \ + V(RangeError_string, "RangeError") \ + V(raw_string, "raw") \ + V(ReferenceError_string, "ReferenceError") \ + V(RegExp_string, "RegExp") \ + V(regexp_to_string, "[object RegExp]") \ + V(reject_string, "reject") \ + V(resolve_string, "resolve") \ + V(return_string, "return") \ + V(revoke_string, "revoke") \ + V(RuntimeError_string, "RuntimeError") \ + V(Script_string, "Script") \ + V(script_string, "script") \ + V(second_string, "second") \ + V(set_space_string, "set ") \ + V(Set_string, "Set") \ + V(set_string, "set") \ + V(SetIterator_string, "Set Iterator") \ + V(setPrototypeOf_string, "setPrototypeOf") \ + V(SharedArrayBuffer_string, "SharedArrayBuffer") \ + V(source_string, "source") \ + V(sourceText_string, "sourceText") \ + V(stack_string, "stack") \ + V(stackTraceLimit_string, "stackTraceLimit") \ + V(star_default_star_string, "*default*") \ + V(sticky_string, "sticky") \ + V(String_string, "String") \ + V(string_string, "string") \ + V(string_to_string, "[object String]") \ + V(symbol_species_string, "[Symbol.species]") \ + V(Symbol_string, "Symbol") \ + V(symbol_string, "symbol") \ + V(SyntaxError_string, "SyntaxError") \ + V(then_string, "then") \ + V(this_function_string, ".this_function") \ + V(this_string, "this") \ + V(throw_string, "throw") \ + V(timed_out, "timed-out") \ + V(timeZoneName_string, "timeZoneName") \ + V(toJSON_string, "toJSON") \ + V(toString_string, "toString") \ + V(true_string, "true") \ + V(type_string, "type") \ + V(TypeError_string, "TypeError") \ + V(Uint16Array_string, "Uint16Array") \ + V(Uint32Array_string, "Uint32Array") \ + V(Uint8Array_string, "Uint8Array") \ + V(Uint8ClampedArray_string, "Uint8ClampedArray") \ + V(undefined_string, "undefined") \ + V(undefined_to_string, "[object Undefined]") \ + V(unicode_string, "unicode") \ + V(URIError_string, "URIError") \ + V(use_asm_string, "use asm") \ + V(use_strict_string, "use strict") \ + V(value_string, "value") \ + V(valueOf_string, "valueOf") \ + V(values_string, "values") \ + V(WeakMap_string, "WeakMap") \ + V(WeakSet_string, "WeakSet") \ + V(weekday_string, "weekday") \ + V(will_handle_string, "willHandle") \ + V(writable_string, "writable") \ + V(year_string, "year") \ V(zero_string, "0") #define PRIVATE_SYMBOL_LIST(V) \ diff --git a/src/interpreter/interpreter-intrinsics-generator.cc b/src/interpreter/interpreter-intrinsics-generator.cc index 96ff9a695a..b8609370db 100644 --- a/src/interpreter/interpreter-intrinsics-generator.cc +++ b/src/interpreter/interpreter-intrinsics-generator.cc @@ -365,12 +365,6 @@ Node* IntrinsicsGenerator::Call( return nullptr; // We never return from the CallJSAndDispatch above. } -Node* IntrinsicsGenerator::ClassOf( - const InterpreterAssembler::RegListNodePair& args, Node* context) { - Node* value = __ LoadRegisterFromRegisterList(args, 0); - return __ ClassOf(value); -} - Node* IntrinsicsGenerator::CreateAsyncFromSyncIterator( const InterpreterAssembler::RegListNodePair& args, Node* context) { InterpreterAssembler::Label not_receiver( diff --git a/src/interpreter/interpreter-intrinsics.h b/src/interpreter/interpreter-intrinsics.h index e3663ad9da..3016183c0b 100644 --- a/src/interpreter/interpreter-intrinsics.h +++ b/src/interpreter/interpreter-intrinsics.h @@ -23,7 +23,6 @@ namespace interpreter { V(GeneratorClose, generator_close, 1) \ V(GetImportMetaObject, get_import_meta_object, 0) \ V(Call, call, -1) \ - V(ClassOf, class_of, 1) \ V(CreateIterResultObject, create_iter_result_object, 2) \ V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) \ V(HasProperty, has_property, 2) \ diff --git a/src/objects-debug.cc b/src/objects-debug.cc index 033b44d4c1..dac8e66b56 100644 --- a/src/objects-debug.cc +++ b/src/objects-debug.cc @@ -780,7 +780,6 @@ void SharedFunctionInfo::SharedFunctionInfoVerify() { VerifyObjectField(kFeedbackMetadataOffset); VerifyObjectField(kFunctionDataOffset); VerifyObjectField(kFunctionIdentifierOffset); - VerifyObjectField(kInstanceClassNameOffset); VerifyObjectField(kNameOffset); VerifyObjectField(kOuterScopeInfoOffset); VerifyObjectField(kScopeInfoOffset); diff --git a/src/objects-inl.h b/src/objects-inl.h index f068e40ffa..c14c098054 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -419,6 +419,22 @@ bool HeapObject::IsStringWrapper() const { return IsJSValue() && JSValue::cast(this)->value()->IsString(); } +bool HeapObject::IsBooleanWrapper() const { + return IsJSValue() && JSValue::cast(this)->value()->IsBoolean(); +} + +bool HeapObject::IsScriptWrapper() const { + return IsJSValue() && JSValue::cast(this)->value()->IsScript(); +} + +bool HeapObject::IsNumberWrapper() const { + return IsJSValue() && JSValue::cast(this)->value()->IsNumber(); +} + +bool HeapObject::IsSymbolWrapper() const { + return IsJSValue() && JSValue::cast(this)->value()->IsSymbol(); +} + bool HeapObject::IsBoolean() const { return IsOddball() && ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); @@ -822,10 +838,6 @@ MaybeHandle Object::ToIndex(Isolate* isolate, Handle input, return ConvertToIndex(isolate, input, error_index); } -bool Object::HasSpecificClassOf(String* name) { - return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); -} - MaybeHandle Object::GetProperty(Handle object, Handle name) { LookupIterator it(object, name); diff --git a/src/objects-printer.cc b/src/objects-printer.cc index 45c4e5afb2..657f0237c6 100644 --- a/src/objects-printer.cc +++ b/src/objects-printer.cc @@ -1179,8 +1179,6 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT os << "\n - formal_parameter_count = " << internal_formal_parameter_count(); os << "\n - expected_nof_properties = " << expected_nof_properties(); os << "\n - language_mode = " << language_mode(); - os << "\n - instance class name = "; - instance_class_name()->Print(os); os << " - code = " << Brief(code()); if (HasBytecodeArray()) { os << "\n - bytecode_array = " << bytecode_array(); diff --git a/src/objects.cc b/src/objects.cc index 91286a2a77..c921440f49 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1313,24 +1313,24 @@ Handle FunctionTemplateInfo::GetOrCreateSharedFunctionInfo( if (current_info->IsSharedFunctionInfo()) { return handle(SharedFunctionInfo::cast(current_info), isolate); } - Handle class_name(info->class_name(), isolate); Handle name; Handle name_string; if (maybe_name.ToHandle(&name) && name->IsString()) { name_string = Handle::cast(name); + } else if (info->class_name()->IsString()) { + name_string = handle(String::cast(info->class_name())); } else { - name_string = class_name->IsString() ? Handle::cast(class_name) - : isolate->factory()->empty_string(); + name_string = isolate->factory()->empty_string(); } Handle code = BUILTIN_CODE(isolate, HandleApiCall); bool is_constructor; FunctionKind function_kind; - if (!info->remove_prototype()) { - is_constructor = true; - function_kind = kNormalFunction; - } else { + if (info->remove_prototype()) { is_constructor = false; function_kind = kConciseMethod; + } else { + is_constructor = true; + function_kind = kNormalFunction; } Handle result = isolate->factory()->NewSharedFunctionInfo( name_string, code, is_constructor, function_kind); @@ -1339,9 +1339,6 @@ Handle FunctionTemplateInfo::GetOrCreateSharedFunctionInfo( } result->set_length(info->length()); - if (class_name->IsString()) { - result->set_instance_class_name(String::cast(*class_name)); - } result->set_api_func_data(*info); result->DontAdaptArguments(); DCHECK(result->IsApiFunction()); @@ -3593,20 +3590,63 @@ void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT (*reinterpret_cast(FIELD_ADDR_CONST(p, offset))) String* JSReceiver::class_name() { - if (IsFunction()) { - return GetHeap()->Function_string(); + if (IsFunction()) return GetHeap()->Function_string(); + if (IsJSArgumentsObject()) return GetHeap()->Arguments_string(); + if (IsJSArray()) return GetHeap()->Array_string(); + if (IsJSArrayBuffer()) { + if (JSArrayBuffer::cast(this)->is_shared()) { + return GetHeap()->SharedArrayBuffer_string(); + } + return GetHeap()->ArrayBuffer_string(); } + if (IsJSArrayIterator()) return GetHeap()->ArrayIterator_string(); + if (IsJSDate()) return GetHeap()->Date_string(); + if (IsJSError()) return GetHeap()->Error_string(); + if (IsJSGeneratorObject()) return GetHeap()->Generator_string(); + if (IsJSMap()) return GetHeap()->Map_string(); + if (IsJSMapIterator()) return GetHeap()->MapIterator_string(); + if (IsJSProxy()) { + return map()->is_callable() ? GetHeap()->Function_string() + : GetHeap()->Object_string(); + } + if (IsJSRegExp()) return GetHeap()->RegExp_string(); + if (IsJSSet()) return GetHeap()->Set_string(); + if (IsJSSetIterator()) return GetHeap()->SetIterator_string(); + if (IsJSTypedArray()) { +#define SWITCH_KIND(Type, type, TYPE, ctype, size) \ + if (map()->elements_kind() == TYPE##_ELEMENTS) { \ + return GetHeap()->Type##Array_string(); \ + } + TYPED_ARRAYS(SWITCH_KIND) +#undef SWITCH_KIND + } + if (IsJSValue()) { + Object* value = JSValue::cast(this)->value(); + if (value->IsBoolean()) return GetHeap()->Boolean_string(); + if (value->IsString()) return GetHeap()->String_string(); + if (value->IsNumber()) return GetHeap()->Number_string(); + if (value->IsBigInt()) return GetHeap()->BigInt_string(); + if (value->IsSymbol()) return GetHeap()->Symbol_string(); + if (value->IsScript()) return GetHeap()->Script_string(); + UNREACHABLE(); + } + if (IsJSWeakMap()) return GetHeap()->WeakMap_string(); + if (IsJSWeakSet()) return GetHeap()->WeakSet_string(); + if (IsJSGlobalProxy()) return GetHeap()->global_string(); + Object* maybe_constructor = map()->GetConstructor(); if (maybe_constructor->IsJSFunction()) { JSFunction* constructor = JSFunction::cast(maybe_constructor); - return String::cast(constructor->shared()->instance_class_name()); - } else if (maybe_constructor->IsFunctionTemplateInfo()) { - FunctionTemplateInfo* info = FunctionTemplateInfo::cast(maybe_constructor); - return info->class_name()->IsString() ? String::cast(info->class_name()) - : GetHeap()->empty_string(); + if (constructor->shared()->IsApiFunction()) { + maybe_constructor = constructor->shared()->get_api_func_data(); + } + } + + if (maybe_constructor->IsFunctionTemplateInfo()) { + FunctionTemplateInfo* info = FunctionTemplateInfo::cast(maybe_constructor); + if (info->class_name()->IsString()) return String::cast(info->class_name()); } - // If the constructor is not present, return "Object". return GetHeap()->Object_string(); } @@ -12422,9 +12462,7 @@ void JSObject::OptimizeAsPrototype(Handle object, Object* maybe_constructor = object->map()->GetConstructor(); if (maybe_constructor->IsJSFunction()) { JSFunction* constructor = JSFunction::cast(maybe_constructor); - Isolate* isolate = object->GetIsolate(); - if (!constructor->shared()->IsApiFunction() && - object->class_name() == isolate->heap()->Object_string()) { + if (!constructor->shared()->IsApiFunction()) { Context* context = constructor->context()->native_context(); JSFunction* object_function = context->object_function(); object->map()->SetConstructor(object_function); diff --git a/src/objects.h b/src/objects.h index f13871b7d3..a758e75cda 100644 --- a/src/objects.h +++ b/src/objects.h @@ -985,12 +985,13 @@ template inline bool Is(Object* obj); V(BigInt) \ V(BoilerplateDescription) \ V(Boolean) \ + V(BooleanWrapper) \ V(BreakPoint) \ V(BreakPointInfo) \ V(ByteArray) \ V(BytecodeArray) \ - V(Callable) \ V(CallHandlerInfo) \ + V(Callable) \ V(Cell) \ V(ClassBoilerplate) \ V(Code) \ @@ -1081,6 +1082,7 @@ template inline bool Is(Object* obj); V(NativeContext) \ V(NormalizedMapCache) \ V(NumberDictionary) \ + V(NumberWrapper) \ V(ObjectHashSet) \ V(ObjectHashTable) \ V(Oddball) \ @@ -1094,6 +1096,7 @@ template inline bool Is(Object* obj); V(RegExpMatchInfo) \ V(ScopeInfo) \ V(ScriptContextTable) \ + V(ScriptWrapper) \ V(SeqOneByteString) \ V(SeqString) \ V(SeqTwoByteString) \ @@ -1111,6 +1114,7 @@ template inline bool Is(Object* obj); V(StringWrapper) \ V(Struct) \ V(Symbol) \ + V(SymbolWrapper) \ V(TemplateInfo) \ V(TemplateList) \ V(TemplateObjectDescription) \ @@ -1242,8 +1246,6 @@ class Object { // implementation of a JSObject's elements. inline bool HasValidElements(); - inline bool HasSpecificClassOf(String* name); - bool BooleanValue(); // ECMA-262 9.2. // ES6 section 7.2.11 Abstract Relational Comparison diff --git a/src/objects/shared-function-info-inl.h b/src/objects/shared-function-info-inl.h index 57a72754b5..afe40987e2 100644 --- a/src/objects/shared-function-info-inl.h +++ b/src/objects/shared-function-info-inl.h @@ -27,8 +27,6 @@ ACCESSORS(SharedFunctionInfo, raw_name, Object, kNameOffset) ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) ACCESSORS(SharedFunctionInfo, feedback_metadata, FeedbackMetadata, kFeedbackMetadataOffset) -ACCESSORS(SharedFunctionInfo, instance_class_name, String, - kInstanceClassNameOffset) ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) diff --git a/src/objects/shared-function-info.h b/src/objects/shared-function-info.h index cbefc7b025..8ce0abe3c0 100644 --- a/src/objects/shared-function-info.h +++ b/src/objects/shared-function-info.h @@ -136,9 +136,6 @@ class SharedFunctionInfo : public HeapObject { DECL_INT_ACCESSORS(unique_id) #endif - // [instance class name]: class name for instances. - DECL_ACCESSORS(instance_class_name, String) - // [function data]: This field holds some additional data for function. // Currently it has one of: // - a FunctionTemplateInfo to make benefit the API [IsApiFunction()]. @@ -428,7 +425,6 @@ class SharedFunctionInfo : public HeapObject { V(kScopeInfoOffset, kPointerSize) \ V(kOuterScopeInfoOffset, kPointerSize) \ V(kConstructStubOffset, kPointerSize) \ - V(kInstanceClassNameOffset, kPointerSize) \ V(kFunctionDataOffset, kPointerSize) \ V(kScriptOffset, kPointerSize) \ V(kDebugInfoOffset, kPointerSize) \ diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc index 8065335147..44077f9ce0 100644 --- a/src/profiler/heap-snapshot-generator.cc +++ b/src/profiler/heap-snapshot-generator.cc @@ -1146,9 +1146,6 @@ void V8HeapExplorer::ExtractSharedFunctionInfoReferences( SetInternalReference(obj, entry, "scope_info", shared->scope_info(), SharedFunctionInfo::kScopeInfoOffset); - SetInternalReference(obj, entry, - "instance_class_name", shared->instance_class_name(), - SharedFunctionInfo::kInstanceClassNameOffset); SetInternalReference(obj, entry, "script", shared->script(), SharedFunctionInfo::kScriptOffset); diff --git a/src/runtime/runtime-collections.cc b/src/runtime/runtime-collections.cc index 44e947aafe..b0158c26e9 100644 --- a/src/runtime/runtime-collections.cc +++ b/src/runtime/runtime-collections.cc @@ -11,6 +11,18 @@ namespace v8 { namespace internal { +RUNTIME_FUNCTION(Runtime_IsJSMapIterator) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsJSMapIterator()); +} + +RUNTIME_FUNCTION(Runtime_IsJSSetIterator) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsJSSetIterator()); +} + RUNTIME_FUNCTION(Runtime_TheHole) { SealHandleScope shs(isolate); DCHECK_EQ(0, args.length()); diff --git a/src/runtime/runtime-error.cc b/src/runtime/runtime-error.cc index 6ded550d04..7cd98f223b 100644 --- a/src/runtime/runtime-error.cc +++ b/src/runtime/runtime-error.cc @@ -20,5 +20,11 @@ RUNTIME_FUNCTION(Runtime_ErrorToString) { RETURN_RESULT_OR_FAILURE(isolate, ErrorUtils::ToString(isolate, recv)); } +RUNTIME_FUNCTION(Runtime_IsJSError) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsJSError()); +} + } // namespace internal } // namespace v8 diff --git a/src/runtime/runtime-generator.cc b/src/runtime/runtime-generator.cc index 04be185205..21217b51a9 100644 --- a/src/runtime/runtime-generator.cc +++ b/src/runtime/runtime-generator.cc @@ -11,6 +11,12 @@ namespace v8 { namespace internal { +RUNTIME_FUNCTION(Runtime_IsJSGeneratorObject) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsJSGeneratorObject()); +} + RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) { HandleScope scope(isolate); DCHECK_EQ(2, args.length()); diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc index 4651eb7b1e..a24ded7e21 100644 --- a/src/runtime/runtime-internal.cc +++ b/src/runtime/runtime-internal.cc @@ -30,6 +30,12 @@ RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { return isolate->heap()->undefined_value(); } +RUNTIME_FUNCTION(Runtime_IsScriptWrapper) { + SealHandleScope shs(isolate); + DCHECK_EQ(1, args.length()); + return isolate->heap()->ToBoolean(args[0]->IsScriptWrapper()); +} + RUNTIME_FUNCTION(Runtime_ExportFromRuntime) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 526cbe6c3c..2a78d63958 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -585,6 +585,11 @@ namespace internal { F(HasFixedUint8ClampedElements, 1, 1) \ F(HasFixedUint8Elements, 1, 1) \ F(HasHoleyElements, 1, 1) \ + F(IsJSError, 1, 1) \ + F(IsJSGeneratorObject, 1, 1) \ + F(IsJSMapIterator, 1, 1) \ + F(IsScriptWrapper, 1, 1) \ + F(IsJSSetIterator, 1, 1) \ F(HasObjectElements, 1, 1) \ F(HasSloppyArgumentsElements, 1, 1) \ F(HasSmiElements, 1, 1) \ diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc index 50f01d5860..dc1f690a63 100644 --- a/src/wasm/wasm-js.cc +++ b/src/wasm/wasm-js.cc @@ -951,7 +951,6 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) { name, isolate->strict_function_map(), LanguageMode::kStrict); Handle cons = factory->NewFunction(args); JSFunction::SetPrototype(cons, isolate->initial_object_prototype()); - cons->shared()->set_instance_class_name(*name); Handle webassembly = factory->NewJSObject(cons, TENURED); PropertyAttributes attributes = static_cast(DONT_ENUM); diff --git a/test/cctest/interpreter/test-interpreter-intrinsics.cc b/test/cctest/interpreter/test-interpreter-intrinsics.cc index b8ebef3b28..7eb76ecb21 100644 --- a/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -219,27 +219,6 @@ TEST(IntrinsicAsStubCall) { has_property_helper.NewObject("({ x: 20 })"))); } -TEST(ClassOf) { - HandleAndZoneScope handles; - Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), - Runtime::kInlineClassOf); - CHECK_EQ(*helper.Invoke(helper.NewObject("123")), *factory->null_value()); - CHECK_EQ(*helper.Invoke(helper.NewObject("'true'")), *factory->null_value()); - CHECK_EQ(*helper.Invoke(helper.NewObject("'foo'")), *factory->null_value()); - CHECK(helper.Invoke(helper.NewObject("({a:1})")) - ->SameValue(*helper.NewObject("'Object'"))); - CHECK(helper.Invoke(helper.NewObject("(function foo() {})")) - ->SameValue(*helper.NewObject("'Function'"))); - CHECK(helper.Invoke(helper.NewObject("new Date()")) - ->SameValue(*helper.NewObject("'Date'"))); - CHECK(helper.Invoke(helper.NewObject("new Set")) - ->SameValue(*helper.NewObject("'Set'"))); - CHECK(helper.Invoke(helper.NewObject("/x/")) - ->SameValue(*helper.NewObject("'RegExp'"))); -} - } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/test/mjsunit/es6/array-iterator.js b/test/mjsunit/es6/array-iterator.js index d2d19b059d..b143c8c034 100644 --- a/test/mjsunit/es6/array-iterator.js +++ b/test/mjsunit/es6/array-iterator.js @@ -152,10 +152,6 @@ function TestArrayIteratorPrototype() { assertEquals(Object.prototype, ArrayIteratorPrototype.__proto__); - assertEquals('Array Iterator', %_ClassOf(array[Symbol.iterator]())); - assertEquals('Array Iterator', %_ClassOf(array.keys())); - assertEquals('Array Iterator', %_ClassOf(array.entries())); - assertFalse(ArrayIteratorPrototype.hasOwnProperty('constructor')); assertArrayEquals(['next'], Object.getOwnPropertyNames(ArrayIteratorPrototype)); diff --git a/test/mjsunit/es6/classof-proxy.js b/test/mjsunit/es6/classof-proxy.js deleted file mode 100644 index 02043614ba..0000000000 --- a/test/mjsunit/es6/classof-proxy.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -function test_function(o) { - if (%_ClassOf(o) === "Function") { - return true; - } else { - return false; - } -} - -var non_callable = new Proxy({}, {}); -var callable = new Proxy(function(){}.__proto__, {}); -var constructable = new Proxy(function(){}, {}); - -assertFalse(test_function(non_callable)); -assertTrue(test_function(callable)); -assertTrue(test_function(constructable)); - -%OptimizeFunctionOnNextCall(test_function); - -assertFalse(test_function(non_callable)); -assertTrue(test_function(callable)); -assertTrue(test_function(constructable)); diff --git a/test/mjsunit/es6/collection-iterator.js b/test/mjsunit/es6/collection-iterator.js index 5a9b2f54e6..8257d96664 100644 --- a/test/mjsunit/es6/collection-iterator.js +++ b/test/mjsunit/es6/collection-iterator.js @@ -14,7 +14,6 @@ function test(f) { test(function TestSetIterator() { var s = new Set; var iter = s.values(); - assertEquals('Set Iterator', %_ClassOf(iter)); var SetIteratorPrototype = iter.__proto__; assertFalse(SetIteratorPrototype.hasOwnProperty('constructor')); @@ -160,7 +159,6 @@ test(function TestSetIteratorSymbol() { test(function TestMapIterator() { var m = new Map; var iter = m.values(); - assertEquals('Map Iterator', %_ClassOf(iter)); var MapIteratorPrototype = iter.__proto__; assertFalse(MapIteratorPrototype.hasOwnProperty('constructor')); diff --git a/test/mjsunit/es6/collections.js b/test/mjsunit/es6/collections.js index 1664a93bde..feae629439 100644 --- a/test/mjsunit/es6/collections.js +++ b/test/mjsunit/es6/collections.js @@ -307,17 +307,6 @@ assertTrue(WeakSet.prototype.has instanceof Function) assertTrue(WeakSet.prototype.delete instanceof Function) -// Test class of instance and prototype. -assertEquals("Set", %_ClassOf(new Set)) -assertEquals("Object", %_ClassOf(Set.prototype)) -assertEquals("Map", %_ClassOf(new Map)) -assertEquals("Object", %_ClassOf(Map.prototype)) -assertEquals("WeakMap", %_ClassOf(new WeakMap)) -assertEquals("Object", %_ClassOf(WeakMap.prototype)) -assertEquals("WeakSet", %_ClassOf(new WeakSet)) -assertEquals("Object", %_ClassOf(WeakMap.prototype)) - - // Test name of constructor. assertEquals("Set", Set.name); assertEquals("Map", Map.name); diff --git a/test/mjsunit/es6/generators-objects.js b/test/mjsunit/es6/generators-objects.js index 2cc359f911..ff216d43e4 100644 --- a/test/mjsunit/es6/generators-objects.js +++ b/test/mjsunit/es6/generators-objects.js @@ -55,7 +55,6 @@ function TestGeneratorObject() { var iter = g(); assertSame(g.prototype, Object.getPrototypeOf(iter)); assertTrue(iter instanceof g); - assertEquals("Generator", %_ClassOf(iter)); assertEquals("[object Generator]", String(iter)); assertEquals([], Object.getOwnPropertyNames(iter)); assertTrue(iter !== g()); diff --git a/test/mjsunit/es6/symbols.js b/test/mjsunit/es6/symbols.js index d83e2174ec..a6c12909b4 100644 --- a/test/mjsunit/es6/symbols.js +++ b/test/mjsunit/es6/symbols.js @@ -67,8 +67,6 @@ function TestType() { assertEquals("symbol", typeof symbols[i]) assertTrue(typeof symbols[i] === "symbol") assertFalse(%SymbolIsPrivate(symbols[i])) - assertEquals(null, %_ClassOf(symbols[i])) - assertEquals("Symbol", %_ClassOf(Object(symbols[i]))) } } TestType() diff --git a/test/mjsunit/es6/typedarray-every.js b/test/mjsunit/es6/typedarray-every.js index a3498f5786..968078988f 100644 --- a/test/mjsunit/es6/typedarray-every.js +++ b/test/mjsunit/es6/typedarray-every.js @@ -132,7 +132,6 @@ function TestTypedArrayForEach(constructor) { }); assertEquals(2, count); assertTrue(!!buffer); - assertEquals("ArrayBuffer", %_ClassOf(buffer)); assertSame(buffer, a.buffer); // The %TypedArray%.every() method should not work when diff --git a/test/mjsunit/es6/typedarray-foreach.js b/test/mjsunit/es6/typedarray-foreach.js index 7a846b1ac7..252706a9b5 100644 --- a/test/mjsunit/es6/typedarray-foreach.js +++ b/test/mjsunit/es6/typedarray-foreach.js @@ -121,7 +121,6 @@ function TestTypedArrayForEach(constructor) { }); assertEquals(2, count); assertTrue(!!buffer); - assertEquals("ArrayBuffer", %_ClassOf(buffer)); assertSame(buffer, a.buffer); // The %TypedArray%.forEach() method should not work when diff --git a/test/mjsunit/harmony/private.js b/test/mjsunit/harmony/private.js index 39376f3ea9..c4306c516c 100644 --- a/test/mjsunit/harmony/private.js +++ b/test/mjsunit/harmony/private.js @@ -57,8 +57,6 @@ function TestType() { assertEquals("symbol", typeof symbols[i]) assertTrue(typeof symbols[i] === "symbol") assertTrue(%SymbolIsPrivate(symbols[i])) - assertEquals(null, %_ClassOf(symbols[i])) - assertEquals("Symbol", %_ClassOf(Object(symbols[i]))) } } TestType() diff --git a/test/mjsunit/regress/regress-5010.js b/test/mjsunit/regress/regress-5010.js deleted file mode 100644 index ecd4026dd8..0000000000 --- a/test/mjsunit/regress/regress-5010.js +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -var bound = (function(){}).bind({}); -assertEquals("Function", %_ClassOf(bound)); -assertEquals("Function", %ClassOf(bound)); diff --git a/test/mjsunit/regress/regress-995.js b/test/mjsunit/regress/regress-995.js index 3f99179104..cf680da1e7 100644 --- a/test/mjsunit/regress/regress-995.js +++ b/test/mjsunit/regress/regress-995.js @@ -39,14 +39,6 @@ function f(value) { } f(new String("bar")); -// HClassOf. -function g(value) { - if (%_ClassOf(value) === 'Date') { - if (%_ClassOf(value) === 'String') assertTrue(false); - } -} -g(new Date()); - // HIsNull. function h(value) { if (value == null) { diff --git a/test/unittests/compiler/typer-unittest.cc b/test/unittests/compiler/typer-unittest.cc index 44464b9476..fcfbfdb646 100644 --- a/test/unittests/compiler/typer-unittest.cc +++ b/test/unittests/compiler/typer-unittest.cc @@ -491,7 +491,6 @@ TEST_MONOTONICITY(ObjectIsString) TEST_MONOTONICITY(ObjectIsSymbol) TEST_MONOTONICITY(ObjectIsUndetectable) TEST_MONOTONICITY(TypeOf) -TEST_MONOTONICITY(ClassOf) TEST_MONOTONICITY(ToBoolean) #undef TEST_MONOTONICITY