Index: src/elements.cc |
diff --git a/src/elements.cc b/src/elements.cc |
index a72158f7d2884584ef4ff50a23c49c193774c4f3..6258da399c6c7d1983e71a4e4cee87745b055353 100644 |
--- a/src/elements.cc |
+++ b/src/elements.cc |
@@ -2863,16 +2863,23 @@ class TypedElementsAccessor |
Handle<JSTypedArray> array = Handle<JSTypedArray>::cast(receiver); |
DCHECK(!array->WasNeutered()); |
- if (!obj_value->IsNumber()) { |
- return FillNumberSlowPath(isolate, array, obj_value, start, end); |
- } |
- |
- ctype value = 0; |
+ ctype value; |
if (obj_value->IsSmi()) { |
value = BackingStore::from_int(Smi::cast(*obj_value)->value()); |
} else { |
- DCHECK(obj_value->IsHeapNumber()); |
- value = BackingStore::from_double(HeapNumber::cast(*obj_value)->value()); |
+ Handle<HeapObject> heap_obj_value = Handle<HeapObject>::cast(obj_value); |
+ if (heap_obj_value->IsHeapNumber()) { |
+ value = BackingStore::from_double( |
+ HeapNumber::cast(*heap_obj_value)->value()); |
+ } else if (heap_obj_value->IsOddball()) { |
+ value = BackingStore::from_double( |
+ Oddball::ToNumber(Handle<Oddball>::cast(heap_obj_value))->Number()); |
+ } else if (heap_obj_value->IsString()) { |
+ value = BackingStore::from_double( |
+ String::ToNumber(Handle<String>::cast(heap_obj_value))->Number()); |
+ } else { |
+ return FillNumberSlowPath(isolate, array, obj_value, start, end); |
+ } |
} |
// Ensure indexes are within array bounds |