ref_encoder.NameOfAddress(*target_reference_address()),
*target_reference_address());
} else if (IsCodeTarget(rmode_)) {
- Code* code = Debug::GetCodeTarget(target_address());
+ Code* code = Code::GetCodeFromTargetAddress(target_address());
PrintF(" (%s) (%p)", Code::Kind2String(code->kind()), target_address());
} else if (IsPosition(rmode_)) {
PrintF(" (%d)", data());
// be of a different kind than in the original code.
if (RelocInfo::IsCodeTarget(rmode())) {
Address target = original_rinfo()->target_address();
- Code* code = Debug::GetCodeTarget(target);
+ Code* code = Code::GetCodeFromTargetAddress(target);
if (code->is_inline_cache_stub() || RelocInfo::IsConstructCall(rmode())) {
break_point_++;
return;
// Step in can only be prepared if currently positioned on an IC call or
// construct call.
Address target = rinfo()->target_address();
- Code* code = Debug::GetCodeTarget(target);
+ Code* code = Code::GetCodeFromTargetAddress(target);
if (code->is_call_stub()) {
// Step in through IC call is handled by the runtime system. Therefore make
// sure that the any current IC is cleared and the runtime system is
bool is_call_target = false;
if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) {
Address target = it.rinfo()->target_address();
- Code* code = Debug::GetCodeTarget(target);
+ Code* code = Code::GetCodeFromTargetAddress(target);
if (code->is_call_stub()) is_call_target = true;
}
// Check whether the code object at the specified address is a debug break code
// object.
bool Debug::IsDebugBreak(Address addr) {
- Code* code = GetCodeTarget(addr);
+ Code* code = Code::GetCodeFromTargetAddress(addr);
return code->ic_state() == DEBUG_BREAK;
}
if (RelocInfo::IsCodeTarget(mode)) {
Address target = rinfo->target_address();
- Code* code = Debug::GetCodeTarget(target);
+ Code* code = Code::GetCodeFromTargetAddress(target);
if (code->is_inline_cache_stub()) {
if (code->is_call_stub()) {
return ComputeCallDebugBreak(code->arguments_count());
}
-Code* Debug::GetCodeTarget(Address target) {
- // Maybe this can be refactored with the stuff in ic-inl.h?
- Code* result =
- Code::cast(HeapObject::FromAddress(target - Code::kHeaderSize));
- return result;
-}
-
-
bool Debug::IsDebugGlobal(GlobalObject* global) {
return IsLoaded() && global == Debug::debug_context()->global();
}
static Handle<Object> GetSourceBreakLocations(
Handle<SharedFunctionInfo> shared);
- static Code* GetCodeTarget(Address target);
// Getter for the debug_context.
inline static Handle<Context> debug_context() { return debug_context_; }
if (rmode == RelocInfo::CONSTRUCT_CALL) {
out.AddFormatted(" constructor,");
}
- Code* code = Debug::GetCodeTarget(relocinfo.target_address());
+ Code* code = Code::GetCodeFromTargetAddress(relocinfo.target_address());
Code::Kind kind = code->kind();
if (code->is_inline_cache_stub()) {
if (rmode == RelocInfo::CODE_TARGET_CONTEXT) {
Code* IC::GetTargetAtAddress(Address address) {
+ // Get the target address of the IC.
Address target = Assembler::target_address_at(address);
- HeapObject* code = HeapObject::FromAddress(target - Code::kHeaderSize);
- // GetTargetAtAddress is called from IC::Clear which in turn is
- // called when marking objects during mark sweep. reinterpret_cast
- // is therefore used instead of the more appropriate
- // Code::cast. Code::cast does not work when the object's map is
- // marked.
- Code* result = reinterpret_cast<Code*>(code);
+ // Convert target address to the code object. Code::GetCodeFromTargetAddress
+ // is safe for use during GC where the map might be marked.
+ Code* result = Code::GetCodeFromTargetAddress(target);
ASSERT(result->is_inline_cache_stub());
return result;
}
}
+Code* Code::GetCodeFromTargetAddress(Address address) {
+ HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize);
+ // GetCodeFromTargetAddress might be called when marking objects during mark
+ // sweep. reinterpret_cast is therefore used instead of the more appropriate
+ // Code::cast. Code::cast does not work when the object's map is
+ // marked.
+ Code* result = reinterpret_cast<Code*>(code);
+ return result;
+}
+
+
Object* Map::prototype() {
return READ_FIELD(this, kPrototypeOffset);
}
static inline int ExtractArgumentsCountFromFlags(Flags flags);
static inline Flags RemoveTypeFromFlags(Flags flags);
+ // Convert a target address into a code object.
+ static inline Code* GetCodeFromTargetAddress(Address address);
// Returns the address of the first instruction.
inline byte* instruction_start();
CHECK_EQ(mode, it1.it()->rinfo()->rmode());
if (mode != v8::internal::RelocInfo::JS_RETURN) {
CHECK_EQ(debug_break,
- Debug::GetCodeTarget(it1.it()->rinfo()->target_address()));
+ Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address()));
} else {
// TODO(1240753): Make the test architecture independent or split
// parts of the debugger into architecture dependent files.