OLD | NEW |
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 result = cell_space_->AllocateRaw(size_in_bytes); | 222 result = cell_space_->AllocateRaw(size_in_bytes); |
223 } else { | 223 } else { |
224 ASSERT(MAP_SPACE == space); | 224 ASSERT(MAP_SPACE == space); |
225 result = map_space_->AllocateRaw(size_in_bytes); | 225 result = map_space_->AllocateRaw(size_in_bytes); |
226 } | 226 } |
227 if (result->IsFailure()) old_gen_exhausted_ = true; | 227 if (result->IsFailure()) old_gen_exhausted_ = true; |
228 return result; | 228 return result; |
229 } | 229 } |
230 | 230 |
231 | 231 |
232 MaybeObject* Heap::NumberFromInt32(int32_t value) { | 232 MaybeObject* Heap::NumberFromInt32( |
| 233 int32_t value, PretenureFlag pretenure) { |
233 if (Smi::IsValid(value)) return Smi::FromInt(value); | 234 if (Smi::IsValid(value)) return Smi::FromInt(value); |
234 // Bypass NumberFromDouble to avoid various redundant checks. | 235 // Bypass NumberFromDouble to avoid various redundant checks. |
235 return AllocateHeapNumber(FastI2D(value)); | 236 return AllocateHeapNumber(FastI2D(value), pretenure); |
236 } | 237 } |
237 | 238 |
238 | 239 |
239 MaybeObject* Heap::NumberFromUint32(uint32_t value) { | 240 MaybeObject* Heap::NumberFromUint32( |
| 241 uint32_t value, PretenureFlag pretenure) { |
240 if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) { | 242 if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) { |
241 return Smi::FromInt((int32_t)value); | 243 return Smi::FromInt((int32_t)value); |
242 } | 244 } |
243 // Bypass NumberFromDouble to avoid various redundant checks. | 245 // Bypass NumberFromDouble to avoid various redundant checks. |
244 return AllocateHeapNumber(FastUI2D(value)); | 246 return AllocateHeapNumber(FastUI2D(value), pretenure); |
245 } | 247 } |
246 | 248 |
247 | 249 |
248 void Heap::FinalizeExternalString(String* string) { | 250 void Heap::FinalizeExternalString(String* string) { |
249 ASSERT(string->IsExternalString()); | 251 ASSERT(string->IsExternalString()); |
250 v8::String::ExternalStringResourceBase** resource_addr = | 252 v8::String::ExternalStringResourceBase** resource_addr = |
251 reinterpret_cast<v8::String::ExternalStringResourceBase**>( | 253 reinterpret_cast<v8::String::ExternalStringResourceBase**>( |
252 reinterpret_cast<byte*>(string) + | 254 reinterpret_cast<byte*>(string) + |
253 ExternalString::kResourceOffset - | 255 ExternalString::kResourceOffset - |
254 kHeapObjectTag); | 256 kHeapObjectTag); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 703 |
702 | 704 |
703 Heap* _inline_get_heap_() { | 705 Heap* _inline_get_heap_() { |
704 return HEAP; | 706 return HEAP; |
705 } | 707 } |
706 | 708 |
707 | 709 |
708 } } // namespace v8::internal | 710 } } // namespace v8::internal |
709 | 711 |
710 #endif // V8_HEAP_INL_H_ | 712 #endif // V8_HEAP_INL_H_ |
OLD | NEW |