| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 7c484de53ee1e537a8abeefdce1e0cab69e4952e..4a4d2e7458a3c6c586e077b9c2ff5245863151bb 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -11,6 +11,7 @@
|
| #include <cmath> // For isnan.
|
| #include "include/v8-debug.h"
|
| #include "include/v8-profiler.h"
|
| +#include "include/v8-sampler.h"
|
| #include "include/v8-testing.h"
|
| #include "src/assert-scope.h"
|
| #include "src/base/platform/platform.h"
|
| @@ -30,6 +31,7 @@
|
| #include "src/heap-snapshot-generator-inl.h"
|
| #include "src/icu_util.h"
|
| #include "src/json-parser.h"
|
| +#include "src/log.h"
|
| #include "src/messages.h"
|
| #include "src/natives.h"
|
| #include "src/parser.h"
|
| @@ -51,7 +53,7 @@
|
|
|
| #define ENTER_V8(isolate) \
|
| ASSERT((isolate)->IsInitialized()); \
|
| - i::VMState<i::OTHER> __state__((isolate))
|
| + i::VMState<OTHER> __state__((isolate))
|
|
|
| namespace v8 {
|
|
|
| @@ -7176,13 +7178,13 @@ const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) {
|
|
|
| void CpuProfiler::SetIdle(bool is_idle) {
|
| i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate();
|
| - i::StateTag state = isolate->current_vm_state();
|
| - ASSERT(state == i::EXTERNAL || state == i::IDLE);
|
| + StateTag state = isolate->current_vm_state();
|
| + ASSERT(state == EXTERNAL || state == IDLE);
|
| if (isolate->js_entry_sp() != NULL) return;
|
| if (is_idle) {
|
| - isolate->set_current_vm_state(i::IDLE);
|
| - } else if (state == i::IDLE) {
|
| - isolate->set_current_vm_state(i::EXTERNAL);
|
| + isolate->set_current_vm_state(IDLE);
|
| + } else if (state == IDLE) {
|
| + isolate->set_current_vm_state(EXTERNAL);
|
| }
|
| }
|
|
|
| @@ -7425,6 +7427,23 @@ void HeapProfiler::SetRetainedObjectInfo(UniqueId id,
|
| reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info);
|
| }
|
|
|
| +Sample* Sampler::GetSample(Isolate* isolate,
|
| + Sample* sample) {
|
| + i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
| +
|
| + i::Logger* logger = internal_isolate->logger();
|
| + if (logger == NULL) return NULL;
|
| +
|
| + i::Sampler* sampler = logger->sampler();
|
| + if (sampler == NULL) return NULL;
|
| +
|
| + // TODO(gohlap): These checks and getters above are just transitory.
|
| + // Get rid of those as we make the API mature.
|
| + // We have these right now because we want the new API
|
| + // to play well with the current cpu-profiler thread inside v8.
|
| +
|
| + return sampler->GetSample(sample);
|
| +}
|
|
|
| v8::Testing::StressType internal::Testing::stress_type_ =
|
| v8::Testing::kStressTypeOpt;
|
|
|