| Index: src/ia32/assembler-ia32.cc
|
| ===================================================================
|
| --- src/ia32/assembler-ia32.cc (revision 4699)
|
| +++ src/ia32/assembler-ia32.cc (working copy)
|
| @@ -36,6 +36,8 @@
|
|
|
| #include "v8.h"
|
|
|
| +#if defined(V8_TARGET_ARCH_IA32)
|
| +
|
| #include "disassembler.h"
|
| #include "macro-assembler.h"
|
| #include "serialize.h"
|
| @@ -160,6 +162,15 @@
|
| 1 << RelocInfo::JS_RETURN | 1 << RelocInfo::INTERNAL_REFERENCE;
|
|
|
|
|
| +bool RelocInfo::IsCodedSpecially() {
|
| + // The deserializer needs to know whether a pointer is specially coded. Being
|
| + // specially coded on IA32 means that it is a relative address, as used by
|
| + // branch instructions. These are also the ones that need changing when a
|
| + // code object moves.
|
| + return (1 << rmode_) & kApplyMask;
|
| +}
|
| +
|
| +
|
| void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
|
| // Patch the code at the current address with the supplied instructions.
|
| for (int i = 0; i < instruction_count; i++) {
|
| @@ -433,7 +444,7 @@
|
|
|
| void Assembler::pop(Register dst) {
|
| ASSERT(reloc_info_writer.last_pc() != NULL);
|
| - if (FLAG_push_pop_elimination && (reloc_info_writer.last_pc() <= last_pc_)) {
|
| + if (FLAG_peephole_optimization && (reloc_info_writer.last_pc() <= last_pc_)) {
|
| // (last_pc_ != NULL) is rolled into the above check.
|
| // If a last_pc_ is set, we need to make sure that there has not been any
|
| // relocation information generated between the last instruction and this
|
| @@ -443,7 +454,7 @@
|
| int push_reg_code = instr & 0x7;
|
| if (push_reg_code == dst.code()) {
|
| pc_ = last_pc_;
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop (same reg) eliminated\n", pc_offset());
|
| }
|
| } else {
|
| @@ -452,7 +463,7 @@
|
| Register src = { push_reg_code };
|
| EnsureSpace ensure_space(this);
|
| emit_operand(dst, Operand(src));
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop (reg->reg) eliminated\n", pc_offset());
|
| }
|
| }
|
| @@ -466,7 +477,7 @@
|
| last_pc_[0] = 0x8b;
|
| last_pc_[1] = op1;
|
| last_pc_ = NULL;
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop (op->reg) eliminated\n", pc_offset());
|
| }
|
| return;
|
| @@ -483,7 +494,7 @@
|
| last_pc_[1] = 0xc4;
|
| last_pc_[2] = 0x04;
|
| last_pc_ = NULL;
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop (mov-pop) eliminated\n", pc_offset());
|
| }
|
| return;
|
| @@ -498,7 +509,7 @@
|
| // change to
|
| // 31c0 xor eax,eax
|
| last_pc_ = NULL;
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop (imm->reg) eliminated\n", pc_offset());
|
| }
|
| return;
|
| @@ -521,7 +532,7 @@
|
| // b8XX000000 mov eax,0x000000XX
|
| }
|
| last_pc_ = NULL;
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop (imm->reg) eliminated\n", pc_offset());
|
| }
|
| return;
|
| @@ -533,7 +544,7 @@
|
| last_pc_ = NULL;
|
| // change to
|
| // b8XXXXXXXX mov eax,0xXXXXXXXX
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop (imm->reg) eliminated\n", pc_offset());
|
| }
|
| return;
|
| @@ -776,6 +787,13 @@
|
| }
|
|
|
|
|
| +void Assembler::stos() {
|
| + EnsureSpace ensure_space(this);
|
| + last_pc_ = pc_;
|
| + EMIT(0xAB);
|
| +}
|
| +
|
| +
|
| void Assembler::xchg(Register dst, Register src) {
|
| EnsureSpace ensure_space(this);
|
| last_pc_ = pc_;
|
| @@ -813,7 +831,7 @@
|
|
|
| void Assembler::add(const Operand& dst, const Immediate& x) {
|
| ASSERT(reloc_info_writer.last_pc() != NULL);
|
| - if (FLAG_push_pop_elimination && (reloc_info_writer.last_pc() <= last_pc_)) {
|
| + if (FLAG_peephole_optimization && (reloc_info_writer.last_pc() <= last_pc_)) {
|
| byte instr = last_pc_[0];
|
| if ((instr & 0xf8) == 0x50) {
|
| // Last instruction was a push. Check whether this is a pop without a
|
| @@ -822,7 +840,7 @@
|
| (x.x_ == kPointerSize) && (x.rmode_ == RelocInfo::NONE)) {
|
| pc_ = last_pc_;
|
| last_pc_ = NULL;
|
| - if (FLAG_print_push_pop_elimination) {
|
| + if (FLAG_print_peephole_optimization) {
|
| PrintF("%d push/pop(noreg) eliminated\n", pc_offset());
|
| }
|
| return;
|
| @@ -2528,3 +2546,5 @@
|
| #endif
|
|
|
| } } // namespace v8::internal
|
| +
|
| +#endif // V8_TARGET_ARCH_IA32
|
|
|