Chromium Code Reviews| 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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 Address cur = obj->address(); | 721 Address cur = obj->address(); |
| 722 Address next = cur + obj->Size(); | 722 Address next = cur + obj->Size(); |
| 723 if ((cur <= addr) && (addr < next)) return obj; | 723 if ((cur <= addr) && (addr < next)) return obj; |
| 724 } | 724 } |
| 725 | 725 |
| 726 UNREACHABLE(); | 726 UNREACHABLE(); |
| 727 return Failure::Exception(); | 727 return Failure::Exception(); |
| 728 } | 728 } |
| 729 | 729 |
| 730 | 730 |
| 731 void PagedSpace::SetAllocationInfo(Address top, Address limit) { | |
| 732 Free(allocation_info_.top, allocation_info_.limit - allocation_info_.top); | |
| 733 allocation_info_.top = top; | |
| 734 allocation_info_.limit = limit; | |
| 735 ASSERT(allocation_info_.VerifyPagedAllocation()); | |
| 736 } | |
| 737 | |
| 738 | |
| 739 bool PagedSpace::Expand() { | 731 bool PagedSpace::Expand() { |
| 740 ASSERT(max_capacity_ % Page::kObjectAreaSize == 0); | 732 ASSERT(max_capacity_ % Page::kObjectAreaSize == 0); |
| 741 ASSERT(Capacity() % Page::kObjectAreaSize == 0); | 733 ASSERT(Capacity() % Page::kObjectAreaSize == 0); |
| 742 | 734 |
| 743 if (Capacity() == max_capacity_) return false; | 735 if (Capacity() == max_capacity_) return false; |
| 744 | 736 |
| 745 ASSERT(Capacity() < max_capacity_); | 737 ASSERT(Capacity() < max_capacity_); |
| 746 | 738 |
| 747 // Are we going to exceed capacity for this space? | 739 // Are we going to exceed capacity for this space? |
| 748 if ((Capacity() + Page::kPageSize) > max_capacity_) return false; | 740 if ((Capacity() + Page::kPageSize) > max_capacity_) return false; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1050 Address current = page->body(); | 1042 Address current = page->body(); |
| 1051 CHECK_EQ(current, to_space_.space_low()); | 1043 CHECK_EQ(current, to_space_.space_low()); |
| 1052 | 1044 |
| 1053 while (current != top()) { | 1045 while (current != top()) { |
| 1054 if (current == page->body_limit()) { | 1046 if (current == page->body_limit()) { |
| 1055 // At end of page, switch to next page. | 1047 // At end of page, switch to next page. |
| 1056 page = page->next_page(); | 1048 page = page->next_page(); |
| 1057 // Next page should be valid. | 1049 // Next page should be valid. |
| 1058 CHECK(!page->is_anchor()); | 1050 CHECK(!page->is_anchor()); |
| 1059 current = page->body(); | 1051 current = page->body(); |
| 1052 continue; | |
|
Vyacheslav Egorov (Chromium)
2011/06/14 10:59:09
I do not think this is necessary.
Erik Corry
2011/06/14 18:51:21
It made a bug go away for me.
If the last object
Lasse Reichstein
2011/06/15 06:56:27
It should be there.
There is nothing preventing to
| |
| 1060 } | 1053 } |
| 1061 // The allocation pointer should not be in the middle of an object. | 1054 // The allocation pointer should not be in the middle of an object. |
| 1062 CHECK(!page->ContainsLimit(top()) || current < top()); | 1055 CHECK(!page->ContainsLimit(top()) || current < top()); |
| 1063 | 1056 |
| 1064 HeapObject* object = HeapObject::FromAddress(current); | 1057 HeapObject* object = HeapObject::FromAddress(current); |
| 1065 | 1058 |
| 1066 // The first word should be a map, and we expect all map pointers to | 1059 // The first word should be a map, and we expect all map pointers to |
| 1067 // be in map space. | 1060 // be in map space. |
| 1068 Map* map = object->map(); | 1061 Map* map = object->map(); |
| 1069 CHECK(map->IsMap()); | 1062 CHECK(map->IsMap()); |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2428 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { | 2421 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { |
| 2429 if (obj->IsCode()) { | 2422 if (obj->IsCode()) { |
| 2430 Code* code = Code::cast(obj); | 2423 Code* code = Code::cast(obj); |
| 2431 isolate->code_kind_statistics()[code->kind()] += code->Size(); | 2424 isolate->code_kind_statistics()[code->kind()] += code->Size(); |
| 2432 } | 2425 } |
| 2433 } | 2426 } |
| 2434 } | 2427 } |
| 2435 #endif // DEBUG | 2428 #endif // DEBUG |
| 2436 | 2429 |
| 2437 } } // namespace v8::internal | 2430 } } // namespace v8::internal |
| OLD | NEW |