}
}
- virtual void Set(Handle<JSObject> holder, uint32_t key,
- Handle<FixedArrayBase> backing_store,
+ virtual void Set(Handle<FixedArrayBase> backing_store, uint32_t key,
Handle<Object> value) final {
- ElementsAccessorSubclass::SetImpl(holder, key, backing_store, value);
+ ElementsAccessorSubclass::SetImpl(backing_store, key, value);
}
- static void SetImpl(Handle<JSObject> obj, uint32_t key,
- Handle<FixedArrayBase> backing_store,
+ static void SetImpl(Handle<FixedArrayBase> backing_store, uint32_t key,
Handle<Object> value) {
- CHECK(key <
- ElementsAccessorSubclass::GetCapacityImpl(*obj, *backing_store));
- BackingStore::SetValue(obj, Handle<BackingStore>::cast(backing_store), key,
+ BackingStore::SetValue(Handle<BackingStore>::cast(backing_store), key,
value);
}
return isolate->factory()->the_hole_value();
}
- static void SetImpl(Handle<JSObject> obj, uint32_t key,
- Handle<FixedArrayBase> store, Handle<Object> value) {
+ static void SetImpl(Handle<FixedArrayBase> store, uint32_t key,
+ Handle<Object> value) {
Handle<SeededNumberDictionary> backing_store =
Handle<SeededNumberDictionary>::cast(store);
int entry = backing_store->FindEntry(key);
}
}
- static void SetImpl(Handle<JSObject> obj, uint32_t key,
- Handle<FixedArrayBase> store, Handle<Object> value) {
+ static void SetImpl(Handle<FixedArrayBase> store, uint32_t key,
+ Handle<Object> value) {
Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(store);
Object* probe = GetParameterMapArg(*parameter_map, key);
if (!probe->IsTheHole()) {
context->set(context_index, *value);
} else {
Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)));
- ElementsAccessor::ForArray(arguments)->Set(obj, key, arguments, value);
+ ElementsAccessor::ForArray(arguments)->Set(arguments, key, value);
}
}
}
-void FixedArray::SetValue(Handle<JSObject> holder, Handle<FixedArray> array,
- uint32_t index, Handle<Object> value) {
+void FixedArray::SetValue(Handle<FixedArray> array, uint32_t index,
+ Handle<Object> value) {
array->set(index, *value);
}
-void FixedDoubleArray::SetValue(Handle<JSObject> holder,
- Handle<FixedDoubleArray> array, uint32_t index,
+void FixedDoubleArray::SetValue(Handle<FixedDoubleArray> array, uint32_t index,
Handle<Object> value) {
array->set(index, value->Number());
}
void ExternalUint8ClampedArray::SetValue(
- Handle<JSObject> holder, Handle<ExternalUint8ClampedArray> array,
- uint32_t index, Handle<Object> value) {
+ Handle<ExternalUint8ClampedArray> array, uint32_t index,
+ Handle<Object> value) {
uint8_t clamped_value = 0;
- Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder);
- if (!view->WasNeutered()) {
- if (index < static_cast<uint32_t>(array->length())) {
- if (value->IsSmi()) {
- int int_value = Handle<Smi>::cast(value)->value();
- if (int_value < 0) {
- clamped_value = 0;
- } else if (int_value > 255) {
- clamped_value = 255;
- } else {
- clamped_value = static_cast<uint8_t>(int_value);
- }
- } else if (value->IsHeapNumber()) {
- double double_value = Handle<HeapNumber>::cast(value)->value();
- if (!(double_value > 0)) {
- // NaN and less than zero clamp to zero.
- clamped_value = 0;
- } else if (double_value > 255) {
- // Greater than 255 clamp to 255.
- clamped_value = 255;
- } else {
- // Other doubles are rounded to the nearest integer.
- clamped_value = static_cast<uint8_t>(lrint(double_value));
- }
- } else {
- // Clamp undefined to zero (default). All other types have been
- // converted to a number type further up in the call chain.
- DCHECK(value->IsUndefined());
- }
- array->set(index, clamped_value);
+ if (value->IsSmi()) {
+ int int_value = Handle<Smi>::cast(value)->value();
+ if (int_value < 0) {
+ clamped_value = 0;
+ } else if (int_value > 255) {
+ clamped_value = 255;
+ } else {
+ clamped_value = static_cast<uint8_t>(int_value);
+ }
+ } else if (value->IsHeapNumber()) {
+ double double_value = Handle<HeapNumber>::cast(value)->value();
+ if (!(double_value > 0)) {
+ // NaN and less than zero clamp to zero.
+ clamped_value = 0;
+ } else if (double_value > 255) {
+ // Greater than 255 clamp to 255.
+ clamped_value = 255;
+ } else {
+ // Other doubles are rounded to the nearest integer.
+ clamped_value = static_cast<uint8_t>(lrint(double_value));
}
+ } else {
+ // Clamp undefined to zero (default). All other types have been
+ // converted to a number type further up in the call chain.
+ DCHECK(value->IsUndefined());
}
+ array->set(index, clamped_value);
}
template <typename ExternalArrayClass, typename ValueType>
-static void ExternalArrayIntSetter(Isolate* isolate, Handle<JSObject> holder,
- Handle<ExternalArrayClass> receiver,
+static void ExternalArrayIntSetter(Handle<ExternalArrayClass> receiver,
uint32_t index, Handle<Object> value) {
ValueType cast_value = 0;
- Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder);
- if (!view->WasNeutered()) {
- if (index < static_cast<uint32_t>(receiver->length())) {
- if (value->IsSmi()) {
- int int_value = Handle<Smi>::cast(value)->value();
- cast_value = static_cast<ValueType>(int_value);
- } else if (value->IsHeapNumber()) {
- double double_value = Handle<HeapNumber>::cast(value)->value();
- cast_value = static_cast<ValueType>(DoubleToInt32(double_value));
- } else {
- // Clamp undefined to zero (default). All other types have been
- // converted to a number type further up in the call chain.
- DCHECK(value->IsUndefined());
- }
- receiver->set(index, cast_value);
- }
+ if (value->IsSmi()) {
+ int int_value = Handle<Smi>::cast(value)->value();
+ cast_value = static_cast<ValueType>(int_value);
+ } else if (value->IsHeapNumber()) {
+ double double_value = Handle<HeapNumber>::cast(value)->value();
+ cast_value = static_cast<ValueType>(DoubleToInt32(double_value));
+ } else {
+ // Clamp undefined to zero (default). All other types have been
+ // converted to a number type further up in the call chain.
+ DCHECK(value->IsUndefined());
}
+ receiver->set(index, cast_value);
}
-void ExternalInt8Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalInt8Array> array,
+void ExternalInt8Array::SetValue(Handle<ExternalInt8Array> array,
uint32_t index, Handle<Object> value) {
- ExternalArrayIntSetter<ExternalInt8Array, int8_t>(array->GetIsolate(), holder,
- array, index, value);
+ ExternalArrayIntSetter<ExternalInt8Array, int8_t>(array, index, value);
}
-void ExternalUint8Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalUint8Array> array,
+void ExternalUint8Array::SetValue(Handle<ExternalUint8Array> array,
uint32_t index, Handle<Object> value) {
- ExternalArrayIntSetter<ExternalUint8Array, uint8_t>(
- array->GetIsolate(), holder, array, index, value);
+ ExternalArrayIntSetter<ExternalUint8Array, uint8_t>(array, index, value);
}
-void ExternalInt16Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalInt16Array> array,
+void ExternalInt16Array::SetValue(Handle<ExternalInt16Array> array,
uint32_t index, Handle<Object> value) {
- ExternalArrayIntSetter<ExternalInt16Array, int16_t>(
- array->GetIsolate(), holder, array, index, value);
+ ExternalArrayIntSetter<ExternalInt16Array, int16_t>(array, index, value);
}
-void ExternalUint16Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalUint16Array> array,
+void ExternalUint16Array::SetValue(Handle<ExternalUint16Array> array,
uint32_t index, Handle<Object> value) {
- ExternalArrayIntSetter<ExternalUint16Array, uint16_t>(
- array->GetIsolate(), holder, array, index, value);
+ ExternalArrayIntSetter<ExternalUint16Array, uint16_t>(array, index, value);
}
-void ExternalInt32Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalInt32Array> array,
+void ExternalInt32Array::SetValue(Handle<ExternalInt32Array> array,
uint32_t index, Handle<Object> value) {
- ExternalArrayIntSetter<ExternalInt32Array, int32_t>(
- array->GetIsolate(), holder, array, index, value);
+ ExternalArrayIntSetter<ExternalInt32Array, int32_t>(array, index, value);
}
-void ExternalUint32Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalUint32Array> array,
+void ExternalUint32Array::SetValue(Handle<ExternalUint32Array> array,
uint32_t index, Handle<Object> value) {
uint32_t cast_value = 0;
- Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder);
- if (!view->WasNeutered()) {
- if (index < static_cast<uint32_t>(array->length())) {
- if (value->IsSmi()) {
- int int_value = Handle<Smi>::cast(value)->value();
- cast_value = static_cast<uint32_t>(int_value);
- } else if (value->IsHeapNumber()) {
- double double_value = Handle<HeapNumber>::cast(value)->value();
- cast_value = static_cast<uint32_t>(DoubleToUint32(double_value));
- } else {
- // Clamp undefined to zero (default). All other types have been
- // converted to a number type further up in the call chain.
- DCHECK(value->IsUndefined());
- }
- array->set(index, cast_value);
- }
+ if (value->IsSmi()) {
+ int int_value = Handle<Smi>::cast(value)->value();
+ cast_value = static_cast<uint32_t>(int_value);
+ } else if (value->IsHeapNumber()) {
+ double double_value = Handle<HeapNumber>::cast(value)->value();
+ cast_value = static_cast<uint32_t>(DoubleToUint32(double_value));
+ } else {
+ // Clamp undefined to zero (default). All other types have been
+ // converted to a number type further up in the call chain.
+ DCHECK(value->IsUndefined());
}
+ array->set(index, cast_value);
}
-void ExternalFloat32Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalFloat32Array> array,
+void ExternalFloat32Array::SetValue(Handle<ExternalFloat32Array> array,
uint32_t index, Handle<Object> value) {
float cast_value = std::numeric_limits<float>::quiet_NaN();
- Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder);
- if (!view->WasNeutered()) {
- if (index < static_cast<uint32_t>(array->length())) {
- if (value->IsSmi()) {
- int int_value = Handle<Smi>::cast(value)->value();
- cast_value = static_cast<float>(int_value);
- } else if (value->IsHeapNumber()) {
- double double_value = Handle<HeapNumber>::cast(value)->value();
- cast_value = static_cast<float>(double_value);
- } else {
- // Clamp undefined to NaN (default). All other types have been
- // converted to a number type further up in the call chain.
- DCHECK(value->IsUndefined());
- }
- array->set(index, cast_value);
- }
+ if (value->IsSmi()) {
+ int int_value = Handle<Smi>::cast(value)->value();
+ cast_value = static_cast<float>(int_value);
+ } else if (value->IsHeapNumber()) {
+ double double_value = Handle<HeapNumber>::cast(value)->value();
+ cast_value = static_cast<float>(double_value);
+ } else {
+ // Clamp undefined to NaN (default). All other types have been
+ // converted to a number type further up in the call chain.
+ DCHECK(value->IsUndefined());
}
+ array->set(index, cast_value);
}
-void ExternalFloat64Array::SetValue(Handle<JSObject> holder,
- Handle<ExternalFloat64Array> array,
+void ExternalFloat64Array::SetValue(Handle<ExternalFloat64Array> array,
uint32_t index, Handle<Object> value) {
double double_value = std::numeric_limits<double>::quiet_NaN();
- Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder);
- if (!view->WasNeutered()) {
- if (index < static_cast<uint32_t>(array->length())) {
- if (value->IsNumber()) {
- double_value = value->Number();
- } else {
- // Clamp undefined to NaN (default). All other types have been
- // converted to a number type further up in the call chain.
- DCHECK(value->IsUndefined());
- }
- array->set(index, double_value);
- }
+ if (value->IsNumber()) {
+ double_value = value->Number();
+ } else {
+ // Clamp undefined to NaN (default). All other types have been
+ // converted to a number type further up in the call chain.
+ DCHECK(value->IsUndefined());
}
+ array->set(index, double_value);
}
public:
// Setter and getter for elements.
inline Object* get(int index) const;
- static void SetValue(Handle<JSObject> holder, Handle<FixedArray> array,
- uint32_t index, Handle<Object> value);
+ static void SetValue(Handle<FixedArray> array, uint32_t index,
+ Handle<Object> value);
static inline Handle<Object> get(Handle<FixedArray> array, int index);
// Setter that uses write barrier.
inline void set(int index, Object* value);
inline uint64_t get_representation(int index);
static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index);
// This accessor has to get a Number as |value|.
- static void SetValue(Handle<JSObject> holder, Handle<FixedDoubleArray> array,
- uint32_t index, Handle<Object> value);
+ static void SetValue(Handle<FixedDoubleArray> array, uint32_t index,
+ Handle<Object> value);
inline void set(int index, double value);
inline void set_the_hole(int index);
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined and clamps the converted value between 0 and 255.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalUint8ClampedArray> array, uint32_t index,
+ static void SetValue(Handle<ExternalUint8ClampedArray> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalUint8ClampedArray)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder, Handle<ExternalInt8Array> array,
- uint32_t index, Handle<Object> value);
+ static void SetValue(Handle<ExternalInt8Array> array, uint32_t index,
+ Handle<Object> value);
DECLARE_CAST(ExternalInt8Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalUint8Array> array, uint32_t index,
+ static void SetValue(Handle<ExternalUint8Array> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalUint8Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalInt16Array> array, uint32_t index,
+ static void SetValue(Handle<ExternalInt16Array> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalInt16Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalUint16Array> array, uint32_t index,
+ static void SetValue(Handle<ExternalUint16Array> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalUint16Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalInt32Array> array, uint32_t index,
+ static void SetValue(Handle<ExternalInt32Array> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalInt32Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalUint32Array> array, uint32_t index,
+ static void SetValue(Handle<ExternalUint32Array> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalUint32Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalFloat32Array> array, uint32_t index,
+ static void SetValue(Handle<ExternalFloat32Array> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalFloat32Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<ExternalFloat64Array> array, uint32_t index,
+ static void SetValue(Handle<ExternalFloat64Array> array, uint32_t index,
Handle<Object> value);
DECLARE_CAST(ExternalFloat64Array)
// This accessor applies the correct conversion from Smi, HeapNumber
// and undefined.
- static void SetValue(Handle<JSObject> holder,
- Handle<FixedTypedArray<Traits> > array, uint32_t index,
+ static void SetValue(Handle<FixedTypedArray<Traits> > array, uint32_t index,
Handle<Object> value);
DECLARE_PRINTER(FixedTypedArray)