OLD | NEW |
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 MaybeObject* Heap::NumberFromInt32( | 254 MaybeObject* Heap::NumberFromInt32( |
255 int32_t value, PretenureFlag pretenure) { | 255 int32_t value, PretenureFlag pretenure) { |
256 if (Smi::IsValid(value)) return Smi::FromInt(value); | 256 if (Smi::IsValid(value)) return Smi::FromInt(value); |
257 // Bypass NumberFromDouble to avoid various redundant checks. | 257 // Bypass NumberFromDouble to avoid various redundant checks. |
258 return AllocateHeapNumber(FastI2D(value), pretenure); | 258 return AllocateHeapNumber(FastI2D(value), pretenure); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 MaybeObject* Heap::NumberFromUint32( | 262 MaybeObject* Heap::NumberFromUint32( |
263 uint32_t value, PretenureFlag pretenure) { | 263 uint32_t value, PretenureFlag pretenure) { |
264 if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) { | 264 if (static_cast<int32_t>(value) >= 0 && |
265 return Smi::FromInt((int32_t)value); | 265 Smi::IsValid(static_cast<int32_t>(value))) { |
| 266 return Smi::FromInt(static_cast<int32_t>(value)); |
266 } | 267 } |
267 // Bypass NumberFromDouble to avoid various redundant checks. | 268 // Bypass NumberFromDouble to avoid various redundant checks. |
268 return AllocateHeapNumber(FastUI2D(value), pretenure); | 269 return AllocateHeapNumber(FastUI2D(value), pretenure); |
269 } | 270 } |
270 | 271 |
271 | 272 |
272 void Heap::FinalizeExternalString(String* string) { | 273 void Heap::FinalizeExternalString(String* string) { |
273 ASSERT(string->IsExternalString()); | 274 ASSERT(string->IsExternalString()); |
274 v8::String::ExternalStringResourceBase** resource_addr = | 275 v8::String::ExternalStringResourceBase** resource_addr = |
275 reinterpret_cast<v8::String::ExternalStringResourceBase**>( | 276 reinterpret_cast<v8::String::ExternalStringResourceBase**>( |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 AssertNoAllocation::~AssertNoAllocation() { } | 840 AssertNoAllocation::~AssertNoAllocation() { } |
840 DisableAssertNoAllocation::DisableAssertNoAllocation() { } | 841 DisableAssertNoAllocation::DisableAssertNoAllocation() { } |
841 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } | 842 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } |
842 | 843 |
843 #endif | 844 #endif |
844 | 845 |
845 | 846 |
846 } } // namespace v8::internal | 847 } } // namespace v8::internal |
847 | 848 |
848 #endif // V8_HEAP_INL_H_ | 849 #endif // V8_HEAP_INL_H_ |
OLD | NEW |