OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of service; | 5 part of service; |
6 | 6 |
7 // Some value smaller than the object ring, so requesting a large array | 7 // Some value smaller than the object ring, so requesting a large array |
8 // doesn't result in an expired ref because the elements lapped it in the | 8 // doesn't result in an expired ref because the elements lapped it in the |
9 // object ring. | 9 // object ring. |
10 const int kDefaultFieldLimit = 100; | 10 const int kDefaultFieldLimit = 100; |
(...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3320 static bool _isInitialIdentifierChar(int c) { | 3320 static bool _isInitialIdentifierChar(int c) { |
3321 if (c >= 65 && c <= 90) return true; // Upper | 3321 if (c >= 65 && c <= 90) return true; // Upper |
3322 if (c >= 97 && c <= 122) return true; // Lower | 3322 if (c >= 97 && c <= 122) return true; // Lower |
3323 if (c == 95) return true; // Underscore | 3323 if (c == 95) return true; // Underscore |
3324 if (c == 36) return true; // Dollar | 3324 if (c == 36) return true; // Dollar |
3325 return false; | 3325 return false; |
3326 } | 3326 } |
3327 | 3327 |
3328 static bool _isIdentifierChar(int c) { | 3328 static bool _isIdentifierChar(int c) { |
3329 if (_isInitialIdentifierChar(c)) return true; | 3329 if (_isInitialIdentifierChar(c)) return true; |
3330 return c >= 48 && c <= 75; // Digit | 3330 return c >= 48 && c <= 57; // Digit |
3331 } | 3331 } |
3332 | 3332 |
3333 void _update(Map map, bool mapIsRef) { | 3333 void _update(Map map, bool mapIsRef) { |
3334 _upgradeCollection(map, isolate); | 3334 _upgradeCollection(map, isolate); |
3335 super._update(map, mapIsRef); | 3335 super._update(map, mapIsRef); |
3336 | 3336 |
3337 uri = map['uri']; | 3337 uri = map['uri']; |
3338 kind = map['_kind']; | 3338 kind = map['_kind']; |
3339 _shortUri = uri.substring(uri.lastIndexOf('/') + 1); | 3339 _shortUri = uri.substring(uri.lastIndexOf('/') + 1); |
3340 name = _shortUri; | 3340 name = _shortUri; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3401 for (var i = 0; i < sourceLines.length; i++) { | 3401 for (var i = 0; i < sourceLines.length; i++) { |
3402 lines.add(new ScriptLine(this, i + lineOffset + 1, sourceLines[i])); | 3402 lines.add(new ScriptLine(this, i + lineOffset + 1, sourceLines[i])); |
3403 } | 3403 } |
3404 for (var bpt in isolate.breakpoints.values) { | 3404 for (var bpt in isolate.breakpoints.values) { |
3405 if (bpt.location.script == this) { | 3405 if (bpt.location.script == this) { |
3406 _addBreakpoint(bpt); | 3406 _addBreakpoint(bpt); |
3407 } | 3407 } |
3408 } | 3408 } |
3409 } | 3409 } |
3410 | 3410 |
3411 // Note, this may return source beyond the token length if [guessTokenLength] | |
3412 // fails. | |
3413 String getToken(int tokenPos) { | |
3414 final int line = tokenToLine(tokenPos); | |
3415 int column = tokenToCol(tokenPos); | |
3416 if ((line == null) || (column == null)) { | |
3417 return null; | |
3418 } | |
3419 // Line and column numbers are | |
rmacnak
2016/10/14 23:10:38
...are 1-origin in the VM.
Cutch
2016/10/17 18:17:27
Done.
| |
3420 column -= 1; | |
3421 String sourceLine = getLine(line).text; | |
3422 if (sourceLine == null) { | |
3423 return null; | |
3424 } | |
3425 final int length = guessTokenLength(line, column); | |
3426 if (length == null) { | |
3427 return sourceLine.substring(column); | |
3428 } else { | |
3429 return sourceLine.substring(column, column + length); | |
3430 } | |
3431 } | |
3432 | |
3411 void _addBreakpoint(Breakpoint bpt) { | 3433 void _addBreakpoint(Breakpoint bpt) { |
3412 var line; | 3434 var line; |
3413 if (bpt.location.tokenPos != null) { | 3435 if (bpt.location.tokenPos != null) { |
3414 line = tokenToLine(bpt.location.tokenPos); | 3436 line = tokenToLine(bpt.location.tokenPos); |
3415 } else { | 3437 } else { |
3416 UnresolvedSourceLocation loc = bpt.location; | 3438 UnresolvedSourceLocation loc = bpt.location; |
3417 line = loc.line; | 3439 line = loc.line; |
3418 } | 3440 } |
3419 getLine(line).addBreakpoint(bpt); | 3441 getLine(line).addBreakpoint(bpt); |
3420 } | 3442 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3603 descriptors | 3625 descriptors |
3604 .add(new PcDescriptor(pcOffset, deoptId, tokenPos, tryIndex, kind)); | 3626 .add(new PcDescriptor(pcOffset, deoptId, tokenPos, tryIndex, kind)); |
3605 } | 3627 } |
3606 } | 3628 } |
3607 } | 3629 } |
3608 | 3630 |
3609 class LocalVarDescriptor implements M.LocalVarDescriptorsRef { | 3631 class LocalVarDescriptor implements M.LocalVarDescriptorsRef { |
3610 final String id; | 3632 final String id; |
3611 final String name; | 3633 final String name; |
3612 final int index; | 3634 final int index; |
3635 final int declarationPos; | |
3613 final int beginPos; | 3636 final int beginPos; |
3614 final int endPos; | 3637 final int endPos; |
3615 final int scopeId; | 3638 final int scopeId; |
3616 final String kind; | 3639 final String kind; |
3617 | 3640 |
3618 LocalVarDescriptor(this.id, this.name, this.index, this.beginPos, this.endPos, | 3641 LocalVarDescriptor(this.id, |
3619 this.scopeId, this.kind); | 3642 this.name, |
3643 this.index, | |
3644 this.declarationPos, | |
3645 this.beginPos, | |
3646 this.endPos, | |
3647 this.scopeId, | |
3648 this.kind); | |
3620 } | 3649 } |
3621 | 3650 |
3622 class LocalVarDescriptors extends ServiceObject { | 3651 class LocalVarDescriptors extends ServiceObject { |
3623 Class clazz; | 3652 Class clazz; |
3624 int size; | 3653 int size; |
3625 bool get immutable => true; | 3654 bool get immutable => true; |
3626 final List<LocalVarDescriptor> descriptors = <LocalVarDescriptor>[]; | 3655 final List<LocalVarDescriptor> descriptors = <LocalVarDescriptor>[]; |
3627 LocalVarDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner); | 3656 LocalVarDescriptors._empty(ServiceObjectOwner owner) : super._empty(owner); |
3628 | 3657 |
3629 void _update(Map m, bool mapIsRef) { | 3658 void _update(Map m, bool mapIsRef) { |
3630 if (mapIsRef) { | 3659 if (mapIsRef) { |
3631 return; | 3660 return; |
3632 } | 3661 } |
3633 _upgradeCollection(m, isolate); | 3662 _upgradeCollection(m, isolate); |
3634 clazz = m['class']; | 3663 clazz = m['class']; |
3635 size = m['size']; | 3664 size = m['size']; |
3636 descriptors.clear(); | 3665 descriptors.clear(); |
3637 for (var descriptor in m['members']) { | 3666 for (var descriptor in m['members']) { |
3638 var id = descriptor['name']; | 3667 var id = descriptor['name']; |
3639 var name = descriptor['name']; | 3668 var name = descriptor['name']; |
3640 var index = descriptor['index']; | 3669 var index = descriptor['index']; |
3641 var beginPos = descriptor['beginPos']; | 3670 var declarationPos = descriptor['declarationTokenPos']; |
3642 var endPos = descriptor['endPos']; | 3671 var beginPos = descriptor['visibleStartTokenPos']; |
rmacnak
2016/10/14 23:10:38
Consider scopeStart/EndTokenPos
Cutch
2016/10/17 18:17:27
Done.
| |
3672 var endPos = descriptor['visibleEndTokenPos']; | |
3643 var scopeId = descriptor['scopeId']; | 3673 var scopeId = descriptor['scopeId']; |
3644 var kind = descriptor['kind'].trim(); | 3674 var kind = descriptor['kind'].trim(); |
3645 descriptors.add(new LocalVarDescriptor( | 3675 descriptors.add(new LocalVarDescriptor( |
3646 id, name, index, beginPos, endPos, scopeId, kind)); | 3676 id, name, index, declarationPos, beginPos, endPos, scopeId, kind)); |
3647 } | 3677 } |
3648 } | 3678 } |
3649 } | 3679 } |
3650 | 3680 |
3651 class ObjectPool extends HeapObject implements M.ObjectPool { | 3681 class ObjectPool extends HeapObject implements M.ObjectPool { |
3652 bool get immutable => false; | 3682 bool get immutable => false; |
3653 | 3683 |
3654 int length; | 3684 int length; |
3655 List<ObjectPoolEntry> entries; | 3685 List<ObjectPoolEntry> entries; |
3656 | 3686 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4364 var v = list[i]; | 4394 var v = list[i]; |
4365 if ((v is Map) && _isServiceMap(v)) { | 4395 if ((v is Map) && _isServiceMap(v)) { |
4366 list[i] = owner.getFromMap(v); | 4396 list[i] = owner.getFromMap(v); |
4367 } else if (v is List) { | 4397 } else if (v is List) { |
4368 _upgradeList(v, owner); | 4398 _upgradeList(v, owner); |
4369 } else if (v is Map) { | 4399 } else if (v is Map) { |
4370 _upgradeMap(v, owner); | 4400 _upgradeMap(v, owner); |
4371 } | 4401 } |
4372 } | 4402 } |
4373 } | 4403 } |
OLD | NEW |