Commit a453a3ce authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

ARM: Add multiplication and modulus to the type recording binary operation stub.

For now the smi part only handles power of two right hand side operands.

Fixed a bug when loading floating point value into core registers with VFP supported.
Review URL: http://codereview.chromium.org/6312059

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6560 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 72b1d0c7
This diff is collapsed.
...@@ -1550,7 +1550,11 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr, ...@@ -1550,7 +1550,11 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr,
void FullCodeGenerator::EmitBinaryOp(Token::Value op, void FullCodeGenerator::EmitBinaryOp(Token::Value op,
OverwriteMode mode) { OverwriteMode mode) {
__ pop(r1); __ pop(r1);
if (op == Token::ADD || op == Token::SUB || op == Token::MUL) { if (op == Token::ADD ||
op == Token::SUB ||
op == Token::MUL ||
op == Token::DIV ||
op == Token::MOD) {
TypeRecordingBinaryOpStub stub(op, mode); TypeRecordingBinaryOpStub stub(op, mode);
__ CallStub(&stub); __ CallStub(&stub);
} else { } else {
......
...@@ -1053,11 +1053,8 @@ void LCodeGen::DoModI(LModI* instr) { ...@@ -1053,11 +1053,8 @@ void LCodeGen::DoModI(LModI* instr) {
} }
// Check for power of two on the right hand side. // Check for power of two on the right hand side.
__ sub(scratch, right, Operand(1), SetCC); __ JumpIfNotPowerOfTwoOrZero(right, scratch, &call_stub);
__ b(mi, &call_stub); // Perform modulo operation (scratch contains right - 1).
__ tst(scratch, right);
__ b(ne, &call_stub);
// Perform modulo operation.
__ and_(result, scratch, Operand(left)); __ and_(result, scratch, Operand(left));
__ bind(&call_stub); __ bind(&call_stub);
......
...@@ -1954,6 +1954,17 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, ...@@ -1954,6 +1954,17 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
} }
void MacroAssembler::JumpIfNotPowerOfTwoOrZero(
Register reg,
Register scratch,
Label* not_power_of_two_or_zero) {
sub(scratch, reg, Operand(1), SetCC);
b(mi, not_power_of_two_or_zero);
tst(scratch, reg);
b(ne, not_power_of_two_or_zero);
}
void MacroAssembler::JumpIfNotBothSmi(Register reg1, void MacroAssembler::JumpIfNotBothSmi(Register reg1,
Register reg2, Register reg2,
Label* on_not_both_smi) { Label* on_not_both_smi) {
...@@ -2102,7 +2113,7 @@ void MacroAssembler::CopyFields(Register dst, ...@@ -2102,7 +2113,7 @@ void MacroAssembler::CopyFields(Register dst,
void MacroAssembler::CountLeadingZeros(Register zeros, // Answer. void MacroAssembler::CountLeadingZeros(Register zeros, // Answer.
Register source, // Input. Register source, // Input.
Register scratch) { Register scratch) {
ASSERT(!zeros.is(source) || !source.is(zeros)); ASSERT(!zeros.is(source) || !source.is(scratch));
ASSERT(!zeros.is(scratch)); ASSERT(!zeros.is(scratch));
ASSERT(!scratch.is(ip)); ASSERT(!scratch.is(ip));
ASSERT(!source.is(ip)); ASSERT(!source.is(ip));
......
...@@ -706,6 +706,17 @@ class MacroAssembler: public Assembler { ...@@ -706,6 +706,17 @@ class MacroAssembler: public Assembler {
void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
bool allow_stub_calls() { return allow_stub_calls_; } bool allow_stub_calls() { return allow_stub_calls_; }
// ---------------------------------------------------------------------------
// Number utilities
// Check whether the value of reg is a power of two and not zero. If not
// control continues at the label not_power_of_two. If reg is a power of two
// the register scratch contains the value of (reg - 1) when control falls
// through.
void JumpIfNotPowerOfTwoOrZero(Register reg,
Register scratch,
Label* not_power_of_two_or_zero);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Smi utilities // Smi utilities
......
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