summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSFunctionInlines.h
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
commit881da28418d380042aa95a97f0cbd42560a64f7c (patch)
treea794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/runtime/JSFunctionInlines.h
parent7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff)
parent0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff)
downloadqtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSFunctionInlines.h')
-rw-r--r--Source/JavaScriptCore/runtime/JSFunctionInlines.h61
1 files changed, 54 insertions, 7 deletions
diff --git a/Source/JavaScriptCore/runtime/JSFunctionInlines.h b/Source/JavaScriptCore/runtime/JSFunctionInlines.h
index 4f89acd7b..ef43d3266 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 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,14 +31,29 @@
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()->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(InitializedBlind) // See comment in JSFunction.cpp concerning the reason for using InitializedBlind as opposed to InitializedWatching.
+ , m_rareData()
{
}
+#if ENABLE(WEBASSEMBLY)
+inline JSFunction::JSFunction(VM& vm, WebAssemblyExecutable* executable, JSScope* scope)
+ : Base(vm, scope, scope->globalObject()->functionStructure())
+ , m_executable(vm, this, executable)
+ , m_rareData()
+{
+}
+#endif
+
inline FunctionExecutable* JSFunction::jsExecutable() const
{
ASSERT(!isHostFunctionNonInline());
@@ -51,18 +66,50 @@ inline bool JSFunction::isHostFunction() const
return m_executable->isHostFunction();
}
+inline Intrinsic JSFunction::intrinsic() const
+{
+ return executable()->intrinsic();
+}
+
+inline bool JSFunction::isBuiltinFunction() const
+{
+#if ENABLE(WEBASSEMBLY)
+ if (m_executable->isWebAssemblyExecutable())
+ return false;
+#endif
+ 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();
}
+inline bool isHostFunction(JSValue value, NativeFunction nativeFunction)
+{
+ JSFunction* function = jsCast<JSFunction*>(getJSFunction(value));
+ if (!function || !function->isHostFunction())
+ return false;
+ return function->nativeFunction() == nativeFunction;
+}
+
} // namespace JSC
#endif // JSFunctionInlines_h