Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index e4e1b5901d904cf1ac69b0fd879461688eac53cb..e38c2852b4d0f28b7108676a82a5ff070d5fcb0c 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -2222,14 +2222,6 @@ int64_t FixedDoubleArray::get_representation(int index) { |
return READ_INT64_FIELD(this, kHeaderSize + index * kDoubleSize); |
} |
-MaybeObject* FixedDoubleArray::get(int index) { |
- if (is_the_hole(index)) { |
- return GetHeap()->the_hole_value(); |
- } else { |
- return GetHeap()->NumberFromDouble(get_scalar(index)); |
- } |
-} |
- |
Handle<Object> FixedDoubleArray::get(Handle<FixedDoubleArray> array, |
int index) { |
@@ -3636,15 +3628,11 @@ uint8_t ExternalUint8ClampedArray::get_scalar(int index) { |
} |
-Object* ExternalUint8ClampedArray::get(int index) { |
- return Smi::FromInt(static_cast<int>(get_scalar(index))); |
-} |
- |
- |
Handle<Object> ExternalUint8ClampedArray::get( |
Handle<ExternalUint8ClampedArray> array, |
int index) { |
- return handle(array->get(index), array->GetIsolate()); |
+ return Handle<Smi>(Smi::FromInt(array->get_scalar(index)), |
+ array->GetIsolate()); |
} |
@@ -3674,14 +3662,10 @@ int8_t ExternalInt8Array::get_scalar(int index) { |
} |
-Object* ExternalInt8Array::get(int index) { |
- return Smi::FromInt(static_cast<int>(get_scalar(index))); |
-} |
- |
- |
Handle<Object> ExternalInt8Array::get(Handle<ExternalInt8Array> array, |
int index) { |
- return handle(array->get(index), array->GetIsolate()); |
+ return Handle<Smi>(Smi::FromInt(array->get_scalar(index)), |
+ array->GetIsolate()); |
} |
@@ -3699,14 +3683,10 @@ uint8_t ExternalUint8Array::get_scalar(int index) { |
} |
-Object* ExternalUint8Array::get(int index) { |
- return Smi::FromInt(static_cast<int>(get_scalar(index))); |
-} |
- |
- |
Handle<Object> ExternalUint8Array::get(Handle<ExternalUint8Array> array, |
int index) { |
- return handle(array->get(index), array->GetIsolate()); |
+ return Handle<Smi>(Smi::FromInt(array->get_scalar(index)), |
+ array->GetIsolate()); |
} |
@@ -3724,14 +3704,10 @@ int16_t ExternalInt16Array::get_scalar(int index) { |
} |
-Object* ExternalInt16Array::get(int index) { |
- return Smi::FromInt(static_cast<int>(get_scalar(index))); |
-} |
- |
- |
Handle<Object> ExternalInt16Array::get(Handle<ExternalInt16Array> array, |
int index) { |
- return handle(array->get(index), array->GetIsolate()); |
+ return Handle<Smi>(Smi::FromInt(array->get_scalar(index)), |
+ array->GetIsolate()); |
} |
@@ -3749,14 +3725,10 @@ uint16_t ExternalUint16Array::get_scalar(int index) { |
} |
-Object* ExternalUint16Array::get(int index) { |
- return Smi::FromInt(static_cast<int>(get_scalar(index))); |
-} |
- |
- |
Handle<Object> ExternalUint16Array::get(Handle<ExternalUint16Array> array, |
int index) { |
- return handle(array->get(index), array->GetIsolate()); |
+ return Handle<Smi>(Smi::FromInt(array->get_scalar(index)), |
+ array->GetIsolate()); |
} |
@@ -3774,11 +3746,6 @@ int32_t ExternalInt32Array::get_scalar(int index) { |
} |
-MaybeObject* ExternalInt32Array::get(int index) { |
- return GetHeap()->NumberFromInt32(get_scalar(index)); |
-} |
- |
- |
Handle<Object> ExternalInt32Array::get(Handle<ExternalInt32Array> array, |
int index) { |
return array->GetIsolate()->factory()-> |
@@ -3800,11 +3767,6 @@ uint32_t ExternalUint32Array::get_scalar(int index) { |
} |
-MaybeObject* ExternalUint32Array::get(int index) { |
- return GetHeap()->NumberFromUint32(get_scalar(index)); |
-} |
- |
- |
Handle<Object> ExternalUint32Array::get(Handle<ExternalUint32Array> array, |
int index) { |
return array->GetIsolate()->factory()-> |
@@ -3826,11 +3788,6 @@ float ExternalFloat32Array::get_scalar(int index) { |
} |
-MaybeObject* ExternalFloat32Array::get(int index) { |
- return GetHeap()->NumberFromDouble(get_scalar(index)); |
-} |
- |
- |
Handle<Object> ExternalFloat32Array::get(Handle<ExternalFloat32Array> array, |
int index) { |
return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index)); |
@@ -3851,11 +3808,6 @@ double ExternalFloat64Array::get_scalar(int index) { |
} |
-MaybeObject* ExternalFloat64Array::get(int index) { |
- return GetHeap()->NumberFromDouble(get_scalar(index)); |
-} |
- |
- |
Handle<Object> ExternalFloat64Array::get(Handle<ExternalFloat64Array> array, |
int index) { |
return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index)); |
@@ -4003,50 +3955,34 @@ double FixedTypedArray<Float64ArrayTraits>::from_double(double value) { |
template <class Traits> |
-MaybeObject* FixedTypedArray<Traits>::get(int index) { |
- return Traits::ToObject(GetHeap(), get_scalar(index)); |
-} |
- |
-template <class Traits> |
Handle<Object> FixedTypedArray<Traits>::get( |
Handle<FixedTypedArray<Traits> > array, |
int index) { |
return Traits::ToHandle(array->GetIsolate(), array->get_scalar(index)); |
} |
+ |
template <class Traits> |
-MaybeObject* FixedTypedArray<Traits>::SetValue(uint32_t index, Object* value) { |
+Handle<Object> FixedTypedArray<Traits>::SetValue( |
+ Handle<FixedTypedArray<Traits> > array, |
+ uint32_t index, |
+ Handle<Object> value) { |
ElementType cast_value = Traits::defaultValue(); |
- if (index < static_cast<uint32_t>(length())) { |
+ if (index < static_cast<uint32_t>(array->length())) { |
if (value->IsSmi()) { |
- int int_value = Smi::cast(value)->value(); |
+ int int_value = Handle<Smi>::cast(value)->value(); |
cast_value = from_int(int_value); |
} else if (value->IsHeapNumber()) { |
- double double_value = HeapNumber::cast(value)->value(); |
+ double double_value = Handle<HeapNumber>::cast(value)->value(); |
cast_value = from_double(double_value); |
} else { |
// Clamp undefined to the default value. All other types have been |
// converted to a number type further up in the call chain. |
ASSERT(value->IsUndefined()); |
} |
- set(index, cast_value); |
+ array->set(index, cast_value); |
} |
- return Traits::ToObject(GetHeap(), cast_value); |
-} |
- |
-template <class Traits> |
-Handle<Object> FixedTypedArray<Traits>::SetValue( |
- Handle<FixedTypedArray<Traits> > array, |
- uint32_t index, |
- Handle<Object> value) { |
- CALL_HEAP_FUNCTION(array->GetIsolate(), |
- array->SetValue(index, *value), |
- Object); |
-} |
- |
- |
-MaybeObject* Uint8ArrayTraits::ToObject(Heap*, uint8_t scalar) { |
- return Smi::FromInt(scalar); |
+ return Traits::ToHandle(array->GetIsolate(), cast_value); |
} |
@@ -4055,82 +3991,42 @@ Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) { |
} |
-MaybeObject* Uint8ClampedArrayTraits::ToObject(Heap*, uint8_t scalar) { |
- return Smi::FromInt(scalar); |
-} |
- |
- |
Handle<Object> Uint8ClampedArrayTraits::ToHandle(Isolate* isolate, |
uint8_t scalar) { |
return handle(Smi::FromInt(scalar), isolate); |
} |
-MaybeObject* Int8ArrayTraits::ToObject(Heap*, int8_t scalar) { |
- return Smi::FromInt(scalar); |
-} |
- |
- |
Handle<Object> Int8ArrayTraits::ToHandle(Isolate* isolate, int8_t scalar) { |
return handle(Smi::FromInt(scalar), isolate); |
} |
-MaybeObject* Uint16ArrayTraits::ToObject(Heap*, uint16_t scalar) { |
- return Smi::FromInt(scalar); |
-} |
- |
- |
Handle<Object> Uint16ArrayTraits::ToHandle(Isolate* isolate, uint16_t scalar) { |
return handle(Smi::FromInt(scalar), isolate); |
} |
-MaybeObject* Int16ArrayTraits::ToObject(Heap*, int16_t scalar) { |
- return Smi::FromInt(scalar); |
-} |
- |
- |
Handle<Object> Int16ArrayTraits::ToHandle(Isolate* isolate, int16_t scalar) { |
return handle(Smi::FromInt(scalar), isolate); |
} |
-MaybeObject* Uint32ArrayTraits::ToObject(Heap* heap, uint32_t scalar) { |
- return heap->NumberFromUint32(scalar); |
-} |
- |
- |
Handle<Object> Uint32ArrayTraits::ToHandle(Isolate* isolate, uint32_t scalar) { |
return isolate->factory()->NewNumberFromUint(scalar); |
} |
-MaybeObject* Int32ArrayTraits::ToObject(Heap* heap, int32_t scalar) { |
- return heap->NumberFromInt32(scalar); |
-} |
- |
- |
Handle<Object> Int32ArrayTraits::ToHandle(Isolate* isolate, int32_t scalar) { |
return isolate->factory()->NewNumberFromInt(scalar); |
} |
-MaybeObject* Float32ArrayTraits::ToObject(Heap* heap, float scalar) { |
- return heap->NumberFromDouble(scalar); |
-} |
- |
- |
Handle<Object> Float32ArrayTraits::ToHandle(Isolate* isolate, float scalar) { |
return isolate->factory()->NewNumber(scalar); |
} |
-MaybeObject* Float64ArrayTraits::ToObject(Heap* heap, double scalar) { |
- return heap->NumberFromDouble(scalar); |
-} |
- |
- |
Handle<Object> Float64ArrayTraits::ToHandle(Isolate* isolate, double scalar) { |
return isolate->factory()->NewNumber(scalar); |
} |