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

Side by Side Diff: src/api.cc

Issue 11365131: Implement VisitHandlesInNewSpaceWithClassIds() (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Applied reviwer's comment Created 7 years, 11 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
OLDNEW
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
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(
4528 PersistentHandleVisitor* visitor) {
4529 i::Isolate* isolate = i::Isolate::Current();
4530 IsDeadCheck(isolate, "v8::V8::VisitHandlesForPartialDependence");
4531
4532 i::AssertNoAllocation no_allocation;
4533
4534 VisitorAdapter visitor_adapter(visitor);
4535 isolate->global_handles()->IterateAllRootsInNewSpaceWithClassIds(
4536 &visitor_adapter);
4537 }
4538
4539
4524 bool v8::V8::IdleNotification(int hint) { 4540 bool v8::V8::IdleNotification(int hint) {
4525 // Returning true tells the caller that it need not 4541 // Returning true tells the caller that it need not
4526 // continue to call IdleNotification. 4542 // continue to call IdleNotification.
4527 i::Isolate* isolate = i::Isolate::Current(); 4543 i::Isolate* isolate = i::Isolate::Current();
4528 if (isolate == NULL || !isolate->IsInitialized()) return true; 4544 if (isolate == NULL || !isolate->IsInitialized()) return true;
4529 return i::V8::IdleNotification(hint); 4545 return i::V8::IdleNotification(hint);
4530 } 4546 }
4531 4547
4532 4548
4533 void v8::V8::LowMemoryNotification() { 4549 void v8::V8::LowMemoryNotification() {
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
6741 6757
6742 v->VisitPointers(blocks_.first(), first_block_limit_); 6758 v->VisitPointers(blocks_.first(), first_block_limit_);
6743 6759
6744 for (int i = 1; i < blocks_.length(); i++) { 6760 for (int i = 1; i < blocks_.length(); i++) {
6745 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6761 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6746 } 6762 }
6747 } 6763 }
6748 6764
6749 6765
6750 } } // namespace v8::internal 6766 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « include/v8.h ('k') | src/global-handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698