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

Side by Side Diff: src/api.cc

Issue 1950963002: Introduce a new phantom weakness type without finalization callback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comment Created 4 years, 7 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
« no previous file with comments | « include/v8.h ('k') | src/global-handles.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 676 }
677 #endif // VERIFY_HEAP 677 #endif // VERIFY_HEAP
678 return result.location(); 678 return result.location();
679 } 679 }
680 680
681 void V8::RegisterExternallyReferencedObject(i::Object** object, 681 void V8::RegisterExternallyReferencedObject(i::Object** object,
682 i::Isolate* isolate) { 682 i::Isolate* isolate) {
683 isolate->heap()->RegisterExternallyReferencedObject(object); 683 isolate->heap()->RegisterExternallyReferencedObject(object);
684 } 684 }
685 685
686 686 void V8::MakeWeak(i::Object** location, void* parameter,
687 void V8::MakeWeak(i::Object** object, void* parameter,
688 int internal_field_index1, int internal_field_index2, 687 int internal_field_index1, int internal_field_index2,
689 WeakCallbackInfo<void>::Callback weak_callback) { 688 WeakCallbackInfo<void>::Callback weak_callback) {
690 WeakCallbackType type = WeakCallbackType::kParameter; 689 WeakCallbackType type = WeakCallbackType::kParameter;
691 if (internal_field_index1 == 0) { 690 if (internal_field_index1 == 0) {
692 if (internal_field_index2 == 1) { 691 if (internal_field_index2 == 1) {
693 type = WeakCallbackType::kInternalFields; 692 type = WeakCallbackType::kInternalFields;
694 } else { 693 } else {
695 DCHECK_EQ(internal_field_index2, -1); 694 DCHECK_EQ(internal_field_index2, -1);
696 type = WeakCallbackType::kInternalFields; 695 type = WeakCallbackType::kInternalFields;
697 } 696 }
698 } else { 697 } else {
699 DCHECK_EQ(internal_field_index1, -1); 698 DCHECK_EQ(internal_field_index1, -1);
700 DCHECK_EQ(internal_field_index2, -1); 699 DCHECK_EQ(internal_field_index2, -1);
701 } 700 }
702 i::GlobalHandles::MakeWeak(object, parameter, weak_callback, type); 701 i::GlobalHandles::MakeWeak(location, parameter, weak_callback, type);
702 }
703
704 void V8::MakeWeak(i::Object** location, void* parameter,
705 WeakCallbackInfo<void>::Callback weak_callback,
706 WeakCallbackType type) {
707 i::GlobalHandles::MakeWeak(location, parameter, weak_callback, type);
708 }
709
710 void V8::MakeWeak(i::Object*** location_addr) {
711 i::GlobalHandles::MakeWeak(location_addr);
712 }
713
714 void* V8::ClearWeak(i::Object** location) {
715 return i::GlobalHandles::ClearWeakness(location);
716 }
717
718 void V8::DisposeGlobal(i::Object** location) {
719 i::GlobalHandles::Destroy(location);
703 } 720 }
704 721
705 722
706 void V8::MakeWeak(i::Object** object, void* parameter,
707 WeakCallbackInfo<void>::Callback weak_callback,
708 WeakCallbackType type) {
709 i::GlobalHandles::MakeWeak(object, parameter, weak_callback, type);
710 }
711
712
713 void* V8::ClearWeak(i::Object** obj) {
714 return i::GlobalHandles::ClearWeakness(obj);
715 }
716
717
718 void V8::DisposeGlobal(i::Object** obj) {
719 i::GlobalHandles::Destroy(obj);
720 }
721
722
723 void V8::Eternalize(Isolate* v8_isolate, Value* value, int* index) { 723 void V8::Eternalize(Isolate* v8_isolate, Value* value, int* index) {
724 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 724 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
725 i::Object* object = *Utils::OpenHandle(value); 725 i::Object* object = *Utils::OpenHandle(value);
726 isolate->eternal_handles()->Create(isolate, object, index); 726 isolate->eternal_handles()->Create(isolate, object, index);
727 } 727 }
728 728
729 729
730 Local<Value> V8::GetEternal(Isolate* v8_isolate, int index) { 730 Local<Value> V8::GetEternal(Isolate* v8_isolate, int index) {
731 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 731 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
732 return Utils::ToLocal(isolate->eternal_handles()->Get(index)); 732 return Utils::ToLocal(isolate->eternal_handles()->Get(index));
(...skipping 6743 matching lines...) Expand 10 before | Expand all | Expand 10 after
7476 regs.sp = state.sp; 7476 regs.sp = state.sp;
7477 regs.fp = state.fp; 7477 regs.fp = state.fp;
7478 i::SimulatorHelper::FillRegisters(isolate, &regs); 7478 i::SimulatorHelper::FillRegisters(isolate, &regs);
7479 #else 7479 #else
7480 const RegisterState& regs = state; 7480 const RegisterState& regs = state;
7481 #endif 7481 #endif
7482 i::TickSample::GetStackSample(isolate, regs, i::TickSample::kSkipCEntryFrame, 7482 i::TickSample::GetStackSample(isolate, regs, i::TickSample::kSkipCEntryFrame,
7483 frames, frames_limit, sample_info); 7483 frames, frames_limit, sample_info);
7484 } 7484 }
7485 7485
7486 size_t Isolate::NumberOfPhantomHandleResetsSinceLastCall() {
7487 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7488 size_t result = isolate->global_handles()->NumberOfPhantomHandleResets();
7489 isolate->global_handles()->ResetNumberOfPhantomHandleResets();
7490 return result;
7491 }
7486 7492
7487 void Isolate::SetEventLogger(LogEventCallback that) { 7493 void Isolate::SetEventLogger(LogEventCallback that) {
7488 // Do not overwrite the event logger if we want to log explicitly. 7494 // Do not overwrite the event logger if we want to log explicitly.
7489 if (i::FLAG_log_internal_timer_events) return; 7495 if (i::FLAG_log_internal_timer_events) return;
7490 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7496 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7491 isolate->set_event_logger(that); 7497 isolate->set_event_logger(that);
7492 } 7498 }
7493 7499
7494 7500
7495 void Isolate::AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback) { 7501 void Isolate::AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback) {
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
8797 Address callback_address = 8803 Address callback_address =
8798 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8804 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8799 VMState<EXTERNAL> state(isolate); 8805 VMState<EXTERNAL> state(isolate);
8800 ExternalCallbackScope call_scope(isolate, callback_address); 8806 ExternalCallbackScope call_scope(isolate, callback_address);
8801 callback(info); 8807 callback(info);
8802 } 8808 }
8803 8809
8804 8810
8805 } // namespace internal 8811 } // namespace internal
8806 } // namespace v8 8812 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/global-handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698