| 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); | |
| 27 | 26 |
| 28 static bool FunctionHasNoSideEffect(Handle<SharedFunctionInfo> info); | 27 static bool FunctionHasNoSideEffect(Handle<SharedFunctionInfo> info); |
| 29 static bool CallbackHasNoSideEffect(Address function_addr); | 28 static bool CallbackHasNoSideEffect(Address function_addr); |
| 30 | 29 |
| 31 private: | 30 private: |
| 32 // This class builds a context chain for evaluation of expressions | 31 // This class builds a context chain for evaluation of expressions |
| 33 // in debugger. | 32 // in debugger. |
| 34 // The scope chain leading up to a breakpoint where evaluation occurs | 33 // The scope chain leading up to a breakpoint where evaluation occurs |
| 35 // looks like: | 34 // looks like: |
| 36 // - [a mix of with, catch and block scopes] | 35 // - [a mix of with, catch and block scopes] |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 List<ContextChainElement> context_chain_; | 79 List<ContextChainElement> context_chain_; |
| 81 Isolate* isolate_; | 80 Isolate* isolate_; |
| 82 JavaScriptFrame* frame_; | 81 JavaScriptFrame* frame_; |
| 83 int inlined_jsframe_index_; | 82 int inlined_jsframe_index_; |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 static MaybeHandle<Object> Evaluate(Isolate* isolate, | 85 static MaybeHandle<Object> Evaluate(Isolate* isolate, |
| 87 Handle<SharedFunctionInfo> outer_info, | 86 Handle<SharedFunctionInfo> outer_info, |
| 88 Handle<Context> context, | 87 Handle<Context> context, |
| 89 Handle<Object> receiver, | 88 Handle<Object> receiver, |
| 90 Handle<String> source, | 89 Handle<String> source); |
| 91 bool throw_on_side_effect); | |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 | 92 |
| 95 } // namespace internal | 93 } // namespace internal |
| 96 } // namespace v8 | 94 } // namespace v8 |
| 97 | 95 |
| 98 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ | 96 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ |
| OLD | NEW |