OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // TODO(rossberg): Handling symbols in the API requires changing the API, | 361 // TODO(rossberg): Handling symbols in the API requires changing the API, |
362 // so we do not support it for now. | 362 // so we do not support it for now. |
363 if (name->IsSymbol()) return isolate->heap()->undefined_value(); | 363 if (name->IsSymbol()) return isolate->heap()->undefined_value(); |
364 if (structure->IsDeclaredAccessorInfo()) { | 364 if (structure->IsDeclaredAccessorInfo()) { |
365 return GetDeclaredAccessorProperty(receiver, | 365 return GetDeclaredAccessorProperty(receiver, |
366 DeclaredAccessorInfo::cast(structure), | 366 DeclaredAccessorInfo::cast(structure), |
367 isolate); | 367 isolate); |
368 } | 368 } |
369 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure); | 369 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure); |
370 Object* fun_obj = data->getter(); | 370 Object* fun_obj = data->getter(); |
371 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); | 371 v8::AccessorGetterCallback call_fun = |
| 372 v8::ToCData<v8::AccessorGetterCallback>(fun_obj); |
372 if (call_fun == NULL) return isolate->heap()->undefined_value(); | 373 if (call_fun == NULL) return isolate->heap()->undefined_value(); |
373 HandleScope scope(isolate); | 374 HandleScope scope(isolate); |
374 JSObject* self = JSObject::cast(receiver); | 375 JSObject* self = JSObject::cast(receiver); |
375 Handle<String> key(String::cast(name)); | 376 Handle<String> key(String::cast(name)); |
376 LOG(isolate, ApiNamedPropertyAccess("load", self, name)); | 377 LOG(isolate, ApiNamedPropertyAccess("load", self, name)); |
377 PropertyCallbackArguments args(isolate, data->data(), self, this); | 378 PropertyCallbackArguments args(isolate, data->data(), self, this); |
378 v8::Handle<v8::Value> result = | 379 v8::Handle<v8::Value> result = |
379 args.Call(call_fun, v8::Utils::ToLocal(key)); | 380 args.Call(call_fun, v8::Utils::ToLocal(key)); |
380 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 381 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
381 if (result.IsEmpty()) { | 382 if (result.IsEmpty()) { |
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2765 if (name->IsSymbol()) return value; | 2766 if (name->IsSymbol()) return value; |
2766 Isolate* isolate = GetIsolate(); | 2767 Isolate* isolate = GetIsolate(); |
2767 HandleScope scope(isolate); | 2768 HandleScope scope(isolate); |
2768 Handle<JSObject> this_handle(this); | 2769 Handle<JSObject> this_handle(this); |
2769 Handle<String> name_handle(String::cast(name)); | 2770 Handle<String> name_handle(String::cast(name)); |
2770 Handle<Object> value_handle(value, isolate); | 2771 Handle<Object> value_handle(value, isolate); |
2771 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); | 2772 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); |
2772 if (!interceptor->setter()->IsUndefined()) { | 2773 if (!interceptor->setter()->IsUndefined()) { |
2773 LOG(isolate, ApiNamedPropertyAccess("interceptor-named-set", this, name)); | 2774 LOG(isolate, ApiNamedPropertyAccess("interceptor-named-set", this, name)); |
2774 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); | 2775 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); |
2775 v8::NamedPropertySetter setter = | 2776 v8::NamedPropertySetterCallback setter = |
2776 v8::ToCData<v8::NamedPropertySetter>(interceptor->setter()); | 2777 v8::ToCData<v8::NamedPropertySetterCallback>(interceptor->setter()); |
2777 Handle<Object> value_unhole(value->IsTheHole() ? | 2778 Handle<Object> value_unhole(value->IsTheHole() ? |
2778 isolate->heap()->undefined_value() : | 2779 isolate->heap()->undefined_value() : |
2779 value, | 2780 value, |
2780 isolate); | 2781 isolate); |
2781 v8::Handle<v8::Value> result = args.Call(setter, | 2782 v8::Handle<v8::Value> result = args.Call(setter, |
2782 v8::Utils::ToLocal(name_handle), | 2783 v8::Utils::ToLocal(name_handle), |
2783 v8::Utils::ToLocal(value_unhole)); | 2784 v8::Utils::ToLocal(value_unhole)); |
2784 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 2785 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
2785 if (!result.IsEmpty()) return *value_handle; | 2786 if (!result.IsEmpty()) return *value_handle; |
2786 } | 2787 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2867 Handle<Object> args[2] = { name_handle, receiver_handle }; | 2868 Handle<Object> args[2] = { name_handle, receiver_handle }; |
2868 Handle<Object> error = | 2869 Handle<Object> error = |
2869 isolate->factory()->NewTypeError("incompatible_method_receiver", | 2870 isolate->factory()->NewTypeError("incompatible_method_receiver", |
2870 HandleVector(args, | 2871 HandleVector(args, |
2871 ARRAY_SIZE(args))); | 2872 ARRAY_SIZE(args))); |
2872 return isolate->Throw(*error); | 2873 return isolate->Throw(*error); |
2873 } | 2874 } |
2874 // TODO(rossberg): Support symbols in the API. | 2875 // TODO(rossberg): Support symbols in the API. |
2875 if (name->IsSymbol()) return value; | 2876 if (name->IsSymbol()) return value; |
2876 Object* call_obj = data->setter(); | 2877 Object* call_obj = data->setter(); |
2877 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); | 2878 v8::AccessorSetterCallback call_fun = |
| 2879 v8::ToCData<v8::AccessorSetterCallback>(call_obj); |
2878 if (call_fun == NULL) return value; | 2880 if (call_fun == NULL) return value; |
2879 Handle<String> key(String::cast(name)); | 2881 Handle<String> key(String::cast(name)); |
2880 LOG(isolate, ApiNamedPropertyAccess("store", this, name)); | 2882 LOG(isolate, ApiNamedPropertyAccess("store", this, name)); |
2881 PropertyCallbackArguments args( | 2883 PropertyCallbackArguments args( |
2882 isolate, data->data(), this, JSObject::cast(holder)); | 2884 isolate, data->data(), this, JSObject::cast(holder)); |
2883 args.Call(call_fun, | 2885 args.Call(call_fun, |
2884 v8::Utils::ToLocal(key), | 2886 v8::Utils::ToLocal(key), |
2885 v8::Utils::ToLocal(value_handle)); | 2887 v8::Utils::ToLocal(value_handle)); |
2886 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 2888 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
2887 return *value_handle; | 2889 return *value_handle; |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4223 // callbacks or interceptor calls. | 4225 // callbacks or interceptor calls. |
4224 AssertNoContextChange ncc; | 4226 AssertNoContextChange ncc; |
4225 | 4227 |
4226 HandleScope scope(isolate); | 4228 HandleScope scope(isolate); |
4227 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); | 4229 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); |
4228 Handle<JSObject> receiver_handle(receiver); | 4230 Handle<JSObject> receiver_handle(receiver); |
4229 Handle<JSObject> holder_handle(this); | 4231 Handle<JSObject> holder_handle(this); |
4230 Handle<String> name_handle(String::cast(name)); | 4232 Handle<String> name_handle(String::cast(name)); |
4231 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this); | 4233 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this); |
4232 if (!interceptor->query()->IsUndefined()) { | 4234 if (!interceptor->query()->IsUndefined()) { |
4233 v8::NamedPropertyQuery query = | 4235 v8::NamedPropertyQueryCallback query = |
4234 v8::ToCData<v8::NamedPropertyQuery>(interceptor->query()); | 4236 v8::ToCData<v8::NamedPropertyQueryCallback>(interceptor->query()); |
4235 LOG(isolate, | 4237 LOG(isolate, |
4236 ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name)); | 4238 ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name)); |
4237 v8::Handle<v8::Integer> result = | 4239 v8::Handle<v8::Integer> result = |
4238 args.Call(query, v8::Utils::ToLocal(name_handle)); | 4240 args.Call(query, v8::Utils::ToLocal(name_handle)); |
4239 if (!result.IsEmpty()) { | 4241 if (!result.IsEmpty()) { |
4240 ASSERT(result->IsInt32()); | 4242 ASSERT(result->IsInt32()); |
4241 return static_cast<PropertyAttributes>(result->Int32Value()); | 4243 return static_cast<PropertyAttributes>(result->Int32Value()); |
4242 } | 4244 } |
4243 } else if (!interceptor->getter()->IsUndefined()) { | 4245 } else if (!interceptor->getter()->IsUndefined()) { |
4244 v8::NamedPropertyGetter getter = | 4246 v8::NamedPropertyGetterCallback getter = |
4245 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 4247 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); |
4246 LOG(isolate, | 4248 LOG(isolate, |
4247 ApiNamedPropertyAccess("interceptor-named-get-has", this, name)); | 4249 ApiNamedPropertyAccess("interceptor-named-get-has", this, name)); |
4248 v8::Handle<v8::Value> result = | 4250 v8::Handle<v8::Value> result = |
4249 args.Call(getter, v8::Utils::ToLocal(name_handle)); | 4251 args.Call(getter, v8::Utils::ToLocal(name_handle)); |
4250 if (!result.IsEmpty()) return DONT_ENUM; | 4252 if (!result.IsEmpty()) return DONT_ENUM; |
4251 } | 4253 } |
4252 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle, | 4254 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle, |
4253 *name_handle, | 4255 *name_handle, |
4254 continue_search); | 4256 continue_search); |
4255 } | 4257 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 Isolate* isolate = GetIsolate(); | 4357 Isolate* isolate = GetIsolate(); |
4356 // Make sure that the top context does not change when doing | 4358 // Make sure that the top context does not change when doing |
4357 // callbacks or interceptor calls. | 4359 // callbacks or interceptor calls. |
4358 AssertNoContextChange ncc; | 4360 AssertNoContextChange ncc; |
4359 HandleScope scope(isolate); | 4361 HandleScope scope(isolate); |
4360 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); | 4362 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); |
4361 Handle<JSReceiver> hreceiver(receiver); | 4363 Handle<JSReceiver> hreceiver(receiver); |
4362 Handle<JSObject> holder(this); | 4364 Handle<JSObject> holder(this); |
4363 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this); | 4365 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this); |
4364 if (!interceptor->query()->IsUndefined()) { | 4366 if (!interceptor->query()->IsUndefined()) { |
4365 v8::IndexedPropertyQuery query = | 4367 v8::IndexedPropertyQueryCallback query = |
4366 v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query()); | 4368 v8::ToCData<v8::IndexedPropertyQueryCallback>(interceptor->query()); |
4367 LOG(isolate, | 4369 LOG(isolate, |
4368 ApiIndexedPropertyAccess("interceptor-indexed-has", this, index)); | 4370 ApiIndexedPropertyAccess("interceptor-indexed-has", this, index)); |
4369 v8::Handle<v8::Integer> result = args.Call(query, index); | 4371 v8::Handle<v8::Integer> result = args.Call(query, index); |
4370 if (!result.IsEmpty()) | 4372 if (!result.IsEmpty()) |
4371 return static_cast<PropertyAttributes>(result->Int32Value()); | 4373 return static_cast<PropertyAttributes>(result->Int32Value()); |
4372 } else if (!interceptor->getter()->IsUndefined()) { | 4374 } else if (!interceptor->getter()->IsUndefined()) { |
4373 v8::IndexedPropertyGetter getter = | 4375 v8::IndexedPropertyGetterCallback getter = |
4374 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); | 4376 v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter()); |
4375 LOG(isolate, | 4377 LOG(isolate, |
4376 ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index)); | 4378 ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index)); |
4377 v8::Handle<v8::Value> result = args.Call(getter, index); | 4379 v8::Handle<v8::Value> result = args.Call(getter, index); |
4378 if (!result.IsEmpty()) return NONE; | 4380 if (!result.IsEmpty()) return NONE; |
4379 } | 4381 } |
4380 | 4382 |
4381 return holder->GetElementAttributeWithoutInterceptor( | 4383 return holder->GetElementAttributeWithoutInterceptor( |
4382 *hreceiver, index, continue_search); | 4384 *hreceiver, index, continue_search); |
4383 } | 4385 } |
4384 | 4386 |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5031 | 5033 |
5032 Handle<Object> JSObject::DeletePropertyWithInterceptor(Handle<JSObject> object, | 5034 Handle<Object> JSObject::DeletePropertyWithInterceptor(Handle<JSObject> object, |
5033 Handle<Name> name) { | 5035 Handle<Name> name) { |
5034 Isolate* isolate = object->GetIsolate(); | 5036 Isolate* isolate = object->GetIsolate(); |
5035 | 5037 |
5036 // TODO(rossberg): Support symbols in the API. | 5038 // TODO(rossberg): Support symbols in the API. |
5037 if (name->IsSymbol()) return isolate->factory()->false_value(); | 5039 if (name->IsSymbol()) return isolate->factory()->false_value(); |
5038 | 5040 |
5039 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); | 5041 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); |
5040 if (!interceptor->deleter()->IsUndefined()) { | 5042 if (!interceptor->deleter()->IsUndefined()) { |
5041 v8::NamedPropertyDeleter deleter = | 5043 v8::NamedPropertyDeleterCallback deleter = |
5042 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter()); | 5044 v8::ToCData<v8::NamedPropertyDeleterCallback>(interceptor->deleter()); |
5043 LOG(isolate, | 5045 LOG(isolate, |
5044 ApiNamedPropertyAccess("interceptor-named-delete", *object, *name)); | 5046 ApiNamedPropertyAccess("interceptor-named-delete", *object, *name)); |
5045 PropertyCallbackArguments args( | 5047 PropertyCallbackArguments args( |
5046 isolate, interceptor->data(), *object, *object); | 5048 isolate, interceptor->data(), *object, *object); |
5047 v8::Handle<v8::Boolean> result = | 5049 v8::Handle<v8::Boolean> result = |
5048 args.Call(deleter, v8::Utils::ToLocal(Handle<String>::cast(name))); | 5050 args.Call(deleter, v8::Utils::ToLocal(Handle<String>::cast(name))); |
5049 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); | 5051 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); |
5050 if (!result.IsEmpty()) { | 5052 if (!result.IsEmpty()) { |
5051 ASSERT(result->IsBoolean()); | 5053 ASSERT(result->IsBoolean()); |
5052 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 5054 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
(...skipping 11 matching lines...) Expand all Loading... |
5064 | 5066 |
5065 MaybeObject* JSObject::DeleteElementWithInterceptor(uint32_t index) { | 5067 MaybeObject* JSObject::DeleteElementWithInterceptor(uint32_t index) { |
5066 Isolate* isolate = GetIsolate(); | 5068 Isolate* isolate = GetIsolate(); |
5067 Heap* heap = isolate->heap(); | 5069 Heap* heap = isolate->heap(); |
5068 // Make sure that the top context does not change when doing | 5070 // Make sure that the top context does not change when doing |
5069 // callbacks or interceptor calls. | 5071 // callbacks or interceptor calls. |
5070 AssertNoContextChange ncc; | 5072 AssertNoContextChange ncc; |
5071 HandleScope scope(isolate); | 5073 HandleScope scope(isolate); |
5072 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); | 5074 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); |
5073 if (interceptor->deleter()->IsUndefined()) return heap->false_value(); | 5075 if (interceptor->deleter()->IsUndefined()) return heap->false_value(); |
5074 v8::IndexedPropertyDeleter deleter = | 5076 v8::IndexedPropertyDeleterCallback deleter = |
5075 v8::ToCData<v8::IndexedPropertyDeleter>(interceptor->deleter()); | 5077 v8::ToCData<v8::IndexedPropertyDeleterCallback>(interceptor->deleter()); |
5076 Handle<JSObject> this_handle(this); | 5078 Handle<JSObject> this_handle(this); |
5077 LOG(isolate, | 5079 LOG(isolate, |
5078 ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index)); | 5080 ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index)); |
5079 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); | 5081 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); |
5080 v8::Handle<v8::Boolean> result = args.Call(deleter, index); | 5082 v8::Handle<v8::Boolean> result = args.Call(deleter, index); |
5081 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 5083 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
5082 if (!result.IsEmpty()) { | 5084 if (!result.IsEmpty()) { |
5083 ASSERT(result->IsBoolean()); | 5085 ASSERT(result->IsBoolean()); |
5084 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 5086 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
5085 result_internal->VerifyApiCallResultType(); | 5087 result_internal->VerifyApiCallResultType(); |
(...skipping 6484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11570 SetPropertyMode set_mode) { | 11572 SetPropertyMode set_mode) { |
11571 Isolate* isolate = GetIsolate(); | 11573 Isolate* isolate = GetIsolate(); |
11572 // Make sure that the top context does not change when doing | 11574 // Make sure that the top context does not change when doing |
11573 // callbacks or interceptor calls. | 11575 // callbacks or interceptor calls. |
11574 AssertNoContextChange ncc; | 11576 AssertNoContextChange ncc; |
11575 HandleScope scope(isolate); | 11577 HandleScope scope(isolate); |
11576 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); | 11578 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); |
11577 Handle<JSObject> this_handle(this); | 11579 Handle<JSObject> this_handle(this); |
11578 Handle<Object> value_handle(value, isolate); | 11580 Handle<Object> value_handle(value, isolate); |
11579 if (!interceptor->setter()->IsUndefined()) { | 11581 if (!interceptor->setter()->IsUndefined()) { |
11580 v8::IndexedPropertySetter setter = | 11582 v8::IndexedPropertySetterCallback setter = |
11581 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter()); | 11583 v8::ToCData<v8::IndexedPropertySetterCallback>(interceptor->setter()); |
11582 LOG(isolate, | 11584 LOG(isolate, |
11583 ApiIndexedPropertyAccess("interceptor-indexed-set", this, index)); | 11585 ApiIndexedPropertyAccess("interceptor-indexed-set", this, index)); |
11584 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); | 11586 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); |
11585 v8::Handle<v8::Value> result = | 11587 v8::Handle<v8::Value> result = |
11586 args.Call(setter, index, v8::Utils::ToLocal(value_handle)); | 11588 args.Call(setter, index, v8::Utils::ToLocal(value_handle)); |
11587 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 11589 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
11588 if (!result.IsEmpty()) return *value_handle; | 11590 if (!result.IsEmpty()) return *value_handle; |
11589 } | 11591 } |
11590 MaybeObject* raw_result = | 11592 MaybeObject* raw_result = |
11591 this_handle->SetElementWithoutInterceptor(index, | 11593 this_handle->SetElementWithoutInterceptor(index, |
(...skipping 12 matching lines...) Expand all Loading... |
11604 uint32_t index, | 11606 uint32_t index, |
11605 Object* holder) { | 11607 Object* holder) { |
11606 Isolate* isolate = GetIsolate(); | 11608 Isolate* isolate = GetIsolate(); |
11607 ASSERT(!structure->IsForeign()); | 11609 ASSERT(!structure->IsForeign()); |
11608 | 11610 |
11609 // api style callbacks. | 11611 // api style callbacks. |
11610 if (structure->IsExecutableAccessorInfo()) { | 11612 if (structure->IsExecutableAccessorInfo()) { |
11611 Handle<ExecutableAccessorInfo> data( | 11613 Handle<ExecutableAccessorInfo> data( |
11612 ExecutableAccessorInfo::cast(structure)); | 11614 ExecutableAccessorInfo::cast(structure)); |
11613 Object* fun_obj = data->getter(); | 11615 Object* fun_obj = data->getter(); |
11614 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); | 11616 v8::AccessorGetterCallback call_fun = |
| 11617 v8::ToCData<v8::AccessorGetterCallback>(fun_obj); |
11615 if (call_fun == NULL) return isolate->heap()->undefined_value(); | 11618 if (call_fun == NULL) return isolate->heap()->undefined_value(); |
11616 HandleScope scope(isolate); | 11619 HandleScope scope(isolate); |
11617 Handle<JSObject> self(JSObject::cast(receiver)); | 11620 Handle<JSObject> self(JSObject::cast(receiver)); |
11618 Handle<JSObject> holder_handle(JSObject::cast(holder)); | 11621 Handle<JSObject> holder_handle(JSObject::cast(holder)); |
11619 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); | 11622 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); |
11620 Handle<String> key = isolate->factory()->NumberToString(number); | 11623 Handle<String> key = isolate->factory()->NumberToString(number); |
11621 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key)); | 11624 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key)); |
11622 PropertyCallbackArguments | 11625 PropertyCallbackArguments |
11623 args(isolate, data->data(), *self, *holder_handle); | 11626 args(isolate, data->data(), *self, *holder_handle); |
11624 v8::Handle<v8::Value> result = args.Call(call_fun, v8::Utils::ToLocal(key)); | 11627 v8::Handle<v8::Value> result = args.Call(call_fun, v8::Utils::ToLocal(key)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11669 // callbacks should be phased out. | 11672 // callbacks should be phased out. |
11670 ASSERT(!structure->IsForeign()); | 11673 ASSERT(!structure->IsForeign()); |
11671 | 11674 |
11672 if (structure->IsExecutableAccessorInfo()) { | 11675 if (structure->IsExecutableAccessorInfo()) { |
11673 // api style callbacks | 11676 // api style callbacks |
11674 Handle<JSObject> self(this); | 11677 Handle<JSObject> self(this); |
11675 Handle<JSObject> holder_handle(JSObject::cast(holder)); | 11678 Handle<JSObject> holder_handle(JSObject::cast(holder)); |
11676 Handle<ExecutableAccessorInfo> data( | 11679 Handle<ExecutableAccessorInfo> data( |
11677 ExecutableAccessorInfo::cast(structure)); | 11680 ExecutableAccessorInfo::cast(structure)); |
11678 Object* call_obj = data->setter(); | 11681 Object* call_obj = data->setter(); |
11679 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); | 11682 v8::AccessorSetterCallback call_fun = |
| 11683 v8::ToCData<v8::AccessorSetterCallback>(call_obj); |
11680 if (call_fun == NULL) return value; | 11684 if (call_fun == NULL) return value; |
11681 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); | 11685 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); |
11682 Handle<String> key(isolate->factory()->NumberToString(number)); | 11686 Handle<String> key(isolate->factory()->NumberToString(number)); |
11683 LOG(isolate, ApiNamedPropertyAccess("store", *self, *key)); | 11687 LOG(isolate, ApiNamedPropertyAccess("store", *self, *key)); |
11684 PropertyCallbackArguments | 11688 PropertyCallbackArguments |
11685 args(isolate, data->data(), *self, *holder_handle); | 11689 args(isolate, data->data(), *self, *holder_handle); |
11686 args.Call(call_fun, | 11690 args.Call(call_fun, |
11687 v8::Utils::ToLocal(key), | 11691 v8::Utils::ToLocal(key), |
11688 v8::Utils::ToLocal(value_handle)); | 11692 v8::Utils::ToLocal(value_handle)); |
11689 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 11693 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12578 uint32_t index) { | 12582 uint32_t index) { |
12579 Isolate* isolate = GetIsolate(); | 12583 Isolate* isolate = GetIsolate(); |
12580 // Make sure that the top context does not change when doing | 12584 // Make sure that the top context does not change when doing |
12581 // callbacks or interceptor calls. | 12585 // callbacks or interceptor calls. |
12582 AssertNoContextChange ncc; | 12586 AssertNoContextChange ncc; |
12583 HandleScope scope(isolate); | 12587 HandleScope scope(isolate); |
12584 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor(), isolate); | 12588 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor(), isolate); |
12585 Handle<Object> this_handle(receiver, isolate); | 12589 Handle<Object> this_handle(receiver, isolate); |
12586 Handle<JSObject> holder_handle(this, isolate); | 12590 Handle<JSObject> holder_handle(this, isolate); |
12587 if (!interceptor->getter()->IsUndefined()) { | 12591 if (!interceptor->getter()->IsUndefined()) { |
12588 v8::IndexedPropertyGetter getter = | 12592 v8::IndexedPropertyGetterCallback getter = |
12589 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); | 12593 v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter()); |
12590 LOG(isolate, | 12594 LOG(isolate, |
12591 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); | 12595 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); |
12592 PropertyCallbackArguments | 12596 PropertyCallbackArguments |
12593 args(isolate, interceptor->data(), receiver, this); | 12597 args(isolate, interceptor->data(), receiver, this); |
12594 v8::Handle<v8::Value> result = args.Call(getter, index); | 12598 v8::Handle<v8::Value> result = args.Call(getter, index); |
12595 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 12599 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
12596 if (!result.IsEmpty()) { | 12600 if (!result.IsEmpty()) { |
12597 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 12601 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
12598 result_internal->VerifyApiCallResultType(); | 12602 result_internal->VerifyApiCallResultType(); |
12599 return *result_internal; | 12603 return *result_internal; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12883 if (name->IsSymbol()) return GetHeap()->undefined_value(); | 12887 if (name->IsSymbol()) return GetHeap()->undefined_value(); |
12884 | 12888 |
12885 Isolate* isolate = GetIsolate(); | 12889 Isolate* isolate = GetIsolate(); |
12886 InterceptorInfo* interceptor = GetNamedInterceptor(); | 12890 InterceptorInfo* interceptor = GetNamedInterceptor(); |
12887 HandleScope scope(isolate); | 12891 HandleScope scope(isolate); |
12888 Handle<Object> receiver_handle(receiver, isolate); | 12892 Handle<Object> receiver_handle(receiver, isolate); |
12889 Handle<JSObject> holder_handle(this); | 12893 Handle<JSObject> holder_handle(this); |
12890 Handle<String> name_handle(String::cast(name)); | 12894 Handle<String> name_handle(String::cast(name)); |
12891 | 12895 |
12892 if (!interceptor->getter()->IsUndefined()) { | 12896 if (!interceptor->getter()->IsUndefined()) { |
12893 v8::NamedPropertyGetter getter = | 12897 v8::NamedPropertyGetterCallback getter = |
12894 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 12898 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); |
12895 LOG(isolate, | 12899 LOG(isolate, |
12896 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 12900 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
12897 PropertyCallbackArguments | 12901 PropertyCallbackArguments |
12898 args(isolate, interceptor->data(), receiver, this); | 12902 args(isolate, interceptor->data(), receiver, this); |
12899 v8::Handle<v8::Value> result = | 12903 v8::Handle<v8::Value> result = |
12900 args.Call(getter, v8::Utils::ToLocal(name_handle)); | 12904 args.Call(getter, v8::Utils::ToLocal(name_handle)); |
12901 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 12905 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
12902 if (!result.IsEmpty()) { | 12906 if (!result.IsEmpty()) { |
12903 *attributes = NONE; | 12907 *attributes = NONE; |
12904 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 12908 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
(...skipping 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16009 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16013 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16010 static const char* error_messages_[] = { | 16014 static const char* error_messages_[] = { |
16011 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16015 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16012 }; | 16016 }; |
16013 #undef ERROR_MESSAGES_TEXTS | 16017 #undef ERROR_MESSAGES_TEXTS |
16014 return error_messages_[reason]; | 16018 return error_messages_[reason]; |
16015 } | 16019 } |
16016 | 16020 |
16017 | 16021 |
16018 } } // namespace v8::internal | 16022 } } // namespace v8::internal |
OLD | NEW |