Commit 034b89cc authored by kasperl@chromium.org's avatar kasperl@chromium.org

Refactor the smi case inlining for binary operations, so

it's easier to inline the code on demand. Right now, we still
only inline the smi case code for bitwise operations.
Review URL: http://codereview.chromium.org/7669

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@547 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ca37dab9
......@@ -428,12 +428,24 @@ void Assembler::pop(Register dst) {
// relocation information generated between the last instruction and this
// pop instruction.
byte instr = last_pc_[0];
if (instr == (0x50 | dst.code())) {
if ((instr & ~0x7) == 0x50) {
int push_reg_code = instr & 0x7;
if (push_reg_code == dst.code()) {
pc_ = last_pc_;
last_pc_ = NULL;
if (FLAG_print_push_pop_elimination) {
PrintF("%d push/pop (same reg) eliminated\n", pc_offset());
}
} else {
// Convert 'push src; pop dst' to 'mov dst, src'.
last_pc_[0] = 0x8b;
Register src = { push_reg_code };
EnsureSpace ensure_space(this);
emit_operand(dst, Operand(src));
if (FLAG_print_push_pop_elimination) {
PrintF("%d push/pop (reg->reg) eliminated\n", pc_offset());
}
}
last_pc_ = NULL;
return;
} else if (instr == 0xff) { // push of an operand, convert to a move
byte op1 = last_pc_[1];
......@@ -2043,6 +2055,7 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
reloc_info_writer.Write(&rinfo);
}
void Assembler::WriteInternalReference(int position, const Label& bound_label) {
ASSERT(bound_label.is_bound());
ASSERT(0 <= position);
......
This diff is collapsed.
......@@ -288,10 +288,11 @@ class CodeGenerator: public Visitor {
void GenericBinaryOperation(Token::Value op,
const OverwriteMode overwrite_mode = NO_OVERWRITE);
void Comparison(Condition cc, bool strict = false);
// Inline small integer literals. To prevent long attacker-controlled byte
// sequences, we only inline small Smi:s.
// sequences, we only inline small Smis.
static const int kMaxSmiInlinedBits = 16;
bool IsInlineSmi(Literal* literal);
void SmiComparison(Condition cc, Handle<Object> value, bool strict = false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment