Upstream version 6.34.113.0
[platform/framework/web/crosswalk.git] / src / v8 / src / third_party / xdk / xdk-v8.cc
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "../../../include/v8.h"
6 #include "xdk-v8.h"
7 #include "xdk-agent.h"
8
9 namespace xdk {
10
11 void XDKInitializeForV8(v8::internal::Isolate* isolate) {
12   if (!internal::XDKAgent::instance().setUp(isolate)) return;
13
14   XDKLog("xdk: XDKInitializeForV8\n");
15
16   // The --prof flag is requred for now to enable the CPU ticks collection.
17   // This flag will be removed once xdk agent implements own sampler.
18   const char* flags = "--prof";
19   v8::V8::SetFlagsFromString(flags, static_cast<int>(strlen(flags)));
20
21   v8::V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault,
22                                  xdk::internal::EventHandler);
23
24   internal::XDKAgent::instance().Start();
25 }
26
27
28 bool XDKIsAgentAlive() {
29   return internal::XDKAgent::instance().isAlive();
30 }
31
32 }  // namespace xdk