summaryrefslogtreecommitdiffstats
path: root/gin/public/debug.h
blob: 0c24109f4009250f52885200cc2249448864bf51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef GIN_PUBLIC_DEBUG_H_
#define GIN_PUBLIC_DEBUG_H_

#include "build/build_config.h"
#include "gin/gin_export.h"
#include "v8/include/v8.h"

namespace gin {

class GIN_EXPORT Debug {
 public:
  /* Installs a callback that is invoked on entry to every V8-generated
   * function.
   *
   * This only affects IsolateHolder instances created after
   * SetFunctionEntryHook was invoked.
   */
  static void SetFunctionEntryHook(v8::FunctionEntryHook entry_hook);

  /* Installs a callback that is invoked each time jit code is added, moved,
   * or removed.
   *
   * This only affects IsolateHolder instances created after
   * SetJitCodeEventHandler was invoked.
   */
  static void SetJitCodeEventHandler(v8::JitCodeEventHandler event_handler);

#if defined(OS_WIN)
  typedef void (__cdecl *CodeRangeCreatedCallback)(void*, size_t);

  /* Sets a callback that is invoked for every new code range being created.
   *
   * On Win64, exception handling in jitted code is broken due to the fact
   * that JS stack frames are not ABI compliant. It is possible to install
   * custom handlers for the code range which holds the jitted code to work
   * around this issue.
   *
   * https://code.google.com/p/v8/issues/detail?id=3598
   */
  static void SetCodeRangeCreatedCallback(CodeRangeCreatedCallback callback);

  typedef void (__cdecl *CodeRangeDeletedCallback)(void*);

  /* Sets a callback that is invoked for every previously registered code range
   * when it is deleted.
   */
  static void SetCodeRangeDeletedCallback(CodeRangeDeletedCallback callback);
#endif
};

}  // namespace gin

#endif  // GIN_PUBLIC_DEBUG_H_