diff options
Diffstat (limited to 'V8Binding/v8/src/ia32/assembler-ia32.cc')
-rw-r--r-- | V8Binding/v8/src/ia32/assembler-ia32.cc | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/V8Binding/v8/src/ia32/assembler-ia32.cc b/V8Binding/v8/src/ia32/assembler-ia32.cc index 02bde2a..b8dda17 100644 --- a/V8Binding/v8/src/ia32/assembler-ia32.cc +++ b/V8Binding/v8/src/ia32/assembler-ia32.cc @@ -157,6 +157,9 @@ void RelocInfo::PatchCode(byte* instructions, int instruction_count) { for (int i = 0; i < instruction_count; i++) { *(pc_ + i) = *(instructions + i); } + + // Indicate that code has changed. + CPU::FlushICache(pc_, instruction_count); } @@ -164,12 +167,25 @@ void RelocInfo::PatchCode(byte* instructions, int instruction_count) { // Additional guard int3 instructions can be added if required. void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { // Call instruction takes up 5 bytes and int3 takes up one byte. - int code_size = 5 + guard_bytes; + static const int kCallCodeSize = 5; + int code_size = kCallCodeSize + guard_bytes; - // Patch the code. + // Create a code patcher. CodePatcher patcher(pc_, code_size); + + // Add a label for checking the size of the code used for returning. +#ifdef DEBUG + Label check_codesize; + patcher.masm()->bind(&check_codesize); +#endif + + // Patch the code. patcher.masm()->call(target, RelocInfo::NONE); + // Check that the size of the code generated is as expected. + ASSERT_EQ(kCallCodeSize, + patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize)); + // Add the requested number of int3 instructions after the call. for (int i = 0; i < guard_bytes; i++) { patcher.masm()->int3(); @@ -721,10 +737,10 @@ void Assembler::cmov(Condition cc, Register dst, const Operand& src) { ASSERT(CpuFeatures::IsEnabled(CpuFeatures::CMOV)); EnsureSpace ensure_space(this); last_pc_ = pc_; - UNIMPLEMENTED(); - USE(cc); - USE(dst); - USE(src); + // Opcode: 0f 40 + cc /r + EMIT(0x0F); + EMIT(0x40 + cc); + emit_operand(dst, src); } @@ -866,6 +882,13 @@ void Assembler::cmp(const Operand& op, const Immediate& imm) { } +void Assembler::cmp(const Operand& op, Handle<Object> handle) { + EnsureSpace ensure_space(this); + last_pc_ = pc_; + emit_arith(7, op, Immediate(handle)); +} + + void Assembler::cmpb_al(const Operand& op) { EnsureSpace ensure_space(this); last_pc_ = pc_; @@ -1947,6 +1970,17 @@ void Assembler::divsd(XMMRegister dst, XMMRegister src) { } +void Assembler::comisd(XMMRegister dst, XMMRegister src) { + ASSERT(CpuFeatures::IsEnabled(CpuFeatures::SSE2)); + EnsureSpace ensure_space(this); + last_pc_ = pc_; + EMIT(0x66); + EMIT(0x0F); + EMIT(0x2F); + emit_sse_operand(dst, src); +} + + void Assembler::movdbl(XMMRegister dst, const Operand& src) { EnsureSpace ensure_space(this); last_pc_ = pc_; |