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

Side by Side Diff: src/conversions.h

Issue 556563005: Fix Smi vs. HeapObject confusion in HConstants. (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 | « no previous file | src/hydrogen-instructions.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #ifndef V8_CONVERSIONS_H_ 5 #ifndef V8_CONVERSIONS_H_
6 #define V8_CONVERSIONS_H_ 6 #define V8_CONVERSIONS_H_
7 7
8 #include <limits> 8 #include <limits>
9 9
10 #include "src/base/logging.h" 10 #include "src/base/logging.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 char* DoubleToPrecisionCString(double value, int f); 146 char* DoubleToPrecisionCString(double value, int f);
147 char* DoubleToRadixCString(double value, int radix); 147 char* DoubleToRadixCString(double value, int radix);
148 148
149 149
150 static inline bool IsMinusZero(double value) { 150 static inline bool IsMinusZero(double value) {
151 static const DoubleRepresentation minus_zero(-0.0); 151 static const DoubleRepresentation minus_zero(-0.0);
152 return DoubleRepresentation(value) == minus_zero; 152 return DoubleRepresentation(value) == minus_zero;
153 } 153 }
154 154
155 155
156 static inline bool IsSmiDouble(double value) {
157 return !IsMinusZero(value) && value >= Smi::kMinValue &&
158 value <= Smi::kMaxValue && value == FastI2D(FastD2I(value));
159 }
160
161
156 // Integer32 is an integer that can be represented as a signed 32-bit 162 // Integer32 is an integer that can be represented as a signed 32-bit
157 // integer. It has to be in the range [-2^31, 2^31 - 1]. 163 // integer. It has to be in the range [-2^31, 2^31 - 1].
158 // We also have to check for negative 0 as it is not an Integer32. 164 // We also have to check for negative 0 as it is not an Integer32.
159 static inline bool IsInt32Double(double value) { 165 static inline bool IsInt32Double(double value) {
160 return !IsMinusZero(value) && 166 return !IsMinusZero(value) &&
161 value >= kMinInt && 167 value >= kMinInt &&
162 value <= kMaxInt && 168 value <= kMaxInt &&
163 value == FastI2D(FastD2I(value)); 169 value == FastI2D(FastD2I(value));
164 } 170 }
165 171
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 Object* number) { 230 Object* number) {
225 size_t result = 0; 231 size_t result = 0;
226 bool is_valid = TryNumberToSize(isolate, number, &result); 232 bool is_valid = TryNumberToSize(isolate, number, &result);
227 CHECK(is_valid); 233 CHECK(is_valid);
228 return result; 234 return result;
229 } 235 }
230 236
231 } } // namespace v8::internal 237 } } // namespace v8::internal
232 238
233 #endif // V8_CONVERSIONS_H_ 239 #endif // V8_CONVERSIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698