8c44be4313
Modify code patching infrastructure to accept code object, which is necessary to get to the object pool containing patchable target addresses. Modify assembler test infrastructure to provide associated code object. Review URL: https://codereview.chromium.org//12260026 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18604 260f80e4-7a28-3924-810f-c04153c831b5
29 lines
926 B
C++
29 lines
926 B
C++
// Copyright (c) 2011, 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/assembler.h"
|
|
#include "vm/disassembler.h"
|
|
#include "vm/unit_test.h"
|
|
#include "vm/virtual_memory.h"
|
|
|
|
namespace dart {
|
|
|
|
// Disassembler only supported on IA32 and X64 now.
|
|
#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
|
|
TEST_CASE(Disassembler) {
|
|
Assembler assembler;
|
|
// The used instructions work on all platforms.
|
|
Register reg = static_cast<Register>(0);
|
|
assembler.AddImmediate(reg, Immediate(1));
|
|
assembler.AddImmediate(reg, Immediate(3));
|
|
|
|
// Only verify that the disassembler does not crash.
|
|
AssemblerTest test("Disassembler", &assembler);
|
|
test.Assemble();
|
|
Disassembler::Disassemble(test.entry(), test.entry() + assembler.CodeSize());
|
|
}
|
|
#endif
|
|
|
|
} // namespace dart
|