| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 | 414 |
| 415 void Assembler::push(const Operand& src) { | 415 void Assembler::push(const Operand& src) { |
| 416 EnsureSpace ensure_space(this); | 416 EnsureSpace ensure_space(this); |
| 417 last_pc_ = pc_; | 417 last_pc_ = pc_; |
| 418 EMIT(0xFF); | 418 EMIT(0xFF); |
| 419 emit_operand(esi, src); | 419 emit_operand(esi, src); |
| 420 } | 420 } |
| 421 | 421 |
| 422 | 422 |
| 423 void Assembler::push(Label* label, RelocInfo::Mode reloc_mode) { | |
| 424 ASSERT_NOT_NULL(label); | |
| 425 EnsureSpace ensure_space(this); | |
| 426 last_pc_ = pc_; | |
| 427 // If reloc_mode == NONE, the label is stored as buffer relative. | |
| 428 ASSERT(reloc_mode == RelocInfo::NONE); | |
| 429 if (label->is_bound()) { | |
| 430 // Index of position relative to Code Object-pointer. | |
| 431 int rel_pos = label->pos() + Code::kHeaderSize - kHeapObjectTag; | |
| 432 if (rel_pos >= 0 && rel_pos < 256) { | |
| 433 EMIT(0x6a); | |
| 434 EMIT(rel_pos); | |
| 435 } else { | |
| 436 EMIT(0x68); | |
| 437 emit(rel_pos); | |
| 438 } | |
| 439 } else { | |
| 440 EMIT(0x68); | |
| 441 emit_disp(label, Displacement::CODE_RELATIVE); | |
| 442 } | |
| 443 } | |
| 444 | |
| 445 | |
| 446 void Assembler::pop(Register dst) { | 423 void Assembler::pop(Register dst) { |
| 447 ASSERT(reloc_info_writer.last_pc() != NULL); | 424 ASSERT(reloc_info_writer.last_pc() != NULL); |
| 448 if (FLAG_push_pop_elimination && (reloc_info_writer.last_pc() <= last_pc_)) { | 425 if (FLAG_push_pop_elimination && (reloc_info_writer.last_pc() <= last_pc_)) { |
| 449 // (last_pc_ != NULL) is rolled into the above check | 426 // (last_pc_ != NULL) is rolled into the above check |
| 450 // If a last_pc_ is set, we need to make sure that there has not been any | 427 // If a last_pc_ is set, we need to make sure that there has not been any |
| 451 // relocation information generated between the last instruction and this | 428 // relocation information generated between the last instruction and this |
| 452 // pop instruction. | 429 // pop instruction. |
| 453 byte instr = last_pc_[0]; | 430 byte instr = last_pc_[0]; |
| 454 if ((instr & ~0x7) == 0x50) { | 431 if ((instr & ~0x7) == 0x50) { |
| 455 int push_reg_code = instr & 0x7; | 432 int push_reg_code = instr & 0x7; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 } | 859 } |
| 883 | 860 |
| 884 | 861 |
| 885 void Assembler::cmp(const Operand& op, const Immediate& imm) { | 862 void Assembler::cmp(const Operand& op, const Immediate& imm) { |
| 886 EnsureSpace ensure_space(this); | 863 EnsureSpace ensure_space(this); |
| 887 last_pc_ = pc_; | 864 last_pc_ = pc_; |
| 888 emit_arith(7, op, imm); | 865 emit_arith(7, op, imm); |
| 889 } | 866 } |
| 890 | 867 |
| 891 | 868 |
| 892 void Assembler::rep_cmpsb() { | 869 void Assembler::cmpb_al(const Operand& op) { |
| 893 EnsureSpace ensure_space(this); | 870 EnsureSpace ensure_space(this); |
| 894 last_pc_ = pc_; | 871 last_pc_ = pc_; |
| 895 EMIT(0xFC); // CLD to ensure forward operation | 872 EMIT(0x38); // CMP r/m8, r8 |
| 896 EMIT(0xF3); // REP | 873 emit_operand(eax, op); // eax has same code as register al. |
| 897 EMIT(0xA6); // CMPSB | |
| 898 } | |
| 899 | |
| 900 void Assembler::rep_cmpsw() { | |
| 901 EnsureSpace ensure_space(this); | |
| 902 last_pc_ = pc_; | |
| 903 EMIT(0xFC); // CLD to ensure forward operation | |
| 904 EMIT(0xF3); // REP | |
| 905 EMIT(0x66); // Operand size overide. | |
| 906 EMIT(0xA7); // CMPS | |
| 907 } | 874 } |
| 908 | 875 |
| 909 | 876 |
| 877 void Assembler::cmpw_ax(const Operand& op) { |
| 878 EnsureSpace ensure_space(this); |
| 879 last_pc_ = pc_; |
| 880 EMIT(0x66); |
| 881 EMIT(0x39); // CMP r/m16, r16 |
| 882 emit_operand(eax, op); // eax has same code as register ax. |
| 883 } |
| 884 |
| 885 |
| 910 void Assembler::dec_b(Register dst) { | 886 void Assembler::dec_b(Register dst) { |
| 911 EnsureSpace ensure_space(this); | 887 EnsureSpace ensure_space(this); |
| 912 last_pc_ = pc_; | 888 last_pc_ = pc_; |
| 913 EMIT(0xFE); | 889 EMIT(0xFE); |
| 914 EMIT(0xC8 | dst.code()); | 890 EMIT(0xC8 | dst.code()); |
| 915 } | 891 } |
| 916 | 892 |
| 917 | 893 |
| 918 void Assembler::dec(Register dst) { | 894 void Assembler::dec(Register dst) { |
| 919 EnsureSpace ensure_space(this); | 895 EnsureSpace ensure_space(this); |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 ASSERT(bound_label.is_bound()); | 2132 ASSERT(bound_label.is_bound()); |
| 2157 ASSERT(0 <= position); | 2133 ASSERT(0 <= position); |
| 2158 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); | 2134 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); |
| 2159 ASSERT(long_at(position) == 0); // only initialize once! | 2135 ASSERT(long_at(position) == 0); // only initialize once! |
| 2160 | 2136 |
| 2161 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); | 2137 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); |
| 2162 long_at_put(position, label_loc); | 2138 long_at_put(position, label_loc); |
| 2163 } | 2139 } |
| 2164 | 2140 |
| 2165 } } // namespace v8::internal | 2141 } } // namespace v8::internal |
| OLD | NEW |