Skip to content

Commit 3af795a

Browse files
author
Gyuyoung Kim
committed
Move JavaScriptCore/dfg to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=139169 Reviewed by Filip Pizlo. Use std::unique_ptr<>|std::make_unique<> in JavaScriptCore/dfg directory. * dfg/DFGBasicBlock.h: * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::JITCompiler): (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::link): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::linkFunction): * dfg/DFGJITCompiler.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::cancel): * dfg/DFGPlan.h: * dfg/DFGSlowPathGenerator.h: * dfg/DFGWorklist.h: * ftl/FTLFail.cpp: (JSC::FTL::fail): * ftl/FTLState.cpp: (JSC::FTL::State::State): Canonical link: https://commits.webkit.org/157104@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176779 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 08306d7 commit 3af795a

10 files changed

Lines changed: 49 additions & 24 deletions

File tree

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
2014-12-03 Gyuyoung Kim <gyuyoung.kim@samsung.com>
2+
3+
Move JavaScriptCore/dfg to std::unique_ptr
4+
https://bugs.webkit.org/show_bug.cgi?id=139169
5+
6+
Reviewed by Filip Pizlo.
7+
8+
Use std::unique_ptr<>|std::make_unique<> in JavaScriptCore/dfg directory.
9+
10+
* dfg/DFGBasicBlock.h:
11+
* dfg/DFGJITCompiler.cpp:
12+
(JSC::DFG::JITCompiler::JITCompiler):
13+
(JSC::DFG::JITCompiler::compile):
14+
(JSC::DFG::JITCompiler::link):
15+
(JSC::DFG::JITCompiler::compileFunction):
16+
(JSC::DFG::JITCompiler::linkFunction):
17+
* dfg/DFGJITCompiler.h:
18+
* dfg/DFGPlan.cpp:
19+
(JSC::DFG::Plan::compileInThreadImpl):
20+
(JSC::DFG::Plan::cancel):
21+
* dfg/DFGPlan.h:
22+
* dfg/DFGSlowPathGenerator.h:
23+
* dfg/DFGWorklist.h:
24+
* ftl/FTLFail.cpp:
25+
(JSC::FTL::fail):
26+
* ftl/FTLState.cpp:
27+
(JSC::FTL::State::State):
28+
129
2014-12-03 Michael Saboff <msaboff@apple.com>
230

331
REGRESSION (r176479): DFG ASSERTION beneath emitOSRExitCall running Kraken/imaging-gaussian-blur.js.ftl-no-cjit-osr-validation and other tests

‎Source/JavaScriptCore/dfg/DFGBasicBlock.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "Operands.h"
4040
#include <wtf/HashMap.h>
4141
#include <wtf/HashSet.h>
42-
#include <wtf/OwnPtr.h>
4342
#include <wtf/Vector.h>
4443

