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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 case ScopeIterator::ScopeTypeCatch: | 355 case ScopeIterator::ScopeTypeCatch: |
356 return SetCatchVariableValue(variable_name, new_value); | 356 return SetCatchVariableValue(variable_name, new_value); |
357 case ScopeIterator::ScopeTypeClosure: | 357 case ScopeIterator::ScopeTypeClosure: |
358 return SetClosureVariableValue(variable_name, new_value); | 358 return SetClosureVariableValue(variable_name, new_value); |
359 case ScopeIterator::ScopeTypeScript: | 359 case ScopeIterator::ScopeTypeScript: |
360 return SetScriptVariableValue(variable_name, new_value); | 360 return SetScriptVariableValue(variable_name, new_value); |
361 case ScopeIterator::ScopeTypeBlock: | 361 case ScopeIterator::ScopeTypeBlock: |
362 case ScopeIterator::ScopeTypeEval: | 362 case ScopeIterator::ScopeTypeEval: |
363 return SetInnerScopeVariableValue(variable_name, new_value); | 363 return SetInnerScopeVariableValue(variable_name, new_value); |
364 case ScopeIterator::ScopeTypeModule: | 364 case ScopeIterator::ScopeTypeModule: |
365 // TODO(2399): should we implement it? | 365 // TODO(neis): Implement. |
366 break; | 366 break; |
367 } | 367 } |
368 return false; | 368 return false; |
369 } | 369 } |
370 | 370 |
371 | 371 |
372 Handle<ScopeInfo> ScopeIterator::CurrentScopeInfo() { | 372 Handle<ScopeInfo> ScopeIterator::CurrentScopeInfo() { |
373 DCHECK(!failed_); | 373 DCHECK(!failed_); |
374 if (!nested_scope_chain_.is_empty()) { | 374 if (!nested_scope_chain_.is_empty()) { |
375 return nested_scope_chain_.last().scope_info; | 375 return nested_scope_chain_.last().scope_info; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 Handle<ScopeInfo> scope_info(context->scope_info()); | 610 Handle<ScopeInfo> scope_info(context->scope_info()); |
611 | 611 |
612 // Allocate and initialize a JSObject with all the members of the debugged | 612 // Allocate and initialize a JSObject with all the members of the debugged |
613 // module. | 613 // module. |
614 Handle<JSObject> module_scope = | 614 Handle<JSObject> module_scope = |
615 isolate_->factory()->NewJSObjectWithNullProto(); | 615 isolate_->factory()->NewJSObjectWithNullProto(); |
616 | 616 |
617 // Fill all context locals. | 617 // Fill all context locals. |
618 CopyContextLocalsToScopeObject(scope_info, context, module_scope); | 618 CopyContextLocalsToScopeObject(scope_info, context, module_scope); |
619 | 619 |
| 620 // TODO(neis): Also collect stack locals as well as imports and exports. |
| 621 |
620 return module_scope; | 622 return module_scope; |
621 } | 623 } |
622 | 624 |
623 bool ScopeIterator::SetParameterValue(Handle<ScopeInfo> scope_info, | 625 bool ScopeIterator::SetParameterValue(Handle<ScopeInfo> scope_info, |
624 JavaScriptFrame* frame, | 626 JavaScriptFrame* frame, |
625 Handle<String> parameter_name, | 627 Handle<String> parameter_name, |
626 Handle<Object> new_value) { | 628 Handle<Object> new_value) { |
627 // Setting stack locals of optimized frames is not supported. | 629 // Setting stack locals of optimized frames is not supported. |
628 if (frame->is_optimized()) return false; | 630 if (frame->is_optimized()) return false; |
629 HandleScope scope(isolate_); | 631 HandleScope scope(isolate_); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 831 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
830 if (beg_pos <= position && position < end_pos) { | 832 if (beg_pos <= position && position < end_pos) { |
831 GetNestedScopeChain(isolate, inner_scope, position); | 833 GetNestedScopeChain(isolate, inner_scope, position); |
832 return; | 834 return; |
833 } | 835 } |
834 } | 836 } |
835 } | 837 } |
836 | 838 |
837 } // namespace internal | 839 } // namespace internal |
838 } // namespace v8 | 840 } // namespace v8 |
OLD | NEW |