Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit a925f8a

Browse files
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
1 parent eee7154 commit a925f8a

File tree

70 files changed

+643
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+643
-350
lines changed

Source/JavaScriptCore/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
829829
runtime/Microtask.h
830830
runtime/ModuleProgramExecutable.h
831831
runtime/NativeExecutable.h
832+
runtime/NativeFunction.h
832833
runtime/NumberObject.h
833834
runtime/NumberPrototype.h
834835
runtime/NumericStrings.h

Source/JavaScriptCore/ChangeLog

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,103 @@
1+
2018-03-12 Mark Lam <[email protected]>
2+
3+
Make a NativeFunction into a class to support pointer profiling.
4+
https://bugs.webkit.org/show_bug.cgi?id=183573
5+
<rdar://problem/38384697>
6+
7+
Reviewed by Filip Pizlo.
8+
9+
1. NativeFunction is now a class, and introducing RawNativeFunction and
10+
TaggedNativeFunction.
11+
12+
RawNativeFunction is the raw pointer type (equivalent
13+
to the old definition of NativeFunction). This is mainly used for underlying
14+
storage inside the NativeFunction class, and also for global data tables that
15+
cannot embed non-trivially constructed objects.
16+
17+
NativeFunction's role is mainly to encapsulate a pointer to a C function that
18+
we pass into the VM.
19+
20+
TaggedNativeFunction encapsulates the tagged version of a pointer to a C
21+
function that we track in the VM.
22+
23+
2. Added a convenience constructor for TrustedImmPtr so that we don't have to
24+
cast function pointers to void* anymore when constructing a TrustedImmPtr.
25+
26+
3. Removed the unused CALL_RETURN macro in CommonSlowPaths.cpp.
27+
28+
4. Added more PtrTag utility functions.
29+
30+
* CMakeLists.txt:
31+
* JavaScriptCore.xcodeproj/project.pbxproj:
32+
* assembler/AbstractMacroAssembler.h:
33+
(JSC::AbstractMacroAssembler::TrustedImmPtr::TrustedImmPtr):
34+
* create_hash_table:
35+
* interpreter/Interpreter.cpp:
36+
(JSC::Interpreter::executeCall):
37+
(JSC::Interpreter::executeConstruct):
38+
* interpreter/InterpreterInlines.h:
39+
(JSC::Interpreter::getOpcodeID):
40+
* jit/JITThunks.cpp:
41+
(JSC::JITThunks::hostFunctionStub):
42+
* jit/JITThunks.h:
43+
* llint/LLIntData.cpp:
44+
(JSC::LLInt::initialize):
45+
* llint/LLIntSlowPaths.cpp:
46+
(JSC::LLInt::setUpCall):
47+
* llint/LowLevelInterpreter.asm:
48+
* llint/LowLevelInterpreter.cpp:
49+
(JSC::CLoop::execute):
50+
* llint/LowLevelInterpreter64.asm:
51+
* offlineasm/ast.rb:
52+
* runtime/CallData.h:
53+
* runtime/CommonSlowPaths.cpp:
54+
* runtime/ConstructData.h:
55+
* runtime/InternalFunction.h:
56+
(JSC::InternalFunction::nativeFunctionFor):
57+
* runtime/JSCell.cpp:
58+
(JSC::JSCell::getCallData):
59+
(JSC::JSCell::getConstructData):
60+
* runtime/JSFunction.h:
61+
* runtime/JSFunctionInlines.h:
62+
(JSC::JSFunction::nativeFunction):
63+
(JSC::JSFunction::nativeConstructor):
64+
(JSC::isHostFunction):
65+
* runtime/Lookup.h:
66+
(JSC::HashTableValue::function const):
67+
(JSC::HashTableValue::accessorGetter const):
68+
(JSC::HashTableValue::accessorSetter const):
69+
(JSC::nonCachingStaticFunctionGetter):
70+
* runtime/NativeExecutable.cpp:
71+
(JSC::NativeExecutable::create):
72+
(JSC::NativeExecutable::NativeExecutable):
73+
* runtime/NativeExecutable.h:
74+
* runtime/NativeFunction.h: Added.
75+
(JSC::NativeFunction::NativeFunction):
76+
(JSC::NativeFunction::operator intptr_t const):
77+
(JSC::NativeFunction::operator bool const):
78+
(JSC::NativeFunction::operator! const):
79+
(JSC::NativeFunction::operator== const):
80+
(JSC::NativeFunction::operator!= const):
81+
(JSC::NativeFunction::operator()):
82+
(JSC::NativeFunction::rawPointer const):
83+
(JSC::NativeFunctionHash::hash):
84+
(JSC::NativeFunctionHash::equal):
85+
(JSC::TaggedNativeFunction::TaggedNativeFunction):
86+
(JSC::TaggedNativeFunction::operator bool const):
87+
(JSC::TaggedNativeFunction::operator! const):
88+
(JSC::TaggedNativeFunction::operator== const):
89+
(JSC::TaggedNativeFunction::operator!= const):
90+
(JSC::TaggedNativeFunction::operator()):
91+
(JSC::TaggedNativeFunction::operator NativeFunction):
92+
(JSC::TaggedNativeFunction::rawPointer const):
93+
(JSC::TaggedNativeFunctionHash::hash):
94+
(JSC::TaggedNativeFunctionHash::equal):
95+
* runtime/PtrTag.h:
96+
(JSC::tagCFunctionPtr):
97+
(JSC::untagCFunctionPtr):
98+
* runtime/VM.h:
99+
(JSC::VM::targetMachinePCForThrowOffset): Deleted.
100+
1101
2018-03-12 Filip Pizlo <[email protected]>
2102

