diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
commit | 881da28418d380042aa95a97f0cbd42560a64f7c (patch) | |
tree | a794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/profiler/ProfilerCompilation.cpp | |
parent | 7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff) | |
parent | 0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff) | |
download | qtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz |
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/JavaScriptCore/profiler/ProfilerCompilation.cpp')
-rw-r--r-- | Source/JavaScriptCore/profiler/ProfilerCompilation.cpp | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp b/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp index f82414ffa..488f563de 100644 --- a/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp +++ b/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,8 +28,9 @@ #include "JSGlobalObject.h" #include "ObjectConstructor.h" -#include "Operations.h" +#include "JSCInlines.h" #include "ProfilerDatabase.h" +#include "Watchpoint.h" #include <wtf/StringPrintStream.h> namespace JSC { namespace Profiler { @@ -37,6 +38,7 @@ namespace JSC { namespace Profiler { Compilation::Compilation(Bytecodes* bytecodes, CompilationKind kind) : m_bytecodes(bytecodes) , m_kind(kind) + , m_jettisonReason(NotJettisoned) , m_numInlinedGetByIds(0) , m_numInlinedPutByIds(0) , m_numInlinedCalls(0) @@ -67,16 +69,18 @@ void Compilation::addDescription(const CompiledBytecode& compiledBytecode) m_descriptions.append(compiledBytecode); } +void Compilation::addDescription(const OriginStack& stack, const CString& description) +{ + addDescription(CompiledBytecode(stack, description)); +} + ExecutionCounter* Compilation::executionCounterFor(const OriginStack& origin) { - HashMap<OriginStack, OwnPtr<ExecutionCounter> >::iterator iter = m_counters.find(origin); - if (iter != m_counters.end()) - return iter->value.get(); - - OwnPtr<ExecutionCounter> counter = adoptPtr(new ExecutionCounter()); - ExecutionCounter* result = counter.get(); - m_counters.add(origin, counter.release()); - return result; + std::unique_ptr<ExecutionCounter>& counter = m_counters.add(origin, nullptr).iterator->value; + if (!counter) + counter = std::make_unique<ExecutionCounter>(); + + return counter.get(); } void Compilation::addOSRExitSite(const Vector<const void*>& codeAddresses) @@ -90,6 +94,18 @@ OSRExit* Compilation::addOSRExit(unsigned id, const OriginStack& originStack, Ex return &m_osrExits.last(); } +void Compilation::setJettisonReason(JettisonReason jettisonReason, const FireDetail* detail) +{ + if (m_jettisonReason != NotJettisoned) + return; // We only care about the original jettison reason. + + m_jettisonReason = jettisonReason; + if (detail) + m_additionalJettisonReason = toCString(*detail); + else + m_additionalJettisonReason = CString(); +} + JSValue Compilation::toJS(ExecState* exec) const { JSObject* result = constructEmptyObject(exec); @@ -108,11 +124,10 @@ JSValue Compilation::toJS(ExecState* exec) const result->putDirect(exec->vm(), exec->propertyNames().descriptions, descriptions); JSArray* counters = constructEmptyArray(exec, 0); - HashMap<OriginStack, OwnPtr<ExecutionCounter> >::const_iterator end = m_counters.end(); - for (HashMap<OriginStack, OwnPtr<ExecutionCounter> >::const_iterator iter = m_counters.begin(); iter != end; ++iter) { + for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) { JSObject* counterEntry = constructEmptyObject(exec); - counterEntry->putDirect(exec->vm(), exec->propertyNames().origin, iter->key.toJS(exec)); - counterEntry->putDirect(exec->vm(), exec->propertyNames().executionCount, jsNumber(iter->value->count())); + counterEntry->putDirect(exec->vm(), exec->propertyNames().origin, it->key.toJS(exec)); + counterEntry->putDirect(exec->vm(), exec->propertyNames().executionCount, jsNumber(it->value->count())); counters->push(exec, counterEntry); } result->putDirect(exec->vm(), exec->propertyNames().counters, counters); @@ -130,6 +145,9 @@ JSValue Compilation::toJS(ExecState* exec) const result->putDirect(exec->vm(), exec->propertyNames().numInlinedGetByIds, jsNumber(m_numInlinedGetByIds)); result->putDirect(exec->vm(), exec->propertyNames().numInlinedPutByIds, jsNumber(m_numInlinedPutByIds)); result->putDirect(exec->vm(), exec->propertyNames().numInlinedCalls, jsNumber(m_numInlinedCalls)); + result->putDirect(exec->vm(), exec->propertyNames().jettisonReason, jsString(exec, String::fromUTF8(toCString(m_jettisonReason)))); + if (!m_additionalJettisonReason.isNull()) + result->putDirect(exec->vm(), exec->propertyNames().additionalJettisonReason, jsString(exec, String::fromUTF8(m_additionalJettisonReason))); return result; } |