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/JSFunctionInlines.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSFunctionInlines.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSFunctionInlines.h | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/runtime/JSFunctionInlines.h b/Source/JavaScriptCore/runtime/JSFunctionInlines.h index fe4e114ad..263a00c30 100644 --- a/Source/JavaScriptCore/runtime/JSFunctionInlines.h +++ b/Source/JavaScriptCore/runtime/JSFunctionInlines.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013, 2015-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 @@ -23,19 +23,25 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSFunctionInlines_h -#define JSFunctionInlines_h +#pragma once -#include "Executable.h" +#include "FunctionExecutable.h" #include "JSFunction.h" +#include "NativeExecutable.h" namespace JSC { -inline JSFunction::JSFunction(VM& vm, FunctionExecutable* executable, JSScope* scope) - : Base(vm, scope->globalObject()->functionStructure()) +inline JSFunction* JSFunction::createWithInvalidatedReallocationWatchpoint( + VM& vm, FunctionExecutable* executable, JSScope* scope) +{ + ASSERT(executable->singletonFunction()->hasBeenInvalidated()); + return createImpl(vm, executable, scope, scope->globalObject(vm)->functionStructure()); +} + +inline JSFunction::JSFunction(VM& vm, FunctionExecutable* executable, JSScope* scope, Structure* structure) + : Base(vm, scope, structure) , m_executable(vm, this, executable) - , m_scope(vm, this, scope) - , m_allocationProfileWatchpoint(ClearWatchpoint) // See comment in JSFunction.cpp concerning the reason for using ClearWatchpoint as opposed to IsWatched. + , m_rareData() { } @@ -51,19 +57,54 @@ inline bool JSFunction::isHostFunction() const return m_executable->isHostFunction(); } +inline Intrinsic JSFunction::intrinsic() const +{ + return executable()->intrinsic(); +} + +inline bool JSFunction::isBuiltinFunction() const +{ + return !isHostFunction() && jsExecutable()->isBuiltinFunction(); +} + +inline bool JSFunction::isHostOrBuiltinFunction() const +{ + return isHostFunction() || isBuiltinFunction(); +} + +inline bool JSFunction::isClassConstructorFunction() const +{ + return !isHostFunction() && jsExecutable()->isClassConstructorFunction(); +} + inline NativeFunction JSFunction::nativeFunction() { - ASSERT(isHostFunction()); + ASSERT(isHostFunctionNonInline()); return static_cast<NativeExecutable*>(m_executable.get())->function(); } inline NativeFunction JSFunction::nativeConstructor() { - ASSERT(isHostFunction()); + ASSERT(isHostFunctionNonInline()); return static_cast<NativeExecutable*>(m_executable.get())->constructor(); } -} // namespace JSC +inline bool isHostFunction(JSValue value, NativeFunction nativeFunction) +{ + JSFunction* function = jsCast<JSFunction*>(getJSFunction(value)); + if (!function || !function->isHostFunction()) + return false; + return function->nativeFunction() == nativeFunction; +} -#endif // JSFunctionInlines_h +inline bool JSFunction::hasReifiedLength() const +{ + return m_rareData ? m_rareData->hasReifiedLength() : false; +} + +inline bool JSFunction::hasReifiedName() const +{ + return m_rareData ? m_rareData->hasReifiedName() : false; +} +} // namespace JSC |