4544
namespace JSC { namespace DFG {

‎Source/JavaScriptCore/dfg/DFGJITCompiler.cpp‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ JITCompiler::JITCompiler(Graph& dfg)
5555
, m_blockHeads(dfg.numBlocks())
5656
{
5757
if (shouldShowDisassembly() || m_graph.m_vm.m_perBytecodeProfiler)
58-
m_disassembler = adoptPtr(new Disassembler(dfg));
58+
m_disassembler = std::make_unique<Disassembler>(dfg);
5959
}
6060

6161
JITCompiler::~JITCompiler()
@@ -291,7 +291,7 @@ void JITCompiler::compile()
291291

292292
setStartOfCode();
293293
compileEntry();
294-
m_speculative = adoptPtr(new SpeculativeJIT(*this));
294+
m_speculative = std::make_unique<SpeculativeJIT>(*this);
295295
addPtr(TrustedImm32(m_graph.stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, stackPointerRegister);
296296
checkStackPointerAlignment();
297297
compileBody();
@@ -312,7 +312,7 @@ void JITCompiler::link()
312312
{
313313
auto linkBuffer = std::make_unique<LinkBuffer>(*m_vm, *this, m_codeBlock, JITCompilationCanFail);
314314
if (linkBuffer->didFailToAllocate()) {
315-
m_graph.m_plan.finalizer = adoptPtr(new FailedFinalizer(m_graph.m_plan));
315+
m_graph.m_plan.finalizer = std::make_unique<FailedFinalizer>(m_graph.m_plan);
316316
return;
317317
}
318318

@@ -324,8 +324,8 @@ void JITCompiler::link()
324324

325325
disassemble(*linkBuffer);
326326

327-
m_graph.m_plan.finalizer = adoptPtr(new JITFinalizer(
328-
m_graph.m_plan, m_jitCode.release(), WTF::move(linkBuffer)));
327+
m_graph.m_plan.finalizer = std::make_unique<JITFinalizer>(
328+
m_graph.m_plan, m_jitCode.release(), WTF::move(linkBuffer));
329329
}
330330

331331
void JITCompiler::compileFunction()
@@ -349,7 +349,7 @@ void JITCompiler::compileFunction()
349349
checkStackPointerAlignment();
350350

351351
// === Function body code generation ===
352-
m_speculative = adoptPtr(new SpeculativeJIT(*this));
352+
m_speculative = std::make_unique<SpeculativeJIT>(*this);
353353
compileBody();
354354
setEndOfMainPath();
355355

@@ -414,7 +414,7 @@ void JITCompiler::linkFunction()
414414
// === Link ===
415415
auto linkBuffer = std::make_unique<LinkBuffer>(*m_vm, *this, m_codeBlock, JITCompilationCanFail);
416416
if (linkBuffer->didFailToAllocate()) {
417-
m_graph.m_plan.finalizer = adoptPtr(new FailedFinalizer(m_graph.m_plan));
417+
m_graph.m_plan.finalizer = std::make_unique<FailedFinalizer>(m_graph.m_plan);
418418
return;
419419
}
420420
link(*linkBuffer);
@@ -429,8 +429,8 @@ void JITCompiler::linkFunction()
429429

430430
MacroAssemblerCodePtr withArityCheck = linkBuffer->locationOf(m_arityCheck);
431431

432-
m_graph.m_plan.finalizer = adoptPtr(new JITFinalizer(
433-
m_graph.m_plan, m_jitCode.release(), WTF::move(linkBuffer), withArityCheck));
432+
m_graph.m_plan.finalizer = std::make_unique<JITFinalizer>(
433+
m_graph.m_plan, m_jitCode.release(), WTF::move(linkBuffer), withArityCheck);
434434
}
435435

436436
void JITCompiler::disassemble(LinkBuffer& linkBuffer)

‎Source/JavaScriptCore/dfg/DFGJITCompiler.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class JITCompiler : public CCallHelpers {
336336
// The dataflow graph currently being generated.
337337
Graph& m_graph;
338338

339-
OwnPtr<Disassembler> m_disassembler;
339+
std::unique_ptr<Disassembler> m_disassembler;
340340

341341
RefPtr<JITCode> m_jitCode;
342342

@@ -372,7 +372,7 @@ class JITCompiler : public CCallHelpers {
372372

373373
Call m_callArityFixup;
374374
Label m_arityCheck;
375-
OwnPtr<SpeculativeJIT> m_speculative;
375+
std::unique_ptr<SpeculativeJIT> m_speculative;
376376
};
377377

378378
} } // namespace JSC::DFG

‎Source/JavaScriptCore/dfg/DFGPlan.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Plan::CompilationPath Plan::compileInThreadImpl(LongLivedState& longLivedState)
207207
Graph dfg(vm, *this, longLivedState);
208208

209209
if (!parse(dfg)) {
210-
finalizer = adoptPtr(new FailedFinalizer(*this));
210+
finalizer = std::make_unique<FailedFinalizer>(*this);
211211
return FailPath;
212212
}
213213

@@ -229,7 +229,7 @@ Plan::CompilationPath Plan::compileInThreadImpl(LongLivedState& longLivedState)
229229
if (mode == FTLForOSREntryMode) {
230230
bool result = performOSREntrypointCreation(dfg);
231231
if (!result) {
232-
finalizer = adoptPtr(new FailedFinalizer(*this));
232+
finalizer = std::make_unique<FailedFinalizer>(*this);
233233
return FailPath;
234234
}
235235
performCPSRethreading(dfg);
@@ -313,7 +313,7 @@ Plan::CompilationPath Plan::compileInThreadImpl(LongLivedState& longLivedState)
313313
case FTLForOSREntryMode: {
314314
#if ENABLE(FTL_JIT)
315315
if (FTL::canCompile(dfg) == FTL::CannotCompile) {
316-
finalizer = adoptPtr(new FailedFinalizer(*this));
316+
finalizer = std::make_unique<FailedFinalizer>(*this);
317317
return FailPath;
318318
}
319319

@@ -375,7 +375,7 @@ Plan::CompilationPath Plan::compileInThreadImpl(LongLivedState& longLivedState)
375375
return CancelPath;
376376

377377
if (!haveLLVM) {
378-
finalizer = adoptPtr(new FailedFinalizer(*this));
378+
finalizer = std::make_unique<FailedFinalizer>(*this);
379379
return FailPath;
380380
}
381381

@@ -524,7 +524,7 @@ void Plan::cancel()
524524
profiledDFGCodeBlock = nullptr;
525525
mustHandleValues.clear();
526526
compilation = nullptr;
527-
finalizer.clear();
527+
finalizer = nullptr;
528528
inlineCallFrames = nullptr;
529529
watchpoints = DesiredWatchpoints();
530530
identifiers = DesiredIdentifiers();

‎Source/JavaScriptCore/dfg/DFGPlan.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct Plan : public ThreadSafeRefCounted<Plan> {
8686

8787
RefPtr<Profiler::Compilation> compilation;
8888

89-
OwnPtr<Finalizer> finalizer;
89+
std::unique_ptr<Finalizer> finalizer;
9090

9191
RefPtr<InlineCallFrameSet> inlineCallFrames;
9292
DesiredWatchpoints watchpoints;

‎Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "DFGSilentRegisterSavePlan.h"
3333
#include "DFGSpeculativeJIT.h"
3434
#include <wtf/FastMalloc.h>
35-
#include <wtf/PassOwnPtr.h>
3635

3736
namespace JSC { namespace DFG {
3837

‎Source/JavaScriptCore/dfg/DFGWorklist.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <wtf/Deque.h>
3434
#include <wtf/HashMap.h>
3535
#include <wtf/Noncopyable.h>
36-
#include <wtf/PassOwnPtr.h>
3736
#include <wtf/ThreadingPrimitives.h>
3837

3938
namespace JSC {

‎Source/JavaScriptCore/ftl/FTLFail.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ using namespace DFG;
3838

3939
void fail(State& state)
4040
{
41-
state.graph.m_plan.finalizer = adoptPtr(new FailedFinalizer(state.graph.m_plan));
41+
state.graph.m_plan.finalizer = std::make_unique<FailedFinalizer>(state.graph.m_plan);
4242

4343
if (state.module)
4444
llvm->DisposeModule(state.module);

‎Source/JavaScriptCore/ftl/FTLState.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ State::State(Graph& graph)
7676
RELEASE_ASSERT_NOT_REACHED();
7777
break;
7878
}
79-
80-
finalizer = new JITFinalizer(graph.m_plan);
81-
graph.m_plan.finalizer = adoptPtr(finalizer);
79+
80+
graph.m_plan.finalizer = std::make_unique<JITFinalizer>(graph.m_plan);
81+
finalizer = static_cast<JITFinalizer*>(graph.m_plan.finalizer.get());
8282
}
8383

8484
State::~State()

0 commit comments

Comments
 (0)