| 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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 ASSERT(bound_label.is_bound()); | 2133 ASSERT(bound_label.is_bound()); |
| 2157 ASSERT(0 <= position); | 2134 ASSERT(0 <= position); |
| 2158 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); | 2135 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); |
| 2159 ASSERT(long_at(position) == 0); // only initialize once! | 2136 ASSERT(long_at(position) == 0); // only initialize once! |
| 2160 | 2137 |
| 2161 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); | 2138 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); |
| 2162 long_at_put(position, label_loc); | 2139 long_at_put(position, label_loc); |
| 2163 } | 2140 } |
| 2164 | 2141 |
| 2165 } } // namespace v8::internal | 2142 } } // namespace v8::internal |
| OLD | NEW |