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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 result = map_space_->AllocateRaw(size_in_bytes); | 262 result = map_space_->AllocateRaw(size_in_bytes); |
263 } | 263 } |
264 if (result->IsFailure()) old_gen_exhausted_ = true; | 264 if (result->IsFailure()) old_gen_exhausted_ = true; |
265 if (profiler->is_tracking_allocations() && result->To(&object)) { | 265 if (profiler->is_tracking_allocations() && result->To(&object)) { |
266 profiler->AllocationEvent(object->address(), size_in_bytes); | 266 profiler->AllocationEvent(object->address(), size_in_bytes); |
267 } | 267 } |
268 return result; | 268 return result; |
269 } | 269 } |
270 | 270 |
271 | 271 |
272 MaybeObject* Heap::NumberFromInt32( | |
273 int32_t value, PretenureFlag pretenure) { | |
274 if (Smi::IsValid(value)) return Smi::FromInt(value); | |
275 // Bypass NumberFromDouble to avoid various redundant checks. | |
276 return AllocateHeapNumber(FastI2D(value), pretenure); | |
277 } | |
278 | |
279 | |
280 MaybeObject* Heap::NumberFromUint32( | 272 MaybeObject* Heap::NumberFromUint32( |
281 uint32_t value, PretenureFlag pretenure) { | 273 uint32_t value, PretenureFlag pretenure) { |
282 if (static_cast<int32_t>(value) >= 0 && | 274 if (static_cast<int32_t>(value) >= 0 && |
283 Smi::IsValid(static_cast<int32_t>(value))) { | 275 Smi::IsValid(static_cast<int32_t>(value))) { |
284 return Smi::FromInt(static_cast<int32_t>(value)); | 276 return Smi::FromInt(static_cast<int32_t>(value)); |
285 } | 277 } |
286 // Bypass NumberFromDouble to avoid various redundant checks. | 278 // Bypass NumberFromDouble to avoid various redundant checks. |
287 return AllocateHeapNumber(FastUI2D(value), pretenure); | 279 return AllocateHeapNumber(FastUI2D(value), pretenure); |
288 } | 280 } |
289 | 281 |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 808 |
817 | 809 |
818 double GCTracer::SizeOfHeapObjects() { | 810 double GCTracer::SizeOfHeapObjects() { |
819 return (static_cast<double>(heap_->SizeOfObjects())) / MB; | 811 return (static_cast<double>(heap_->SizeOfObjects())) / MB; |
820 } | 812 } |
821 | 813 |
822 | 814 |
823 } } // namespace v8::internal | 815 } } // namespace v8::internal |
824 | 816 |
825 #endif // V8_HEAP_INL_H_ | 817 #endif // V8_HEAP_INL_H_ |
OLD | NEW |