OLD | NEW |
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 Loading... |
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 void V8::MakeWeak(i::Object** object, void* parameter, | |
687 WeakCallback weak_callback) { | |
688 i::GlobalHandles::MakeWeak(object, parameter, weak_callback); | |
689 } | |
690 | |
691 | 686 |
692 void V8::MakeWeak(i::Object** object, void* parameter, | 687 void V8::MakeWeak(i::Object** object, void* parameter, |
693 int internal_field_index1, int internal_field_index2, | 688 int internal_field_index1, int internal_field_index2, |
694 WeakCallbackInfo<void>::Callback weak_callback) { | 689 WeakCallbackInfo<void>::Callback weak_callback) { |
695 WeakCallbackType type = WeakCallbackType::kParameter; | 690 WeakCallbackType type = WeakCallbackType::kParameter; |
696 if (internal_field_index1 == 0) { | 691 if (internal_field_index1 == 0) { |
697 if (internal_field_index2 == 1) { | 692 if (internal_field_index2 == 1) { |
698 type = WeakCallbackType::kInternalFields; | 693 type = WeakCallbackType::kInternalFields; |
699 } else { | 694 } else { |
700 DCHECK_EQ(internal_field_index2, -1); | 695 DCHECK_EQ(internal_field_index2, -1); |
(...skipping 8101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8802 Address callback_address = | 8797 Address callback_address = |
8803 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8798 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8804 VMState<EXTERNAL> state(isolate); | 8799 VMState<EXTERNAL> state(isolate); |
8805 ExternalCallbackScope call_scope(isolate, callback_address); | 8800 ExternalCallbackScope call_scope(isolate, callback_address); |
8806 callback(info); | 8801 callback(info); |
8807 } | 8802 } |
8808 | 8803 |
8809 | 8804 |
8810 } // namespace internal | 8805 } // namespace internal |
8811 } // namespace v8 | 8806 } // namespace v8 |
OLD | NEW |