OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DEBUG_DEBUG_EVALUATE_H_ | 5 #ifndef V8_DEBUG_DEBUG_EVALUATE_H_ |
6 #define V8_DEBUG_DEBUG_EVALUATE_H_ | 6 #define V8_DEBUG_DEBUG_EVALUATE_H_ |
7 | 7 |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 class DebugEvaluate : public AllStatic { | 14 class DebugEvaluate : public AllStatic { |
15 public: | 15 public: |
16 static MaybeHandle<Object> Global(Isolate* isolate, Handle<String> source); | 16 static MaybeHandle<Object> Global(Isolate* isolate, Handle<String> source); |
17 | 17 |
18 // Evaluate a piece of JavaScript in the context of a stack frame for | 18 // Evaluate a piece of JavaScript in the context of a stack frame for |
19 // debugging. Things that need special attention are: | 19 // debugging. Things that need special attention are: |
20 // - Parameters and stack-allocated locals need to be materialized. Altered | 20 // - Parameters and stack-allocated locals need to be materialized. Altered |
21 // values need to be written back to the stack afterwards. | 21 // values need to be written back to the stack afterwards. |
22 // - The arguments object needs to materialized. | 22 // - The arguments object needs to materialized. |
23 static MaybeHandle<Object> Local(Isolate* isolate, StackFrame::Id frame_id, | 23 static MaybeHandle<Object> Local(Isolate* isolate, StackFrame::Id frame_id, |
24 int inlined_jsframe_index, | 24 int inlined_jsframe_index, |
25 Handle<String> source); | 25 Handle<String> source, |
| 26 bool throw_on_side_effect); |
26 | 27 |
27 static bool FunctionHasNoSideEffect(Handle<SharedFunctionInfo> info); | 28 static bool FunctionHasNoSideEffect(Handle<SharedFunctionInfo> info); |
28 static bool CallbackHasNoSideEffect(Address function_addr); | 29 static bool CallbackHasNoSideEffect(Address function_addr); |
29 | 30 |
30 private: | 31 private: |
31 // This class builds a context chain for evaluation of expressions | 32 // This class builds a context chain for evaluation of expressions |
32 // in debugger. | 33 // in debugger. |
33 // The scope chain leading up to a breakpoint where evaluation occurs | 34 // The scope chain leading up to a breakpoint where evaluation occurs |
34 // looks like: | 35 // looks like: |
35 // - [a mix of with, catch and block scopes] | 36 // - [a mix of with, catch and block scopes] |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 List<ContextChainElement> context_chain_; | 80 List<ContextChainElement> context_chain_; |
80 Isolate* isolate_; | 81 Isolate* isolate_; |
81 JavaScriptFrame* frame_; | 82 JavaScriptFrame* frame_; |
82 int inlined_jsframe_index_; | 83 int inlined_jsframe_index_; |
83 }; | 84 }; |
84 | 85 |
85 static MaybeHandle<Object> Evaluate(Isolate* isolate, | 86 static MaybeHandle<Object> Evaluate(Isolate* isolate, |
86 Handle<SharedFunctionInfo> outer_info, | 87 Handle<SharedFunctionInfo> outer_info, |
87 Handle<Context> context, | 88 Handle<Context> context, |
88 Handle<Object> receiver, | 89 Handle<Object> receiver, |
89 Handle<String> source); | 90 Handle<String> source, |
| 91 bool throw_on_side_effect); |
90 }; | 92 }; |
91 | 93 |
92 | 94 |
93 } // namespace internal | 95 } // namespace internal |
94 } // namespace v8 | 96 } // namespace v8 |
95 | 97 |
96 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ | 98 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ |
OLD | NEW |