| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 Object* result = Heap::AllocateRawTwoByteString(1); | 1552 Object* result = Heap::AllocateRawTwoByteString(1); |
| 1553 if (result->IsFailure()) return result; | 1553 if (result->IsFailure()) return result; |
| 1554 String* answer = String::cast(result); | 1554 String* answer = String::cast(result); |
| 1555 answer->Set(StringShape(answer), 0, code); | 1555 answer->Set(StringShape(answer), 0, code); |
| 1556 return answer; | 1556 return answer; |
| 1557 } | 1557 } |
| 1558 | 1558 |
| 1559 | 1559 |
| 1560 Object* Heap::AllocateByteArray(int length, PretenureFlag pretenure) { |
| 1561 if (pretenure == NOT_TENURED) { |
| 1562 return AllocateByteArray(length); |
| 1563 } |
| 1564 int size = ByteArray::SizeFor(length); |
| 1565 AllocationSpace space = |
| 1566 size > MaxHeapObjectSize() ? LO_SPACE : OLD_DATA_SPACE; |
| 1567 |
| 1568 Object* result = AllocateRaw(size, space, OLD_DATA_SPACE); |
| 1569 |
| 1570 if (result->IsFailure()) return result; |
| 1571 |
| 1572 reinterpret_cast<Array*>(result)->set_map(byte_array_map()); |
| 1573 reinterpret_cast<Array*>(result)->set_length(length); |
| 1574 return result; |
| 1575 } |
| 1576 |
| 1577 |
| 1560 Object* Heap::AllocateByteArray(int length) { | 1578 Object* Heap::AllocateByteArray(int length) { |
| 1561 int size = ByteArray::SizeFor(length); | 1579 int size = ByteArray::SizeFor(length); |
| 1562 AllocationSpace space = | 1580 AllocationSpace space = |
| 1563 size > MaxHeapObjectSize() ? LO_SPACE : NEW_SPACE; | 1581 size > MaxHeapObjectSize() ? LO_SPACE : NEW_SPACE; |
| 1564 | 1582 |
| 1565 Object* result = AllocateRaw(size, space, OLD_DATA_SPACE); | 1583 Object* result = AllocateRaw(size, space, OLD_DATA_SPACE); |
| 1566 | 1584 |
| 1567 if (result->IsFailure()) return result; | 1585 if (result->IsFailure()) return result; |
| 1568 | 1586 |
| 1569 reinterpret_cast<Array*>(result)->set_map(byte_array_map()); | 1587 reinterpret_cast<Array*>(result)->set_map(byte_array_map()); |
| (...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3251 #ifdef DEBUG | 3269 #ifdef DEBUG |
| 3252 bool Heap::GarbageCollectionGreedyCheck() { | 3270 bool Heap::GarbageCollectionGreedyCheck() { |
| 3253 ASSERT(FLAG_gc_greedy); | 3271 ASSERT(FLAG_gc_greedy); |
| 3254 if (Bootstrapper::IsActive()) return true; | 3272 if (Bootstrapper::IsActive()) return true; |
| 3255 if (disallow_allocation_failure()) return true; | 3273 if (disallow_allocation_failure()) return true; |
| 3256 return CollectGarbage(0, NEW_SPACE); | 3274 return CollectGarbage(0, NEW_SPACE); |
| 3257 } | 3275 } |
| 3258 #endif | 3276 #endif |
| 3259 | 3277 |
| 3260 } } // namespace v8::internal | 3278 } } // namespace v8::internal |
| OLD | NEW |