Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 // Figure out how many bytes of "pc_offset" correspond to actual code by | 1638 // Figure out how many bytes of "pc_offset" correspond to actual code by |
| 1639 // subtracting off the bytes that correspond to constant/veneer pools. See | 1639 // subtracting off the bytes that correspond to constant/veneer pools. See |
| 1640 // Assembler::CheckConstPool() and Assembler::CheckVeneerPool(). Note that this | 1640 // Assembler::CheckConstPool() and Assembler::CheckVeneerPool(). Note that this |
| 1641 // is only useful for architectures using constant pools or veneer pools. | 1641 // is only useful for architectures using constant pools or veneer pools. |
| 1642 static int ComputeCodeOffsetFromPcOffset(Code *code, int pc_offset) { | 1642 static int ComputeCodeOffsetFromPcOffset(Code *code, int pc_offset) { |
| 1643 DCHECK_EQ(code->kind(), Code::FUNCTION); | 1643 DCHECK_EQ(code->kind(), Code::FUNCTION); |
| 1644 DCHECK(!code->has_debug_break_slots()); | 1644 DCHECK(!code->has_debug_break_slots()); |
| 1645 DCHECK_LE(0, pc_offset); | 1645 DCHECK_LE(0, pc_offset); |
| 1646 DCHECK_LT(pc_offset, code->instruction_end() - code->instruction_start()); | 1646 DCHECK_LT(pc_offset, code->instruction_end() - code->instruction_start()); |
| 1647 | 1647 |
| 1648 int code_offset = pc_offset; | |
| 1649 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 | |
|
Yang
2015/03/09 08:03:56
Strongly objecting platform-dependent code here.
| |
| 1648 int mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL) | | 1650 int mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL) | |
| 1649 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); | 1651 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); |
| 1650 byte *pc = code->instruction_start() + pc_offset; | 1652 byte *pc = code->instruction_start() + pc_offset; |
| 1651 int code_offset = pc_offset; | |
| 1652 for (RelocIterator it(code, mask); !it.done(); it.next()) { | 1653 for (RelocIterator it(code, mask); !it.done(); it.next()) { |
| 1653 RelocInfo* info = it.rinfo(); | 1654 RelocInfo* info = it.rinfo(); |
| 1654 if (info->pc() >= pc) break; | 1655 if (info->pc() >= pc) break; |
| 1655 DCHECK(RelocInfo::IsConstPool(info->rmode())); | 1656 DCHECK(RelocInfo::IsConstPool(info->rmode())); |
| 1656 code_offset -= static_cast<int>(info->data()); | 1657 code_offset -= static_cast<int>(info->data()); |
| 1657 DCHECK_LE(0, code_offset); | 1658 DCHECK_LE(0, code_offset); |
| 1658 } | 1659 } |
| 1660 #endif | |
| 1659 | 1661 |
| 1660 return code_offset; | 1662 return code_offset; |
| 1661 } | 1663 } |
| 1662 | 1664 |
| 1663 | 1665 |
| 1664 // The inverse of ComputeCodeOffsetFromPcOffset. | 1666 // The inverse of ComputeCodeOffsetFromPcOffset. |
| 1665 static int ComputePcOffsetFromCodeOffset(Code *code, int code_offset) { | 1667 static int ComputePcOffsetFromCodeOffset(Code *code, int code_offset) { |
| 1666 DCHECK_EQ(code->kind(), Code::FUNCTION); | 1668 DCHECK_EQ(code->kind(), Code::FUNCTION); |
| 1667 | 1669 |
| 1670 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 | |
|
Yang
2015/03/09 08:03:56
Ditto.
| |
| 1668 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 1671 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 1669 RelocInfo::ModeMask(RelocInfo::CONST_POOL) | | 1672 RelocInfo::ModeMask(RelocInfo::CONST_POOL) | |
| 1670 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); | 1673 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); |
| 1674 #else | |
| 1675 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT); | |
| 1676 #endif | |
| 1671 int reloc = 0; | 1677 int reloc = 0; |
| 1672 for (RelocIterator it(code, mask); !it.done(); it.next()) { | 1678 for (RelocIterator it(code, mask); !it.done(); it.next()) { |
| 1673 RelocInfo* info = it.rinfo(); | 1679 RelocInfo* info = it.rinfo(); |
| 1674 if (info->pc() - code->instruction_start() - reloc >= code_offset) break; | 1680 if (info->pc() - code->instruction_start() - reloc >= code_offset) break; |
| 1675 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { | 1681 if (RelocInfo::IsDebugBreakSlot(info->rmode())) { |
| 1676 reloc += Assembler::kDebugBreakSlotLength; | 1682 reloc += Assembler::kDebugBreakSlotLength; |
| 1677 } else { | 1683 } else { |
| 1678 DCHECK(RelocInfo::IsConstPool(info->rmode())); | 1684 DCHECK(RelocInfo::IsConstPool(info->rmode())); |
| 1679 reloc += static_cast<int>(info->data()); | 1685 reloc += static_cast<int>(info->data()); |
| 1680 } | 1686 } |
| (...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3381 logger_->DebugEvent("Put", message.text()); | 3387 logger_->DebugEvent("Put", message.text()); |
| 3382 } | 3388 } |
| 3383 | 3389 |
| 3384 | 3390 |
| 3385 void LockingCommandMessageQueue::Clear() { | 3391 void LockingCommandMessageQueue::Clear() { |
| 3386 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3392 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 3387 queue_.Clear(); | 3393 queue_.Clear(); |
| 3388 } | 3394 } |
| 3389 | 3395 |
| 3390 } } // namespace v8::internal | 3396 } } // namespace v8::internal |
| OLD | NEW |