V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
debug-evaluate.h
1
// Copyright 2015 the V8 project authors. 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
#ifndef V8_DEBUG_DEBUG_EVALUATE_H_
6
#define V8_DEBUG_DEBUG_EVALUATE_H_
7
8
#include <vector>
9
10
#include "src/debug/debug-frames.h"
11
#include "src/debug/debug-scopes.h"
12
#include "src/objects.h"
13
#include "src/objects/shared-function-info.h"
14
#include "src/objects/string-table.h"
15
16
namespace
v8
{
17
namespace
internal {
18
19
class
FrameInspector;
20
21
class
DebugEvaluate
:
public
AllStatic
{
22
public
:
23
static
MaybeHandle<Object>
Global
(
Isolate
* isolate,
Handle<String>
source,
24
bool
throw_on_side_effect);
25
26
// Evaluate a piece of JavaScript in the context of a stack frame for
27
// debugging. Things that need special attention are:
28
// - Parameters and stack-allocated locals need to be materialized. Altered
29
// values need to be written back to the stack afterwards.
30
// - The arguments object needs to materialized.
31
static
MaybeHandle<Object>
Local
(
Isolate
* isolate, StackFrame::Id frame_id,
32
int
inlined_jsframe_index,
33
Handle<String>
source,
34
bool
throw_on_side_effect);
35
36
// This is used for break-at-entry for builtins and API functions.
37
// Evaluate a piece of JavaScript in the native context, but with the
38
// materialized arguments object and receiver of the current call.
39
static
MaybeHandle<Object>
WithTopmostArguments(
Isolate
* isolate,
40
Handle<String>
source);
41
42
static
DebugInfo::SideEffectState FunctionGetSideEffectState(
43
Isolate
* isolate,
Handle<SharedFunctionInfo>
info);
44
static
void
ApplySideEffectChecks(
Handle<BytecodeArray>
bytecode_array);
45
46
private
:
47
// This class builds a context chain for evaluation of expressions
48
// in debugger.
49
// The scope chain leading up to a breakpoint where evaluation occurs
50
// looks like:
51
// - [a mix of with, catch and block scopes]
52
// - [function stack + context]
53
// - [outer context]
54
// The builder materializes all stack variables into properties of objects;
55
// the expression is then evaluated as if it is inside a series of 'with'
56
// statements using those objects. To this end, the builder builds a new
57
// context chain, based on a scope chain:
58
// - every With and Catch scope begets a cloned context
59
// - Block scope begets one or two contexts:
60
// - if a block has context-allocated varaibles, its context is cloned
61
// - stack locals are materizalized as a With context
62
// - Local scope begets a With context for materizalized locals, chained to
63
// original function context. Original function context is the end of
64
// the chain.
65
class
ContextBuilder {
66
public
:
67
ContextBuilder(
Isolate
* isolate,
JavaScriptFrame
* frame,
68
int
inlined_jsframe_index);
69
70
void
UpdateValues();
71
72
Handle<Context>
evaluation_context()
const
{
return
evaluation_context_; }
73
Handle<SharedFunctionInfo>
outer_info()
const
;
74
75
private
:
76
struct
ContextChainElement {
77
Handle<Context>
wrapped_context;
78
Handle<JSObject>
materialized_object;
79
Handle<StringSet>
whitelist;
80
};
81
82
Handle<Context>
evaluation_context_;
83
std::vector<ContextChainElement> context_chain_;
84
Isolate
* isolate_;
85
FrameInspector
frame_inspector_;
86
ScopeIterator
scope_iterator_;
87
};
88
89
static
MaybeHandle<Object>
Evaluate(
Isolate
* isolate,
90
Handle<SharedFunctionInfo>
outer_info,
91
Handle<Context>
context,
92
Handle<Object>
receiver,
93
Handle<String>
source,
94
bool
throw_on_side_effect);
95
};
96
97
98
}
// namespace internal
99
}
// namespace v8
100
101
#endif // V8_DEBUG_DEBUG_EVALUATE_H_
v8::Global
Definition:
v8.h:94
v8::Local
Definition:
v8.h:85
v8::internal::DebugEvaluate
Definition:
debug-evaluate.h:21
v8::internal::ScopeIterator
Definition:
debug-scopes.h:22
v8
Definition:
libplatform.h:13
v8::internal::Handle< String >
v8::internal::MaybeHandle
Definition:
globals.h:561
v8::internal::AllStatic
Definition:
globals.h:92
v8::internal::Isolate
Definition:
isolate.h:516
v8::internal::FrameInspector
Definition:
debug-frames.h:17
v8::internal::JavaScriptFrame
Definition:
frames.h:674
v8
src
debug
debug-evaluate.h
Generated on Tue Dec 25 2018 14:38:46 by
1.8.14