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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 return result.location(); | 427 return result.location(); |
428 } | 428 } |
429 | 429 |
430 | 430 |
431 void V8::MakeWeak(i::Object** object, void* parameter, | 431 void V8::MakeWeak(i::Object** object, void* parameter, |
432 WeakCallback weak_callback) { | 432 WeakCallback weak_callback) { |
433 i::GlobalHandles::MakeWeak(object, parameter, weak_callback); | 433 i::GlobalHandles::MakeWeak(object, parameter, weak_callback); |
434 } | 434 } |
435 | 435 |
436 | 436 |
437 void V8::MakePhantom( | 437 void V8::MakePhantom(i::Object** object, void* parameter, |
438 i::Object** object, void* parameter, int internal_field_index1, | 438 int internal_field_index1, int internal_field_index2, |
439 int internal_field_index2, | 439 PhantomCallbackData<void>::Callback weak_callback) { |
440 PhantomCallbackData<void, void, void>::Callback weak_callback) { | |
441 if (internal_field_index1 == 0) { | 440 if (internal_field_index1 == 0) { |
442 if (internal_field_index2 == 1) { | 441 if (internal_field_index2 == 1) { |
443 i::GlobalHandles::MakePhantom(object, parameter, 2, weak_callback); | 442 i::GlobalHandles::MakePhantom(object, parameter, 2, weak_callback); |
444 } else { | 443 } else { |
445 DCHECK_EQ(internal_field_index2, Object::kNoInternalFieldIndex); | 444 DCHECK_EQ(internal_field_index2, kNoInternalFieldIndex); |
446 i::GlobalHandles::MakePhantom(object, parameter, 1, weak_callback); | 445 i::GlobalHandles::MakePhantom(object, parameter, 1, weak_callback); |
447 } | 446 } |
448 } else { | 447 } else { |
449 DCHECK_EQ(internal_field_index1, Object::kNoInternalFieldIndex); | 448 DCHECK_EQ(internal_field_index1, kNoInternalFieldIndex); |
450 DCHECK_EQ(internal_field_index2, Object::kNoInternalFieldIndex); | 449 DCHECK_EQ(internal_field_index2, kNoInternalFieldIndex); |
451 i::GlobalHandles::MakePhantom(object, parameter, 0, weak_callback); | 450 i::GlobalHandles::MakePhantom(object, parameter, 0, weak_callback); |
452 } | 451 } |
453 } | 452 } |
454 | 453 |
455 | 454 |
456 void* V8::ClearWeak(i::Object** obj) { | 455 void* V8::ClearWeak(i::Object** obj) { |
457 return i::GlobalHandles::ClearWeakness(obj); | 456 return i::GlobalHandles::ClearWeakness(obj); |
458 } | 457 } |
459 | 458 |
460 | 459 |
(...skipping 7133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7594 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7593 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7595 Address callback_address = | 7594 Address callback_address = |
7596 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7595 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7597 VMState<EXTERNAL> state(isolate); | 7596 VMState<EXTERNAL> state(isolate); |
7598 ExternalCallbackScope call_scope(isolate, callback_address); | 7597 ExternalCallbackScope call_scope(isolate, callback_address); |
7599 callback(info); | 7598 callback(info); |
7600 } | 7599 } |
7601 | 7600 |
7602 | 7601 |
7603 } } // namespace v8::internal | 7602 } } // namespace v8::internal |
OLD | NEW |