haikuwebkit/LayoutTests/js/exception-instanceof-expect...

15 lines
730 B
Plaintext
Raw Permalink Normal View History

Improve error messages in JSC https://bugs.webkit.org/show_bug.cgi?id=141869 Reviewed by Geoffrey Garen. Source/JavaScriptCore: JavaScriptCore has some unintuitive error messages associated with certain common errors. This patch changes some specific error messages to be more understandable and also creates a mechanism that will allow for easy modification of error messages in the future. The specific errors we change are not a function errors and invalid parameter errors. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/Interpreter.cpp: (JSC::sizeOfVarargs): * jit/JITOperations.cpp: op_throw_static_error always has a JSString as its argument. There is no need to dance around this, and we should assert that this always holds. This JSString represents the error message we want to display to the user, so there is no need to pass it into errorDescriptionForValue which will now place quotes around the string. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::opIn): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): * runtime/ErrorInstance.h: (JSC::ErrorInstance::hasSourceAppender): (JSC::ErrorInstance::sourceAppender): (JSC::ErrorInstance::setSourceAppender): (JSC::ErrorInstance::clearSourceAppender): (JSC::ErrorInstance::setRuntimeTypeForCause): (JSC::ErrorInstance::runtimeTypeForCause): (JSC::ErrorInstance::clearRuntimeTypeForCause): (JSC::ErrorInstance::appendSourceToMessage): Deleted. (JSC::ErrorInstance::setAppendSourceToMessage): Deleted. (JSC::ErrorInstance::clearAppendSourceToMessage): Deleted. * runtime/ExceptionHelpers.cpp: (JSC::errorDescriptionForValue): (JSC::defaultApproximateSourceError): (JSC::defaultSourceAppender): (JSC::functionCallBase): (JSC::notAFunctionSourceAppender): (JSC::invalidParameterInSourceAppender): (JSC::invalidParameterInstanceofSourceAppender): (JSC::createError): (JSC::createInvalidFunctionApplyParameterError): (JSC::createInvalidInParameterError): (JSC::createInvalidInstanceofParameterError): (JSC::createNotAConstructorError): (JSC::createNotAFunctionError): (JSC::createNotAnObjectError): (JSC::createInvalidParameterError): Deleted. * runtime/ExceptionHelpers.h: * runtime/JSObject.cpp: (JSC::JSObject::hasInstance): * runtime/RuntimeType.cpp: Added. (JSC::runtimeTypeForValue): (JSC::runtimeTypeAsString): * runtime/RuntimeType.h: Added. * runtime/TypeProfilerLog.cpp: (JSC::TypeProfilerLog::processLogEntries): * runtime/TypeSet.cpp: (JSC::TypeSet::getRuntimeTypeForValue): Deleted. * runtime/TypeSet.h: * runtime/VM.cpp: (JSC::appendSourceToError): (JSC::VM::throwException): LayoutTests: * fast/dom/NodeList/nodelist-item-call-as-function-expected.txt: * fast/dom/call-a-constructor-as-a-function-expected.txt: * fast/regex/dom/cross-frame-callable-expected.txt: * fast/selectors/closest-general-expected.txt: * http/tests/security/xss-DENIED-window-index-assign-expected.txt: * js/dom/exception-thrown-from-new-expected.txt: * js/exception-for-nonobject-expected.txt: * js/exception-function-apply-expected.txt: Added. * js/exception-function-apply.html: Added. * js/exception-in-expected.txt: Added. * js/exception-in.html: Added. * js/exception-instanceof-expected.txt: Added. * js/exception-instanceof.html: Added. * js/instance-of-immediates-expected.txt: * js/script-tests/exception-function-apply.js: Added. * js/script-tests/exception-in.js: Added. * js/script-tests/exception-instanceof.js: Added. * js/typedarray-constructors-expected.txt: * platform/mac-wk2/plugins/npruntime/object-from-destroyed-plugin-expected.txt: * platform/mac-wk2/plugins/npruntime/object-from-destroyed-plugin-in-subframe-expected.txt: * platform/mac/css3/selectors3/xhtml/css3-modsel-15c-expected.txt: * platform/mac/css3/selectors3/xml/css3-modsel-15c-expected.txt: * plugins/npruntime/object-from-destroyed-plugin-expected.txt: * plugins/npruntime/object-from-destroyed-plugin-in-subframe-expected.txt: * plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt: * sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T1-expected.txt: * sputnik/Conformance/13_Function_Definition/S13_A17_T2-expected.txt: * sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/S15.1_A2_T1-expected.txt: * sputnik/Conformance/15_Native_Objects/15.2_Object/15.2.4/S15.2.4_A3-expected.txt: * svg/dom/svgpath-out-of-bounds-getPathSeg-expected.txt: Canonical link: https://commits.webkit.org/161017@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-24 07:30:05 +00:00
Test for error messages for instanceof
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
[ES6] Add support for Symbol.hasInstance https://bugs.webkit.org/show_bug.cgi?id=151839 Reviewed by Saam Barati. Source/JavaScriptCore: Fixed version of r193986, r193983, and r193974. This patch adds support for Symbol.hasInstance, unfortunately in order to prevent regressions several new bytecodes and DFG IR nodes were necessary. Before, Symbol.hasInstance when executing an instanceof expression we would emit three bytecodes: overrides_has_instance, get_by_id, then instanceof. As the spec has changed, we emit a more complicated set of bytecodes in addition to some new ones. First the role of overrides_has_instance and its corresponding DFG node have changed. Now it returns a js-boolean indicating whether the RHS of the instanceof expression (from here on called the constructor for simplicity) needs non-default behavior for resolving the expression. i.e. The constructor has a Symbol.hasInstance that differs from the one on Function.prototype[Symbol.hasInstance] or is a bound/C-API function. Once we get to the DFG this node is generally eliminated as we can prove the value of Symbol.hasInstance is a constant. The second new bytecode is instanceof_custom. insntanceof_custom, just emits a call to slow path code that computes the result. In the DFG, there is also a new node, CheckTypeInfoFlags, which checks the type info flags are consistent with the ones provided and OSR exits if the flags are not. Additionally, we attempt to prove that the result of CheckHasValue will be a constant and transform it into a CheckTypeInfoFlags followed by a JSConstant. * API/JSCallbackObject.h: * builtins/FunctionPrototype.js: (symbolHasInstance): * bytecode/BytecodeBasicBlock.cpp: (JSC::isBranch): Deleted. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecode/ExitKind.cpp: (JSC::exitKindToString): * bytecode/ExitKind.h: * bytecode/PreciseJumpTargets.cpp: (JSC::getJumpTargetsForBytecodeOffset): Deleted. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitOverridesHasInstance): (JSC::BytecodeGenerator::emitInstanceOfCustom): (JSC::BytecodeGenerator::emitCheckHasInstance): Deleted. * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::InstanceOfNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGHeapLocation.cpp: (WTF::printInternal): * dfg/DFGHeapLocation.h: * dfg/DFGNode.h: (JSC::DFG::Node::hasCellOperand): (JSC::DFG::Node::hasTypeInfoOperand): (JSC::DFG::Node::typeInfoOperand): * dfg/DFGNodeType.h: * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCheckTypeInfoFlags): (JSC::DFG::SpeculativeJIT::compileInstanceOfCustom): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::callOperation): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLIntrinsicRepository.h: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::compileNode): (JSC::FTL::DFG::LowerDFGToLLVM::compileOverridesHasInstance): (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckTypeInfoFlags): (JSC::FTL::DFG::LowerDFGToLLVM::compileInstanceOfCustom): (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckHasInstance): Deleted. * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_check_has_instance): Deleted. (JSC::JIT::emitSlow_op_check_has_instance): Deleted. * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_check_has_instance): Deleted. (JSC::JIT::emitSlow_op_check_has_instance): Deleted. * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/CommonIdentifiers.h: * runtime/ExceptionHelpers.cpp: (JSC::invalidParameterInstanceofSourceAppender): (JSC::invalidParameterInstanceofNotFunctionSourceAppender): (JSC::invalidParameterInstanceofhasInstanceValueNotFunctionSourceAppender): (JSC::createInvalidInstanceofParameterErrorNotFunction): (JSC::createInvalidInstanceofParameterErrorhasInstanceValueNotFunction): (JSC::createInvalidInstanceofParameterError): Deleted. * runtime/ExceptionHelpers.h: * runtime/FunctionPrototype.cpp: (JSC::FunctionPrototype::addFunctionProperties): * runtime/FunctionPrototype.h: * runtime/JSBoundFunction.cpp: (JSC::isBoundFunction): (JSC::hasInstanceBoundFunction): * runtime/JSBoundFunction.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::functionProtoHasInstanceSymbolFunction): * runtime/JSObject.cpp: (JSC::JSObject::hasInstance): (JSC::objectPrivateFuncInstanceOf): * runtime/JSObject.h: * runtime/JSTypeInfo.h: (JSC::TypeInfo::TypeInfo): (JSC::TypeInfo::overridesHasInstance): * runtime/WriteBarrier.h: (JSC::WriteBarrierBase<Unknown>::slot): * tests/es6.yaml: * tests/stress/instanceof-custom-hasinstancesymbol.js: Added. (Constructor): (value): (instanceOf): (body): * tests/stress/symbol-hasInstance.js: Added. (Constructor): (value): (ObjectClass.Symbol.hasInstance): (NumberClass.Symbol.hasInstance): LayoutTests: Fix tests to reflect the changes to instanceof in ES6. Added a new regression test for bound functions in instanceof as the perfomance on bound functions should, to some degree, reflect the performance on C-API users. * inspector/model/remote-object-get-properties-expected.txt: * js/Object-getOwnPropertyNames-expected.txt: * js/exception-for-nonobject-expected.txt: * js/exception-instanceof-expected.txt: * js/instance-of-immediates-expected.txt: * js/regress/instanceof-bound-expected.txt: Added. * js/regress/instanceof-bound.html: Added. * js/regress/script-tests/instanceof-bound.js: Added. (Constructor): (test): * js/script-tests/Object-getOwnPropertyNames.js: Canonical link: https://commits.webkit.org/170515@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-18 00:37:35 +00:00
PASS 'instanceof' instanceof 'instanceof' threw exception TypeError: Right hand side of instanceof is not an object.
PASS 20 instanceof 'hello' threw exception TypeError: Right hand side of instanceof is not an object.
Improve error messages in JSC https://bugs.webkit.org/show_bug.cgi?id=141869 Reviewed by Geoffrey Garen. Source/JavaScriptCore: JavaScriptCore has some unintuitive error messages associated with certain common errors. This patch changes some specific error messages to be more understandable and also creates a mechanism that will allow for easy modification of error messages in the future. The specific errors we change are not a function errors and invalid parameter errors. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/Interpreter.cpp: (JSC::sizeOfVarargs): * jit/JITOperations.cpp: op_throw_static_error always has a JSString as its argument. There is no need to dance around this, and we should assert that this always holds. This JSString represents the error message we want to display to the user, so there is no need to pass it into errorDescriptionForValue which will now place quotes around the string. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::opIn): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): * runtime/ErrorInstance.h: (JSC::ErrorInstance::hasSourceAppender): (JSC::ErrorInstance::sourceAppender): (JSC::ErrorInstance::setSourceAppender): (JSC::ErrorInstance::clearSourceAppender): (JSC::ErrorInstance::setRuntimeTypeForCause): (JSC::ErrorInstance::runtimeTypeForCause): (JSC::ErrorInstance::clearRuntimeTypeForCause): (JSC::ErrorInstance::appendSourceToMessage): Deleted. (JSC::ErrorInstance::setAppendSourceToMessage): Deleted. (JSC::ErrorInstance::clearAppendSourceToMessage): Deleted. * runtime/ExceptionHelpers.cpp: (JSC::errorDescriptionForValue): (JSC::defaultApproximateSourceError): (JSC::defaultSourceAppender): (JSC::functionCallBase): (JSC::notAFunctionSourceAppender): (JSC::invalidParameterInSourceAppender): (JSC::invalidParameterInstanceofSourceAppender): (JSC::createError): (JSC::createInvalidFunctionApplyParameterError): (JSC::createInvalidInParameterError): (JSC::createInvalidInstanceofParameterError): (JSC::createNotAConstructorError): (JSC::createNotAFunctionError): (JSC::createNotAnObjectError): (JSC::createInvalidParameterError): Deleted. * runtime/ExceptionHelpers.h: * runtime/JSObject.cpp: (JSC::JSObject::hasInstance): * runtime/RuntimeType.cpp: Added. (JSC::runtimeTypeForValue): (JSC::runtimeTypeAsString): * runtime/RuntimeType.h: Added. * runtime/TypeProfilerLog.cpp: (JSC::TypeProfilerLog::processLogEntries): * runtime/TypeSet.cpp: (JSC::TypeSet::getRuntimeTypeForValue): Deleted. * runtime/TypeSet.h: * runtime/VM.cpp: (JSC::appendSourceToError): (JSC::VM::throwException): LayoutTests: * fast/dom/NodeList/nodelist-item-call-as-function-expected.txt: * fast/dom/call-a-constructor-as-a-function-expected.txt: * fast/regex/dom/cross-frame-callable-expected.txt: * fast/selectors/closest-general-expected.txt: * http/tests/security/xss-DENIED-window-index-assign-expected.txt: * js/dom/exception-thrown-from-new-expected.txt: * js/exception-for-nonobject-expected.txt: * js/exception-function-apply-expected.txt: Added. * js/exception-function-apply.html: Added. * js/exception-in-expected.txt: Added. * js/exception-in.html: Added. * js/exception-instanceof-expected.txt: Added. * js/exception-instanceof.html: Added. * js/instance-of-immediates-expected.txt: * js/script-tests/exception-function-apply.js: Added. * js/script-tests/exception-in.js: Added. * js/script-tests/exception-instanceof.js: Added. * js/typedarray-constructors-expected.txt: * platform/mac-wk2/plugins/npruntime/object-from-destroyed-plugin-expected.txt: * platform/mac-wk2/plugins/npruntime/object-from-destroyed-plugin-in-subframe-expected.txt: * platform/mac/css3/selectors3/xhtml/css3-modsel-15c-expected.txt: * platform/mac/css3/selectors3/xml/css3-modsel-15c-expected.txt: * plugins/npruntime/object-from-destroyed-plugin-expected.txt: * plugins/npruntime/object-from-destroyed-plugin-in-subframe-expected.txt: * plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt: * sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T1-expected.txt: * sputnik/Conformance/13_Function_Definition/S13_A17_T2-expected.txt: * sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/S15.1_A2_T1-expected.txt: * sputnik/Conformance/15_Native_Objects/15.2_Object/15.2.4/S15.2.4_A3-expected.txt: * svg/dom/svgpath-out-of-bounds-getPathSeg-expected.txt: Canonical link: https://commits.webkit.org/161017@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-24 07:30:05 +00:00
PASS 20 instanceof {} threw exception TypeError: {} is not a function. (evaluating '20 instanceof {}').
[ES6] Add support for Symbol.hasInstance https://bugs.webkit.org/show_bug.cgi?id=151839 Reviewed by Saam Barati. Source/JavaScriptCore: Fixed version of r193986, r193983, and r193974. This patch adds support for Symbol.hasInstance, unfortunately in order to prevent regressions several new bytecodes and DFG IR nodes were necessary. Before, Symbol.hasInstance when executing an instanceof expression we would emit three bytecodes: overrides_has_instance, get_by_id, then instanceof. As the spec has changed, we emit a more complicated set of bytecodes in addition to some new ones. First the role of overrides_has_instance and its corresponding DFG node have changed. Now it returns a js-boolean indicating whether the RHS of the instanceof expression (from here on called the constructor for simplicity) needs non-default behavior for resolving the expression. i.e. The constructor has a Symbol.hasInstance that differs from the one on Function.prototype[Symbol.hasInstance] or is a bound/C-API function. Once we get to the DFG this node is generally eliminated as we can prove the value of Symbol.hasInstance is a constant. The second new bytecode is instanceof_custom. insntanceof_custom, just emits a call to slow path code that computes the result. In the DFG, there is also a new node, CheckTypeInfoFlags, which checks the type info flags are consistent with the ones provided and OSR exits if the flags are not. Additionally, we attempt to prove that the result of CheckHasValue will be a constant and transform it into a CheckTypeInfoFlags followed by a JSConstant. * API/JSCallbackObject.h: * builtins/FunctionPrototype.js: (symbolHasInstance): * bytecode/BytecodeBasicBlock.cpp: (JSC::isBranch): Deleted. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecode/ExitKind.cpp: (JSC::exitKindToString): * bytecode/ExitKind.h: * bytecode/PreciseJumpTargets.cpp: (JSC::getJumpTargetsForBytecodeOffset): Deleted. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitOverridesHasInstance): (JSC::BytecodeGenerator::emitInstanceOfCustom): (JSC::BytecodeGenerator::emitCheckHasInstance): Deleted. * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::InstanceOfNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGHeapLocation.cpp: (WTF::printInternal): * dfg/DFGHeapLocation.h: * dfg/DFGNode.h: (JSC::DFG::Node::hasCellOperand): (JSC::DFG::Node::hasTypeInfoOperand): (JSC::DFG::Node::typeInfoOperand): * dfg/DFGNodeType.h: * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCheckTypeInfoFlags): (JSC::DFG::SpeculativeJIT::compileInstanceOfCustom): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::callOperation): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLIntrinsicRepository.h: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::compileNode): (JSC::FTL::DFG::LowerDFGToLLVM::compileOverridesHasInstance): (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckTypeInfoFlags): (JSC::FTL::DFG::LowerDFGToLLVM::compileInstanceOfCustom): (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckHasInstance): Deleted. * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_check_has_instance): Deleted. (JSC::JIT::emitSlow_op_check_has_instance): Deleted. * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_check_has_instance): Deleted. (JSC::JIT::emitSlow_op_check_has_instance): Deleted. * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/CommonIdentifiers.h: * runtime/ExceptionHelpers.cpp: (JSC::invalidParameterInstanceofSourceAppender): (JSC::invalidParameterInstanceofNotFunctionSourceAppender): (JSC::invalidParameterInstanceofhasInstanceValueNotFunctionSourceAppender): (JSC::createInvalidInstanceofParameterErrorNotFunction): (JSC::createInvalidInstanceofParameterErrorhasInstanceValueNotFunction): (JSC::createInvalidInstanceofParameterError): Deleted. * runtime/ExceptionHelpers.h: * runtime/FunctionPrototype.cpp: (JSC::FunctionPrototype::addFunctionProperties): * runtime/FunctionPrototype.h: * runtime/JSBoundFunction.cpp: (JSC::isBoundFunction): (JSC::hasInstanceBoundFunction): * runtime/JSBoundFunction.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::functionProtoHasInstanceSymbolFunction): * runtime/JSObject.cpp: (JSC::JSObject::hasInstance): (JSC::objectPrivateFuncInstanceOf): * runtime/JSObject.h: * runtime/JSTypeInfo.h: (JSC::TypeInfo::TypeInfo): (JSC::TypeInfo::overridesHasInstance): * runtime/WriteBarrier.h: (JSC::WriteBarrierBase<Unknown>::slot): * tests/es6.yaml: * tests/stress/instanceof-custom-hasinstancesymbol.js: Added. (Constructor): (value): (instanceOf): (body): * tests/stress/symbol-hasInstance.js: Added. (Constructor): (value): (ObjectClass.Symbol.hasInstance): (NumberClass.Symbol.hasInstance): LayoutTests: Fix tests to reflect the changes to instanceof in ES6. Added a new regression test for bound functions in instanceof as the perfomance on bound functions should, to some degree, reflect the performance on C-API users. * inspector/model/remote-object-get-properties-expected.txt: * js/Object-getOwnPropertyNames-expected.txt: * js/exception-for-nonobject-expected.txt: * js/exception-instanceof-expected.txt: * js/instance-of-immediates-expected.txt: * js/regress/instanceof-bound-expected.txt: Added. * js/regress/instanceof-bound.html: Added. * js/regress/script-tests/instanceof-bound.js: Added. (Constructor): (test): * js/script-tests/Object-getOwnPropertyNames.js: Canonical link: https://commits.webkit.org/170515@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-18 00:37:35 +00:00
PASS 20 instanceof {}.foo threw exception TypeError: Right hand side of instanceof is not an object.
PASS 20 instanceof true threw exception TypeError: Right hand side of instanceof is not an object.
Improve error messages in JSC https://bugs.webkit.org/show_bug.cgi?id=141869 Reviewed by Geoffrey Garen. Source/JavaScriptCore: JavaScriptCore has some unintuitive error messages associated with certain common errors. This patch changes some specific error messages to be more understandable and also creates a mechanism that will allow for easy modification of error messages in the future. The specific errors we change are not a function errors and invalid parameter errors. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/Interpreter.cpp: (JSC::sizeOfVarargs): * jit/JITOperations.cpp: op_throw_static_error always has a JSString as its argument. There is no need to dance around this, and we should assert that this always holds. This JSString represents the error message we want to display to the user, so there is no need to pass it into errorDescriptionForValue which will now place quotes around the string. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::opIn): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance): * runtime/ErrorInstance.h: (JSC::ErrorInstance::hasSourceAppender): (JSC::ErrorInstance::sourceAppender): (JSC::ErrorInstance::setSourceAppender): (JSC::ErrorInstance::clearSourceAppender): (JSC::ErrorInstance::setRuntimeTypeForCause): (JSC::ErrorInstance::runtimeTypeForCause): (JSC::ErrorInstance::clearRuntimeTypeForCause): (JSC::ErrorInstance::appendSourceToMessage): Deleted. (JSC::ErrorInstance::setAppendSourceToMessage): Deleted. (JSC::ErrorInstance::clearAppendSourceToMessage): Deleted. * runtime/ExceptionHelpers.cpp: (JSC::errorDescriptionForValue): (JSC::defaultApproximateSourceError): (JSC::defaultSourceAppender): (JSC::functionCallBase): (JSC::notAFunctionSourceAppender): (JSC::invalidParameterInSourceAppender): (JSC::invalidParameterInstanceofSourceAppender): (JSC::createError): (JSC::createInvalidFunctionApplyParameterError): (JSC::createInvalidInParameterError): (JSC::createInvalidInstanceofParameterError): (JSC::createNotAConstructorError): (JSC::createNotAFunctionError): (JSC::createNotAnObjectError): (JSC::createInvalidParameterError): Deleted. * runtime/ExceptionHelpers.h: * runtime/JSObject.cpp: (JSC::JSObject::hasInstance): * runtime/RuntimeType.cpp: Added. (JSC::runtimeTypeForValue): (JSC::runtimeTypeAsString): * runtime/RuntimeType.h: Added. * runtime/TypeProfilerLog.cpp: (JSC::TypeProfilerLog::processLogEntries): * runtime/TypeSet.cpp: (JSC::TypeSet::getRuntimeTypeForValue): Deleted. * runtime/TypeSet.h: * runtime/VM.cpp: (JSC::appendSourceToError): (JSC::VM::throwException): LayoutTests: * fast/dom/NodeList/nodelist-item-call-as-function-expected.txt: * fast/dom/call-a-constructor-as-a-function-expected.txt: * fast/regex/dom/cross-frame-callable-expected.txt: * fast/selectors/closest-general-expected.txt: * http/tests/security/xss-DENIED-window-index-assign-expected.txt: * js/dom/exception-thrown-from-new-expected.txt: * js/exception-for-nonobject-expected.txt: * js/exception-function-apply-expected.txt: Added. * js/exception-function-apply.html: Added. * js/exception-in-expected.txt: Added. * js/exception-in.html: Added. * js/exception-instanceof-expected.txt: Added. * js/exception-instanceof.html: Added. * js/instance-of-immediates-expected.txt: * js/script-tests/exception-function-apply.js: Added. * js/script-tests/exception-in.js: Added. * js/script-tests/exception-instanceof.js: Added. * js/typedarray-constructors-expected.txt: * platform/mac-wk2/plugins/npruntime/object-from-destroyed-plugin-expected.txt: * platform/mac-wk2/plugins/npruntime/object-from-destroyed-plugin-in-subframe-expected.txt: * platform/mac/css3/selectors3/xhtml/css3-modsel-15c-expected.txt: * platform/mac/css3/selectors3/xml/css3-modsel-15c-expected.txt: * plugins/npruntime/object-from-destroyed-plugin-expected.txt: * plugins/npruntime/object-from-destroyed-plugin-in-subframe-expected.txt: * plugins/npruntime/plugin-scriptable-object-invoke-default-expected.txt: * sputnik/Conformance/12_Statement/12.1_Block/S12.1_A4_T1-expected.txt: * sputnik/Conformance/13_Function_Definition/S13_A17_T2-expected.txt: * sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/S15.1_A2_T1-expected.txt: * sputnik/Conformance/15_Native_Objects/15.2_Object/15.2.4/S15.2.4_A3-expected.txt: * svg/dom/svgpath-out-of-bounds-getPathSeg-expected.txt: Canonical link: https://commits.webkit.org/161017@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-24 07:30:05 +00:00
PASS successfullyParsed is true
TEST COMPLETE