Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/profiler/cpu-profiler.h b/src/profiler/cpu-profiler.h
index ed1e15f..d354aeb 100644
--- a/src/profiler/cpu-profiler.h
+++ b/src/profiler/cpu-profiler.h
@@ -5,14 +5,18 @@
#ifndef V8_PROFILER_CPU_PROFILER_H_
#define V8_PROFILER_CPU_PROFILER_H_
+#include <memory>
+
#include "src/allocation.h"
#include "src/base/atomic-utils.h"
#include "src/base/atomicops.h"
#include "src/base/platform/time.h"
#include "src/compiler.h"
+#include "src/isolate.h"
+#include "src/libsampler/v8-sampler.h"
#include "src/locked-queue.h"
#include "src/profiler/circular-queue.h"
-#include "src/profiler/sampler.h"
+#include "src/profiler/profiler-listener.h"
#include "src/profiler/tick-sample.h"
namespace v8 {
@@ -82,6 +86,8 @@
const char* deopt_reason;
SourcePosition position;
int deopt_id;
+ void* pc;
+ int fp_to_sp_delta;
INLINE(void UpdateCodeMap(CodeMap* code_map));
};
@@ -128,7 +134,7 @@
class ProfilerEventsProcessor : public base::Thread {
public:
ProfilerEventsProcessor(ProfileGenerator* generator,
- Sampler* sampler,
+ sampler::Sampler* sampler,
base::TimeDelta period);
virtual ~ProfilerEventsProcessor();
@@ -166,7 +172,7 @@
SampleProcessingResult ProcessOneSample();
ProfileGenerator* generator_;
- Sampler* sampler_;
+ sampler::Sampler* sampler_;
base::Atomic32 running_;
const base::TimeDelta period_; // Samples & code events processing period.
LockedQueue<CodeEventsContainer> events_buffer_;
@@ -180,24 +186,11 @@
unsigned last_processed_code_event_id_;
};
-
-#define PROFILE(IsolateGetter, Call) \
- do { \
- Isolate* cpu_profiler_isolate = (IsolateGetter); \
- v8::internal::Logger* logger = cpu_profiler_isolate->logger(); \
- CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \
- if (logger->is_logging_code_events() || cpu_profiler->is_profiling()) { \
- logger->Call; \
- } \
- } while (false)
-
-
-class CpuProfiler : public CodeEventListener {
+class CpuProfiler : public CodeEventObserver {
public:
explicit CpuProfiler(Isolate* isolate);
- CpuProfiler(Isolate* isolate,
- CpuProfilesCollection* test_collection,
+ CpuProfiler(Isolate* isolate, CpuProfilesCollection* profiles,
ProfileGenerator* test_generator,
ProfilerEventsProcessor* test_processor);
@@ -214,41 +207,16 @@
void DeleteAllProfiles();
void DeleteProfile(CpuProfile* profile);
+ void CodeEventHandler(const CodeEventsContainer& evt_rec) override;
+
// Invoked from stack sampler (thread or signal handler.)
inline TickSample* StartTickSample();
inline void FinishTickSample();
- // Must be called via PROFILE macro, otherwise will crash when
- // profiling is not enabled.
- void CallbackEvent(Name* name, Address entry_point) override;
- void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
- const char* comment) override;
- void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
- Name* name) override;
- void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
- SharedFunctionInfo* shared, Name* script_name) override;
- void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
- SharedFunctionInfo* shared, Name* script_name, int line,
- int column) override;
- void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code,
- int args_count) override;
- void CodeMovingGCEvent() override {}
- void CodeMoveEvent(AbstractCode* from, Address to) override;
- void CodeDisableOptEvent(AbstractCode* code,
- SharedFunctionInfo* shared) override;
- void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta);
- void GetterCallbackEvent(Name* name, Address entry_point) override;
- void RegExpCodeCreateEvent(AbstractCode* code, String* source) override;
- void SetterCallbackEvent(Name* name, Address entry_point) override;
- void SharedFunctionInfoMoveEvent(Address from, Address to) override {}
+ bool is_profiling() const { return is_profiling_; }
- INLINE(bool is_profiling() const) { return is_profiling_; }
- bool* is_profiling_address() {
- return &is_profiling_;
- }
-
- ProfileGenerator* generator() const { return generator_; }
- ProfilerEventsProcessor* processor() const { return processor_; }
+ ProfileGenerator* generator() const { return generator_.get(); }
+ ProfilerEventsProcessor* processor() const { return processor_.get(); }
Isolate* isolate() const { return isolate_; }
private:
@@ -257,15 +225,12 @@
void StopProcessor();
void ResetProfiles();
void LogBuiltins();
- void RecordInliningInfo(CodeEntry* entry, AbstractCode* abstract_code);
- void RecordDeoptInlinedFrames(CodeEntry* entry, AbstractCode* abstract_code);
- Name* InferScriptName(Name* name, SharedFunctionInfo* info);
- Isolate* isolate_;
+ Isolate* const isolate_;
base::TimeDelta sampling_interval_;
- CpuProfilesCollection* profiles_;
- ProfileGenerator* generator_;
- ProfilerEventsProcessor* processor_;
+ std::unique_ptr<CpuProfilesCollection> profiles_;
+ std::unique_ptr<ProfileGenerator> generator_;
+ std::unique_ptr<ProfilerEventsProcessor> processor_;
bool saved_is_logging_;
bool is_profiling_;