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 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // - Local scope begets a With context for materizalized locals, chained to | 46 // - Local scope begets a With context for materizalized locals, chained to |
47 // original function context. Original function context is the end of | 47 // original function context. Original function context is the end of |
48 // the chain. | 48 // the chain. |
49 class ContextBuilder { | 49 class ContextBuilder { |
50 public: | 50 public: |
51 ContextBuilder(Isolate* isolate, JavaScriptFrame* frame, | 51 ContextBuilder(Isolate* isolate, JavaScriptFrame* frame, |
52 int inlined_jsframe_index); | 52 int inlined_jsframe_index); |
53 | 53 |
54 void UpdateValues(); | 54 void UpdateValues(); |
55 | 55 |
56 Handle<Context> innermost_context() const { return innermost_context_; } | 56 Handle<Context> evaluation_context() const { return evaluation_context_; } |
57 Handle<Context> native_context() const { return native_context_; } | |
58 Handle<SharedFunctionInfo> outer_info() const { return outer_info_; } | 57 Handle<SharedFunctionInfo> outer_info() const { return outer_info_; } |
59 | 58 |
60 private: | 59 private: |
61 struct ContextChainElement { | 60 struct ContextChainElement { |
62 Handle<Context> original_context; | 61 Handle<ScopeInfo> scope_info; |
63 Handle<Context> cloned_context; | 62 Handle<Context> wrapped_context; |
64 Handle<JSObject> materialized_object; | 63 Handle<JSObject> materialized_object; |
65 Handle<ScopeInfo> scope_info; | 64 Handle<NameDictionary> whitelist; |
66 }; | 65 }; |
67 | 66 |
68 void RecordContextsInChain(Handle<Context>* inner_context, | |
69 Handle<Context> first, Handle<Context> last); | |
70 | |
71 Handle<JSObject> NewJSObjectWithNullProto(); | 67 Handle<JSObject> NewJSObjectWithNullProto(); |
72 | 68 |
73 // Helper function to find or create the arguments object for | 69 // Helper function to find or create the arguments object for |
74 // Runtime_DebugEvaluate. | 70 // Runtime_DebugEvaluate. |
75 void MaterializeArgumentsObject(Handle<JSObject> target, | 71 void MaterializeArgumentsObject(Handle<JSObject> target, |
76 Handle<JSFunction> function); | 72 Handle<JSFunction> function); |
77 | 73 |
78 void MaterializeContextChain(Handle<JSObject> target, | 74 void MaterializeReceiver(Handle<JSObject> target, |
79 Handle<Context> context); | 75 Handle<Context> local_context, |
80 | 76 Handle<JSFunction> local_function, |
81 void UpdateContextChainFromMaterializedObject(Handle<JSObject> source, | 77 bool this_is_non_local); |
82 Handle<Context> context); | |
83 | |
84 Handle<Context> MaterializeReceiver(Handle<Context> parent_context, | |
85 Handle<Context> lookup_context, | |
86 Handle<JSFunction> local_function, | |
87 Handle<JSFunction> global_function, | |
88 bool this_is_non_local); | |
89 | |
90 MaybeHandle<Object> LoadFromContext(Handle<Context> context, | |
91 Handle<String> name, bool* global); | |
92 | |
93 void StoreToContext(Handle<Context> context, Handle<String> name, | |
94 Handle<Object> value); | |
95 | 78 |
96 Handle<SharedFunctionInfo> outer_info_; | 79 Handle<SharedFunctionInfo> outer_info_; |
97 Handle<Context> innermost_context_; | 80 Handle<Context> evaluation_context_; |
98 Handle<Context> native_context_; | |
99 List<ContextChainElement> context_chain_; | 81 List<ContextChainElement> context_chain_; |
100 List<Handle<String> > non_locals_; | |
101 Isolate* isolate_; | 82 Isolate* isolate_; |
102 JavaScriptFrame* frame_; | 83 JavaScriptFrame* frame_; |
103 int inlined_jsframe_index_; | 84 int inlined_jsframe_index_; |
104 }; | 85 }; |
105 | 86 |
106 static MaybeHandle<Object> Evaluate(Isolate* isolate, | 87 static MaybeHandle<Object> Evaluate(Isolate* isolate, |
107 Handle<SharedFunctionInfo> outer_info, | 88 Handle<SharedFunctionInfo> outer_info, |
108 Handle<Context> context, | 89 Handle<Context> context, |
109 Handle<HeapObject> context_extension, | 90 Handle<HeapObject> context_extension, |
110 Handle<Object> receiver, | 91 Handle<Object> receiver, |
111 Handle<String> source); | 92 Handle<String> source); |
112 }; | 93 }; |
113 | 94 |
114 | 95 |
115 } // namespace internal | 96 } // namespace internal |
116 } // namespace v8 | 97 } // namespace v8 |
117 | 98 |
118 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ | 99 #endif // V8_DEBUG_DEBUG_EVALUATE_H_ |
OLD | NEW |