| 710 | // --- Implementation --- |
| 711 | |
| 712 | Local<Value> Object::GetInternalField(int index) { |
| 713 | #ifndef V8_ENABLE_CHECKS |
| 714 | using A = internal::Address; |
| 715 | using I = internal::Internals; |
| 716 | A obj = *reinterpret_cast<A*>(this); |
| 717 | // Fast path: If the object is a plain JSObject, which is the common case, we |
| 718 | // know where to find the internal fields and can return the value directly. |
| 719 | int instance_type = I::GetInstanceType(obj); |
| 720 | if (v8::internal::CanHaveInternalField(instance_type)) { |
| 721 | int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index); |
| 722 | A value = I::ReadRawField<A>(obj, offset); |
| 723 | #ifdef V8_COMPRESS_POINTERS |
| 724 | // We read the full pointer value and then decompress it in order to avoid |
| 725 | // dealing with potential endiannes issues. |
| 726 | value = I::DecompressTaggedAnyField(obj, static_cast<uint32_t>(value)); |
| 727 | #endif |
| 728 | internal::Isolate* isolate = |
| 729 | internal::IsolateFromNeverReadOnlySpaceObject(obj); |
| 730 | A* result = HandleScope::CreateHandle(isolate, value); |
| 731 | return Local<Value>(reinterpret_cast<Value*>(result)); |
| 732 | } |
| 733 | #endif |
| 734 | return SlowGetInternalField(index); |
| 735 | } |
| 736 | |
| 737 | void* Object::GetAlignedPointerFromInternalField(int index) { |
| 738 | #if !defined(V8_ENABLE_CHECKS) |
no outgoing calls
no test coverage detected