Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects.cc

Issue 9419003: Cast NaN to float in ExternalFloatArray::SetValue. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 11739 matching lines...) Expand 10 before | Expand all | Expand 10 after
11750 // converted to a number type further up in the call chain. 11750 // converted to a number type further up in the call chain.
11751 ASSERT(value->IsUndefined()); 11751 ASSERT(value->IsUndefined());
11752 } 11752 }
11753 set(index, cast_value); 11753 set(index, cast_value);
11754 } 11754 }
11755 return heap->NumberFromUint32(cast_value); 11755 return heap->NumberFromUint32(cast_value);
11756 } 11756 }
11757 11757
11758 11758
11759 MaybeObject* ExternalFloatArray::SetValue(uint32_t index, Object* value) { 11759 MaybeObject* ExternalFloatArray::SetValue(uint32_t index, Object* value) {
11760 float cast_value = OS::nan_value(); 11760 float cast_value = static_cast<float>(OS::nan_value());
11761 Heap* heap = GetHeap(); 11761 Heap* heap = GetHeap();
11762 if (index < static_cast<uint32_t>(length())) { 11762 if (index < static_cast<uint32_t>(length())) {
11763 if (value->IsSmi()) { 11763 if (value->IsSmi()) {
11764 int int_value = Smi::cast(value)->value(); 11764 int int_value = Smi::cast(value)->value();
11765 cast_value = static_cast<float>(int_value); 11765 cast_value = static_cast<float>(int_value);
11766 } else if (value->IsHeapNumber()) { 11766 } else if (value->IsHeapNumber()) {
11767 double double_value = HeapNumber::cast(value)->value(); 11767 double double_value = HeapNumber::cast(value)->value();
11768 cast_value = static_cast<float>(double_value); 11768 cast_value = static_cast<float>(double_value);
11769 } else { 11769 } else {
11770 // Clamp undefined to NaN (default). All other types have been 11770 // Clamp undefined to NaN (default). All other types have been
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
13071 if (break_point_objects()->IsUndefined()) return 0; 13071 if (break_point_objects()->IsUndefined()) return 0;
13072 // Single break point. 13072 // Single break point.
13073 if (!break_point_objects()->IsFixedArray()) return 1; 13073 if (!break_point_objects()->IsFixedArray()) return 1;
13074 // Multiple break points. 13074 // Multiple break points.
13075 return FixedArray::cast(break_point_objects())->length(); 13075 return FixedArray::cast(break_point_objects())->length();
13076 } 13076 }
13077 #endif // ENABLE_DEBUGGER_SUPPORT 13077 #endif // ENABLE_DEBUGGER_SUPPORT
13078 13078
13079 13079
13080 } } // namespace v8::internal 13080 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698