80c7ad1070
Introduce a new PcDescriptor kind to distinguish closure calls from other runtime calls. The debugger can patch these calls to set a breakpoint. When stepping into a closure call, the debugger must fish out the closure object from the stack, find the function and set breakpoints in it. Arm and Mips breakpoint stubs are not implemented yet. ia32 and x64 stubs tested by hand. Automated test to follow. R=srdjan@google.com Review URL: https://codereview.chromium.org//14858033 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22596 260f80e4-7a28-3924-810f-c04153c831b5
79 lines
2.3 KiB
C++
79 lines
2.3 KiB
C++
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
|
|
#if defined(TARGET_ARCH_MIPS)
|
|
|
|
#include "vm/code_patcher.h"
|
|
|
|
#include "vm/instructions.h"
|
|
#include "vm/object.h"
|
|
|
|
namespace dart {
|
|
|
|
RawArray* CodePatcher::GetClosureArgDescAt(uword return_address,
|
|
const Code& code) {
|
|
ASSERT(code.ContainsInstructionAt(return_address));
|
|
CallPattern call(return_address, code);
|
|
return call.ArgumentsDescriptor();
|
|
}
|
|
|
|
|
|
uword CodePatcher::GetStaticCallTargetAt(uword return_address,
|
|
const Code& code) {
|
|
ASSERT(code.ContainsInstructionAt(return_address));
|
|
CallPattern call(return_address, code);
|
|
return call.TargetAddress();
|
|
}
|
|
|
|
|
|
void CodePatcher::PatchStaticCallAt(uword return_address,
|
|
const Code& code,
|
|
uword new_target) {
|
|
ASSERT(code.ContainsInstructionAt(return_address));
|
|
CallPattern call(return_address, code);
|
|
call.SetTargetAddress(new_target);
|
|
}
|
|
|
|
|
|
void CodePatcher::PatchInstanceCallAt(uword return_address,
|
|
const Code& code,
|
|
uword new_target) {
|
|
ASSERT(code.ContainsInstructionAt(return_address));
|
|
CallPattern call(return_address, code);
|
|
call.SetTargetAddress(new_target);
|
|
}
|
|
|
|
|
|
void CodePatcher::InsertCallAt(uword start, uword target) {
|
|
UNIMPLEMENTED();
|
|
}
|
|
|
|
|
|
uword CodePatcher::GetInstanceCallAt(uword return_address,
|
|
const Code& code,
|
|
ICData* ic_data,
|
|
Array* arguments_descriptor) {
|
|
ASSERT(code.ContainsInstructionAt(return_address));
|
|
CallPattern call(return_address, code);
|
|
if (ic_data != NULL) {
|
|
*ic_data = call.IcData();
|
|
}
|
|
if (arguments_descriptor != NULL) {
|
|
*arguments_descriptor = call.ArgumentsDescriptor();
|
|
}
|
|
return call.TargetAddress();
|
|
}
|
|
|
|
|
|
intptr_t CodePatcher::InstanceCallSizeInBytes() {
|
|
// The instance call instruction sequence has a variable size on MIPS.
|
|
UNREACHABLE();
|
|
return 0;
|
|
}
|
|
|
|
} // namespace dart
|
|
|
|
#endif // defined TARGET_ARCH_MIPS
|