Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: src/debug/debug-scopes.cc

Issue 1834633003: [debugger] allow debug-evaluate to change stack and context values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 case FUNCTION_SCOPE: 207 case FUNCTION_SCOPE:
208 DCHECK(context_->IsFunctionContext() || !scope_info->HasContext()); 208 DCHECK(context_->IsFunctionContext() || !scope_info->HasContext());
209 return ScopeTypeLocal; 209 return ScopeTypeLocal;
210 case MODULE_SCOPE: 210 case MODULE_SCOPE:
211 DCHECK(context_->IsModuleContext()); 211 DCHECK(context_->IsModuleContext());
212 return ScopeTypeModule; 212 return ScopeTypeModule;
213 case SCRIPT_SCOPE: 213 case SCRIPT_SCOPE:
214 DCHECK(context_->IsScriptContext() || context_->IsNativeContext()); 214 DCHECK(context_->IsScriptContext() || context_->IsNativeContext());
215 return ScopeTypeScript; 215 return ScopeTypeScript;
216 case WITH_SCOPE: 216 case WITH_SCOPE:
217 DCHECK(context_->IsWithContext()); 217 DCHECK(context_->IsWithContext() || context_->IsDebugEvaluateContext());
218 return ScopeTypeWith; 218 return ScopeTypeWith;
219 case CATCH_SCOPE: 219 case CATCH_SCOPE:
220 DCHECK(context_->IsCatchContext()); 220 DCHECK(context_->IsCatchContext());
221 return ScopeTypeCatch; 221 return ScopeTypeCatch;
222 case BLOCK_SCOPE: 222 case BLOCK_SCOPE:
223 DCHECK(!scope_info->HasContext() || context_->IsBlockContext()); 223 DCHECK(!scope_info->HasContext() || context_->IsBlockContext());
224 return ScopeTypeBlock; 224 return ScopeTypeBlock;
225 case EVAL_SCOPE: 225 case EVAL_SCOPE:
226 UNREACHABLE(); 226 UNREACHABLE();
227 } 227 }
(...skipping 12 matching lines...) Expand all
240 } 240 }
241 if (context_->IsBlockContext()) { 241 if (context_->IsBlockContext()) {
242 return ScopeTypeBlock; 242 return ScopeTypeBlock;
243 } 243 }
244 if (context_->IsModuleContext()) { 244 if (context_->IsModuleContext()) {
245 return ScopeTypeModule; 245 return ScopeTypeModule;
246 } 246 }
247 if (context_->IsScriptContext()) { 247 if (context_->IsScriptContext()) {
248 return ScopeTypeScript; 248 return ScopeTypeScript;
249 } 249 }
250 DCHECK(context_->IsWithContext()); 250 DCHECK(context_->IsWithContext() || context_->IsDebugEvaluateContext());
251 return ScopeTypeWith; 251 return ScopeTypeWith;
252 } 252 }
253 253
254 254
255 MaybeHandle<JSObject> ScopeIterator::ScopeObject() { 255 MaybeHandle<JSObject> ScopeIterator::ScopeObject() {
256 DCHECK(!failed_); 256 DCHECK(!failed_);
257 switch (Type()) { 257 switch (Type()) {
258 case ScopeIterator::ScopeTypeGlobal: 258 case ScopeIterator::ScopeTypeGlobal:
259 return Handle<JSObject>(CurrentContext()->global_proxy()); 259 return Handle<JSObject>(CurrentContext()->global_proxy());
260 case ScopeIterator::ScopeTypeScript: 260 case ScopeIterator::ScopeTypeScript:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 if (Type() == ScopeTypeGlobal || Type() == ScopeTypeScript || 337 if (Type() == ScopeTypeGlobal || Type() == ScopeTypeScript ||
338 nested_scope_chain_.is_empty()) { 338 nested_scope_chain_.is_empty()) {
339 return context_; 339 return context_;
340 } else if (nested_scope_chain_.last().scope_info->HasContext()) { 340 } else if (nested_scope_chain_.last().scope_info->HasContext()) {
341 return context_; 341 return context_;
342 } else { 342 } else {
343 return Handle<Context>(); 343 return Handle<Context>();
344 } 344 }
345 } 345 }
346 346
347 347 Handle<NameDictionary> ScopeIterator::GetNonLocals() {
348 void ScopeIterator::GetNonLocals(List<Handle<String> >* list_out) {
349 Handle<String> this_string = isolate_->factory()->this_string(); 348 Handle<String> this_string = isolate_->factory()->this_string();
349 Handle<NameDictionary> dict =
350 NameDictionary::New(isolate_, non_locals_->occupancy());
350 for (HashMap::Entry* entry = non_locals_->Start(); entry != nullptr; 351 for (HashMap::Entry* entry = non_locals_->Start(); entry != nullptr;
351 entry = non_locals_->Next(entry)) { 352 entry = non_locals_->Next(entry)) {
352 Handle<String> name(reinterpret_cast<String**>(entry->key)); 353 Handle<String> name(reinterpret_cast<String**>(entry->key));
353 // We need to treat "this" differently. 354 // We need to treat "this" differently.
354 if (name.is_identical_to(this_string)) continue; 355 if (name.is_identical_to(this_string)) continue;
355 list_out->Add(Handle<String>(reinterpret_cast<String**>(entry->key))); 356 dict = NameDictionary::Add(dict, name, name, PropertyDetails::Empty());
356 } 357 }
358 return dict;
357 } 359 }
358 360
359 361
360 bool ScopeIterator::ThisIsNonLocal() { 362 bool ScopeIterator::ThisIsNonLocal() {
361 Handle<String> this_string = isolate_->factory()->this_string(); 363 Handle<String> this_string = isolate_->factory()->this_string();
362 void* key = reinterpret_cast<void*>(this_string.location()); 364 void* key = reinterpret_cast<void*>(this_string.location());
363 HashMap::Entry* entry = non_locals_->Lookup(key, this_string->Hash()); 365 HashMap::Entry* entry = non_locals_->Lookup(key, this_string->Hash());
364 return entry != nullptr; 366 return entry != nullptr;
365 } 367 }
366 368
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 DCHECK(beg_pos >= 0 && end_pos >= 0); 855 DCHECK(beg_pos >= 0 && end_pos >= 0);
854 if (beg_pos <= position && position < end_pos) { 856 if (beg_pos <= position && position < end_pos) {
855 GetNestedScopeChain(isolate, inner_scope, position); 857 GetNestedScopeChain(isolate, inner_scope, position);
856 return; 858 return;
857 } 859 }
858 } 860 }
859 } 861 }
860 862
861 } // namespace internal 863 } // namespace internal
862 } // namespace v8 864 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug-scopes.h ('k') | src/factory.h » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698