| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/heap.h" | 5 #include "vm/heap.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/compiler_stats.h" | 9 #include "vm/compiler_stats.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 return "debugging"; | 355 return "debugging"; |
| 356 case kGCTestCase: | 356 case kGCTestCase: |
| 357 return "test case"; | 357 return "test case"; |
| 358 default: | 358 default: |
| 359 UNREACHABLE(); | 359 UNREACHABLE(); |
| 360 return ""; | 360 return ""; |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 | 364 |
| 365 void Heap::SetPeer(RawObject* raw_obj, void* peer) { |
| 366 if (raw_obj->IsNewObject()) { |
| 367 new_space_->SetPeer(raw_obj, peer); |
| 368 } else { |
| 369 ASSERT(raw_obj->IsOldObject()); |
| 370 old_space_->SetPeer(raw_obj, peer); |
| 371 } |
| 372 } |
| 373 |
| 374 |
| 375 void* Heap::GetPeer(RawObject* raw_obj) { |
| 376 if (raw_obj->IsNewObject()) { |
| 377 return new_space_->GetPeer(raw_obj); |
| 378 } |
| 379 ASSERT(raw_obj->IsOldObject()); |
| 380 return old_space_->GetPeer(raw_obj); |
| 381 } |
| 382 |
| 383 |
| 384 int64_t Heap::PeerCount() const { |
| 385 return new_space_->PeerCount() + old_space_->PeerCount(); |
| 386 } |
| 387 |
| 388 |
| 365 #if defined(DEBUG) | 389 #if defined(DEBUG) |
| 366 NoGCScope::NoGCScope() : StackResource(Isolate::Current()) { | 390 NoGCScope::NoGCScope() : StackResource(Isolate::Current()) { |
| 367 isolate()->IncrementNoGCScopeDepth(); | 391 isolate()->IncrementNoGCScopeDepth(); |
| 368 } | 392 } |
| 369 | 393 |
| 370 | 394 |
| 371 NoGCScope::~NoGCScope() { | 395 NoGCScope::~NoGCScope() { |
| 372 isolate()->DecrementNoGCScopeDepth(); | 396 isolate()->DecrementNoGCScopeDepth(); |
| 373 } | 397 } |
| 374 #endif // defined(DEBUG) | 398 #endif // defined(DEBUG) |
| 375 | 399 |
| 376 } // namespace dart | 400 } // namespace dart |
| OLD | NEW |