summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/runtime/ErrorConstructor.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/runtime/ErrorConstructor.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/ErrorConstructor.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
index 2e31e7fd5..1d822c7ac 100644
--- a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
+++ b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
- * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -25,13 +25,13 @@
#include "Interpreter.h"
#include "JSGlobalObject.h"
#include "JSString.h"
-#include "Operations.h"
+#include "JSCInlines.h"
namespace JSC {
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ErrorConstructor);
-const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ErrorConstructor) };
+const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(ErrorConstructor) };
ErrorConstructor::ErrorConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
@@ -40,44 +40,42 @@ ErrorConstructor::ErrorConstructor(VM& vm, Structure* structure)
void ErrorConstructor::finishCreation(VM& vm, ErrorPrototype* errorPrototype)
{
- Base::finishCreation(vm, errorPrototype->classInfo()->className);
+ Base::finishCreation(vm, ASCIILiteral("Error"));
// ECMA 15.11.3.1 Error.prototype
putDirectWithoutTransition(vm, vm.propertyNames->prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
- putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum);
+ putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | ReadOnly);
}
// ECMA 15.9.3
EncodedJSValue JSC_HOST_CALL Interpreter::constructWithErrorConstructor(ExecState* exec)
{
- JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
- Structure* errorStructure = asInternalFunction(exec->callee())->globalObject()->errorStructure();
- Vector<StackFrame> stackTrace;
- exec->vm().interpreter->getStackTrace(stackTrace, std::numeric_limits<size_t>::max());
- stackTrace.remove(0);
- return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, stackTrace));
+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ JSValue message = exec->argument(0);
+ Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->jsCallee())->globalObject()->errorStructure());
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ scope.release();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
}
ConstructType ErrorConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = Interpreter::constructWithErrorConstructor;
- return ConstructTypeHost;
+ return ConstructType::Host;
}
EncodedJSValue JSC_HOST_CALL Interpreter::callErrorConstructor(ExecState* exec)
{
- JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
- Structure* errorStructure = asInternalFunction(exec->callee())->globalObject()->errorStructure();
- Vector<StackFrame> stackTrace;
- exec->vm().interpreter->getStackTrace(stackTrace, std::numeric_limits<size_t>::max());
- stackTrace.remove(0);
- return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, stackTrace));
+ JSValue message = exec->argument(0);
+ Structure* errorStructure = asInternalFunction(exec->jsCallee())->globalObject()->errorStructure();
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
}
CallType ErrorConstructor::getCallData(JSCell*, CallData& callData)
{
callData.native.function = Interpreter::callErrorConstructor;
- return CallTypeHost;
+ return CallType::Host;
}
} // namespace JSC