From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/JavaScriptCore/runtime/ConstructData.cpp | 33 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'Source/JavaScriptCore/runtime/ConstructData.cpp') diff --git a/Source/JavaScriptCore/runtime/ConstructData.cpp b/Source/JavaScriptCore/runtime/ConstructData.cpp index 3dc46180c..94e672f7a 100644 --- a/Source/JavaScriptCore/runtime/ConstructData.cpp +++ b/Source/JavaScriptCore/runtime/ConstructData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2016 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,18 +26,39 @@ #include "config.h" #include "ConstructData.h" -#include "Executable.h" #include "Interpreter.h" +#include "JSCInlines.h" #include "JSFunction.h" #include "JSGlobalObject.h" -#include "Operations.h" +#include "ScriptProfilingScope.h" namespace JSC { -JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args) +JSObject* construct(ExecState* exec, JSValue constructorObject, const ArgList& args, const char* errorMessage) { - ASSERT(constructType == ConstructTypeJS || constructType == ConstructTypeHost); - return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args); + VM& vm = exec->vm(); + auto scope = DECLARE_THROW_SCOPE(vm); + + ConstructData constructData; + ConstructType constructType = getConstructData(constructorObject, constructData); + if (constructType == ConstructType::None) + return throwTypeError(exec, scope, errorMessage); + + scope.release(); + return construct(exec, constructorObject, constructType, constructData, args, constructorObject); +} + + +JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args, JSValue newTarget) +{ + ASSERT(constructType == ConstructType::JS || constructType == ConstructType::Host); + return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args, newTarget); +} + +JSObject* profiledConstruct(ExecState* exec, ProfilingReason reason, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args, JSValue newTarget) +{ + ScriptProfilingScope profilingScope(exec->vmEntryGlobalObject(), reason); + return construct(exec, constructorObject, constructType, constructData, args, newTarget); } } // namespace JSC -- cgit v1.2.1