Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: src/assembler-ia32.cc

Issue 12427: Merge regexp2000 back into bleeding_edge (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/assembler-ia32.cc
===================================================================
--- src/assembler-ia32.cc (revision 830)
+++ src/assembler-ia32.cc (working copy)
@@ -122,7 +122,8 @@
#undef __
CodeDesc desc;
assm.GetCode(&desc);
- Object* code = Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB));
+ Object* code =
+ Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB), NULL);
if (!code->IsCode()) return;
F0 f = FUNCTION_CAST<F0>(Code::cast(code)->entry());
uint32_t res = f();
@@ -294,7 +295,6 @@
}
buffer_size_ = buffer_size;
own_buffer_ = true;
-
} else {
// use externally provided buffer instead
ASSERT(buffer_size > 0);
@@ -420,6 +420,29 @@
}
+void Assembler::push(Label* label, RelocInfo::Mode reloc_mode) {
+ ASSERT_NOT_NULL(label);
+ EnsureSpace ensure_space(this);
+ last_pc_ = pc_;
+ // If reloc_mode == NONE, the label is stored as buffer relative.
+ ASSERT(reloc_mode == RelocInfo::NONE);
+ if (label->is_bound()) {
+ // Index of position in Code object:
+ int pos = label->pos() + Code::kHeaderSize;
Lasse Reichstein 2008/11/25 10:34:46 Known bug: Off-by-one. Must subtract kHeapObjectTa
+ if (pos >= 0 && pos < 256) {
+ EMIT(0x6a);
+ EMIT(pos);
+ } else {
+ EMIT(0x68);
+ emit(pos);
+ }
+ } else {
+ EMIT(0x68);
+ emit_disp(label, Displacement::CODE_RELATIVE);
+ }
+}
+
+
void Assembler::pop(Register dst) {
ASSERT(reloc_info_writer.last_pc() != NULL);
if (FLAG_push_pop_elimination && (reloc_info_writer.last_pc() <= last_pc_)) {
@@ -546,6 +569,22 @@
}
+void Assembler::enter(const Immediate& size) {
+ EnsureSpace ensure_space(this);
+ last_pc_ = pc_;
+ EMIT(0xC8);
+ emit_w(size);
+ EMIT(0);
+}
+
+
+void Assembler::leave() {
+ EnsureSpace ensure_space(this);
+ last_pc_ = pc_;
+ EMIT(0xC9);
+}
+
+
void Assembler::mov_b(Register dst, const Operand& src) {
EnsureSpace ensure_space(this);
last_pc_ = pc_;
@@ -830,6 +869,23 @@
}
+void Assembler::rep_cmpsb() {
Lasse Reichstein 2008/11/25 10:34:46 Should this be split into cld, rep and cmpsb? The
+ EnsureSpace ensure_space(this);
+ last_pc_ = pc_;
+ EMIT(0xFC); // CLD to ensure forward operation
+ EMIT(0xF3); // REP
+ EMIT(0xA6); // CMPSB
+}
+
+void Assembler::rep_cmpsw() {
+ EnsureSpace ensure_space(this);
+ last_pc_ = pc_;
+ EMIT(0xFC); // CLD to ensure forward operation
+ EMIT(0xF3); // REP
+ EMIT(0xA7); // CMPSW
+}
+
+
void Assembler::dec_b(Register dst) {
EnsureSpace ensure_space(this);
last_pc_ = pc_;
@@ -1074,6 +1130,14 @@
}
+void Assembler::shr_cl(Register dst) {
+ EnsureSpace ensure_space(this);
+ last_pc_ = pc_;
+ EMIT(0xD1);
+ EMIT(0xE8 | dst.code());
+}
+
+
void Assembler::sub(const Operand& dst, const Immediate& x) {
EnsureSpace ensure_space(this);
last_pc_ = pc_;
@@ -1171,6 +1235,15 @@
}
+void Assembler::bt(const Operand& dst, Register src) {
+ EnsureSpace ensure_space(this);
+ last_pc_ = pc_;
+ EMIT(0x0F);
+ EMIT(0xA3);
+ emit_operand(src, dst);
+}
+
+
void Assembler::bts(const Operand& dst, Register src) {
EnsureSpace ensure_space(this);
last_pc_ = pc_;
@@ -1224,13 +1297,6 @@
}
-void Assembler::leave() {
- EnsureSpace ensure_space(this);
- last_pc_ = pc_;
- EMIT(0xC9);
-}
-
-
// Labels refer to positions in the (to be) generated code.
// There are bound, linked, and unused labels.
//
@@ -1270,12 +1336,16 @@
while (L->is_linked()) {
Displacement disp = disp_at(L);
int fixup_pos = L->pos();
- if (disp.type() == Displacement::UNCONDITIONAL_JUMP) {
- ASSERT(byte_at(fixup_pos - 1) == 0xE9); // jmp expected
+ if (disp.type() == Displacement::CODE_RELATIVE) {
+ long_at_put(fixup_pos, pos + Code::kHeaderSize);
Lasse Reichstein 2008/11/25 10:34:46 Off-by-one here too.
+ } else {
+ if (disp.type() == Displacement::UNCONDITIONAL_JUMP) {
+ ASSERT(byte_at(fixup_pos - 1) == 0xE9); // jmp expected
+ }
+ // relative address, relative to point after address
+ int imm32 = pos - (fixup_pos + sizeof(int32_t));
+ long_at_put(fixup_pos, imm32);
}
- // relative address, relative to point after address
- int imm32 = pos - (fixup_pos + sizeof(int32_t));
- long_at_put(fixup_pos, imm32);
disp.next(L);
}
L->bind_to(pos);

Powered by Google App Engine
This is Rietveld 408576698