3103
Unreviewed, fix simple goof that was causing 32-bit DFG crashes.

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,7 @@
17321732
FE10AAEB1F44D528009DEDC5 /* ProbeStack.h in Headers */ = {isa = PBXBuildFile; fileRef = FE10AAEA1F44D512009DEDC5 /* ProbeStack.h */; settings = {ATTRIBUTES = (Private, ); }; };
17331733
FE10AAEE1F44D954009DEDC5 /* ProbeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE10AAED1F44D946009DEDC5 /* ProbeContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
17341734
FE1220271BE7F58C0039E6F2 /* JITAddGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1220261BE7F5640039E6F2 /* JITAddGenerator.h */; };
1735+
FE1409072056F3FF00CFE318 /* NativeFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1409062056F3FE00CFE318 /* NativeFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
17351736
FE187A021BFBE5610038BBCA /* JITMulGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A001BFBC73C0038BBCA /* JITMulGenerator.h */; };
17361737
FE187A0D1C030D5C0038BBCA /* JITDivGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0B1C0229230038BBCA /* JITDivGenerator.h */; };
17371738
FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */; };
@@ -4637,6 +4638,7 @@
46374638
FE10AAF31F46826D009DEDC5 /* ProbeContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProbeContext.cpp; sourceTree = "<group>"; };
46384639
FE1220251BE7F5640039E6F2 /* JITAddGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITAddGenerator.cpp; sourceTree = "<group>"; };
46394640
FE1220261BE7F5640039E6F2 /* JITAddGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITAddGenerator.h; sourceTree = "<group>"; };
4641+
FE1409062056F3FE00CFE318 /* NativeFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeFunction.h; sourceTree = "<group>"; };
46404642
FE1879FF1BFBC73C0038BBCA /* JITMulGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITMulGenerator.cpp; sourceTree = "<group>"; };
46414643
FE187A001BFBC73C0038BBCA /* JITMulGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITMulGenerator.h; sourceTree = "<group>"; };
46424644
FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITDivGenerator.cpp; sourceTree = "<group>"; };
@@ -6827,6 +6829,7 @@
68276829
BC02E90B0E1839DB000F9297 /* NativeErrorPrototype.h */,
68286830
147341DE1DC2CE9600AA29BA /* NativeExecutable.cpp */,
68296831
147341CF1DC02DB400AA29BA /* NativeExecutable.h */,
6832+
FE1409062056F3FE00CFE318 /* NativeFunction.h */,
68306833
E33E8D1E1B9013DE00346B52 /* NativeStdFunctionCell.cpp */,
68316834
E33E8D1F1B9013DE00346B52 /* NativeStdFunctionCell.h */,
68326835
6546F51F1A32A59C006F07D5 /* NullGetterFunction.cpp */,
@@ -9143,6 +9146,7 @@
91439146
79CFC6F01C33B10000C768EA /* LLIntPCRanges.h in Headers */,
91449147
53FA2AE11CF37F3F0022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.h in Headers */,
91459148
0F4680A514BA7F8D00BFE272 /* LLIntSlowPaths.h in Headers */,
9149+
FE1409072056F3FF00CFE318 /* NativeFunction.h in Headers */,
91469150
0F0B839D14BCF46600885B4F /* LLIntThunks.h in Headers */,
91479151
0F75A061200D26180038E2CF /* LocalAllocator.h in Headers */,
91489152
0F75A060200D260B0038E2CF /* LocalAllocatorInlines.h in Headers */,

Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2008-2017 Apple Inc. All rights reserved.
2+
* Copyright (C) 2008-2018 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -260,6 +260,12 @@ class AbstractMacroAssembler : public AbstractMacroAssemblerBase {
260260
{
261261
}
262262

263+
template<typename ReturnType, typename... Arguments>
264+
explicit TrustedImmPtr(ReturnType(*value)(Arguments...))
265+
: m_value(reinterpret_cast<void*>(value))
266+
{
267+
}
268+
263269
explicit TrustedImmPtr(std::nullptr_t)
264270
{
265271
}

Source/JavaScriptCore/create_hash_table

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# (c) 2000-2002 by Harri Porten <[email protected]> and
66
# David Faure <[email protected]>
77
# Modified (c) 2004 by Nikolas Zimmermann <[email protected]>
8-
# Copyright (C) 2007, 2008, 2009, 2015-2016 Apple Inc. All rights reserved.
8+
# Copyright (C) 2007-2018 Apple Inc. All rights reserved.
99
#
1010
# This library is free software; you can redistribute it and/or
1111
# modify it under the terms of the GNU Lesser General Public
@@ -306,13 +306,13 @@ sub output() {
306306
my $intrinsic = "NoIntrinsic";
307307

308308
if ($values[$i]{"type"} eq "PropertyAttribute::Function") {
309-
$firstCastStr = "static_cast<NativeFunction>";
309+
$firstCastStr = "static_cast<RawNativeFunction>";
310310
$firstValue = $values[$i]{"function"};
311311
$secondValue = $values[$i]{"params"};
312312
$intrinsic = $values[$i]{"intrinsic"};
313313
} elsif ($values[$i]{"type"} eq "PropertyAttribute::Accessor") {
314-
$firstCastStr = "static_cast<NativeFunction>";
315-
$secondCastStr = "static_cast<NativeFunction>";
314+
$firstCastStr = "static_cast<RawNativeFunction>";
315+
$secondCastStr = "static_cast<RawNativeFunction>";
316316
$firstValue = $values[$i]{"get"};
317317
$secondValue = $values[$i]{"put"};
318318
} elsif ($values[$i]{"type"} eq "PropertyAttribute::Property") {

Source/JavaScriptCore/interpreter/Interpreter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2008-2017 Apple Inc. All rights reserved.
2+
* Copyright (C) 2008-2018 Apple Inc. All rights reserved.
33
* Copyright (C) 2008 Cameron Zwarich <[email protected]>
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -1027,7 +1027,7 @@ JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallT
10271027
throwScope.release();
10281028
result = callData.js.functionExecutable->generatedJITCodeForCall()->execute(&vm, &protoCallFrame);
10291029
} else {
1030-
result = JSValue::decode(vmEntryToNative(reinterpret_cast<void*>(callData.native.function), &vm, &protoCallFrame));
1030+
result = JSValue::decode(vmEntryToNative(callData.native.function.rawPointer(), &vm, &protoCallFrame));
10311031
RETURN_IF_EXCEPTION(throwScope, JSValue());
10321032
}
10331033
}
@@ -1093,7 +1093,7 @@ JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* construc
10931093
if (isJSConstruct)
10941094
result = constructData.js.functionExecutable->generatedJITCodeForConstruct()->execute(&vm, &protoCallFrame);
10951095
else {
1096-
result = JSValue::decode(vmEntryToNative(reinterpret_cast<void*>(constructData.native.function), &vm, &protoCallFrame));
1096+
result = JSValue::decode(vmEntryToNative(constructData.native.function.rawPointer(), &vm, &protoCallFrame));
10971097

10981098
if (LIKELY(!throwScope.exception()))
10991099
RELEASE_ASSERT(result.isObject());

Source/JavaScriptCore/interpreter/InterpreterInlines.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (C) 2016 Yusuke Suzuki <[email protected]>
3-
* Copyright (C) 2016-2017 Apple Inc. All rights reserved.
3+
* Copyright (C) 2016-2018 Apple Inc. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
2929
#include "Instruction.h"
3030
#include "Interpreter.h"
3131
#include "LLIntData.h"
32+
#include "PtrTag.h"
3233
#include "UnlinkedCodeBlock.h"
3334

3435
namespace JSC {
@@ -46,7 +47,7 @@ inline OpcodeID Interpreter::getOpcodeID(Opcode opcode)
4647
// The OpcodeID is embedded in the int32_t word preceding the location of
4748
// the LLInt code for the opcode (see the EMBED_OPCODE_ID_IF_NEEDED macro
4849
// in LowLevelInterpreter.cpp).
49-
MacroAssemblerCodePtr codePtr(reinterpret_cast<void*>(opcode));
50+
MacroAssemblerCodePtr codePtr(removeCodePtrTag<void*>(opcode));
5051
int32_t* opcodeIDAddress = codePtr.dataLocation<int32_t*>() - 1;
5152
OpcodeID opcodeID = static_cast<OpcodeID>(*opcodeIDAddress);
5253
ASSERT(opcodeID < NUMBER_OF_BYTECODE_IDS);

Source/JavaScriptCore/jit/JITThunks.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ void JITThunks::finalize(Handle<Unknown> handle, void*)
108108
weakRemove(*m_hostFunctionStubMap, std::make_tuple(nativeExecutable->function(), nativeExecutable->constructor(), nativeExecutable->name()), nativeExecutable);
109109
}
110110

111-
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, NativeFunction constructor, const String& name)
111+
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, TaggedNativeFunction function, TaggedNativeFunction constructor, const String& name)
112112
{
113113
return hostFunctionStub(vm, function, constructor, nullptr, NoIntrinsic, nullptr, name);
114114
}
115115

