Smi ranges are not symmetrical. -kMinSmiValue is not a Smi.
Review URL: http://codereview.chromium.org/9041 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@680 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
4e3bbd8247
commit
240d818bb8
@ -1261,9 +1261,15 @@ void CodeGenerator::GenerateFastCaseSwitchJumpTable(
|
|||||||
__ bind(&is_smi);
|
__ bind(&is_smi);
|
||||||
|
|
||||||
if (min_index != 0) {
|
if (min_index != 0) {
|
||||||
// small positive numbers can be immediate operands.
|
// Small positive numbers can be immediate operands.
|
||||||
if (min_index < 0) {
|
if (min_index < 0) {
|
||||||
|
// If min_index is Smi::kMinValue, -min_index is not a Smi.
|
||||||
|
if (Smi::IsValid(-min_index)) {
|
||||||
__ add(r0, r0, Operand(Smi::FromInt(-min_index)));
|
__ add(r0, r0, Operand(Smi::FromInt(-min_index)));
|
||||||
|
} else {
|
||||||
|
__ add(r0, r0, Operand(Smi::FromInt(-min_index - 1)));
|
||||||
|
__ add(r0, r0, Operand(Smi::FromInt(1)));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
__ sub(r0, r0, Operand(Smi::FromInt(min_index)));
|
__ sub(r0, r0, Operand(Smi::FromInt(min_index)));
|
||||||
}
|
}
|
||||||
@ -1277,7 +1283,7 @@ void CodeGenerator::GenerateFastCaseSwitchJumpTable(
|
|||||||
// the pc-register at the above add.
|
// the pc-register at the above add.
|
||||||
__ stop("Unreachable: Switch table alignment");
|
__ stop("Unreachable: Switch table alignment");
|
||||||
|
|
||||||
// table containing branch operations.
|
// Table containing branch operations.
|
||||||
for (int i = 0; i < range; i++) {
|
for (int i = 0; i < range; i++) {
|
||||||
__ b(case_targets[i]);
|
__ b(case_targets[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user