| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 384 } |
| 385 | 385 |
| 386 | 386 |
| 387 void Page::InitializeAsAnchor(PagedSpace* owner) { | 387 void Page::InitializeAsAnchor(PagedSpace* owner) { |
| 388 set_owner(owner); | 388 set_owner(owner); |
| 389 set_prev_page(this); | 389 set_prev_page(this); |
| 390 set_next_page(this); | 390 set_next_page(this); |
| 391 } | 391 } |
| 392 | 392 |
| 393 | 393 |
| 394 NewSpacePage* NewSpacePage::Initialize(Heap* heap, Address start) { | 394 NewSpacePage* NewSpacePage::Initialize(Heap* heap, |
| 395 Address start, |
| 396 SemiSpaceId id) { |
| 395 MemoryChunk* chunk = MemoryChunk::Initialize(heap, | 397 MemoryChunk* chunk = MemoryChunk::Initialize(heap, |
| 396 start, | 398 start, |
| 397 Page::kPageSize, | 399 Page::kPageSize, |
| 398 NOT_EXECUTABLE, | 400 NOT_EXECUTABLE, |
| 399 heap->new_space()); | 401 heap->new_space()); |
| 400 chunk->initialize_scan_on_scavenge(true); | 402 chunk->initialize_scan_on_scavenge(true); |
| 401 chunk->SetFlag(MemoryChunk::IN_NEW_SPACE); | 403 chunk->SetFlag(MemoryChunk::IN_NEW_SPACE); |
| 404 if (id == kSecondSemiSpace) { |
| 405 chunk->SetFlag(MemoryChunk::SEMI_SPACE_TAG); |
| 406 } else { |
| 407 ASSERT(!chunk->IsFlagSet(MemoryChunk::SEMI_SPACE_TAG)); |
| 408 } |
| 402 heap->incremental_marking()->SetNewSpacePageFlags(chunk); | 409 heap->incremental_marking()->SetNewSpacePageFlags(chunk); |
| 403 return static_cast<NewSpacePage*>(chunk); | 410 return static_cast<NewSpacePage*>(chunk); |
| 404 } | 411 } |
| 405 | 412 |
| 406 | 413 |
| 407 MemoryChunk* MemoryChunk::Initialize(Heap* heap, | 414 MemoryChunk* MemoryChunk::Initialize(Heap* heap, |
| 408 Address base, | 415 Address base, |
| 409 size_t size, | 416 size_t size, |
| 410 Executability executable, | 417 Executability executable, |
| 411 Space* owner) { | 418 Space* owner) { |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 | 1035 |
| 1029 bool SemiSpace::Commit() { | 1036 bool SemiSpace::Commit() { |
| 1030 ASSERT(!is_committed()); | 1037 ASSERT(!is_committed()); |
| 1031 if (!heap()->isolate()->memory_allocator()->CommitBlock( | 1038 if (!heap()->isolate()->memory_allocator()->CommitBlock( |
| 1032 start_, capacity_, executable())) { | 1039 start_, capacity_, executable())) { |
| 1033 return false; | 1040 return false; |
| 1034 } | 1041 } |
| 1035 committed_ = true; | 1042 committed_ = true; |
| 1036 // TODO(gc): When more than one page is present, initialize and | 1043 // TODO(gc): When more than one page is present, initialize and |
| 1037 // chain them all. | 1044 // chain them all. |
| 1038 current_page_ = NewSpacePage::Initialize(heap(), start_); | 1045 current_page_ = NewSpacePage::Initialize(heap(), start_, id_); |
| 1039 return true; | 1046 return true; |
| 1040 } | 1047 } |
| 1041 | 1048 |
| 1042 | 1049 |
| 1043 bool SemiSpace::Uncommit() { | 1050 bool SemiSpace::Uncommit() { |
| 1044 ASSERT(is_committed()); | 1051 ASSERT(is_committed()); |
| 1045 if (!heap()->isolate()->memory_allocator()->UncommitBlock( | 1052 if (!heap()->isolate()->memory_allocator()->UncommitBlock( |
| 1046 start_, capacity_)) { | 1053 start_, capacity_)) { |
| 1047 return false; | 1054 return false; |
| 1048 } | 1055 } |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { | 2272 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { |
| 2266 if (obj->IsCode()) { | 2273 if (obj->IsCode()) { |
| 2267 Code* code = Code::cast(obj); | 2274 Code* code = Code::cast(obj); |
| 2268 isolate->code_kind_statistics()[code->kind()] += code->Size(); | 2275 isolate->code_kind_statistics()[code->kind()] += code->Size(); |
| 2269 } | 2276 } |
| 2270 } | 2277 } |
| 2271 } | 2278 } |
| 2272 #endif // DEBUG | 2279 #endif // DEBUG |
| 2273 | 2280 |
| 2274 } } // namespace v8::internal | 2281 } } // namespace v8::internal |
| OLD | NEW |