| 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-scopes.h" | 5 #include "src/debug/debug-scopes.h" |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 nested_scope_chain_(4), | 21 nested_scope_chain_(4), |
| 22 non_locals_(nullptr), | 22 non_locals_(nullptr), |
| 23 seen_script_scope_(false), | 23 seen_script_scope_(false), |
| 24 failed_(false) { | 24 failed_(false) { |
| 25 if (!frame_inspector->GetContext()->IsContext() || | 25 if (!frame_inspector->GetContext()->IsContext() || |
| 26 !frame_inspector->GetFunction()->IsJSFunction()) { | 26 !frame_inspector->GetFunction()->IsJSFunction()) { |
| 27 // Optimized frame, context or function cannot be materialized. Give up. | 27 // Optimized frame, context or function cannot be materialized. Give up. |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 | 30 |
| 31 context_ = Handle<Context>(Context::cast(frame_inspector->GetContext())); | 31 context_ = Handle<Context>::cast(frame_inspector->GetContext()); |
| 32 | 32 |
| 33 // Catch the case when the debugger stops in an internal function. | 33 // Catch the case when the debugger stops in an internal function. |
| 34 Handle<JSFunction> function = GetFunction(); | 34 Handle<JSFunction> function = GetFunction(); |
| 35 Handle<SharedFunctionInfo> shared_info(function->shared()); | 35 Handle<SharedFunctionInfo> shared_info(function->shared()); |
| 36 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | 36 Handle<ScopeInfo> scope_info(shared_info->scope_info()); |
| 37 if (shared_info->script() == isolate->heap()->undefined_value()) { | 37 if (shared_info->script() == isolate->heap()->undefined_value()) { |
| 38 while (context_->closure() == *function) { | 38 while (context_->closure() == *function) { |
| 39 context_ = Handle<Context>(context_->previous(), isolate_); | 39 context_ = Handle<Context>(context_->previous(), isolate_); |
| 40 } | 40 } |
| 41 return; | 41 return; |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 MaybeHandle<JSObject> ScopeIterator::MaterializeLocalScope() { | 454 MaybeHandle<JSObject> ScopeIterator::MaterializeLocalScope() { |
| 455 Handle<JSFunction> function = GetFunction(); | 455 Handle<JSFunction> function = GetFunction(); |
| 456 | 456 |
| 457 Handle<JSObject> local_scope = | 457 Handle<JSObject> local_scope = |
| 458 isolate_->factory()->NewJSObject(isolate_->object_function()); | 458 isolate_->factory()->NewJSObject(isolate_->object_function()); |
| 459 frame_inspector_->MaterializeStackLocals(local_scope, function); | 459 frame_inspector_->MaterializeStackLocals(local_scope, function); |
| 460 | 460 |
| 461 Handle<Context> frame_context(Context::cast(frame_inspector_->GetContext())); | 461 Handle<Context> frame_context = |
| 462 Handle<Context>::cast(frame_inspector_->GetContext()); |
| 462 | 463 |
| 463 HandleScope scope(isolate_); | 464 HandleScope scope(isolate_); |
| 464 Handle<SharedFunctionInfo> shared(function->shared()); | 465 Handle<SharedFunctionInfo> shared(function->shared()); |
| 465 Handle<ScopeInfo> scope_info(shared->scope_info()); | 466 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 466 | 467 |
| 467 if (!scope_info->HasContext()) return local_scope; | 468 if (!scope_info->HasContext()) return local_scope; |
| 468 | 469 |
| 469 // Third fill all context locals. | 470 // Third fill all context locals. |
| 470 Handle<Context> function_context(frame_context->closure_context()); | 471 Handle<Context> function_context(frame_context->closure_context()); |
| 471 CopyContextLocalsToScopeObject(scope_info, function_context, local_scope); | 472 CopyContextLocalsToScopeObject(scope_info, function_context, local_scope); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 isolate_, value, Object::GetPropertyOrElement(extension, key), false); | 810 isolate_, value, Object::GetPropertyOrElement(extension, key), false); |
| 810 RETURN_ON_EXCEPTION_VALUE( | 811 RETURN_ON_EXCEPTION_VALUE( |
| 811 isolate_, JSObject::SetOwnPropertyIgnoreAttributes( | 812 isolate_, JSObject::SetOwnPropertyIgnoreAttributes( |
| 812 scope_object, key, value, NONE), false); | 813 scope_object, key, value, NONE), false); |
| 813 } | 814 } |
| 814 return true; | 815 return true; |
| 815 } | 816 } |
| 816 | 817 |
| 817 } // namespace internal | 818 } // namespace internal |
| 818 } // namespace v8 | 819 } // namespace v8 |
| OLD | NEW |