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

Side by Side Diff: src/v8conversions.h

Issue 105313008: Delete unused TypeInfo class (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: xmas present for Sven Created 7 years 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/type-info.cc ('k') | src/v8globals.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 // 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 15 matching lines...) Expand all
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_V8CONVERSIONS_H_ 28 #ifndef V8_V8CONVERSIONS_H_
29 #define V8_V8CONVERSIONS_H_ 29 #define V8_V8CONVERSIONS_H_
30 30
31 #include "conversions.h" 31 #include "conversions.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36
37 static inline bool IsMinusZero(double value) {
38 static const DoubleRepresentation minus_zero(-0.0);
39 return DoubleRepresentation(value) == minus_zero;
40 }
41
42
43 // Integer32 is an integer that can be represented as a signed 32-bit
44 // integer. It has to be in the range [-2^31, 2^31 - 1].
45 // We also have to check for negative 0 as it is not an Integer32.
46 static inline bool IsInt32Double(double value) {
47 return !IsMinusZero(value) &&
48 value >= kMinInt &&
49 value <= kMaxInt &&
50 value == FastI2D(FastD2I(value));
51 }
52
53
36 // Convert from Number object to C integer. 54 // Convert from Number object to C integer.
37 inline int32_t NumberToInt32(Object* number) { 55 inline int32_t NumberToInt32(Object* number) {
38 if (number->IsSmi()) return Smi::cast(number)->value(); 56 if (number->IsSmi()) return Smi::cast(number)->value();
39 return DoubleToInt32(number->Number()); 57 return DoubleToInt32(number->Number());
40 } 58 }
41 59
42 60
43 inline uint32_t NumberToUint32(Object* number) { 61 inline uint32_t NumberToUint32(Object* number) {
44 if (number->IsSmi()) return Smi::cast(number)->value(); 62 if (number->IsSmi()) return Smi::cast(number)->value();
45 return DoubleToUint32(number->Number()); 63 return DoubleToUint32(number->Number());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 Object* number) { 104 Object* number) {
87 size_t result = 0; 105 size_t result = 0;
88 bool is_valid = TryNumberToSize(isolate, number, &result); 106 bool is_valid = TryNumberToSize(isolate, number, &result);
89 CHECK(is_valid); 107 CHECK(is_valid);
90 return result; 108 return result;
91 } 109 }
92 110
93 } } // namespace v8::internal 111 } } // namespace v8::internal
94 112
95 #endif // V8_V8CONVERSIONS_H_ 113 #endif // V8_V8CONVERSIONS_H_
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | src/v8globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698