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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 size_executable_ += reservation.size(); | 521 size_executable_ += reservation.size(); |
522 } | 522 } |
523 | 523 |
524 #ifdef DEBUG | 524 #ifdef DEBUG |
525 ZapBlock(base, CodePageGuardStartOffset()); | 525 ZapBlock(base, CodePageGuardStartOffset()); |
526 ZapBlock(base + CodePageAreaStartOffset(), body_size); | 526 ZapBlock(base + CodePageAreaStartOffset(), body_size); |
527 #endif | 527 #endif |
528 area_start = base + CodePageAreaStartOffset(); | 528 area_start = base + CodePageAreaStartOffset(); |
529 area_end = area_start + body_size; | 529 area_end = area_start + body_size; |
530 } else { | 530 } else { |
531 chunk_size = MemoryChunk::kObjectStartOffset + body_size; | 531 int object_start_offset = MemoryChunk::kObjectStartOffset; |
| 532 if (owner != NULL && owner->identity() == LO_SPACE) { |
| 533 object_start_offset = MemoryChunk::kLargeObjectStartOffset; |
| 534 } |
| 535 |
| 536 chunk_size = object_start_offset + body_size; |
532 base = AllocateAlignedMemory(chunk_size, | 537 base = AllocateAlignedMemory(chunk_size, |
533 MemoryChunk::kAlignment, | 538 MemoryChunk::kAlignment, |
534 executable, | 539 executable, |
535 &reservation); | 540 &reservation); |
536 | 541 |
537 if (base == NULL) return NULL; | 542 if (base == NULL) return NULL; |
538 | 543 |
539 #ifdef DEBUG | 544 #ifdef DEBUG |
540 ZapBlock(base, chunk_size); | 545 ZapBlock(base, chunk_size); |
541 #endif | 546 #endif |
542 | 547 |
543 area_start = base + Page::kObjectStartOffset; | 548 area_start = base + object_start_offset; |
544 area_end = base + chunk_size; | 549 area_end = base + chunk_size; |
545 } | 550 } |
546 | 551 |
547 isolate_->counters()->memory_allocated()-> | 552 isolate_->counters()->memory_allocated()-> |
548 Increment(static_cast<int>(chunk_size)); | 553 Increment(static_cast<int>(chunk_size)); |
549 | 554 |
550 LOG(isolate_, NewEvent("MemoryChunk", base, chunk_size)); | 555 LOG(isolate_, NewEvent("MemoryChunk", base, chunk_size)); |
551 if (owner != NULL) { | 556 if (owner != NULL) { |
552 ObjectSpace space = static_cast<ObjectSpace>(1 << owner->identity()); | 557 ObjectSpace space = static_cast<ObjectSpace>(1 << owner->identity()); |
553 PerformAllocationCallback(space, kAllocationActionAllocate, chunk_size); | 558 PerformAllocationCallback(space, kAllocationActionAllocate, chunk_size); |
(...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 object->ShortPrint(); | 2857 object->ShortPrint(); |
2853 PrintF("\n"); | 2858 PrintF("\n"); |
2854 } | 2859 } |
2855 printf(" --------------------------------------\n"); | 2860 printf(" --------------------------------------\n"); |
2856 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 2861 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
2857 } | 2862 } |
2858 | 2863 |
2859 #endif // DEBUG | 2864 #endif // DEBUG |
2860 | 2865 |
2861 } } // namespace v8::internal | 2866 } } // namespace v8::internal |
OLD | NEW |