| 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 | 26 |
| 27 static bool HasNoSideEffect(Handle<BytecodeArray> bytecode_array); |
| 28 |
| 27 private: | 29 private: |
| 28 // This class builds a context chain for evaluation of expressions | 30 // This class builds a context chain for evaluation of expressions |
| 29 // in debugger. | 31 // in debugger. |
| 30 // The scope chain leading up to a breakpoint where evaluation occurs | 32 // The scope chain leading up to a breakpoint where evaluation occurs |
| 31 // looks like: | 33 // looks like: |
| 32 // - [a mix of with, catch and block scopes] | 34 // - [a mix of with, catch and block scopes] |
| 33 // - [function stack + context] | 35 // - [function stack + context] |
| 34 // - [outer context] | 36 // - [outer context] |
| 35 // The builder materializes all stack variables into properties of objects; | 37 // The builder materializes all stack variables into properties of objects; |
| 36 // the expression is then evaluated as if it is inside a series of 'with' | 38 // the expression is then evaluated as if it is inside a series of 'with' |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 Handle<Context> context, | 86 Handle<Context> context, |
| 85 Handle<Object> receiver, | 87 Handle<Object> receiver, |
| 86 Handle<String> source); | 88 Handle<String> source); |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 | 91 |
| 90 } // namespace internal | 92 } // namespace internal |
| 91 } // namespace v8 | 93 } // namespace v8 |
| 92 | 94 |
| 93 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ | 95 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ |
| OLD | NEW |