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

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

Issue 553843002: Replace our home-grown BitCast with bit_cast from Chrome/Google3. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/property.cc » ('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 // 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 DCHECK_NE(GetHeap()->fixed_cow_array_map(), map()); 2186 DCHECK_NE(GetHeap()->fixed_cow_array_map(), map());
2187 DCHECK_EQ(FIXED_ARRAY_TYPE, map()->instance_type()); 2187 DCHECK_EQ(FIXED_ARRAY_TYPE, map()->instance_type());
2188 DCHECK(index >= 0 && index < this->length()); 2188 DCHECK(index >= 0 && index < this->length());
2189 int offset = kHeaderSize + index * kPointerSize; 2189 int offset = kHeaderSize + index * kPointerSize;
2190 WRITE_FIELD(this, offset, value); 2190 WRITE_FIELD(this, offset, value);
2191 WRITE_BARRIER(GetHeap(), this, offset, value); 2191 WRITE_BARRIER(GetHeap(), this, offset, value);
2192 } 2192 }
2193 2193
2194 2194
2195 inline bool FixedDoubleArray::is_the_hole_nan(double value) { 2195 inline bool FixedDoubleArray::is_the_hole_nan(double value) {
2196 return BitCast<uint64_t, double>(value) == kHoleNanInt64; 2196 return bit_cast<uint64_t, double>(value) == kHoleNanInt64;
2197 } 2197 }
2198 2198
2199 2199
2200 inline double FixedDoubleArray::hole_nan_as_double() { 2200 inline double FixedDoubleArray::hole_nan_as_double() {
2201 return BitCast<double, uint64_t>(kHoleNanInt64); 2201 return bit_cast<double, uint64_t>(kHoleNanInt64);
2202 } 2202 }
2203 2203
2204 2204
2205 inline double FixedDoubleArray::canonical_not_the_hole_nan_as_double() { 2205 inline double FixedDoubleArray::canonical_not_the_hole_nan_as_double() {
2206 DCHECK(BitCast<uint64_t>(base::OS::nan_value()) != kHoleNanInt64); 2206 DCHECK(bit_cast<uint64_t>(base::OS::nan_value()) != kHoleNanInt64);
2207 DCHECK((BitCast<uint64_t>(base::OS::nan_value()) >> 32) != kHoleNanUpper32); 2207 DCHECK((bit_cast<uint64_t>(base::OS::nan_value()) >> 32) != kHoleNanUpper32);
2208 return base::OS::nan_value(); 2208 return base::OS::nan_value();
2209 } 2209 }
2210 2210
2211 2211
2212 double FixedDoubleArray::get_scalar(int index) { 2212 double FixedDoubleArray::get_scalar(int index) {
2213 DCHECK(map() != GetHeap()->fixed_cow_array_map() && 2213 DCHECK(map() != GetHeap()->fixed_cow_array_map() &&
2214 map() != GetHeap()->fixed_array_map()); 2214 map() != GetHeap()->fixed_array_map());
2215 DCHECK(index >= 0 && index < this->length()); 2215 DCHECK(index >= 0 && index < this->length());
2216 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); 2216 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize);
2217 DCHECK(!is_the_hole_nan(result)); 2217 DCHECK(!is_the_hole_nan(result));
(...skipping 5029 matching lines...) Expand 10 before | Expand all | Expand 10 after
7247 #undef READ_SHORT_FIELD 7247 #undef READ_SHORT_FIELD
7248 #undef WRITE_SHORT_FIELD 7248 #undef WRITE_SHORT_FIELD
7249 #undef READ_BYTE_FIELD 7249 #undef READ_BYTE_FIELD
7250 #undef WRITE_BYTE_FIELD 7250 #undef WRITE_BYTE_FIELD
7251 #undef NOBARRIER_READ_BYTE_FIELD 7251 #undef NOBARRIER_READ_BYTE_FIELD
7252 #undef NOBARRIER_WRITE_BYTE_FIELD 7252 #undef NOBARRIER_WRITE_BYTE_FIELD
7253 7253
7254 } } // namespace v8::internal 7254 } } // namespace v8::internal
7255 7255
7256 #endif // V8_OBJECTS_INL_H_ 7256 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/property.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698