OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/disassembler.h" | 5 #include "vm/disassembler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/os.h" | 9 #include "vm/os.h" |
10 #include "vm/json_stream.h" | 10 #include "vm/json_stream.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 if (p[i] == '\n' || p[i] == '\r') { | 66 if (p[i] == '\n' || p[i] == '\r') { |
67 p[i] = ' '; | 67 p[i] = ' '; |
68 } | 68 } |
69 } | 69 } |
70 JSONObject jsobj(&jsarr_); | 70 JSONObject jsobj(&jsarr_); |
71 jsobj.AddProperty("type", "DisassembledInstructionComment"); | 71 jsobj.AddProperty("type", "DisassembledInstructionComment"); |
72 jsobj.AddProperty("comment", p); | 72 jsobj.AddProperty("comment", p); |
73 free(p); | 73 free(p); |
74 } | 74 } |
75 | 75 |
| 76 |
| 77 class FindAddrVisitor : public FindObjectVisitor { |
| 78 public: |
| 79 explicit FindAddrVisitor(uword addr) |
| 80 : FindObjectVisitor(Isolate::Current()), addr_(addr) { } |
| 81 virtual ~FindAddrVisitor() { } |
| 82 |
| 83 virtual uword filter_addr() const { return addr_; } |
| 84 |
| 85 // Check if object matches find condition. |
| 86 virtual bool FindObject(RawObject* obj) const { |
| 87 return obj == reinterpret_cast<RawObject*>(addr_); |
| 88 } |
| 89 |
| 90 private: |
| 91 const uword addr_; |
| 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(FindAddrVisitor); |
| 94 }; |
| 95 |
| 96 |
| 97 bool Disassembler::CanFindOldObject(uword addr) { |
| 98 FindAddrVisitor visitor(addr); |
| 99 return Isolate::Current()->heap()->FindOldObject(&visitor) != Object::null(); |
| 100 } |
| 101 |
76 } // namespace dart | 102 } // namespace dart |
OLD | NEW |