Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RUNTIME_ENTRY_WITH_RCS(Address, Object, BUILTIN_CONVERT_RESULT,
- Runtime_StorePropertyWithInterceptor)
- Address Runtime_StorePropertyWithInterceptor(int args_length,
- Address* args_object,
- Isolate* isolate) {
- DCHECK_EQ(3, args_length);
- HandleScope scope(isolate);
- #define RT_STPWI_VALUE_ADDRESS \
- (reinterpret_cast<Address*>(reinterpret_cast<Address>(args_object) - \
- (0 * kSystemPointerSize)))
- #define RT_STPWI_NAME_ADDRESS \
- (reinterpret_cast<Address*>(reinterpret_cast<Address>(args_object) - \
- (2 * kSystemPointerSize)))
- #define RT_STPWI_RECV_ADDRESS \
- (reinterpret_cast<Address*>(reinterpret_cast<Address>(args_object) - \
- (1 * kSystemPointerSize)))
- Handle<JSObject> receiver = Handle<JSObject>(RT_STPWI_RECV_ADDRESS);
- Handle<Name> name = Handle<Name>(RT_STPWI_NAME_ADDRESS);
- Handle<Object> value = Handle<Object>(RT_STPWI_VALUE_ADDRESS);
- {
- bool bCont{};
- InterceptorInfo interceptorInfo;
- auto handler = receiver->map().cached_property_handler();
- if (!handler.is_null()) {
- interceptorInfo = InterceptorInfo::cast(handler);
- } else {
- if (receiver->HasNamedInterceptor()) {
- Handle<JSObject> interceptor_holder = receiver;
- if (receiver->IsJSGlobalProxy() &&
- (!receiver->HasNamedInterceptor() ||
- receiver->GetNamedInterceptor().non_masking())) {
- interceptor_holder =
- handle(JSObject::cast(receiver->map().prototype()), isolate);
- }
- DCHECK(interceptor_holder->HasNamedInterceptor());
- interceptorInfo = interceptor_holder->GetNamedInterceptor();
- receiver->map().set_cached_property_handler(interceptorInfo);
- } else {
- // intentional fallthrough to LookupIterator it [...] without goto
- bCont = true;
- }
- }
- if (!bCont) {
- DCHECK(!interceptorInfo.non_masking());
- if (interceptorInfo.use_fastpath()) {
- bool bStatus =
- reinterpret_cast<GenericNamedPropertySetterFastCallback>(
- v8::internal::Foreign::cast(interceptorInfo.setter())
- .foreign_address())(
- (v8::Isolate*)(isolate), v8::Utils::ToLocal(receiver),
- v8::Utils::ToLocal(name),
- v8::Utils::ToLocal(
- value));
- if (isolate->has_scheduled_exception()) {
- return isolate->PromoteScheduledException().ptr();
- }
- if (bStatus) {
- return *RT_STPWI_VALUE_ADDRESS; // 1:
- }
- } else {
- PropertyCallbackArguments arguments(isolate, interceptorInfo.data(),
- *receiver, *receiver,
- Just(kDontThrow));
- if (isolate->has_scheduled_exception()) {
- arguments.AcceptSideEffects();
- return isolate->PromoteScheduledException().ptr();
- }
- if (!arguments
- .CallNamedSetter(
- Handle<InterceptorInfo>(interceptorInfo, isolate), name,
- value)
- .is_null()) {
- return *RT_STPWI_VALUE_ADDRESS; // 1:
- }
- }
- // 1: If the interceptor didn't handle the request, then there must be no
- // side effects.
- }
- }
- LookupIterator it(isolate, receiver, name, receiver);
- // Skip past any access check on the receiver.
- if (it.state() == LookupIterator::ACCESS_CHECK) {
- DCHECK(it.HasAccess());
- it.Next();
- }
- // Skip past the interceptor on the receiver.
- DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
- it.Next();
- Object::SetProperty(&it, value, StoreOrigin::kNamed),
- ReadOnlyRoots(isolate).exception();
- return *RT_STPWI_VALUE_ADDRESS;
- }
Add Comment
Please, Sign In to add comment