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/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 16 matching lines...) Expand all Loading... |
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>::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()->IsUndefined(isolate)) { |
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; |
42 } | 42 } |
43 | 43 |
44 // Currently it takes too much time to find nested scopes due to script | 44 // Currently it takes too much time to find nested scopes due to script |
45 // parsing. Sometimes we want to run the ScopeIterator as fast as possible | 45 // parsing. Sometimes we want to run the ScopeIterator as fast as possible |
46 // (for example, while collecting async call stacks on every | 46 // (for example, while collecting async call stacks on every |
47 // addEventListener call), even if we drop some nested scopes. | 47 // addEventListener call), even if we drop some nested scopes. |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 Isolate* isolate = scope_info->GetIsolate(); | 749 Isolate* isolate = scope_info->GetIsolate(); |
750 int local_count = scope_info->ContextLocalCount(); | 750 int local_count = scope_info->ContextLocalCount(); |
751 if (local_count == 0) return; | 751 if (local_count == 0) return; |
752 // Fill all context locals to the context extension. | 752 // Fill all context locals to the context extension. |
753 for (int i = 0; i < local_count; ++i) { | 753 for (int i = 0; i < local_count; ++i) { |
754 Handle<String> name(scope_info->ContextLocalName(i)); | 754 Handle<String> name(scope_info->ContextLocalName(i)); |
755 if (ScopeInfo::VariableIsSynthetic(*name)) continue; | 755 if (ScopeInfo::VariableIsSynthetic(*name)) continue; |
756 int context_index = Context::MIN_CONTEXT_SLOTS + i; | 756 int context_index = Context::MIN_CONTEXT_SLOTS + i; |
757 Handle<Object> value = Handle<Object>(context->get(context_index), isolate); | 757 Handle<Object> value = Handle<Object>(context->get(context_index), isolate); |
758 // Reflect variables under TDZ as undefined in scope object. | 758 // Reflect variables under TDZ as undefined in scope object. |
759 if (value->IsTheHole()) continue; | 759 if (value->IsTheHole(isolate)) continue; |
760 // This should always succeed. | 760 // This should always succeed. |
761 // TODO(verwaest): Use AddDataProperty instead. | 761 // TODO(verwaest): Use AddDataProperty instead. |
762 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, name, value, NONE) | 762 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, name, value, NONE) |
763 .Check(); | 763 .Check(); |
764 } | 764 } |
765 } | 765 } |
766 | 766 |
767 void ScopeIterator::CopyContextExtensionToScopeObject( | 767 void ScopeIterator::CopyContextExtensionToScopeObject( |
768 Handle<Context> context, Handle<JSObject> scope_object, | 768 Handle<Context> context, Handle<JSObject> scope_object, |
769 KeyCollectionMode mode) { | 769 KeyCollectionMode mode) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 802 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
803 if (beg_pos <= position && position < end_pos) { | 803 if (beg_pos <= position && position < end_pos) { |
804 GetNestedScopeChain(isolate, inner_scope, position); | 804 GetNestedScopeChain(isolate, inner_scope, position); |
805 return; | 805 return; |
806 } | 806 } |
807 } | 807 } |
808 } | 808 } |
809 | 809 |
810 } // namespace internal | 810 } // namespace internal |
811 } // namespace v8 | 811 } // namespace v8 |
OLD | NEW |