Chromium Code Reviews| 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/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
| 11 #include "vm/runtime_entry.h" | 11 #include "vm/runtime_entry.h" |
| 12 #include "vm/stub_code.h" | 12 #include "vm/stub_code.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 17 DEFINE_FLAG(bool, code_comments, false, "Include comments into disassembly"); | |
|
srdjan
2012/05/17 17:22:08
and code.
Vyacheslav Egorov (Google)
2012/05/17 21:16:27
Done.
| |
| 17 | 18 |
| 18 | 19 |
| 19 class DirectCallRelocation : public AssemblerFixup { | 20 class DirectCallRelocation : public AssemblerFixup { |
| 20 public: | 21 public: |
| 21 void Process(const MemoryRegion& region, int position) { | 22 void Process(const MemoryRegion& region, int position) { |
| 22 // Direct calls are relative to the following instruction on x86. | 23 // Direct calls are relative to the following instruction on x86. |
| 23 int32_t pointer = region.Load<int32_t>(position); | 24 int32_t pointer = region.Load<int32_t>(position); |
| 24 int32_t delta = region.start() + position + sizeof(int32_t); | 25 int32_t delta = region.start() + position + sizeof(int32_t); |
| 25 region.Store<int32_t>(position, pointer - delta); | 26 region.Store<int32_t>(position, pointer - delta); |
| 26 } | 27 } |
| (...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1552 | 1553 |
| 1553 void Assembler::EmitGenericShift(int rm, | 1554 void Assembler::EmitGenericShift(int rm, |
| 1554 Register operand, | 1555 Register operand, |
| 1555 Register shifter) { | 1556 Register shifter) { |
| 1556 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1557 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1557 ASSERT(shifter == ECX); | 1558 ASSERT(shifter == ECX); |
| 1558 EmitUint8(0xD3); | 1559 EmitUint8(0xD3); |
| 1559 EmitOperand(rm, Operand(operand)); | 1560 EmitOperand(rm, Operand(operand)); |
| 1560 } | 1561 } |
| 1561 | 1562 |
| 1563 | |
| 1564 void Assembler::Comment(const char* comment) { | |
| 1565 if (FLAG_code_comments) { | |
| 1566 comments_.Add(new CodeComment(buffer_.GetPosition(), | |
| 1567 String::Handle(String::New(comment)))); | |
| 1568 } | |
| 1569 } | |
| 1570 | |
| 1571 | |
| 1572 CodeComments Assembler::GetComments() { | |
| 1573 CodeComments comments = CodeComments::New(comments_.length()); | |
|
srdjan
2012/05/17 17:22:08
Make CodeComments ZoneObject and return "const Cod
Vyacheslav Egorov (Google)
2012/05/17 21:16:27
Done.
| |
| 1574 | |
| 1575 for (int i = 0; i < comments_.length(); i++) { | |
|
srdjan
2012/05/17 17:22:08
intptr_t
Vyacheslav Egorov (Google)
2012/05/17 21:16:27
Done.
| |
| 1576 comments.SetPCAt(i, comments_[i]->pc()); | |
| 1577 comments.SetCommentAt(i, comments_[i]->comment()); | |
| 1578 } | |
| 1579 | |
| 1580 return comments; | |
| 1581 } | |
| 1582 | |
| 1583 | |
| 1562 } // namespace dart | 1584 } // namespace dart |
| 1563 | 1585 |
| 1564 #endif // defined TARGET_ARCH_IA32 | 1586 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |