OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4490 } | 4490 } |
4491 | 4491 |
4492 | 4492 |
4493 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { | 4493 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { |
4494 i::Isolate* isolate = i::Isolate::Current(); | 4494 i::Isolate* isolate = i::Isolate::Current(); |
4495 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); | 4495 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); |
4496 isolate->heap()->VisitExternalResources(visitor); | 4496 isolate->heap()->VisitExternalResources(visitor); |
4497 } | 4497 } |
4498 | 4498 |
4499 | 4499 |
4500 class VisitorAdapter : public i::ObjectVisitor { | |
4501 public: | |
4502 explicit VisitorAdapter(PersistentHandleVisitor* visitor) | |
4503 : visitor_(visitor) {} | |
4504 virtual void VisitPointers(i::Object** start, i::Object** end) { | |
4505 UNREACHABLE(); | |
4506 } | |
4507 virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) { | |
4508 visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)), | |
4509 class_id); | |
4510 } | |
4511 private: | |
4512 PersistentHandleVisitor* visitor_; | |
4513 }; | |
4514 | |
4515 | |
4500 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) { | 4516 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) { |
4501 i::Isolate* isolate = i::Isolate::Current(); | 4517 i::Isolate* isolate = i::Isolate::Current(); |
4502 IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId"); | 4518 IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId"); |
4503 | 4519 |
4504 i::AssertNoAllocation no_allocation; | 4520 i::AssertNoAllocation no_allocation; |
4505 | 4521 |
4506 class VisitorAdapter : public i::ObjectVisitor { | 4522 VisitorAdapter visitor_adapter(visitor); |
4507 public: | |
4508 explicit VisitorAdapter(PersistentHandleVisitor* visitor) | |
4509 : visitor_(visitor) {} | |
4510 virtual void VisitPointers(i::Object** start, i::Object** end) { | |
4511 UNREACHABLE(); | |
4512 } | |
4513 virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) { | |
4514 visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)), | |
4515 class_id); | |
4516 } | |
4517 private: | |
4518 PersistentHandleVisitor* visitor_; | |
4519 } visitor_adapter(visitor); | |
4520 isolate->global_handles()->IterateAllRootsWithClassIds(&visitor_adapter); | 4523 isolate->global_handles()->IterateAllRootsWithClassIds(&visitor_adapter); |
4521 } | 4524 } |
4522 | 4525 |
4523 | 4526 |
4527 void v8::V8::VisitHandlesForPartialDependence(Isolate* exported_isolate, | |
Sven Panne
2013/01/18 08:14:30
Again: Formatting nit, move this to the next line.
haraken
2013/01/18 08:18:46
Done.
| |
4528 PersistentHandleVisitor* visitor) { | |
4529 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate); | |
4530 ASSERT(isolate == i::Isolate::Current()); | |
Sven Panne
2013/01/18 08:14:30
I am not totally sure if this assertion is needed.
haraken
2013/01/18 08:18:46
FYI, we've been adding this check for Isolate-vers
| |
4531 IsDeadCheck(isolate, "v8::V8::VisitHandlesForPartialDependence"); | |
4532 | |
4533 i::AssertNoAllocation no_allocation; | |
4534 | |
4535 VisitorAdapter visitor_adapter(visitor); | |
4536 isolate->global_handles()->IterateAllRootsInNewSpaceWithClassIds( | |
4537 &visitor_adapter); | |
4538 } | |
4539 | |
4540 | |
4524 bool v8::V8::IdleNotification(int hint) { | 4541 bool v8::V8::IdleNotification(int hint) { |
4525 // Returning true tells the caller that it need not | 4542 // Returning true tells the caller that it need not |
4526 // continue to call IdleNotification. | 4543 // continue to call IdleNotification. |
4527 i::Isolate* isolate = i::Isolate::Current(); | 4544 i::Isolate* isolate = i::Isolate::Current(); |
4528 if (isolate == NULL || !isolate->IsInitialized()) return true; | 4545 if (isolate == NULL || !isolate->IsInitialized()) return true; |
4529 return i::V8::IdleNotification(hint); | 4546 return i::V8::IdleNotification(hint); |
4530 } | 4547 } |
4531 | 4548 |
4532 | 4549 |
4533 void v8::V8::LowMemoryNotification() { | 4550 void v8::V8::LowMemoryNotification() { |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5442 size_t length, | 5459 size_t length, |
5443 RetainedObjectInfo* info) { | 5460 RetainedObjectInfo* info) { |
5444 i::Isolate* isolate = i::Isolate::Current(); | 5461 i::Isolate* isolate = i::Isolate::Current(); |
5445 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return; | 5462 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return; |
5446 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); | 5463 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); |
5447 isolate->global_handles()->AddObjectGroup( | 5464 isolate->global_handles()->AddObjectGroup( |
5448 reinterpret_cast<i::Object***>(objects), length, info); | 5465 reinterpret_cast<i::Object***>(objects), length, info); |
5449 } | 5466 } |
5450 | 5467 |
5451 | 5468 |
5452 void V8::AddObjectGroup(Isolate* exportedIsolate, | 5469 void V8::AddObjectGroup(Isolate* exported_isolate, |
5453 Persistent<Value>* objects, | 5470 Persistent<Value>* objects, |
5454 size_t length, | 5471 size_t length, |
5455 RetainedObjectInfo* info) { | 5472 RetainedObjectInfo* info) { |
5456 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exportedIsolate); | 5473 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate); |
5457 ASSERT(isolate == i::Isolate::Current()); | 5474 ASSERT(isolate == i::Isolate::Current()); |
5458 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return; | 5475 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return; |
5459 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); | 5476 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); |
5460 isolate->global_handles()->AddObjectGroup( | 5477 isolate->global_handles()->AddObjectGroup( |
5461 reinterpret_cast<i::Object***>(objects), length, info); | 5478 reinterpret_cast<i::Object***>(objects), length, info); |
5462 } | 5479 } |
5463 | 5480 |
5464 | 5481 |
5465 void V8::AddImplicitReferences(Persistent<Object> parent, | 5482 void V8::AddImplicitReferences(Persistent<Object> parent, |
5466 Persistent<Value>* children, | 5483 Persistent<Value>* children, |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6741 | 6758 |
6742 v->VisitPointers(blocks_.first(), first_block_limit_); | 6759 v->VisitPointers(blocks_.first(), first_block_limit_); |
6743 | 6760 |
6744 for (int i = 1; i < blocks_.length(); i++) { | 6761 for (int i = 1; i < blocks_.length(); i++) { |
6745 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6762 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6746 } | 6763 } |
6747 } | 6764 } |
6748 | 6765 |
6749 | 6766 |
6750 } } // namespace v8::internal | 6767 } } // namespace v8::internal |
OLD | NEW |