Skip to content

Commit fea5bfb

Browse files
author
Mark Lam
committed
JITMathIC should not use integer offsets into machine code.
https://bugs.webkit.org/show_bug.cgi?id=190030 <rdar://problem/44803307> Reviewed by Saam Barati. We'll replace them with CodeLocation smart pointers instead. * jit/JITMathIC.h: (JSC::isProfileEmpty): Canonical link: https://commits.webkit.org/204994@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 0868284 commit fea5bfb

2 files changed

Lines changed: 25 additions & 15 deletions

File tree

Source/JavaScriptCore/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2018-09-27 Mark Lam <[email protected]>
2+
3+
JITMathIC should not use integer offsets into machine code.
4+
https://bugs.webkit.org/show_bug.cgi?id=190030
5+
<rdar://problem/44803307>
6+
7+
Reviewed by Saam Barati.
8+
9+
We'll replace them with CodeLocation smart pointers instead.
10+
11+
* jit/JITMathIC.h:
12+
(JSC::isProfileEmpty):
13+
114
2018-09-26 Mark Lam <[email protected]>
215

316
Options::useSeparatedWXHeap() should always be false when ENABLE(FAST_JIT_PERMISSIONS) && CPU(ARM64E).

Source/JavaScriptCore/jit/JITMathIC.h

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ class JITMathIC {
6262
{
6363
}
6464

65-
CodeLocationLabel<JSInternalPtrTag> doneLocation() { return m_inlineStart.labelAtOffset(m_inlineSize); }
66-
CodeLocationLabel<JSInternalPtrTag> slowPathStartLocation() { return m_inlineStart.labelAtOffset(m_deltaFromStartToSlowPathStart); }
67-
CodeLocationCall<JSInternalPtrTag> slowPathCallLocation() { return m_inlineStart.callAtOffset(m_deltaFromStartToSlowPathCallLocation); }
68-
65+
CodeLocationLabel<JSInternalPtrTag> doneLocation() { return m_inlineEnd; }
66+
CodeLocationCall<JSInternalPtrTag> slowPathCallLocation() { return m_slowPathCallLocation; }
67+
CodeLocationLabel<JSInternalPtrTag> slowPathStartLocation() { return m_slowPathStartLocation; }
68+
6969
bool generateInline(CCallHelpers& jit, MathICGenerationState& state, bool shouldEmitProfiling = true)
7070
{
7171
#if CPU(ARM_TRADITIONAL)
@@ -136,7 +136,7 @@ class JITMathIC {
136136
auto jump = jit.jump();
137137
// We don't need a nop sled here because nobody should be jumping into the middle of an IC.
138138
bool needsBranchCompaction = false;
139-
RELEASE_ASSERT(jit.m_assembler.buffer().codeSize() <= static_cast<size_t>(m_inlineSize));
139+
RELEASE_ASSERT(jit.m_assembler.buffer().codeSize() <= static_cast<size_t>(MacroAssembler::differenceBetweenCodePtr(m_inlineStart, m_inlineEnd)));
140140
LinkBuffer linkBuffer(jit, m_inlineStart, jit.m_assembler.buffer().codeSize(), JITCompilationMustSucceed, needsBranchCompaction);
141141
RELEASE_ASSERT(linkBuffer.isValid());
142142
linkBuffer.link(jump, CodeLocationLabel<JITStubRoutinePtrTag>(m_code.code()));
@@ -224,14 +224,11 @@ class JITMathIC {
224224
CodeLocationLabel<JSInternalPtrTag> start = linkBuffer.locationOf<JSInternalPtrTag>(state.fastPathStart);
225225
m_inlineStart = start;
226226

227-
m_inlineSize = MacroAssembler::differenceBetweenCodePtr(
228-
start, linkBuffer.locationOf<NoPtrTag>(state.fastPathEnd));
229-
ASSERT(m_inlineSize > 0);
227+
m_inlineEnd = linkBuffer.locationOf<JSInternalPtrTag>(state.fastPathEnd);
228+
ASSERT(m_inlineEnd.untaggedExecutableAddress() > m_inlineStart.untaggedExecutableAddress());
230229

231-
m_deltaFromStartToSlowPathCallLocation = MacroAssembler::differenceBetweenCodePtr(
232-
start, linkBuffer.locationOf<NoPtrTag>(state.slowPathCall));
233-
m_deltaFromStartToSlowPathStart = MacroAssembler::differenceBetweenCodePtr(
234-
start, linkBuffer.locationOf<NoPtrTag>(state.slowPathStart));
230+
m_slowPathCallLocation = linkBuffer.locationOf<JSInternalPtrTag>(state.slowPathCall);
231+
m_slowPathStartLocation = linkBuffer.locationOf<JSInternalPtrTag>(state.slowPathStart);
235232
}
236233

237234
ArithProfile* arithProfile() const { return m_arithProfile; }
@@ -252,9 +249,9 @@ class JITMathIC {
252249
Instruction* m_instruction;
253250
MacroAssemblerCodeRef<JITStubRoutinePtrTag> m_code;
254251
CodeLocationLabel<JSInternalPtrTag> m_inlineStart;
255-
int32_t m_inlineSize;
256-
int32_t m_deltaFromStartToSlowPathCallLocation;
257-
int32_t m_deltaFromStartToSlowPathStart;
252+
CodeLocationLabel<JSInternalPtrTag> m_inlineEnd;
253+
CodeLocationLabel<JSInternalPtrTag> m_slowPathCallLocation;
254+
CodeLocationLabel<JSInternalPtrTag> m_slowPathStartLocation;
258255
bool m_generateFastPathOnRepatch { false };
259256
GeneratorType m_generator;
260257
};

0 commit comments

Comments
 (0)