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/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/debug/debug-frames.h" | 10 #include "src/debug/debug-frames.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 for (const Handle<String>& name : non_locals_) { | 339 for (const Handle<String>& name : non_locals_) { |
340 HandleScope scope(isolate_); | 340 HandleScope scope(isolate_); |
341 Handle<Object> value; | 341 Handle<Object> value; |
342 bool global; | 342 bool global; |
343 if (!LoadFromContext(context, name, &global).ToHandle(&value) || global) { | 343 if (!LoadFromContext(context, name, &global).ToHandle(&value) || global) { |
344 // If resolving the variable fails, skip it. If it resolves to a global | 344 // If resolving the variable fails, skip it. If it resolves to a global |
345 // variable, skip it as well since it's not read-only and can be resolved | 345 // variable, skip it as well since it's not read-only and can be resolved |
346 // within debug-evaluate. | 346 // within debug-evaluate. |
347 continue; | 347 continue; |
348 } | 348 } |
| 349 if (value->IsTheHole()) continue; // Value is not initialized yet (in TDZ). |
349 JSObject::SetOwnPropertyIgnoreAttributes(target, name, value, NONE).Check(); | 350 JSObject::SetOwnPropertyIgnoreAttributes(target, name, value, NONE).Check(); |
350 } | 351 } |
351 } | 352 } |
352 | 353 |
353 | 354 |
354 void DebugEvaluate::ContextBuilder::StoreToContext(Handle<Context> context, | 355 void DebugEvaluate::ContextBuilder::StoreToContext(Handle<Context> context, |
355 Handle<String> name, | 356 Handle<String> name, |
356 Handle<Object> value) { | 357 Handle<Object> value) { |
357 static const ContextLookupFlags flags = FOLLOW_CONTEXT_CHAIN; | 358 static const ContextLookupFlags flags = FOLLOW_CONTEXT_CHAIN; |
358 int index; | 359 int index; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 LoadFromContext(lookup_context, this_string, &global).ToHandle(&receiver); | 398 LoadFromContext(lookup_context, this_string, &global).ToHandle(&receiver); |
398 } else if (local_function->shared()->scope_info()->HasReceiver()) { | 399 } else if (local_function->shared()->scope_info()->HasReceiver()) { |
399 receiver = handle(frame_->receiver(), isolate_); | 400 receiver = handle(frame_->receiver(), isolate_); |
400 } | 401 } |
401 return isolate_->factory()->NewCatchContext(global_function, parent_context, | 402 return isolate_->factory()->NewCatchContext(global_function, parent_context, |
402 this_string, receiver); | 403 this_string, receiver); |
403 } | 404 } |
404 | 405 |
405 } // namespace internal | 406 } // namespace internal |
406 } // namespace v8 | 407 } // namespace v8 |
OLD | NEW |