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

Unified Diff: src/codegen-arm.cc

Issue 9040: * Added check for HeapNumber in the fast-cast Smi switch. (Closed)
Patch Set: Fix ofr Issue 137. Addressed reviewer comments 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
« no previous file with comments | « no previous file | src/codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-arm.cc
diff --git a/src/codegen-arm.cc b/src/codegen-arm.cc
index 35522b19adb71c5f49637acd2a772f3f031d6adb..5bf0637ca13a07173dbec83ebf1f032742151e16 100644
--- a/src/codegen-arm.cc
+++ b/src/codegen-arm.cc
@@ -1247,6 +1247,19 @@ void CodeGenerator::GenerateFastCaseSwitchJumpTable(
ASSERT(kSmiTag == 0 && kSmiTagSize <= 2);
__ pop(r0);
+
+ // Test for a Smi value in a HeapNumber.
+ Label is_smi;
+ __ tst(r0, Operand(kSmiTagMask));
+ __ b(eq, &is_smi);
+ __ ldr(r1, MemOperand(r0, HeapObject::kMapOffset - kHeapObjectTag));
+ __ ldrb(r1, MemOperand(r1, Map::kInstanceTypeOffset - kHeapObjectTag));
+ __ cmp(r1, Operand(HEAP_NUMBER_TYPE));
+ __ b(ne, fail_label);
+ __ push(r0);
+ __ CallRuntime(Runtime::kNumberToSmi, 1);
+ __ bind(&is_smi);
+
if (min_index != 0) {
// small positive numbers can be immediate operands.
if (min_index < 0) {
« no previous file with comments | « no previous file | src/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698