OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2158 return Utils::OpenHandle(this)->IsForeign(); | 2158 return Utils::OpenHandle(this)->IsForeign(); |
2159 } | 2159 } |
2160 | 2160 |
2161 | 2161 |
2162 bool Value::IsInt32() const { | 2162 bool Value::IsInt32() const { |
2163 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsInt32()")) return false; | 2163 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsInt32()")) return false; |
2164 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2164 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2165 if (obj->IsSmi()) return true; | 2165 if (obj->IsSmi()) return true; |
2166 if (obj->IsNumber()) { | 2166 if (obj->IsNumber()) { |
2167 double value = obj->Number(); | 2167 double value = obj->Number(); |
| 2168 static const i::DoubleRepresentation minus_zero(-0.0); |
| 2169 i::DoubleRepresentation rep(value); |
| 2170 if (rep.bits == minus_zero.bits) { |
| 2171 return false; |
| 2172 } |
2168 return i::FastI2D(i::FastD2I(value)) == value; | 2173 return i::FastI2D(i::FastD2I(value)) == value; |
2169 } | 2174 } |
2170 return false; | 2175 return false; |
2171 } | 2176 } |
2172 | 2177 |
2173 | 2178 |
2174 bool Value::IsUint32() const { | 2179 bool Value::IsUint32() const { |
2175 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsUint32()")) return false; | 2180 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsUint32()")) return false; |
2176 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2181 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2177 if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0; | 2182 if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0; |
2178 if (obj->IsNumber()) { | 2183 if (obj->IsNumber()) { |
2179 double value = obj->Number(); | 2184 double value = obj->Number(); |
| 2185 static const i::DoubleRepresentation minus_zero(-0.0); |
| 2186 i::DoubleRepresentation rep(value); |
| 2187 if (rep.bits == minus_zero.bits) { |
| 2188 return false; |
| 2189 } |
2180 return i::FastUI2D(i::FastD2UI(value)) == value; | 2190 return i::FastUI2D(i::FastD2UI(value)) == value; |
2181 } | 2191 } |
2182 return false; | 2192 return false; |
2183 } | 2193 } |
2184 | 2194 |
2185 | 2195 |
2186 bool Value::IsDate() const { | 2196 bool Value::IsDate() const { |
2187 i::Isolate* isolate = i::Isolate::Current(); | 2197 i::Isolate* isolate = i::Isolate::Current(); |
2188 if (IsDeadCheck(isolate, "v8::Value::IsDate()")) return false; | 2198 if (IsDeadCheck(isolate, "v8::Value::IsDate()")) return false; |
2189 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2199 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
(...skipping 3958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6148 | 6158 |
6149 | 6159 |
6150 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6160 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
6151 HandleScopeImplementer* scope_implementer = | 6161 HandleScopeImplementer* scope_implementer = |
6152 reinterpret_cast<HandleScopeImplementer*>(storage); | 6162 reinterpret_cast<HandleScopeImplementer*>(storage); |
6153 scope_implementer->IterateThis(v); | 6163 scope_implementer->IterateThis(v); |
6154 return storage + ArchiveSpacePerThread(); | 6164 return storage + ArchiveSpacePerThread(); |
6155 } | 6165 } |
6156 | 6166 |
6157 } } // namespace v8::internal | 6167 } } // namespace v8::internal |
OLD | NEW |