MIPS: Check in Lithium that allocation size in Smi range.
authorpalfia@homejinni.com <palfia@homejinni.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 3 Apr 2014 23:34:28 +0000 (23:34 +0000)
committerpalfia@homejinni.com <palfia@homejinni.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 3 Apr 2014 23:34:28 +0000 (23:34 +0000)
Port r20458 (984d99c9)

Oirginal commit message:
This is to avoid triggering an assertion from Smi::FromInt. The
generated code is unreachable, so it is not a real bug.

BUG=
R=plind44@gmail.com

Review URL: https://codereview.chromium.org/224583002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20491 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/mips/lithium-codegen-mips.cc

index 5c337e8..89620d8 100644 (file)
@@ -5371,7 +5371,13 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
     __ push(size);
   } else {
     int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
-    __ Push(Smi::FromInt(size));
+    if (size >= 0 && size <= Smi::kMaxValue) {
+      __ Push(Smi::FromInt(size));
+    } else {
+      // We should never get here at runtime => abort
+      __ stop("invalid allocation size");
+      return;
+    }
   }
 
   int flags = AllocateDoubleAlignFlag::encode(