| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 7295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7306 static Object* ExternalArrayIntSetter(ExternalArrayClass* receiver, | 7306 static Object* ExternalArrayIntSetter(ExternalArrayClass* receiver, |
| 7307 uint32_t index, | 7307 uint32_t index, |
| 7308 Object* value) { | 7308 Object* value) { |
| 7309 ValueType cast_value = 0; | 7309 ValueType cast_value = 0; |
| 7310 if (index < static_cast<uint32_t>(receiver->length())) { | 7310 if (index < static_cast<uint32_t>(receiver->length())) { |
| 7311 if (value->IsSmi()) { | 7311 if (value->IsSmi()) { |
| 7312 int int_value = Smi::cast(value)->value(); | 7312 int int_value = Smi::cast(value)->value(); |
| 7313 cast_value = static_cast<ValueType>(int_value); | 7313 cast_value = static_cast<ValueType>(int_value); |
| 7314 } else if (value->IsHeapNumber()) { | 7314 } else if (value->IsHeapNumber()) { |
| 7315 double double_value = HeapNumber::cast(value)->value(); | 7315 double double_value = HeapNumber::cast(value)->value(); |
| 7316 cast_value = static_cast<ValueType>(double_value); | 7316 cast_value = static_cast<ValueType>(DoubleToInt32(double_value)); |
| 7317 } else { | 7317 } else { |
| 7318 // Clamp undefined to zero (default). All other types have been | 7318 // Clamp undefined to zero (default). All other types have been |
| 7319 // converted to a number type further up in the call chain. | 7319 // converted to a number type further up in the call chain. |
| 7320 ASSERT(value->IsUndefined()); | 7320 ASSERT(value->IsUndefined()); |
| 7321 } | 7321 } |
| 7322 receiver->set(index, cast_value); | 7322 receiver->set(index, cast_value); |
| 7323 } else { | 7323 } else { |
| 7324 return Top::Throw(*Factory::NewIndexError(index)); | 7324 return Top::Throw(*Factory::NewIndexError(index)); |
| 7325 } | 7325 } |
| 7326 return Heap::NumberFromInt32(cast_value); | 7326 return Heap::NumberFromInt32(cast_value); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7358 | 7358 |
| 7359 | 7359 |
| 7360 Object* ExternalUnsignedIntArray::SetValue(uint32_t index, Object* value) { | 7360 Object* ExternalUnsignedIntArray::SetValue(uint32_t index, Object* value) { |
| 7361 uint32_t cast_value = 0; | 7361 uint32_t cast_value = 0; |
| 7362 if (index < static_cast<uint32_t>(length())) { | 7362 if (index < static_cast<uint32_t>(length())) { |
| 7363 if (value->IsSmi()) { | 7363 if (value->IsSmi()) { |
| 7364 int int_value = Smi::cast(value)->value(); | 7364 int int_value = Smi::cast(value)->value(); |
| 7365 cast_value = static_cast<uint32_t>(int_value); | 7365 cast_value = static_cast<uint32_t>(int_value); |
| 7366 } else if (value->IsHeapNumber()) { | 7366 } else if (value->IsHeapNumber()) { |
| 7367 double double_value = HeapNumber::cast(value)->value(); | 7367 double double_value = HeapNumber::cast(value)->value(); |
| 7368 cast_value = static_cast<uint32_t>(double_value); | 7368 cast_value = static_cast<uint32_t>(DoubleToUint32(double_value)); |
| 7369 } else { | 7369 } else { |
| 7370 // Clamp undefined to zero (default). All other types have been | 7370 // Clamp undefined to zero (default). All other types have been |
| 7371 // converted to a number type further up in the call chain. | 7371 // converted to a number type further up in the call chain. |
| 7372 ASSERT(value->IsUndefined()); | 7372 ASSERT(value->IsUndefined()); |
| 7373 } | 7373 } |
| 7374 set(index, cast_value); | 7374 set(index, cast_value); |
| 7375 } else { | 7375 } else { |
| 7376 return Top::Throw(*Factory::NewIndexError(index)); | 7376 return Top::Throw(*Factory::NewIndexError(index)); |
| 7377 } | 7377 } |
| 7378 return Heap::NumberFromUint32(cast_value); | 7378 return Heap::NumberFromUint32(cast_value); |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8312 if (break_point_objects()->IsUndefined()) return 0; | 8312 if (break_point_objects()->IsUndefined()) return 0; |
| 8313 // Single beak point. | 8313 // Single beak point. |
| 8314 if (!break_point_objects()->IsFixedArray()) return 1; | 8314 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8315 // Multiple break points. | 8315 // Multiple break points. |
| 8316 return FixedArray::cast(break_point_objects())->length(); | 8316 return FixedArray::cast(break_point_objects())->length(); |
| 8317 } | 8317 } |
| 8318 #endif | 8318 #endif |
| 8319 | 8319 |
| 8320 | 8320 |
| 8321 } } // namespace v8::internal | 8321 } } // namespace v8::internal |
| OLD | NEW |