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 #include "src/debug/debug-evaluate.h" | 5 #include "src/debug/debug-evaluate.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/debug/debug-frames.h" | 10 #include "src/debug/debug-frames.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 | 88 |
89 // Compile and evaluate source for the given context. | 89 // Compile and evaluate source for the given context. |
90 MaybeHandle<Object> DebugEvaluate::Evaluate( | 90 MaybeHandle<Object> DebugEvaluate::Evaluate( |
91 Isolate* isolate, Handle<SharedFunctionInfo> outer_info, | 91 Isolate* isolate, Handle<SharedFunctionInfo> outer_info, |
92 Handle<Context> context, Handle<HeapObject> context_extension, | 92 Handle<Context> context, Handle<HeapObject> context_extension, |
93 Handle<Object> receiver, Handle<String> source) { | 93 Handle<Object> receiver, Handle<String> source) { |
94 if (context_extension->IsJSObject()) { | 94 if (context_extension->IsJSObject()) { |
95 Handle<JSObject> extension = Handle<JSObject>::cast(context_extension); | 95 Handle<JSObject> extension = Handle<JSObject>::cast(context_extension); |
96 Handle<JSFunction> closure(context->closure(), isolate); | 96 Handle<JSFunction> closure(context->closure(), isolate); |
97 context = isolate->factory()->NewWithContext(closure, context, extension); | 97 context = isolate->factory()->NewWithContext( |
| 98 closure, context, ScopeInfo::CreateForWithScope(isolate), extension); |
98 } | 99 } |
99 | 100 |
100 Handle<JSFunction> eval_fun; | 101 Handle<JSFunction> eval_fun; |
101 ASSIGN_RETURN_ON_EXCEPTION( | 102 ASSIGN_RETURN_ON_EXCEPTION( |
102 isolate, eval_fun, | 103 isolate, eval_fun, |
103 Compiler::GetFunctionFromEval(source, outer_info, context, SLOPPY, | 104 Compiler::GetFunctionFromEval(source, outer_info, context, SLOPPY, |
104 NO_PARSE_RESTRICTION, kNoSourcePosition, | 105 NO_PARSE_RESTRICTION, kNoSourcePosition, |
105 kNoSourcePosition), | 106 kNoSourcePosition), |
106 Object); | 107 Object); |
107 | 108 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 context_chain_element.wrapped_context = it.CurrentContext(); | 198 context_chain_element.wrapped_context = it.CurrentContext(); |
198 } | 199 } |
199 context_chain_.Add(context_chain_element); | 200 context_chain_.Add(context_chain_element); |
200 } else { | 201 } else { |
201 break; | 202 break; |
202 } | 203 } |
203 } | 204 } |
204 | 205 |
205 for (int i = context_chain_.length() - 1; i >= 0; i--) { | 206 for (int i = context_chain_.length() - 1; i >= 0; i--) { |
206 evaluation_context_ = factory->NewDebugEvaluateContext( | 207 evaluation_context_ = factory->NewDebugEvaluateContext( |
207 evaluation_context_, context_chain_[i].materialized_object, | 208 evaluation_context_, ScopeInfo::CreateForWithScope(isolate), |
| 209 context_chain_[i].materialized_object, |
208 context_chain_[i].wrapped_context, context_chain_[i].whitelist); | 210 context_chain_[i].wrapped_context, context_chain_[i].whitelist); |
209 } | 211 } |
210 } | 212 } |
211 | 213 |
212 | 214 |
213 void DebugEvaluate::ContextBuilder::UpdateValues() { | 215 void DebugEvaluate::ContextBuilder::UpdateValues() { |
214 // TODO(yangguo): remove updating values. | 216 // TODO(yangguo): remove updating values. |
215 for (int i = 0; i < context_chain_.length(); i++) { | 217 for (int i = 0; i < context_chain_.length(); i++) { |
216 ContextChainElement element = context_chain_[i]; | 218 ContextChainElement element = context_chain_[i]; |
217 if (!element.materialized_object.is_null()) { | 219 if (!element.materialized_object.is_null()) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 return; | 255 return; |
254 } else if (local_function->shared()->scope_info()->HasReceiver() && | 256 } else if (local_function->shared()->scope_info()->HasReceiver() && |
255 !frame_->receiver()->IsTheHole(isolate_)) { | 257 !frame_->receiver()->IsTheHole(isolate_)) { |
256 recv = handle(frame_->receiver(), isolate_); | 258 recv = handle(frame_->receiver(), isolate_); |
257 } | 259 } |
258 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); | 260 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); |
259 } | 261 } |
260 | 262 |
261 } // namespace internal | 263 } // namespace internal |
262 } // namespace v8 | 264 } // namespace v8 |
OLD | NEW |