OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/keys.h" | 5 #include "src/keys.h" |
6 | 6 |
7 #include "src/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/elements.h" | 8 #include "src/elements.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/identity-map.h" | 10 #include "src/identity-map.h" |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 ? object->GetIndexedInterceptor() | 432 ? object->GetIndexedInterceptor() |
433 : object->GetNamedInterceptor(), | 433 : object->GetNamedInterceptor(), |
434 isolate); | 434 isolate); |
435 if ((accumulator->filter() & ONLY_ALL_CAN_READ) && | 435 if ((accumulator->filter() & ONLY_ALL_CAN_READ) && |
436 !interceptor->all_can_read()) { | 436 !interceptor->all_can_read()) { |
437 return Just(true); | 437 return Just(true); |
438 } | 438 } |
439 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, | 439 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, |
440 *object, Object::DONT_THROW); | 440 *object, Object::DONT_THROW); |
441 Handle<JSObject> result; | 441 Handle<JSObject> result; |
442 if (!interceptor->enumerator()->IsUndefined()) { | 442 if (!interceptor->enumerator()->IsUndefined(isolate)) { |
443 Callback enum_fun = v8::ToCData<Callback>(interceptor->enumerator()); | 443 Callback enum_fun = v8::ToCData<Callback>(interceptor->enumerator()); |
444 const char* log_tag = type == kIndexed ? "interceptor-indexed-enum" | 444 const char* log_tag = type == kIndexed ? "interceptor-indexed-enum" |
445 : "interceptor-named-enum"; | 445 : "interceptor-named-enum"; |
446 LOG(isolate, ApiObjectAccess(log_tag, *object)); | 446 LOG(isolate, ApiObjectAccess(log_tag, *object)); |
447 result = args.Call(enum_fun); | 447 result = args.Call(enum_fun); |
448 } | 448 } |
449 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); | 449 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); |
450 if (result.is_null()) return Just(true); | 450 if (result.is_null()) return Just(true); |
451 accumulator->AddKeys( | 451 accumulator->AddKeys( |
452 result, type == kIndexed ? CONVERT_TO_ARRAY_INDEX : DO_NOT_CONVERT); | 452 result, type == kIndexed ? CONVERT_TO_ARRAY_INDEX : DO_NOT_CONVERT); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 } | 591 } |
592 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O. | 592 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O. |
593 Handle<JSReceiver> target(proxy->target(), isolate_); | 593 Handle<JSReceiver> target(proxy->target(), isolate_); |
594 // 5. Let trap be ? GetMethod(handler, "ownKeys"). | 594 // 5. Let trap be ? GetMethod(handler, "ownKeys"). |
595 Handle<Object> trap; | 595 Handle<Object> trap; |
596 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 596 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
597 isolate_, trap, Object::GetMethod(Handle<JSReceiver>::cast(handler), | 597 isolate_, trap, Object::GetMethod(Handle<JSReceiver>::cast(handler), |
598 isolate_->factory()->ownKeys_string()), | 598 isolate_->factory()->ownKeys_string()), |
599 Nothing<bool>()); | 599 Nothing<bool>()); |
600 // 6. If trap is undefined, then | 600 // 6. If trap is undefined, then |
601 if (trap->IsUndefined()) { | 601 if (trap->IsUndefined(isolate_)) { |
602 // 6a. Return target.[[OwnPropertyKeys]](). | 602 // 6a. Return target.[[OwnPropertyKeys]](). |
603 return CollectOwnJSProxyTargetKeys(proxy, target); | 603 return CollectOwnJSProxyTargetKeys(proxy, target); |
604 } | 604 } |
605 // 7. Let trapResultArray be Call(trap, handler, «target»). | 605 // 7. Let trapResultArray be Call(trap, handler, «target»). |
606 Handle<Object> trap_result_array; | 606 Handle<Object> trap_result_array; |
607 Handle<Object> args[] = {target}; | 607 Handle<Object> args[] = {target}; |
608 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 608 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
609 isolate_, trap_result_array, | 609 isolate_, trap_result_array, |
610 Execution::Call(isolate_, trap, handler, arraysize(args), args), | 610 Execution::Call(isolate_, trap, handler, arraysize(args), args), |
611 Nothing<bool>()); | 611 Nothing<bool>()); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 isolate_, keys, JSReceiver::OwnPropertyKeys(target), Nothing<bool>()); | 730 isolate_, keys, JSReceiver::OwnPropertyKeys(target), Nothing<bool>()); |
731 bool prev_filter_proxy_keys_ = filter_proxy_keys_; | 731 bool prev_filter_proxy_keys_ = filter_proxy_keys_; |
732 filter_proxy_keys_ = false; | 732 filter_proxy_keys_ = false; |
733 Maybe<bool> result = AddKeysFromJSProxy(proxy, keys); | 733 Maybe<bool> result = AddKeysFromJSProxy(proxy, keys); |
734 filter_proxy_keys_ = prev_filter_proxy_keys_; | 734 filter_proxy_keys_ = prev_filter_proxy_keys_; |
735 return result; | 735 return result; |
736 } | 736 } |
737 | 737 |
738 } // namespace internal | 738 } // namespace internal |
739 } // namespace v8 | 739 } // namespace v8 |
OLD | NEW |