Make a NativeFunction into a class to support pointer profiling.
https://bugs.webkit.org/show_bug.cgi?id=183573
<rdar://problem/38384697>

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

1. NativeFunction is now a class, and introducing RawNativeFunction and
   TaggedNativeFunction.

   RawNativeFunction is the raw pointer type (equivalent
   to the old definition of NativeFunction).  This is mainly used for underlying
   storage inside the NativeFunction class, and also for global data tables that
   cannot embed non-trivially constructed objects.

   NativeFunction's role is mainly to encapsulate a pointer to a C function that
   we pass into the VM.

   TaggedNativeFunction encapsulates the tagged version of a pointer to a C
   function that we track in the VM.

2. Added a convenience constructor for TrustedImmPtr so that we don't have to
   cast function pointers to void* anymore when constructing a TrustedImmPtr.

3. Removed the unused CALL_RETURN macro in CommonSlowPaths.cpp.

4. Added more PtrTag utility functions.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssembler::TrustedImmPtr::TrustedImmPtr):
* create_hash_table:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
* interpreter/InterpreterInlines.h:
(JSC::Interpreter::getOpcodeID):
* jit/JITThunks.cpp:
(JSC::JITThunks::hostFunctionStub):
* jit/JITThunks.h:
* llint/LLIntData.cpp:
(JSC::LLInt::initialize):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::setUpCall):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter.cpp:
(JSC::CLoop::execute):
* llint/LowLevelInterpreter64.asm:
* offlineasm/ast.rb:
* runtime/CallData.h:
* runtime/CommonSlowPaths.cpp:
* runtime/ConstructData.h:
* runtime/InternalFunction.h:
(JSC::InternalFunction::nativeFunctionFor):
* runtime/JSCell.cpp:
(JSC::JSCell::getCallData):
(JSC::JSCell::getConstructData):
* runtime/JSFunction.h:
* runtime/JSFunctionInlines.h:
(JSC::JSFunction::nativeFunction):
(JSC::JSFunction::nativeConstructor):
(JSC::isHostFunction):
* runtime/Lookup.h:
(JSC::HashTableValue::function const):
(JSC::HashTableValue::accessorGetter const):
(JSC::HashTableValue::accessorSetter const):
(JSC::nonCachingStaticFunctionGetter):
* runtime/NativeExecutable.cpp:
(JSC::NativeExecutable::create):
(JSC::NativeExecutable::NativeExecutable):
* runtime/NativeExecutable.h:
* runtime/NativeFunction.h: Added.
(JSC::NativeFunction::NativeFunction):
(JSC::NativeFunction::operator intptr_t const):
(JSC::NativeFunction::operator bool const):
(JSC::NativeFunction::operator! const):
(JSC::NativeFunction::operator== const):
(JSC::NativeFunction::operator!= const):
(JSC::NativeFunction::operator()):
(JSC::NativeFunction::rawPointer const):
(JSC::NativeFunctionHash::hash):
(JSC::NativeFunctionHash::equal):
(JSC::TaggedNativeFunction::TaggedNativeFunction):
(JSC::TaggedNativeFunction::operator bool const):
(JSC::TaggedNativeFunction::operator! const):
(JSC::TaggedNativeFunction::operator== const):
(JSC::TaggedNativeFunction::operator!= const):
(JSC::TaggedNativeFunction::operator()):
(JSC::TaggedNativeFunction::operator NativeFunction):
(JSC::TaggedNativeFunction::rawPointer const):
(JSC::TaggedNativeFunctionHash::hash):
(JSC::TaggedNativeFunctionHash::equal):
* runtime/PtrTag.h:
(JSC::tagCFunctionPtr):
(JSC::untagCFunctionPtr):
* runtime/VM.h:
(JSC::VM::targetMachinePCForThrowOffset): Deleted.

Source/WebCore:

No new tests because there's no new behavior.  Only updating bindings.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHashTableValueArray):
* bindings/scripts/test/JS/JSMapLike.cpp:
* bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
* bindings/scripts/test/JS/JSTestCallTracer.cpp:
* bindings/scripts/test/JS/JSTestDOMJIT.cpp:
* bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestIterable.cpp:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestSerialization.cpp:
* bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestStringifier.cpp:
* bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
* bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
* bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
* bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
* bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:

Source/WTF:

Changed Poisoned so that it can be used on tagged pointers as well.

* wtf/Poisoned.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/JSFunctionInlines.h b/Source/JavaScriptCore/runtime/JSFunctionInlines.h
index 2278939..d480a40 100644
--- a/Source/JavaScriptCore/runtime/JSFunctionInlines.h
+++ b/Source/JavaScriptCore/runtime/JSFunctionInlines.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -77,19 +77,19 @@
     return !isHostFunction() && jsExecutable()->isClassConstructorFunction();
 }
 
-inline NativeFunction JSFunction::nativeFunction()
+inline TaggedNativeFunction JSFunction::nativeFunction()
 {
     ASSERT(isHostFunctionNonInline());
     return static_cast<NativeExecutable*>(m_executable.get())->function();
 }
 
-inline NativeFunction JSFunction::nativeConstructor()
+inline TaggedNativeFunction JSFunction::nativeConstructor()
 {
     ASSERT(isHostFunctionNonInline());
     return static_cast<NativeExecutable*>(m_executable.get())->constructor();
 }
 
-inline bool isHostFunction(JSValue value, NativeFunction nativeFunction)
+inline bool isHostFunction(JSValue value, TaggedNativeFunction nativeFunction)
 {
     JSFunction* function = jsCast<JSFunction*>(getJSFunction(value));
     if (!function || !function->isHostFunction())