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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // - Between the function scope and the native context, we only resolve | 151 // - Between the function scope and the native context, we only resolve |
152 // variable names that the current function already uses. Only for these | 152 // variable names that the current function already uses. Only for these |
153 // names we can be sure that they will be correctly resolved. For the | 153 // names we can be sure that they will be correctly resolved. For the |
154 // rest, we only resolve to with, script, and native contexts. We use a | 154 // rest, we only resolve to with, script, and native contexts. We use a |
155 // whitelist to implement that. | 155 // whitelist to implement that. |
156 // Context::Lookup has special handling for debug-evaluate contexts: | 156 // Context::Lookup has special handling for debug-evaluate contexts: |
157 // - Look up in the materialized stack variables. | 157 // - Look up in the materialized stack variables. |
158 // - Look up in the original context. | 158 // - Look up in the original context. |
159 // - Check the whitelist to find out whether to skip contexts during lookup. | 159 // - Check the whitelist to find out whether to skip contexts during lookup. |
160 const ScopeIterator::Option option = ScopeIterator::COLLECT_NON_LOCALS; | 160 const ScopeIterator::Option option = ScopeIterator::COLLECT_NON_LOCALS; |
161 for (ScopeIterator it(isolate, &frame_inspector, option); | 161 for (ScopeIterator it(isolate, &frame_inspector, option); !it.Done(); |
162 !it.Failed() && !it.Done(); it.Next()) { | 162 it.Next()) { |
163 ScopeIterator::ScopeType scope_type = it.Type(); | 163 ScopeIterator::ScopeType scope_type = it.Type(); |
164 if (scope_type == ScopeIterator::ScopeTypeLocal) { | 164 if (scope_type == ScopeIterator::ScopeTypeLocal) { |
165 DCHECK_EQ(FUNCTION_SCOPE, it.CurrentScopeInfo()->scope_type()); | 165 DCHECK_EQ(FUNCTION_SCOPE, it.CurrentScopeInfo()->scope_type()); |
166 Handle<JSObject> materialized = factory->NewJSObjectWithNullProto(); | 166 Handle<JSObject> materialized = factory->NewJSObjectWithNullProto(); |
167 Handle<Context> local_context = | 167 Handle<Context> local_context = |
168 it.HasContext() ? it.CurrentContext() : outer_context; | 168 it.HasContext() ? it.CurrentContext() : outer_context; |
169 Handle<StringSet> non_locals = it.GetNonLocals(); | 169 Handle<StringSet> non_locals = it.GetNonLocals(); |
170 MaterializeReceiver(materialized, local_context, local_function, | 170 MaterializeReceiver(materialized, local_context, local_function, |
171 non_locals); | 171 non_locals); |
172 frame_inspector.MaterializeStackLocals(materialized, local_function); | 172 frame_inspector.MaterializeStackLocals(materialized, local_function); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return; | 264 return; |
265 } else if (local_function->shared()->scope_info()->HasReceiver() && | 265 } else if (local_function->shared()->scope_info()->HasReceiver() && |
266 !frame_->receiver()->IsTheHole(isolate_)) { | 266 !frame_->receiver()->IsTheHole(isolate_)) { |
267 recv = handle(frame_->receiver(), isolate_); | 267 recv = handle(frame_->receiver(), isolate_); |
268 } | 268 } |
269 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); | 269 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); |
270 } | 270 } |
271 | 271 |
272 } // namespace internal | 272 } // namespace internal |
273 } // namespace v8 | 273 } // namespace v8 |
OLD | NEW |