OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/debugger.h" | 5 #include "vm/debugger.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "platform/address_sanitizer.h" | 9 #include "platform/address_sanitizer.h" |
10 | 10 |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2922 | 2922 |
2923 bool Debugger::IsAtAsyncJump(ActivationFrame* top_frame) { | 2923 bool Debugger::IsAtAsyncJump(ActivationFrame* top_frame) { |
2924 Zone* zone = Thread::Current()->zone(); | 2924 Zone* zone = Thread::Current()->zone(); |
2925 Object& closure_or_null = | 2925 Object& closure_or_null = |
2926 Object::Handle(zone, top_frame->GetAsyncOperation()); | 2926 Object::Handle(zone, top_frame->GetAsyncOperation()); |
2927 if (!closure_or_null.IsNull()) { | 2927 if (!closure_or_null.IsNull()) { |
2928 ASSERT(closure_or_null.IsInstance()); | 2928 ASSERT(closure_or_null.IsInstance()); |
2929 ASSERT(Instance::Cast(closure_or_null).IsClosure()); | 2929 ASSERT(Instance::Cast(closure_or_null).IsClosure()); |
2930 const Script& script = Script::Handle(zone, top_frame->SourceScript()); | 2930 const Script& script = Script::Handle(zone, top_frame->SourceScript()); |
2931 if (script.kind() == RawScript::kKernelTag) { | 2931 if (script.kind() == RawScript::kKernelTag) { |
| 2932 // Are we at a yield point (previous await)? |
| 2933 const Array& yields = Array::Handle(script.yield_positions()); |
| 2934 intptr_t looking_for = top_frame->TokenPos().value(); |
| 2935 Smi& value = Smi::Handle(zone); |
| 2936 for (int i = 0; i < yields.Length(); i++) { |
| 2937 value ^= yields.At(i); |
| 2938 if (value.Value() == looking_for) return true; |
| 2939 } |
2932 return false; | 2940 return false; |
2933 } | 2941 } |
2934 const TokenStream& tokens = TokenStream::Handle(zone, script.tokens()); | 2942 const TokenStream& tokens = TokenStream::Handle(zone, script.tokens()); |
2935 TokenStream::Iterator iter(zone, tokens, top_frame->TokenPos()); | 2943 TokenStream::Iterator iter(zone, tokens, top_frame->TokenPos()); |
2936 if ((iter.CurrentTokenKind() == Token::kIDENT) && | 2944 if ((iter.CurrentTokenKind() == Token::kIDENT) && |
2937 ((iter.CurrentLiteral() == Symbols::Await().raw()) || | 2945 ((iter.CurrentLiteral() == Symbols::Await().raw()) || |
2938 (iter.CurrentLiteral() == Symbols::YieldKw().raw()))) { | 2946 (iter.CurrentLiteral() == Symbols::YieldKw().raw()))) { |
2939 return true; | 2947 return true; |
2940 } | 2948 } |
2941 } | 2949 } |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3599 | 3607 |
3600 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3608 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3601 ASSERT(bpt->next() == NULL); | 3609 ASSERT(bpt->next() == NULL); |
3602 bpt->set_next(code_breakpoints_); | 3610 bpt->set_next(code_breakpoints_); |
3603 code_breakpoints_ = bpt; | 3611 code_breakpoints_ = bpt; |
3604 } | 3612 } |
3605 | 3613 |
3606 #endif // !PRODUCT | 3614 #endif // !PRODUCT |
3607 | 3615 |
3608 } // namespace dart | 3616 } // namespace dart |
OLD | NEW |