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

Side by Side Diff: src/objects-inl.h

Issue 14362023: Replace math.h with cmath (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 years, 8 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 | « src/objects-debug.cc ('k') | src/platform.h » ('j') | 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 853
854 double Object::Number() { 854 double Object::Number() {
855 ASSERT(IsNumber()); 855 ASSERT(IsNumber());
856 return IsSmi() 856 return IsSmi()
857 ? static_cast<double>(reinterpret_cast<Smi*>(this)->value()) 857 ? static_cast<double>(reinterpret_cast<Smi*>(this)->value())
858 : reinterpret_cast<HeapNumber*>(this)->value(); 858 : reinterpret_cast<HeapNumber*>(this)->value();
859 } 859 }
860 860
861 861
862 bool Object::IsNaN() { 862 bool Object::IsNaN() {
863 return this->IsHeapNumber() && isnan(HeapNumber::cast(this)->value()); 863 return this->IsHeapNumber() && std::isnan(HeapNumber::cast(this)->value());
864 } 864 }
865 865
866 866
867 MaybeObject* Object::ToSmi() { 867 MaybeObject* Object::ToSmi() {
868 if (IsSmi()) return this; 868 if (IsSmi()) return this;
869 if (IsHeapNumber()) { 869 if (IsHeapNumber()) {
870 double value = HeapNumber::cast(this)->value(); 870 double value = HeapNumber::cast(this)->value();
871 int int_value = FastD2I(value); 871 int int_value = FastD2I(value);
872 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { 872 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
873 return Smi::FromInt(int_value); 873 return Smi::FromInt(int_value);
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 } else { 1914 } else {
1915 return GetHeap()->NumberFromDouble(get_scalar(index)); 1915 return GetHeap()->NumberFromDouble(get_scalar(index));
1916 } 1916 }
1917 } 1917 }
1918 1918
1919 1919
1920 void FixedDoubleArray::set(int index, double value) { 1920 void FixedDoubleArray::set(int index, double value) {
1921 ASSERT(map() != HEAP->fixed_cow_array_map() && 1921 ASSERT(map() != HEAP->fixed_cow_array_map() &&
1922 map() != HEAP->fixed_array_map()); 1922 map() != HEAP->fixed_array_map());
1923 int offset = kHeaderSize + index * kDoubleSize; 1923 int offset = kHeaderSize + index * kDoubleSize;
1924 if (isnan(value)) value = canonical_not_the_hole_nan_as_double(); 1924 if (std::isnan(value)) value = canonical_not_the_hole_nan_as_double();
1925 WRITE_DOUBLE_FIELD(this, offset, value); 1925 WRITE_DOUBLE_FIELD(this, offset, value);
1926 } 1926 }
1927 1927
1928 1928
1929 void FixedDoubleArray::set_the_hole(int index) { 1929 void FixedDoubleArray::set_the_hole(int index) {
1930 ASSERT(map() != HEAP->fixed_cow_array_map() && 1930 ASSERT(map() != HEAP->fixed_cow_array_map() &&
1931 map() != HEAP->fixed_array_map()); 1931 map() != HEAP->fixed_array_map());
1932 int offset = kHeaderSize + index * kDoubleSize; 1932 int offset = kHeaderSize + index * kDoubleSize;
1933 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); 1933 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
1934 } 1934 }
(...skipping 4184 matching lines...) Expand 10 before | Expand all | Expand 10 after
6119 #undef WRITE_UINT32_FIELD 6119 #undef WRITE_UINT32_FIELD
6120 #undef READ_SHORT_FIELD 6120 #undef READ_SHORT_FIELD
6121 #undef WRITE_SHORT_FIELD 6121 #undef WRITE_SHORT_FIELD
6122 #undef READ_BYTE_FIELD 6122 #undef READ_BYTE_FIELD
6123 #undef WRITE_BYTE_FIELD 6123 #undef WRITE_BYTE_FIELD
6124 6124
6125 6125
6126 } } // namespace v8::internal 6126 } } // namespace v8::internal
6127 6127
6128 #endif // V8_OBJECTS_INL_H_ 6128 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698