Index: src/ia32/macro-assembler-ia32.cc |
=================================================================== |
--- src/ia32/macro-assembler-ia32.cc (revision 5165) |
+++ src/ia32/macro-assembler-ia32.cc (working copy) |
@@ -377,6 +377,12 @@ |
} |
+void MacroAssembler::AbortIfSmi(Register object) { |
+ test(object, Immediate(kSmiTagMask)); |
+ Assert(not_equal, "Operand a smi"); |
+} |
+ |
+ |
void MacroAssembler::EnterFrame(StackFrame::Type type) { |
push(ebp); |
mov(ebp, Operand(esp)); |
@@ -1497,6 +1503,45 @@ |
} |
+void MacroAssembler::JumpIfNotNumber(Register reg, |
+ TypeInfo info, |
+ Label* on_not_number) { |
+ if (FLAG_debug_code) AbortIfSmi(reg); |
+ if (!info.IsNumber()) { |
+ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
+ Factory::heap_number_map()); |
+ j(not_equal, on_not_number); |
+ } |
+} |
+ |
+ |
+void MacroAssembler::JumpIfNotInt32(Register reg, |
+ Register scratch, |
+ TypeInfo info, |
+ Label* on_not_int32) { |
+ if (FLAG_debug_code) { |
+ AbortIfSmi(reg); |
+ AbortIfNotNumber(reg); |
+ } |
+ const uint32_t non_smi_exponent = |
+ (HeapNumber::kExponentBias + 30) << HeapNumber::kExponentShift; |
+ if (!info.IsInteger32()) { |
+ bool push_pop = scratch.is(no_reg); |
+ if (push_pop) { |
+ push(reg); |
+ scratch = reg; |
+ } |
+ mov(scratch, FieldOperand(reg, HeapNumber::kExponentOffset)); |
+ and_(scratch, HeapNumber::kExponentMask); |
+ cmp(scratch, non_smi_exponent); |
+ if (push_pop) { |
+ pop(reg); |
+ } |
+ j(greater, on_not_int32); |
Lasse Reichstein
2010/08/06 08:20:12
Is this faster than using SSE2 cvttsd2si and check
Erik Corry
2010/08/09 13:13:49
Done.
|
+ } |
+} |
+ |
+ |
void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii( |
Register instance_type, |
Register scratch, |