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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( | 97 context = isolate->factory()->NewWithContext( |
98 closure, context, ScopeInfo::CreateForWithScope(isolate), extension); | 98 closure, context, |
| 99 ScopeInfo::CreateForWithScope( |
| 100 isolate, context->IsNativeContext() |
| 101 ? Handle<ScopeInfo>::null() |
| 102 : Handle<ScopeInfo>(context->scope_info())), |
| 103 extension); |
99 } | 104 } |
100 | 105 |
101 Handle<JSFunction> eval_fun; | 106 Handle<JSFunction> eval_fun; |
102 ASSIGN_RETURN_ON_EXCEPTION( | 107 ASSIGN_RETURN_ON_EXCEPTION( |
103 isolate, eval_fun, | 108 isolate, eval_fun, |
104 Compiler::GetFunctionFromEval(source, outer_info, context, SLOPPY, | 109 Compiler::GetFunctionFromEval(source, outer_info, context, SLOPPY, |
105 NO_PARSE_RESTRICTION, kNoSourcePosition, | 110 NO_PARSE_RESTRICTION, kNoSourcePosition, |
106 kNoSourcePosition), | 111 kNoSourcePosition), |
107 Object); | 112 Object); |
108 | 113 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 context_chain_element.wrapped_context = it.CurrentContext(); | 203 context_chain_element.wrapped_context = it.CurrentContext(); |
199 } | 204 } |
200 context_chain_.Add(context_chain_element); | 205 context_chain_.Add(context_chain_element); |
201 } else { | 206 } else { |
202 break; | 207 break; |
203 } | 208 } |
204 } | 209 } |
205 | 210 |
206 for (int i = context_chain_.length() - 1; i >= 0; i--) { | 211 for (int i = context_chain_.length() - 1; i >= 0; i--) { |
207 evaluation_context_ = factory->NewDebugEvaluateContext( | 212 evaluation_context_ = factory->NewDebugEvaluateContext( |
208 evaluation_context_, ScopeInfo::CreateForWithScope(isolate), | 213 evaluation_context_, |
| 214 ScopeInfo::CreateForWithScope( |
| 215 isolate, |
| 216 evaluation_context_->IsNativeContext() |
| 217 ? Handle<ScopeInfo>::null() |
| 218 : Handle<ScopeInfo>(evaluation_context_->scope_info())), |
209 context_chain_[i].materialized_object, | 219 context_chain_[i].materialized_object, |
210 context_chain_[i].wrapped_context, context_chain_[i].whitelist); | 220 context_chain_[i].wrapped_context, context_chain_[i].whitelist); |
211 } | 221 } |
212 } | 222 } |
213 | 223 |
214 | 224 |
215 void DebugEvaluate::ContextBuilder::UpdateValues() { | 225 void DebugEvaluate::ContextBuilder::UpdateValues() { |
216 // TODO(yangguo): remove updating values. | 226 // TODO(yangguo): remove updating values. |
217 for (int i = 0; i < context_chain_.length(); i++) { | 227 for (int i = 0; i < context_chain_.length(); i++) { |
218 ContextChainElement element = context_chain_[i]; | 228 ContextChainElement element = context_chain_[i]; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 return; | 265 return; |
256 } else if (local_function->shared()->scope_info()->HasReceiver() && | 266 } else if (local_function->shared()->scope_info()->HasReceiver() && |
257 !frame_->receiver()->IsTheHole(isolate_)) { | 267 !frame_->receiver()->IsTheHole(isolate_)) { |
258 recv = handle(frame_->receiver(), isolate_); | 268 recv = handle(frame_->receiver(), isolate_); |
259 } | 269 } |
260 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); | 270 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); |
261 } | 271 } |
262 | 272 |
263 } // namespace internal | 273 } // namespace internal |
264 } // namespace v8 | 274 } // namespace v8 |
OLD | NEW |