Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: src/heap/heap.cc

Issue 2371173002: [heap] Cleanup Heap::SetUp (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/context-slot-cache.h" 9 #include "src/ast/context-slot-cache.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 5418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5429 store_buffer_ = new StoreBuffer(this); 5429 store_buffer_ = new StoreBuffer(this);
5430 5430
5431 // Initialize incremental marking. 5431 // Initialize incremental marking.
5432 incremental_marking_ = new IncrementalMarking(this); 5432 incremental_marking_ = new IncrementalMarking(this);
5433 5433
5434 for (int i = 0; i <= LAST_SPACE; i++) { 5434 for (int i = 0; i <= LAST_SPACE; i++) {
5435 space_[i] = nullptr; 5435 space_[i] = nullptr;
5436 } 5436 }
5437 5437
5438 space_[NEW_SPACE] = new_space_ = new NewSpace(this); 5438 space_[NEW_SPACE] = new_space_ = new NewSpace(this);
5439 if (new_space_ == nullptr) return false;
5440
5441 // Set up new space.
5442 if (!new_space_->SetUp(initial_semispace_size_, max_semi_space_size_)) { 5439 if (!new_space_->SetUp(initial_semispace_size_, max_semi_space_size_)) {
5443 return false; 5440 return false;
5444 } 5441 }
5445 new_space_top_after_last_gc_ = new_space()->top(); 5442 new_space_top_after_last_gc_ = new_space()->top();
5446 5443
5447 // Initialize old space.
5448 space_[OLD_SPACE] = old_space_ = 5444 space_[OLD_SPACE] = old_space_ =
5449 new OldSpace(this, OLD_SPACE, NOT_EXECUTABLE); 5445 new OldSpace(this, OLD_SPACE, NOT_EXECUTABLE);
5450 if (old_space_ == NULL) return false;
5451 if (!old_space_->SetUp()) return false; 5446 if (!old_space_->SetUp()) return false;
5452 5447
5453 // Initialize the code space, set its maximum capacity to the old
5454 // generation size. It needs executable memory.
5455 space_[CODE_SPACE] = code_space_ = new OldSpace(this, CODE_SPACE, EXECUTABLE); 5448 space_[CODE_SPACE] = code_space_ = new OldSpace(this, CODE_SPACE, EXECUTABLE);
5456 if (code_space_ == NULL) return false;
5457 if (!code_space_->SetUp()) return false; 5449 if (!code_space_->SetUp()) return false;
5458 5450
5459 // Initialize map space.
5460 space_[MAP_SPACE] = map_space_ = new MapSpace(this, MAP_SPACE); 5451 space_[MAP_SPACE] = map_space_ = new MapSpace(this, MAP_SPACE);
5461 if (map_space_ == NULL) return false;
5462 if (!map_space_->SetUp()) return false; 5452 if (!map_space_->SetUp()) return false;
5463 5453
5464 // The large object code space may contain code or data. We set the memory 5454 // The large object code space may contain code or data. We set the memory
5465 // to be non-executable here for safety, but this means we need to enable it 5455 // to be non-executable here for safety, but this means we need to enable it
5466 // explicitly when allocating large code objects. 5456 // explicitly when allocating large code objects.
5467 space_[LO_SPACE] = lo_space_ = new LargeObjectSpace(this, LO_SPACE); 5457 space_[LO_SPACE] = lo_space_ = new LargeObjectSpace(this, LO_SPACE);
5468 if (lo_space_ == NULL) return false;
5469 if (!lo_space_->SetUp()) return false; 5458 if (!lo_space_->SetUp()) return false;
5470 5459
5471 // Set up the seed that is used to randomize the string hash function. 5460 // Set up the seed that is used to randomize the string hash function.
5472 DCHECK(hash_seed() == 0); 5461 DCHECK(hash_seed() == 0);
5473 if (FLAG_randomize_hashes) { 5462 if (FLAG_randomize_hashes) {
5474 if (FLAG_hash_seed == 0) { 5463 if (FLAG_hash_seed == 0) {
5475 int rnd = isolate()->random_number_generator()->NextInt(); 5464 int rnd = isolate()->random_number_generator()->NextInt();
5476 set_hash_seed(Smi::FromInt(rnd & Name::kHashBitMask)); 5465 set_hash_seed(Smi::FromInt(rnd & Name::kHashBitMask));
5477 } else { 5466 } else {
5478 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); 5467 set_hash_seed(Smi::FromInt(FLAG_hash_seed));
5479 } 5468 }
5480 } 5469 }
5481 5470
5482 for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount); 5471 for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount);
5483 i++) { 5472 i++) {
5484 deferred_counters_[i] = 0; 5473 deferred_counters_[i] = 0;
5485 } 5474 }
5486 5475
5487 tracer_ = new GCTracer(this); 5476 tracer_ = new GCTracer(this);
5488
5489 scavenge_collector_ = new Scavenger(this); 5477 scavenge_collector_ = new Scavenger(this);
5490
5491 mark_compact_collector_ = new MarkCompactCollector(this); 5478 mark_compact_collector_ = new MarkCompactCollector(this);
5492
5493 gc_idle_time_handler_ = new GCIdleTimeHandler(); 5479 gc_idle_time_handler_ = new GCIdleTimeHandler();
5494
5495 memory_reducer_ = new MemoryReducer(this); 5480 memory_reducer_ = new MemoryReducer(this);
5496
5497 if (FLAG_track_gc_object_stats) { 5481 if (FLAG_track_gc_object_stats) {
5498 live_object_stats_ = new ObjectStats(this); 5482 live_object_stats_ = new ObjectStats(this);
5499 dead_object_stats_ = new ObjectStats(this); 5483 dead_object_stats_ = new ObjectStats(this);
5500 } 5484 }
5501
5502 scavenge_job_ = new ScavengeJob(); 5485 scavenge_job_ = new ScavengeJob();
5503 5486
5504 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); 5487 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
5505 LOG(isolate_, IntPtrTEvent("heap-available", Available())); 5488 LOG(isolate_, IntPtrTEvent("heap-available", Available()));
5506 5489
5507 store_buffer()->SetUp(); 5490 store_buffer()->SetUp();
5508 5491
5509 mark_compact_collector()->SetUp(); 5492 mark_compact_collector()->SetUp();
5510 5493
5511 idle_scavenge_observer_ = new IdleScavengeObserver( 5494 idle_scavenge_observer_ = new IdleScavengeObserver(
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 } 6467 }
6485 6468
6486 6469
6487 // static 6470 // static
6488 int Heap::GetStaticVisitorIdForMap(Map* map) { 6471 int Heap::GetStaticVisitorIdForMap(Map* map) {
6489 return StaticVisitorBase::GetVisitorId(map); 6472 return StaticVisitorBase::GetVisitorId(map);
6490 } 6473 }
6491 6474
6492 } // namespace internal 6475 } // namespace internal
6493 } // namespace v8 6476 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698