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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 } | 641 } |
642 | 642 |
643 | 643 |
644 void V8::MarkIndependent(i::Object** object) { | 644 void V8::MarkIndependent(i::Object** object) { |
645 i::Isolate* isolate = i::Isolate::Current(); | 645 i::Isolate* isolate = i::Isolate::Current(); |
646 LOG_API(isolate, "MakeIndependent"); | 646 LOG_API(isolate, "MakeIndependent"); |
647 isolate->global_handles()->MarkIndependent(object); | 647 isolate->global_handles()->MarkIndependent(object); |
648 } | 648 } |
649 | 649 |
650 | 650 |
| 651 bool V8::IsGlobalIndependent(i::Object** obj) { |
| 652 i::Isolate* isolate = i::Isolate::Current(); |
| 653 LOG_API(isolate, "IsGlobalIndependent"); |
| 654 if (!isolate->IsInitialized()) return false; |
| 655 return i::GlobalHandles::IsIndependent(obj); |
| 656 } |
| 657 |
| 658 |
651 bool V8::IsGlobalNearDeath(i::Object** obj) { | 659 bool V8::IsGlobalNearDeath(i::Object** obj) { |
652 i::Isolate* isolate = i::Isolate::Current(); | 660 i::Isolate* isolate = i::Isolate::Current(); |
653 LOG_API(isolate, "IsGlobalNearDeath"); | 661 LOG_API(isolate, "IsGlobalNearDeath"); |
654 if (!isolate->IsInitialized()) return false; | 662 if (!isolate->IsInitialized()) return false; |
655 return i::GlobalHandles::IsNearDeath(obj); | 663 return i::GlobalHandles::IsNearDeath(obj); |
656 } | 664 } |
657 | 665 |
658 | 666 |
659 bool V8::IsGlobalWeak(i::Object** obj) { | 667 bool V8::IsGlobalWeak(i::Object** obj) { |
660 i::Isolate* isolate = i::Isolate::Current(); | 668 i::Isolate* isolate = i::Isolate::Current(); |
(...skipping 3668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4329 } | 4337 } |
4330 | 4338 |
4331 | 4339 |
4332 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { | 4340 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { |
4333 i::Isolate* isolate = i::Isolate::Current(); | 4341 i::Isolate* isolate = i::Isolate::Current(); |
4334 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); | 4342 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); |
4335 isolate->heap()->VisitExternalResources(visitor); | 4343 isolate->heap()->VisitExternalResources(visitor); |
4336 } | 4344 } |
4337 | 4345 |
4338 | 4346 |
| 4347 void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) { |
| 4348 i::Isolate* isolate = i::Isolate::Current(); |
| 4349 IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId"); |
| 4350 |
| 4351 i::AssertNoAllocation no_allocation; |
| 4352 |
| 4353 class VisitorAdapter : public i::ObjectVisitor { |
| 4354 public: |
| 4355 explicit VisitorAdapter(PersistentHandleVisitor* visitor) |
| 4356 : visitor_(visitor) {} |
| 4357 virtual void VisitPointers(i::Object** start, i::Object** end) { |
| 4358 UNREACHABLE(); |
| 4359 } |
| 4360 virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) { |
| 4361 visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)), |
| 4362 class_id); |
| 4363 } |
| 4364 private: |
| 4365 PersistentHandleVisitor* visitor_; |
| 4366 } visitor_adapter(visitor); |
| 4367 isolate->global_handles()->IterateAllRootsWithClassIds(&visitor_adapter); |
| 4368 } |
| 4369 |
| 4370 |
4339 bool v8::V8::IdleNotification(int hint) { | 4371 bool v8::V8::IdleNotification(int hint) { |
4340 // Returning true tells the caller that it need not | 4372 // Returning true tells the caller that it need not |
4341 // continue to call IdleNotification. | 4373 // continue to call IdleNotification. |
4342 i::Isolate* isolate = i::Isolate::Current(); | 4374 i::Isolate* isolate = i::Isolate::Current(); |
4343 if (isolate == NULL || !isolate->IsInitialized()) return true; | 4375 if (isolate == NULL || !isolate->IsInitialized()) return true; |
4344 return i::V8::IdleNotification(hint); | 4376 return i::V8::IdleNotification(hint); |
4345 } | 4377 } |
4346 | 4378 |
4347 | 4379 |
4348 void v8::V8::LowMemoryNotification() { | 4380 void v8::V8::LowMemoryNotification() { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 i::Handle<i::Object> error_handle = Utils::OpenHandle(*error); | 4645 i::Handle<i::Object> error_handle = Utils::OpenHandle(*error); |
4614 context->set_error_message_for_code_gen_from_strings(*error_handle); | 4646 context->set_error_message_for_code_gen_from_strings(*error_handle); |
4615 } | 4647 } |
4616 | 4648 |
4617 | 4649 |
4618 void V8::SetWrapperClassId(i::Object** global_handle, uint16_t class_id) { | 4650 void V8::SetWrapperClassId(i::Object** global_handle, uint16_t class_id) { |
4619 i::GlobalHandles::SetWrapperClassId(global_handle, class_id); | 4651 i::GlobalHandles::SetWrapperClassId(global_handle, class_id); |
4620 } | 4652 } |
4621 | 4653 |
4622 | 4654 |
| 4655 uint16_t V8::GetWrapperClassId(internal::Object** global_handle) { |
| 4656 return i::GlobalHandles::GetWrapperClassId(global_handle); |
| 4657 } |
| 4658 |
| 4659 |
4623 Local<v8::Object> ObjectTemplate::NewInstance() { | 4660 Local<v8::Object> ObjectTemplate::NewInstance() { |
4624 i::Isolate* isolate = i::Isolate::Current(); | 4661 i::Isolate* isolate = i::Isolate::Current(); |
4625 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", | 4662 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", |
4626 return Local<v8::Object>()); | 4663 return Local<v8::Object>()); |
4627 LOG_API(isolate, "ObjectTemplate::NewInstance"); | 4664 LOG_API(isolate, "ObjectTemplate::NewInstance"); |
4628 ENTER_V8(isolate); | 4665 ENTER_V8(isolate); |
4629 EXCEPTION_PREAMBLE(isolate); | 4666 EXCEPTION_PREAMBLE(isolate); |
4630 i::Handle<i::Object> obj = | 4667 i::Handle<i::Object> obj = |
4631 i::Execution::InstantiateObject(Utils::OpenHandle(this), | 4668 i::Execution::InstantiateObject(Utils::OpenHandle(this), |
4632 &has_pending_exception); | 4669 &has_pending_exception); |
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6590 | 6627 |
6591 v->VisitPointers(blocks_.first(), first_block_limit_); | 6628 v->VisitPointers(blocks_.first(), first_block_limit_); |
6592 | 6629 |
6593 for (int i = 1; i < blocks_.length(); i++) { | 6630 for (int i = 1; i < blocks_.length(); i++) { |
6594 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6631 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6595 } | 6632 } |
6596 } | 6633 } |
6597 | 6634 |
6598 | 6635 |
6599 } } // namespace v8::internal | 6636 } } // namespace v8::internal |
OLD | NEW |