| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 return result.location(); | 401 return result.location(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 | 404 |
| 405 void V8::MakeWeak(i::Object** object, void* parameter, | 405 void V8::MakeWeak(i::Object** object, void* parameter, |
| 406 WeakCallback weak_callback) { | 406 WeakCallback weak_callback) { |
| 407 i::GlobalHandles::MakeWeak(object, parameter, weak_callback); | 407 i::GlobalHandles::MakeWeak(object, parameter, weak_callback); |
| 408 } | 408 } |
| 409 | 409 |
| 410 | 410 |
| 411 void V8::MakePhantom(i::Object** object, void* parameter, | |
| 412 PhantomCallbackData<void>::Callback weak_callback) { | |
| 413 i::GlobalHandles::MakePhantom(object, parameter, weak_callback); | |
| 414 } | |
| 415 | |
| 416 | |
| 417 void V8::MakePhantom( | 411 void V8::MakePhantom( |
| 418 i::Object** object, | 412 i::Object** object, void* parameter, int internal_field_index1, |
| 419 InternalFieldsCallbackData<void, void>::Callback weak_callback, | 413 int internal_field_index2, |
| 420 int internal_field_index1, int internal_field_index2) { | 414 PhantomCallbackData<void, void, void>::Callback weak_callback) { |
| 421 i::GlobalHandles::MakePhantom(object, weak_callback, internal_field_index1, | 415 if (internal_field_index1 == 0) { |
| 422 internal_field_index2); | 416 if (internal_field_index2 == 1) { |
| 417 i::GlobalHandles::MakePhantom(object, parameter, 2, weak_callback); |
| 418 } else { |
| 419 DCHECK_EQ(internal_field_index2, Object::kNoInternalFieldIndex); |
| 420 i::GlobalHandles::MakePhantom(object, parameter, 1, weak_callback); |
| 421 } |
| 422 } else { |
| 423 DCHECK_EQ(internal_field_index1, Object::kNoInternalFieldIndex); |
| 424 DCHECK_EQ(internal_field_index2, Object::kNoInternalFieldIndex); |
| 425 i::GlobalHandles::MakePhantom(object, parameter, 0, weak_callback); |
| 426 } |
| 423 } | 427 } |
| 424 | 428 |
| 425 | 429 |
| 426 void* V8::ClearWeak(i::Object** obj) { | 430 void* V8::ClearWeak(i::Object** obj) { |
| 427 return i::GlobalHandles::ClearWeakness(obj); | 431 return i::GlobalHandles::ClearWeakness(obj); |
| 428 } | 432 } |
| 429 | 433 |
| 430 | 434 |
| 431 void V8::DisposeGlobal(i::Object** obj) { | 435 void V8::DisposeGlobal(i::Object** obj) { |
| 432 i::GlobalHandles::Destroy(obj); | 436 i::GlobalHandles::Destroy(obj); |
| (...skipping 7175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7608 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7612 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7609 Address callback_address = | 7613 Address callback_address = |
| 7610 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7614 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7611 VMState<EXTERNAL> state(isolate); | 7615 VMState<EXTERNAL> state(isolate); |
| 7612 ExternalCallbackScope call_scope(isolate, callback_address); | 7616 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7613 callback(info); | 7617 callback(info); |
| 7614 } | 7618 } |
| 7615 | 7619 |
| 7616 | 7620 |
| 7617 } } // namespace v8::internal | 7621 } } // namespace v8::internal |
| OLD | NEW |