diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/runtime/ConstructData.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/runtime/ConstructData.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/ConstructData.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
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 |