116-
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, NativeFunction constructor, ThunkGenerator generator, Intrinsic intrinsic, const DOMJIT::Signature* signature, const String& name)
116+
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, TaggedNativeFunction function, TaggedNativeFunction constructor, ThunkGenerator generator, Intrinsic intrinsic, const DOMJIT::Signature* signature, const String& name)
117117
{
118118
ASSERT(!isCompilationThread());
119119
ASSERT(VM::canUseJIT());
@@ -135,7 +135,7 @@ NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, N
135135
return nativeExecutable;
136136
}
137137

138-
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, ThunkGenerator generator, Intrinsic intrinsic, const String& name)
138+
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, TaggedNativeFunction function, ThunkGenerator generator, Intrinsic intrinsic, const String& name)
139139
{
140140
return hostFunctionStub(vm, function, callHostFunctionAsConstructor, generator, intrinsic, nullptr, name);
141141
}

Source/JavaScriptCore/jit/JITThunks.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2012, 2013, 2016 Apple Inc. All rights reserved.
2+
* Copyright (C) 2012-2018 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -53,17 +53,17 @@ class JITThunks final : private WeakHandleOwner {
5353

5454
MacroAssemblerCodePtr ctiNativeCall(VM*);
5555
MacroAssemblerCodePtr ctiNativeConstruct(VM*);
56-
MacroAssemblerCodePtr ctiNativeTailCall(VM*);
57-
MacroAssemblerCodePtr ctiNativeTailCallWithoutSavedTags(VM*);
56+
MacroAssemblerCodePtr ctiNativeTailCall(VM*);
57+
MacroAssemblerCodePtr ctiNativeTailCallWithoutSavedTags(VM*);
5858
MacroAssemblerCodePtr ctiInternalFunctionCall(VM*);
5959
MacroAssemblerCodePtr ctiInternalFunctionConstruct(VM*);
6060

6161
MacroAssemblerCodeRef ctiStub(VM*, ThunkGenerator);
6262
MacroAssemblerCodeRef existingCTIStub(ThunkGenerator);
6363

64-
NativeExecutable* hostFunctionStub(VM*, NativeFunction, NativeFunction constructor, const String& name);
65-
NativeExecutable* hostFunctionStub(VM*, NativeFunction, NativeFunction constructor, ThunkGenerator, Intrinsic, const DOMJIT::Signature*, const String& name);
66-
NativeExecutable* hostFunctionStub(VM*, NativeFunction, ThunkGenerator, Intrinsic, const String& name);
64+
NativeExecutable* hostFunctionStub(VM*, TaggedNativeFunction, TaggedNativeFunction constructor, const String& name);
65+
NativeExecutable* hostFunctionStub(VM*, TaggedNativeFunction, TaggedNativeFunction constructor, ThunkGenerator, Intrinsic, const DOMJIT::Signature*, const String& name);
66+
NativeExecutable* hostFunctionStub(VM*, TaggedNativeFunction, ThunkGenerator, Intrinsic, const String& name);
6767

6868
void clearHostFunctionStubs();
6969

@@ -73,7 +73,7 @@ class JITThunks final : private WeakHandleOwner {
7373
typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
7474
CTIStubMap m_ctiStubMap;
7575

76-
typedef std::tuple<NativeFunction, NativeFunction, String> HostFunctionKey;
76+
typedef std::tuple<TaggedNativeFunction, TaggedNativeFunction, String> HostFunctionKey;
7777

7878
struct HostFunctionHash {
7979
static unsigned hash(const HostFunctionKey& key)
@@ -90,18 +90,18 @@ class JITThunks final : private WeakHandleOwner {
9090
static const bool safeToCompareToEmptyOrDeleted = true;
9191

9292
private:
93-
static inline unsigned hashPointer(NativeFunction p)
93+
static inline unsigned hashPointer(TaggedNativeFunction p)
9494
{
95-
return DefaultHash<NativeFunction>::Hash::hash(p);
95+
return DefaultHash<TaggedNativeFunction>::Hash::hash(p);
9696
}
9797
};
9898

9999
struct HostFunctionHashTrait : WTF::GenericHashTraits<HostFunctionKey> {
100100
static const bool emptyValueIsZero = true;
101101
static EmptyValueType emptyValue() { return std::make_tuple(nullptr, nullptr, String()); }
102102

103-
static void constructDeletedValue(HostFunctionKey& slot) { std::get<0>(slot) = reinterpret_cast<NativeFunction>(-1); }
104-
static bool isDeletedValue(const HostFunctionKey& value) { return std::get<0>(value) == reinterpret_cast<NativeFunction>(-1); }
103+
static void constructDeletedValue(HostFunctionKey& slot) { std::get<0>(slot) = TaggedNativeFunction(-1); }
104+
static bool isDeletedValue(const HostFunctionKey& value) { return std::get<0>(value) == TaggedNativeFunction(-1); }
105105
};
106106

107107
typedef HashMap<HostFunctionKey, Weak<NativeExecutable>, HostFunctionHash, HostFunctionHashTrait> HostFunctionStubMap;

Source/JavaScriptCore/llint/LLIntData.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ void initialize()
7777
CodeEntryWithArityCheckPtrTag, // llint_function_for_construct_arity_check
7878
CodeEntryPtrTag, // llint_generic_return_point
7979
BytecodePtrTag, // llint_throw_from_slow_path_trampoline
80-
CodeEntryPtrTag, // llint_throw_during_call_trampoline
80+
ExceptionHandlerPtrTag, // llint_throw_during_call_trampoline
8181
NativeCodePtrTag, // llint_native_call_trampoline
8282
NativeCodePtrTag, // llint_native_construct_trampoline
83-
InternalFunctionPtrTag, // llint_internal_function_call_trampoline
84-
InternalFunctionPtrTag, // llint_internal_function_construct_trampoline
83+
NativeCodePtrTag, // llint_internal_function_call_trampoline
84+
NativeCodePtrTag, // llint_internal_function_construct_trampoline
8585
ExceptionHandlerPtrTag, // handleUncaughtException
8686
};
8787

0 commit comments

Comments
 (0)