Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: src/objects.cc

Issue 760883002: Add interceptor support for symbols (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after
2873 break; 2873 break;
2874 } 2874 }
2875 } 2875 }
2876 if (new_map->NumberOfOwnDescriptors() != old_nof) return MaybeHandle<Map>(); 2876 if (new_map->NumberOfOwnDescriptors() != old_nof) return MaybeHandle<Map>();
2877 return handle(new_map); 2877 return handle(new_map);
2878 } 2878 }
2879 2879
2880 2880
2881 MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(LookupIterator* it, 2881 MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(LookupIterator* it,
2882 Handle<Object> value) { 2882 Handle<Object> value) {
2883 // TODO(rossberg): Support symbols in the API. 2883 Handle<Name> name = it->name();
2884 if (it->name()->IsSymbol()) return value;
2885
2886 Handle<String> name_string = Handle<String>::cast(it->name());
2887 Handle<JSObject> holder = it->GetHolder<JSObject>(); 2884 Handle<JSObject> holder = it->GetHolder<JSObject>();
2888 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor()); 2885 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor());
2889 if (interceptor->setter()->IsUndefined()) return MaybeHandle<Object>(); 2886 if (interceptor->setter()->IsUndefined() ||
2887 (name->IsSymbol() && !interceptor->can_intercept_symbols())) {
2888 return MaybeHandle<Object>();
2889 }
2890 2890
2891 LOG(it->isolate(), 2891 LOG(it->isolate(),
2892 ApiNamedPropertyAccess("interceptor-named-set", *holder, *name_string)); 2892 ApiNamedPropertyAccess("interceptor-named-set", *holder, *name));
2893 PropertyCallbackArguments args(it->isolate(), interceptor->data(), *holder, 2893 PropertyCallbackArguments args(it->isolate(), interceptor->data(), *holder,
2894 *holder); 2894 *holder);
2895 v8::NamedPropertySetterCallback setter = 2895 v8::GenericNamedPropertySetterCallback setter =
2896 v8::ToCData<v8::NamedPropertySetterCallback>(interceptor->setter()); 2896 v8::ToCData<v8::GenericNamedPropertySetterCallback>(
2897 v8::Handle<v8::Value> result = args.Call( 2897 interceptor->setter());
2898 setter, v8::Utils::ToLocal(name_string), v8::Utils::ToLocal(value)); 2898 v8::Handle<v8::Value> result =
2899 args.Call(setter, v8::Utils::ToLocal(name), v8::Utils::ToLocal(value));
2899 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); 2900 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object);
2900 if (!result.IsEmpty()) return value; 2901 if (!result.IsEmpty()) return value;
2901 2902
2902 return MaybeHandle<Object>(); 2903 return MaybeHandle<Object>();
2903 } 2904 }
2904 2905
2905 2906
2906 MaybeHandle<Object> Object::SetProperty(Handle<Object> object, 2907 MaybeHandle<Object> Object::SetProperty(Handle<Object> object,
2907 Handle<Name> name, Handle<Object> value, 2908 Handle<Name> name, Handle<Object> value,
2908 StrictMode strict_mode, 2909 StrictMode strict_mode,
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
4074 4075
4075 return AddDataProperty(&it, value, attributes, STRICT, 4076 return AddDataProperty(&it, value, attributes, STRICT,
4076 CERTAINLY_NOT_STORE_FROM_KEYED); 4077 CERTAINLY_NOT_STORE_FROM_KEYED);
4077 } 4078 }
4078 4079
4079 4080
4080 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( 4081 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
4081 Handle<JSObject> holder, 4082 Handle<JSObject> holder,
4082 Handle<Object> receiver, 4083 Handle<Object> receiver,
4083 Handle<Name> name) { 4084 Handle<Name> name) {
4084 // TODO(rossberg): Support symbols in the API.
4085 if (name->IsSymbol()) return maybe(ABSENT);
4086
4087 Isolate* isolate = holder->GetIsolate(); 4085 Isolate* isolate = holder->GetIsolate();
4088 HandleScope scope(isolate); 4086 HandleScope scope(isolate);
4089 4087
4090 // Make sure that the top context does not change when doing 4088 // Make sure that the top context does not change when doing
4091 // callbacks or interceptor calls. 4089 // callbacks or interceptor calls.
4092 AssertNoContextChange ncc(isolate); 4090 AssertNoContextChange ncc(isolate);
4093 4091
4094 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor()); 4092 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor());
4093 if (name->IsSymbol() && !interceptor->can_intercept_symbols()) {
4094 return maybe(ABSENT);
4095 }
4095 PropertyCallbackArguments args( 4096 PropertyCallbackArguments args(
4096 isolate, interceptor->data(), *receiver, *holder); 4097 isolate, interceptor->data(), *receiver, *holder);
4097 if (!interceptor->query()->IsUndefined()) { 4098 if (!interceptor->query()->IsUndefined()) {
4098 v8::NamedPropertyQueryCallback query = 4099 v8::GenericNamedPropertyQueryCallback query =
4099 v8::ToCData<v8::NamedPropertyQueryCallback>(interceptor->query()); 4100 v8::ToCData<v8::GenericNamedPropertyQueryCallback>(
4101 interceptor->query());
4100 LOG(isolate, 4102 LOG(isolate,
4101 ApiNamedPropertyAccess("interceptor-named-has", *holder, *name)); 4103 ApiNamedPropertyAccess("interceptor-named-has", *holder, *name));
4102 v8::Handle<v8::Integer> result = 4104 v8::Handle<v8::Integer> result = args.Call(query, v8::Utils::ToLocal(name));
4103 args.Call(query, v8::Utils::ToLocal(Handle<String>::cast(name)));
4104 if (!result.IsEmpty()) { 4105 if (!result.IsEmpty()) {
4105 DCHECK(result->IsInt32()); 4106 DCHECK(result->IsInt32());
4106 return maybe(static_cast<PropertyAttributes>(result->Int32Value())); 4107 return maybe(static_cast<PropertyAttributes>(result->Int32Value()));
4107 } 4108 }
4108 } else if (!interceptor->getter()->IsUndefined()) { 4109 } else if (!interceptor->getter()->IsUndefined()) {
4109 v8::NamedPropertyGetterCallback getter = 4110 v8::GenericNamedPropertyGetterCallback getter =
4110 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); 4111 v8::ToCData<v8::GenericNamedPropertyGetterCallback>(
4112 interceptor->getter());
4111 LOG(isolate, 4113 LOG(isolate,
4112 ApiNamedPropertyAccess("interceptor-named-get-has", *holder, *name)); 4114 ApiNamedPropertyAccess("interceptor-named-get-has", *holder, *name));
4113 v8::Handle<v8::Value> result = 4115 v8::Handle<v8::Value> result = args.Call(getter, v8::Utils::ToLocal(name));
4114 args.Call(getter, v8::Utils::ToLocal(Handle<String>::cast(name)));
4115 if (!result.IsEmpty()) return maybe(DONT_ENUM); 4116 if (!result.IsEmpty()) return maybe(DONT_ENUM);
4116 } 4117 }
4117 4118
4118 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<PropertyAttributes>()); 4119 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<PropertyAttributes>());
4119 return maybe(ABSENT); 4120 return maybe(ABSENT);
4120 } 4121 }
4121 4122
4122 4123
4123 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( 4124 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
4124 Handle<JSReceiver> object, Handle<Name> name) { 4125 Handle<JSReceiver> object, Handle<Name> name) {
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
4932 Handle<Name> name = isolate->factory()->hidden_string(); 4933 Handle<Name> name = isolate->factory()->hidden_string();
4933 SetOwnPropertyIgnoreAttributes(object, name, value, DONT_ENUM).Assert(); 4934 SetOwnPropertyIgnoreAttributes(object, name, value, DONT_ENUM).Assert();
4934 return object; 4935 return object;
4935 } 4936 }
4936 4937
4937 4938
4938 MaybeHandle<Object> JSObject::DeletePropertyWithInterceptor( 4939 MaybeHandle<Object> JSObject::DeletePropertyWithInterceptor(
4939 Handle<JSObject> holder, Handle<JSObject> receiver, Handle<Name> name) { 4940 Handle<JSObject> holder, Handle<JSObject> receiver, Handle<Name> name) {
4940 Isolate* isolate = holder->GetIsolate(); 4941 Isolate* isolate = holder->GetIsolate();
4941 4942
4942 // TODO(rossberg): Support symbols in the API. 4943 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor());
4943 if (name->IsSymbol()) return MaybeHandle<Object>(); 4944 if (interceptor->deleter()->IsUndefined() ||
4945 (name->IsSymbol() && !interceptor->can_intercept_symbols())) {
4946 return MaybeHandle<Object>();
4947 }
4944 4948
4945 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor()); 4949 v8::GenericNamedPropertyDeleterCallback deleter =
4946 if (interceptor->deleter()->IsUndefined()) return MaybeHandle<Object>(); 4950 v8::ToCData<v8::GenericNamedPropertyDeleterCallback>(
4947 4951 interceptor->deleter());
4948 v8::NamedPropertyDeleterCallback deleter =
4949 v8::ToCData<v8::NamedPropertyDeleterCallback>(interceptor->deleter());
4950 LOG(isolate, 4952 LOG(isolate,
4951 ApiNamedPropertyAccess("interceptor-named-delete", *holder, *name)); 4953 ApiNamedPropertyAccess("interceptor-named-delete", *holder, *name));
4952 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver, 4954 PropertyCallbackArguments args(isolate, interceptor->data(), *receiver,
4953 *holder); 4955 *holder);
4954 v8::Handle<v8::Boolean> result = 4956 v8::Handle<v8::Boolean> result = args.Call(deleter, v8::Utils::ToLocal(name));
4955 args.Call(deleter, v8::Utils::ToLocal(Handle<String>::cast(name)));
4956 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 4957 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
4957 if (result.IsEmpty()) return MaybeHandle<Object>(); 4958 if (result.IsEmpty()) return MaybeHandle<Object>();
4958 4959
4959 DCHECK(result->IsBoolean()); 4960 DCHECK(result->IsBoolean());
4960 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 4961 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
4961 result_internal->VerifyApiCallResultType(); 4962 result_internal->VerifyApiCallResultType();
4962 // Rebox CustomArguments::kReturnValueOffset before returning. 4963 // Rebox CustomArguments::kReturnValueOffset before returning.
4963 return handle(*result_internal, isolate); 4964 return handle(*result_internal, isolate);
4964 } 4965 }
4965 4966
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
5855 } 5856 }
5856 } 5857 }
5857 return free_index; 5858 return free_index;
5858 } 5859 }
5859 5860
5860 5861
5861 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) { 5862 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) {
5862 int len = array->length(); 5863 int len = array->length();
5863 for (int i = 0; i < len; i++) { 5864 for (int i = 0; i < len; i++) {
5864 Object* e = array->get(i); 5865 Object* e = array->get(i);
5865 if (!(e->IsString() || e->IsNumber())) return false; 5866 if (!(e->IsName() || e->IsNumber())) return false;
5866 } 5867 }
5867 return true; 5868 return true;
5868 } 5869 }
5869 5870
5870 5871
5871 static Handle<FixedArray> ReduceFixedArrayTo( 5872 static Handle<FixedArray> ReduceFixedArrayTo(
5872 Handle<FixedArray> array, int length) { 5873 Handle<FixedArray> array, int length) {
5873 DCHECK(array->length() >= length); 5874 DCHECK(array->length() >= length);
5874 if (array->length() == length) return array; 5875 if (array->length() == length) return array;
5875 5876
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
6063 !current->HasNamedInterceptor() && 6064 !current->HasNamedInterceptor() &&
6064 !current->HasIndexedInterceptor()); 6065 !current->HasIndexedInterceptor());
6065 // Compute the property keys and cache them if possible. 6066 // Compute the property keys and cache them if possible.
6066 ASSIGN_RETURN_ON_EXCEPTION( 6067 ASSIGN_RETURN_ON_EXCEPTION(
6067 isolate, content, 6068 isolate, content,
6068 FixedArray::UnionOfKeys( 6069 FixedArray::UnionOfKeys(
6069 content, GetEnumPropertyKeys(current, cache_enum_keys)), 6070 content, GetEnumPropertyKeys(current, cache_enum_keys)),
6070 FixedArray); 6071 FixedArray);
6071 DCHECK(ContainsOnlyValidKeys(content)); 6072 DCHECK(ContainsOnlyValidKeys(content));
6072 6073
6073 // Add the property keys from the interceptor. 6074 // Add the non-symbol property keys from the interceptor.
6074 if (current->HasNamedInterceptor()) { 6075 if (current->HasNamedInterceptor()) {
6075 Handle<JSObject> result; 6076 Handle<JSObject> result;
6076 if (JSObject::GetKeysForNamedInterceptor( 6077 if (JSObject::GetKeysForNamedInterceptor(
6077 current, object).ToHandle(&result)) { 6078 current, object).ToHandle(&result)) {
6078 ASSIGN_RETURN_ON_EXCEPTION( 6079 ASSIGN_RETURN_ON_EXCEPTION(
6079 isolate, content, 6080 isolate, content, FixedArray::AddKeysFromArrayLike(
6080 FixedArray::AddKeysFromArrayLike(content, result), 6081 content, result, FixedArray::NON_SYMBOL_KEYS),
6081 FixedArray); 6082 FixedArray);
6082 } 6083 }
6083 DCHECK(ContainsOnlyValidKeys(content)); 6084 DCHECK(ContainsOnlyValidKeys(content));
6084 } 6085 }
6085 6086
6086 // If we only want own properties we bail out after the first 6087 // If we only want own properties we bail out after the first
6087 // iteration. 6088 // iteration.
6088 if (type == OWN_ONLY) break; 6089 if (type == OWN_ONLY) break;
6089 } 6090 }
6090 return content; 6091 return content;
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
7995 void FixedArray::Shrink(int new_length) { 7996 void FixedArray::Shrink(int new_length) {
7996 DCHECK(0 <= new_length && new_length <= length()); 7997 DCHECK(0 <= new_length && new_length <= length());
7997 if (new_length < length()) { 7998 if (new_length < length()) {
7998 GetHeap()->RightTrimFixedArray<Heap::FROM_MUTATOR>( 7999 GetHeap()->RightTrimFixedArray<Heap::FROM_MUTATOR>(
7999 this, length() - new_length); 8000 this, length() - new_length);
8000 } 8001 }
8001 } 8002 }
8002 8003
8003 8004
8004 MaybeHandle<FixedArray> FixedArray::AddKeysFromArrayLike( 8005 MaybeHandle<FixedArray> FixedArray::AddKeysFromArrayLike(
8005 Handle<FixedArray> content, 8006 Handle<FixedArray> content, Handle<JSObject> array, KeyFilter filter) {
8006 Handle<JSObject> array) {
8007 DCHECK(array->IsJSArray() || array->HasSloppyArgumentsElements()); 8007 DCHECK(array->IsJSArray() || array->HasSloppyArgumentsElements());
8008 ElementsAccessor* accessor = array->GetElementsAccessor(); 8008 ElementsAccessor* accessor = array->GetElementsAccessor();
8009 Handle<FixedArray> result; 8009 Handle<FixedArray> result;
8010 ASSIGN_RETURN_ON_EXCEPTION( 8010 ASSIGN_RETURN_ON_EXCEPTION(
8011 array->GetIsolate(), result, 8011 array->GetIsolate(), result,
8012 accessor->AddElementsToFixedArray(array, array, content), 8012 accessor->AddElementsToFixedArray(array, array, content, filter),
8013 FixedArray); 8013 FixedArray);
8014 8014
8015 #ifdef ENABLE_SLOW_DCHECKS 8015 #ifdef ENABLE_SLOW_DCHECKS
8016 if (FLAG_enable_slow_asserts) { 8016 if (FLAG_enable_slow_asserts) {
8017 DisallowHeapAllocation no_allocation; 8017 DisallowHeapAllocation no_allocation;
8018 for (int i = 0; i < result->length(); i++) { 8018 for (int i = 0; i < result->length(); i++) {
8019 Object* current = result->get(i); 8019 Object* current = result->get(i);
8020 DCHECK(current->IsNumber() || current->IsName()); 8020 DCHECK(current->IsNumber() || current->IsName());
8021 } 8021 }
8022 } 8022 }
8023 #endif 8023 #endif
8024 return result; 8024 return result;
8025 } 8025 }
8026 8026
8027 8027
8028 MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first, 8028 MaybeHandle<FixedArray> FixedArray::UnionOfKeys(Handle<FixedArray> first,
8029 Handle<FixedArray> second) { 8029 Handle<FixedArray> second) {
8030 ElementsAccessor* accessor = ElementsAccessor::ForArray(second); 8030 ElementsAccessor* accessor = ElementsAccessor::ForArray(second);
8031 Handle<FixedArray> result; 8031 Handle<FixedArray> result;
8032 ASSIGN_RETURN_ON_EXCEPTION( 8032 ASSIGN_RETURN_ON_EXCEPTION(
8033 first->GetIsolate(), result, 8033 first->GetIsolate(), result,
8034 accessor->AddElementsToFixedArray( 8034 accessor->AddElementsToFixedArray(
8035 Handle<Object>::null(), // receiver 8035 Handle<Object>::null(), // receiver
8036 Handle<JSObject>::null(), // holder 8036 Handle<JSObject>::null(), // holder
8037 first, 8037 first, Handle<FixedArrayBase>::cast(second), ALL_KEYS),
8038 Handle<FixedArrayBase>::cast(second)),
8039 FixedArray); 8038 FixedArray);
8040 8039
8041 #ifdef ENABLE_SLOW_DCHECKS 8040 #ifdef ENABLE_SLOW_DCHECKS
8042 if (FLAG_enable_slow_asserts) { 8041 if (FLAG_enable_slow_asserts) {
8043 DisallowHeapAllocation no_allocation; 8042 DisallowHeapAllocation no_allocation;
8044 for (int i = 0; i < result->length(); i++) { 8043 for (int i = 0; i < result->length(); i++) {
8045 Object* current = result->get(i); 8044 Object* current = result->get(i);
8046 DCHECK(current->IsNumber() || current->IsName()); 8045 DCHECK(current->IsNumber() || current->IsName());
8047 } 8046 }
8048 } 8047 }
(...skipping 5399 matching lines...) Expand 10 before | Expand all | Expand 10 after
13448 return InterceptorInfo::cast(result); 13447 return InterceptorInfo::cast(result);
13449 } 13448 }
13450 13449
13451 13450
13452 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( 13451 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(
13453 Handle<JSObject> holder, 13452 Handle<JSObject> holder,
13454 Handle<Object> receiver, 13453 Handle<Object> receiver,
13455 Handle<Name> name) { 13454 Handle<Name> name) {
13456 Isolate* isolate = holder->GetIsolate(); 13455 Isolate* isolate = holder->GetIsolate();
13457 13456
13458 // TODO(rossberg): Support symbols in the API.
13459 if (name->IsSymbol()) return isolate->factory()->undefined_value();
13460
13461 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor(), isolate); 13457 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor(), isolate);
13462 Handle<String> name_string = Handle<String>::cast(name);
13463
13464 if (interceptor->getter()->IsUndefined()) return MaybeHandle<Object>(); 13458 if (interceptor->getter()->IsUndefined()) return MaybeHandle<Object>();
13465 13459
13466 v8::NamedPropertyGetterCallback getter = 13460 if (name->IsSymbol() && !interceptor->can_intercept_symbols()) {
13467 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); 13461 return MaybeHandle<Object>();
13462 }
13463
13464 v8::GenericNamedPropertyGetterCallback getter =
13465 v8::ToCData<v8::GenericNamedPropertyGetterCallback>(
13466 interceptor->getter());
13468 LOG(isolate, 13467 LOG(isolate,
13469 ApiNamedPropertyAccess("interceptor-named-get", *holder, *name)); 13468 ApiNamedPropertyAccess("interceptor-named-get", *holder, *name));
13470 PropertyCallbackArguments 13469 PropertyCallbackArguments
13471 args(isolate, interceptor->data(), *receiver, *holder); 13470 args(isolate, interceptor->data(), *receiver, *holder);
13472 v8::Handle<v8::Value> result = 13471 v8::Handle<v8::Value> result = args.Call(getter, v8::Utils::ToLocal(name));
13473 args.Call(getter, v8::Utils::ToLocal(name_string));
13474 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 13472 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
13475 if (result.IsEmpty()) return MaybeHandle<Object>(); 13473 if (result.IsEmpty()) return MaybeHandle<Object>();
13476 13474
13477 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 13475 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
13478 result_internal->VerifyApiCallResultType(); 13476 result_internal->VerifyApiCallResultType();
13479 // Rebox handle before return 13477 // Rebox handle before return
13480 return handle(*result_internal, isolate); 13478 return handle(*result_internal, isolate);
13481 } 13479 }
13482 13480
13483 13481
13484 // Compute the property keys from the interceptor. 13482 // Compute the property keys from the interceptor.
13485 // TODO(rossberg): support symbols in API, and filter here if needed.
13486 MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor( 13483 MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor(
13487 Handle<JSObject> object, Handle<JSReceiver> receiver) { 13484 Handle<JSObject> object, Handle<JSReceiver> receiver) {
13488 Isolate* isolate = receiver->GetIsolate(); 13485 Isolate* isolate = receiver->GetIsolate();
13489 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); 13486 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor());
13490 PropertyCallbackArguments 13487 PropertyCallbackArguments
13491 args(isolate, interceptor->data(), *receiver, *object); 13488 args(isolate, interceptor->data(), *receiver, *object);
13492 v8::Handle<v8::Object> result; 13489 v8::Handle<v8::Object> result;
13493 if (!interceptor->enumerator()->IsUndefined()) { 13490 if (!interceptor->enumerator()->IsUndefined()) {
13494 v8::NamedPropertyEnumeratorCallback enum_fun = 13491 v8::GenericNamedPropertyEnumeratorCallback enum_fun =
13495 v8::ToCData<v8::NamedPropertyEnumeratorCallback>( 13492 v8::ToCData<v8::GenericNamedPropertyEnumeratorCallback>(
13496 interceptor->enumerator()); 13493 interceptor->enumerator());
13497 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object)); 13494 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object));
13498 result = args.Call(enum_fun); 13495 result = args.Call(enum_fun);
13499 } 13496 }
13500 if (result.IsEmpty()) return MaybeHandle<JSObject>(); 13497 if (result.IsEmpty()) return MaybeHandle<JSObject>();
13501 #if ENABLE_EXTRA_CHECKS 13498 #if ENABLE_EXTRA_CHECKS
13502 CHECK(v8::Utils::OpenHandle(*result)->IsJSArray() || 13499 CHECK(v8::Utils::OpenHandle(*result)->IsJSArray() ||
13503 v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements()); 13500 v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements());
13504 #endif 13501 #endif
13505 // Rebox before returning. 13502 // Rebox before returning.
(...skipping 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after
16832 Handle<DependentCode> codes = 16829 Handle<DependentCode> codes =
16833 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16830 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16834 DependentCode::kPropertyCellChangedGroup, 16831 DependentCode::kPropertyCellChangedGroup,
16835 info->object_wrapper()); 16832 info->object_wrapper());
16836 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16833 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16837 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16834 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16838 cell, info->zone()); 16835 cell, info->zone());
16839 } 16836 }
16840 16837
16841 } } // namespace v8::internal 16838 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698