OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 14917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14928 array->set(index, cast_value); | 14928 array->set(index, cast_value); |
14929 } | 14929 } |
14930 return array->GetIsolate()->factory()->NewNumberFromUint(cast_value); | 14930 return array->GetIsolate()->factory()->NewNumberFromUint(cast_value); |
14931 } | 14931 } |
14932 | 14932 |
14933 | 14933 |
14934 Handle<Object> ExternalFloat32Array::SetValue( | 14934 Handle<Object> ExternalFloat32Array::SetValue( |
14935 Handle<ExternalFloat32Array> array, | 14935 Handle<ExternalFloat32Array> array, |
14936 uint32_t index, | 14936 uint32_t index, |
14937 Handle<Object> value) { | 14937 Handle<Object> value) { |
14938 float cast_value = static_cast<float>(base::OS::nan_value()); | 14938 float cast_value = std::numeric_limits<float>::quiet_NaN(); |
14939 if (index < static_cast<uint32_t>(array->length())) { | 14939 if (index < static_cast<uint32_t>(array->length())) { |
14940 if (value->IsSmi()) { | 14940 if (value->IsSmi()) { |
14941 int int_value = Handle<Smi>::cast(value)->value(); | 14941 int int_value = Handle<Smi>::cast(value)->value(); |
14942 cast_value = static_cast<float>(int_value); | 14942 cast_value = static_cast<float>(int_value); |
14943 } else if (value->IsHeapNumber()) { | 14943 } else if (value->IsHeapNumber()) { |
14944 double double_value = Handle<HeapNumber>::cast(value)->value(); | 14944 double double_value = Handle<HeapNumber>::cast(value)->value(); |
14945 cast_value = static_cast<float>(double_value); | 14945 cast_value = static_cast<float>(double_value); |
14946 } else { | 14946 } else { |
14947 // Clamp undefined to NaN (default). All other types have been | 14947 // Clamp undefined to NaN (default). All other types have been |
14948 // converted to a number type further up in the call chain. | 14948 // converted to a number type further up in the call chain. |
14949 DCHECK(value->IsUndefined()); | 14949 DCHECK(value->IsUndefined()); |
14950 } | 14950 } |
14951 array->set(index, cast_value); | 14951 array->set(index, cast_value); |
14952 } | 14952 } |
14953 return array->GetIsolate()->factory()->NewNumber(cast_value); | 14953 return array->GetIsolate()->factory()->NewNumber(cast_value); |
14954 } | 14954 } |
14955 | 14955 |
14956 | 14956 |
14957 Handle<Object> ExternalFloat64Array::SetValue( | 14957 Handle<Object> ExternalFloat64Array::SetValue( |
14958 Handle<ExternalFloat64Array> array, | 14958 Handle<ExternalFloat64Array> array, |
14959 uint32_t index, | 14959 uint32_t index, |
14960 Handle<Object> value) { | 14960 Handle<Object> value) { |
14961 double double_value = base::OS::nan_value(); | 14961 double double_value = std::numeric_limits<double>::quiet_NaN(); |
14962 if (index < static_cast<uint32_t>(array->length())) { | 14962 if (index < static_cast<uint32_t>(array->length())) { |
14963 if (value->IsNumber()) { | 14963 if (value->IsNumber()) { |
14964 double_value = value->Number(); | 14964 double_value = value->Number(); |
14965 } else { | 14965 } else { |
14966 // Clamp undefined to NaN (default). All other types have been | 14966 // Clamp undefined to NaN (default). All other types have been |
14967 // converted to a number type further up in the call chain. | 14967 // converted to a number type further up in the call chain. |
14968 DCHECK(value->IsUndefined()); | 14968 DCHECK(value->IsUndefined()); |
14969 } | 14969 } |
14970 array->set(index, double_value); | 14970 array->set(index, double_value); |
14971 } | 14971 } |
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16819 Handle<DependentCode> codes = | 16819 Handle<DependentCode> codes = |
16820 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16820 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16821 DependentCode::kPropertyCellChangedGroup, | 16821 DependentCode::kPropertyCellChangedGroup, |
16822 info->object_wrapper()); | 16822 info->object_wrapper()); |
16823 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16823 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16824 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16824 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16825 cell, info->zone()); | 16825 cell, info->zone()); |
16826 } | 16826 } |
16827 | 16827 |
16828 } } // namespace v8::internal | 16828 } } // namespace v8::internal |
OLD | NEW |