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 4388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4399 } | 4399 } |
4400 | 4400 |
4401 | 4401 |
4402 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { | 4402 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { |
4403 i::Isolate* isolate = i::Isolate::Current(); | 4403 i::Isolate* isolate = i::Isolate::Current(); |
4404 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); | 4404 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); |
4405 isolate->heap()->VisitExternalResources(visitor); | 4405 isolate->heap()->VisitExternalResources(visitor); |
4406 } | 4406 } |
4407 | 4407 |
4408 | 4408 |
| 4409 class VisitorAdapter : public i::ObjectVisitor { |
| 4410 public: |
| 4411 explicit VisitorAdapter(PersistentHandleVisitor* visitor) |
| 4412 : visitor_(visitor) {} |
| 4413 virtual void VisitPointers(i::Object** start, i::Object** end) { |
| 4414 UNREACHABLE(); |
| 4415 } |
| 4416 virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) { |
| 4417 visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)), |
| 4418 class_id); |
| 4419 } |
| 4420 private: |
| 4421 PersistentHandleVisitor* visitor_; |
| 4422 }; |
| 4423 |
| 4424 |
4409 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) { | 4425 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) { |
4410 i::Isolate* isolate = i::Isolate::Current(); | 4426 i::Isolate* isolate = i::Isolate::Current(); |
4411 IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId"); | 4427 IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId"); |
4412 | 4428 |
4413 i::AssertNoAllocation no_allocation; | 4429 i::AssertNoAllocation no_allocation; |
4414 | 4430 |
4415 class VisitorAdapter : public i::ObjectVisitor { | 4431 VisitorAdapter visitor_adapter(visitor); |
4416 public: | |
4417 explicit VisitorAdapter(PersistentHandleVisitor* visitor) | |
4418 : visitor_(visitor) {} | |
4419 virtual void VisitPointers(i::Object** start, i::Object** end) { | |
4420 UNREACHABLE(); | |
4421 } | |
4422 virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) { | |
4423 visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)), | |
4424 class_id); | |
4425 } | |
4426 private: | |
4427 PersistentHandleVisitor* visitor_; | |
4428 } visitor_adapter(visitor); | |
4429 isolate->global_handles()->IterateAllRootsWithClassIds(&visitor_adapter); | 4432 isolate->global_handles()->IterateAllRootsWithClassIds(&visitor_adapter); |
4430 } | 4433 } |
4431 | 4434 |
4432 | 4435 |
| 4436 void v8::V8::VisitHandlesInNewSpaceWithClassIds( |
| 4437 PersistentHandleVisitor* visitor) { |
| 4438 i::Isolate* isolate = i::Isolate::Current(); |
| 4439 IsDeadCheck(isolate, "v8::V8::VisitHandlesInNewSpaceWithClassId"); |
| 4440 |
| 4441 i::AssertNoAllocation no_allocation; |
| 4442 |
| 4443 VisitorAdapter visitor_adapter(visitor); |
| 4444 isolate->global_handles()->IterateAllRootsInNewSpaceWithClassIds( |
| 4445 &visitor_adapter); |
| 4446 } |
| 4447 |
| 4448 |
4433 bool v8::V8::IdleNotification(int hint) { | 4449 bool v8::V8::IdleNotification(int hint) { |
4434 // Returning true tells the caller that it need not | 4450 // Returning true tells the caller that it need not |
4435 // continue to call IdleNotification. | 4451 // continue to call IdleNotification. |
4436 i::Isolate* isolate = i::Isolate::Current(); | 4452 i::Isolate* isolate = i::Isolate::Current(); |
4437 if (isolate == NULL || !isolate->IsInitialized()) return true; | 4453 if (isolate == NULL || !isolate->IsInitialized()) return true; |
4438 return i::V8::IdleNotification(hint); | 4454 return i::V8::IdleNotification(hint); |
4439 } | 4455 } |
4440 | 4456 |
4441 | 4457 |
4442 void v8::V8::LowMemoryNotification() { | 4458 void v8::V8::LowMemoryNotification() { |
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6644 | 6660 |
6645 v->VisitPointers(blocks_.first(), first_block_limit_); | 6661 v->VisitPointers(blocks_.first(), first_block_limit_); |
6646 | 6662 |
6647 for (int i = 1; i < blocks_.length(); i++) { | 6663 for (int i = 1; i < blocks_.length(); i++) { |
6648 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6664 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6649 } | 6665 } |
6650 } | 6666 } |
6651 | 6667 |
6652 | 6668 |
6653 } } // namespace v8::internal | 6669 } } // namespace v8::internal |
OLD | NEW |