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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( | 272 MaybeObject* Heap::NumberFromInt32( |
273 int32_t value, PretenureFlag pretenure) { | 273 int32_t value, PretenureFlag pretenure) { |
274 if (Smi::IsValid(value)) return Smi::FromInt(value); | 274 if (Smi::IsValid(value)) return Smi::FromInt(value); |
275 // Bypass NumberFromDouble to avoid various redundant checks. | 275 // Bypass NumberFromDouble to avoid various redundant checks. |
276 return AllocateHeapNumber(FastI2D(value), pretenure); | 276 return AllocateHeapNumber(FastI2D(value), IMMUTABLE, pretenure); |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 MaybeObject* Heap::NumberFromUint32( | 280 MaybeObject* Heap::NumberFromUint32( |
281 uint32_t value, PretenureFlag pretenure) { | 281 uint32_t value, PretenureFlag pretenure) { |
282 if (static_cast<int32_t>(value) >= 0 && | 282 if (static_cast<int32_t>(value) >= 0 && |
283 Smi::IsValid(static_cast<int32_t>(value))) { | 283 Smi::IsValid(static_cast<int32_t>(value))) { |
284 return Smi::FromInt(static_cast<int32_t>(value)); | 284 return Smi::FromInt(static_cast<int32_t>(value)); |
285 } | 285 } |
286 // Bypass NumberFromDouble to avoid various redundant checks. | 286 // Bypass NumberFromDouble to avoid various redundant checks. |
287 return AllocateHeapNumber(FastUI2D(value), pretenure); | 287 return AllocateHeapNumber(FastUI2D(value), IMMUTABLE, pretenure); |
288 } | 288 } |
289 | 289 |
290 | 290 |
291 void Heap::FinalizeExternalString(String* string) { | 291 void Heap::FinalizeExternalString(String* string) { |
292 ASSERT(string->IsExternalString()); | 292 ASSERT(string->IsExternalString()); |
293 v8::String::ExternalStringResourceBase** resource_addr = | 293 v8::String::ExternalStringResourceBase** resource_addr = |
294 reinterpret_cast<v8::String::ExternalStringResourceBase**>( | 294 reinterpret_cast<v8::String::ExternalStringResourceBase**>( |
295 reinterpret_cast<byte*>(string) + | 295 reinterpret_cast<byte*>(string) + |
296 ExternalString::kResourceOffset - | 296 ExternalString::kResourceOffset - |
297 kHeapObjectTag); | 297 kHeapObjectTag); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 | 832 |
833 | 833 |
834 double GCTracer::SizeOfHeapObjects() { | 834 double GCTracer::SizeOfHeapObjects() { |
835 return (static_cast<double>(heap_->SizeOfObjects())) / MB; | 835 return (static_cast<double>(heap_->SizeOfObjects())) / MB; |
836 } | 836 } |
837 | 837 |
838 | 838 |
839 } } // namespace v8::internal | 839 } } // namespace v8::internal |
840 | 840 |
841 #endif // V8_HEAP_INL_H_ | 841 #endif // V8_HEAP_INL_H_ |
OLD | NEW |