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

Side by Side Diff: src/objects.cc

Issue 12494012: new style of property/function callbacks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 7 years, 8 months 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 | Annotate | Revision Log
OLDNEW
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 isolate); 332 isolate);
333 } 333 }
334 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure); 334 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure);
335 Object* fun_obj = data->getter(); 335 Object* fun_obj = data->getter();
336 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); 336 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj);
337 if (call_fun == NULL) return isolate->heap()->undefined_value(); 337 if (call_fun == NULL) return isolate->heap()->undefined_value();
338 HandleScope scope(isolate); 338 HandleScope scope(isolate);
339 JSObject* self = JSObject::cast(receiver); 339 JSObject* self = JSObject::cast(receiver);
340 Handle<String> key(String::cast(name)); 340 Handle<String> key(String::cast(name));
341 LOG(isolate, ApiNamedPropertyAccess("load", self, name)); 341 LOG(isolate, ApiNamedPropertyAccess("load", self, name));
342 CustomArguments args(isolate, data->data(), self, this); 342 PropertyCallbackArguments args(isolate, data->data(), self, this);
343 v8::AccessorInfo info(args.end()); 343 v8::AccessorInfo info = args.NewInfo();
344 v8::Handle<v8::Value> result; 344 v8::Handle<v8::Value> result;
345 { 345 {
346 // Leaving JavaScript. 346 // Leaving JavaScript.
347 VMState<EXTERNAL> state(isolate); 347 VMState<EXTERNAL> state(isolate);
348 result = call_fun(v8::Utils::ToLocal(key), info); 348 result = args.GetCallbackResult(
349 isolate, call_fun, call_fun(v8::Utils::ToLocal(key), info));
349 } 350 }
350 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 351 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
351 if (result.IsEmpty()) { 352 if (result.IsEmpty()) {
352 return isolate->heap()->undefined_value(); 353 return isolate->heap()->undefined_value();
353 } 354 }
354 Object* return_value = *v8::Utils::OpenHandle(*result); 355 Object* return_value = *v8::Utils::OpenHandle(*result);
355 return_value->VerifyApiCallResultType(); 356 return_value->VerifyApiCallResultType();
356 return return_value; 357 return return_value;
357 } 358 }
358 359
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 // TODO(rossberg): Support symbols in the API. 2106 // TODO(rossberg): Support symbols in the API.
2106 if (name->IsSymbol()) return value; 2107 if (name->IsSymbol()) return value;
2107 Isolate* isolate = GetIsolate(); 2108 Isolate* isolate = GetIsolate();
2108 HandleScope scope(isolate); 2109 HandleScope scope(isolate);
2109 Handle<JSObject> this_handle(this); 2110 Handle<JSObject> this_handle(this);
2110 Handle<String> name_handle(String::cast(name)); 2111 Handle<String> name_handle(String::cast(name));
2111 Handle<Object> value_handle(value, isolate); 2112 Handle<Object> value_handle(value, isolate);
2112 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 2113 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
2113 if (!interceptor->setter()->IsUndefined()) { 2114 if (!interceptor->setter()->IsUndefined()) {
2114 LOG(isolate, ApiNamedPropertyAccess("interceptor-named-set", this, name)); 2115 LOG(isolate, ApiNamedPropertyAccess("interceptor-named-set", this, name));
2115 CustomArguments args(isolate, interceptor->data(), this, this); 2116 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
2116 v8::AccessorInfo info(args.end()); 2117 v8::AccessorInfo info = args.NewInfo();
2117 v8::NamedPropertySetter setter = 2118 v8::NamedPropertySetter setter =
2118 v8::ToCData<v8::NamedPropertySetter>(interceptor->setter()); 2119 v8::ToCData<v8::NamedPropertySetter>(interceptor->setter());
2119 v8::Handle<v8::Value> result; 2120 v8::Handle<v8::Value> result;
2120 { 2121 {
2121 // Leaving JavaScript. 2122 // Leaving JavaScript.
2122 VMState<EXTERNAL> state(isolate); 2123 VMState<EXTERNAL> state(isolate);
2123 Handle<Object> value_unhole(value->IsTheHole() ? 2124 Handle<Object> value_unhole(value->IsTheHole() ?
2124 isolate->heap()->undefined_value() : 2125 isolate->heap()->undefined_value() :
2125 value, 2126 value,
2126 isolate); 2127 isolate);
2127 result = setter(v8::Utils::ToLocal(name_handle), 2128 result = args.GetCallbackResult(
2128 v8::Utils::ToLocal(value_unhole), 2129 isolate,
2129 info); 2130 setter,
2131 setter(v8::Utils::ToLocal(name_handle),
2132 v8::Utils::ToLocal(value_unhole),
2133 info));
2130 } 2134 }
2131 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 2135 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
2132 if (!result.IsEmpty()) return *value_handle; 2136 if (!result.IsEmpty()) return *value_handle;
2133 } 2137 }
2134 MaybeObject* raw_result = 2138 MaybeObject* raw_result =
2135 this_handle->SetPropertyPostInterceptor(*name_handle, 2139 this_handle->SetPropertyPostInterceptor(*name_handle,
2136 *value_handle, 2140 *value_handle,
2137 attributes, 2141 attributes,
2138 strict_mode, 2142 strict_mode,
2139 PERFORM_EXTENSIBILITY_CHECK); 2143 PERFORM_EXTENSIBILITY_CHECK);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 ARRAY_SIZE(args))); 2223 ARRAY_SIZE(args)));
2220 return isolate->Throw(*error); 2224 return isolate->Throw(*error);
2221 } 2225 }
2222 // TODO(rossberg): Support symbols in the API. 2226 // TODO(rossberg): Support symbols in the API.
2223 if (name->IsSymbol()) return value; 2227 if (name->IsSymbol()) return value;
2224 Object* call_obj = data->setter(); 2228 Object* call_obj = data->setter();
2225 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); 2229 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj);
2226 if (call_fun == NULL) return value; 2230 if (call_fun == NULL) return value;
2227 Handle<String> key(String::cast(name)); 2231 Handle<String> key(String::cast(name));
2228 LOG(isolate, ApiNamedPropertyAccess("store", this, name)); 2232 LOG(isolate, ApiNamedPropertyAccess("store", this, name));
2229 CustomArguments args(isolate, data->data(), this, JSObject::cast(holder)); 2233 PropertyCallbackArguments
2230 v8::AccessorInfo info(args.end()); 2234 args(isolate, data->data(), this, JSObject::cast(holder));
2235 v8::AccessorInfo info = args.NewInfo();
2231 { 2236 {
2232 // Leaving JavaScript. 2237 // Leaving JavaScript.
2233 VMState<EXTERNAL> state(isolate); 2238 VMState<EXTERNAL> state(isolate);
2234 call_fun(v8::Utils::ToLocal(key), 2239 call_fun(v8::Utils::ToLocal(key),
2235 v8::Utils::ToLocal(value_handle), 2240 v8::Utils::ToLocal(value_handle),
2236 info); 2241 info);
2237 } 2242 }
2238 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 2243 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
2239 return *value_handle; 2244 return *value_handle;
2240 } 2245 }
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
3477 3482
3478 // Make sure that the top context does not change when doing 3483 // Make sure that the top context does not change when doing
3479 // callbacks or interceptor calls. 3484 // callbacks or interceptor calls.
3480 AssertNoContextChange ncc; 3485 AssertNoContextChange ncc;
3481 3486
3482 HandleScope scope(isolate); 3487 HandleScope scope(isolate);
3483 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 3488 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
3484 Handle<JSObject> receiver_handle(receiver); 3489 Handle<JSObject> receiver_handle(receiver);
3485 Handle<JSObject> holder_handle(this); 3490 Handle<JSObject> holder_handle(this);
3486 Handle<String> name_handle(String::cast(name)); 3491 Handle<String> name_handle(String::cast(name));
3487 CustomArguments args(isolate, interceptor->data(), receiver, this); 3492 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this);
3488 v8::AccessorInfo info(args.end()); 3493 v8::AccessorInfo info = args.NewInfo();
3489 if (!interceptor->query()->IsUndefined()) { 3494 if (!interceptor->query()->IsUndefined()) {
3490 v8::NamedPropertyQuery query = 3495 v8::NamedPropertyQuery query =
3491 v8::ToCData<v8::NamedPropertyQuery>(interceptor->query()); 3496 v8::ToCData<v8::NamedPropertyQuery>(interceptor->query());
3492 LOG(isolate, 3497 LOG(isolate,
3493 ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name)); 3498 ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name));
3494 v8::Handle<v8::Integer> result; 3499 v8::Handle<v8::Integer> result;
3495 { 3500 {
3496 // Leaving JavaScript. 3501 // Leaving JavaScript.
3497 VMState<EXTERNAL> state(isolate); 3502 VMState<EXTERNAL> state(isolate);
3498 result = query(v8::Utils::ToLocal(name_handle), info); 3503 result = args.GetCallbackResult(
3504 isolate, query, query(v8::Utils::ToLocal(name_handle), info));
3499 } 3505 }
3500 if (!result.IsEmpty()) { 3506 if (!result.IsEmpty()) {
3501 ASSERT(result->IsInt32()); 3507 ASSERT(result->IsInt32());
3502 return static_cast<PropertyAttributes>(result->Int32Value()); 3508 return static_cast<PropertyAttributes>(result->Int32Value());
3503 } 3509 }
3504 } else if (!interceptor->getter()->IsUndefined()) { 3510 } else if (!interceptor->getter()->IsUndefined()) {
3505 v8::NamedPropertyGetter getter = 3511 v8::NamedPropertyGetter getter =
3506 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); 3512 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
3507 LOG(isolate, 3513 LOG(isolate,
3508 ApiNamedPropertyAccess("interceptor-named-get-has", this, name)); 3514 ApiNamedPropertyAccess("interceptor-named-get-has", this, name));
3509 v8::Handle<v8::Value> result; 3515 v8::Handle<v8::Value> result;
3510 { 3516 {
3511 // Leaving JavaScript. 3517 // Leaving JavaScript.
3512 VMState<EXTERNAL> state(isolate); 3518 VMState<EXTERNAL> state(isolate);
3513 result = getter(v8::Utils::ToLocal(name_handle), info); 3519 result = args.GetCallbackResult(
3520 isolate, getter, getter(v8::Utils::ToLocal(name_handle), info));
3514 } 3521 }
3515 if (!result.IsEmpty()) return DONT_ENUM; 3522 if (!result.IsEmpty()) return DONT_ENUM;
3516 } 3523 }
3517 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle, 3524 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle,
3518 *name_handle, 3525 *name_handle,
3519 continue_search); 3526 continue_search);
3520 } 3527 }
3521 3528
3522 3529
3523 PropertyAttributes JSReceiver::GetPropertyAttributeWithReceiver( 3530 PropertyAttributes JSReceiver::GetPropertyAttributeWithReceiver(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 PropertyAttributes JSObject::GetElementAttributeWithInterceptor( 3625 PropertyAttributes JSObject::GetElementAttributeWithInterceptor(
3619 JSReceiver* receiver, uint32_t index, bool continue_search) { 3626 JSReceiver* receiver, uint32_t index, bool continue_search) {
3620 Isolate* isolate = GetIsolate(); 3627 Isolate* isolate = GetIsolate();
3621 // Make sure that the top context does not change when doing 3628 // Make sure that the top context does not change when doing
3622 // callbacks or interceptor calls. 3629 // callbacks or interceptor calls.
3623 AssertNoContextChange ncc; 3630 AssertNoContextChange ncc;
3624 HandleScope scope(isolate); 3631 HandleScope scope(isolate);
3625 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); 3632 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor());
3626 Handle<JSReceiver> hreceiver(receiver); 3633 Handle<JSReceiver> hreceiver(receiver);
3627 Handle<JSObject> holder(this); 3634 Handle<JSObject> holder(this);
3628 CustomArguments args(isolate, interceptor->data(), receiver, this); 3635 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this);
3629 v8::AccessorInfo info(args.end()); 3636 v8::AccessorInfo info = args.NewInfo();
3630 if (!interceptor->query()->IsUndefined()) { 3637 if (!interceptor->query()->IsUndefined()) {
3631 v8::IndexedPropertyQuery query = 3638 v8::IndexedPropertyQuery query =
3632 v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query()); 3639 v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query());
3633 LOG(isolate, 3640 LOG(isolate,
3634 ApiIndexedPropertyAccess("interceptor-indexed-has", this, index)); 3641 ApiIndexedPropertyAccess("interceptor-indexed-has", this, index));
3635 v8::Handle<v8::Integer> result; 3642 v8::Handle<v8::Integer> result;
3636 { 3643 {
3637 // Leaving JavaScript. 3644 // Leaving JavaScript.
3638 VMState<EXTERNAL> state(isolate); 3645 VMState<EXTERNAL> state(isolate);
3639 result = query(index, info); 3646 result = args.GetCallbackResult(isolate, query, query(index, info));
3640 } 3647 }
3641 if (!result.IsEmpty()) 3648 if (!result.IsEmpty())
3642 return static_cast<PropertyAttributes>(result->Int32Value()); 3649 return static_cast<PropertyAttributes>(result->Int32Value());
3643 } else if (!interceptor->getter()->IsUndefined()) { 3650 } else if (!interceptor->getter()->IsUndefined()) {
3644 v8::IndexedPropertyGetter getter = 3651 v8::IndexedPropertyGetter getter =
3645 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); 3652 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter());
3646 LOG(isolate, 3653 LOG(isolate,
3647 ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index)); 3654 ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index));
3648 v8::Handle<v8::Value> result; 3655 v8::Handle<v8::Value> result;
3649 { 3656 {
3650 // Leaving JavaScript. 3657 // Leaving JavaScript.
3651 VMState<EXTERNAL> state(isolate); 3658 VMState<EXTERNAL> state(isolate);
3652 result = getter(index, info); 3659 result = args.GetCallbackResult(isolate, getter, getter(index, info));
3653 } 3660 }
3654 if (!result.IsEmpty()) return NONE; 3661 if (!result.IsEmpty()) return NONE;
3655 } 3662 }
3656 3663
3657 return holder->GetElementAttributeWithoutInterceptor( 3664 return holder->GetElementAttributeWithoutInterceptor(
3658 *hreceiver, index, continue_search); 3665 *hreceiver, index, continue_search);
3659 } 3666 }
3660 3667
3661 3668
3662 PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor( 3669 PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor(
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
4306 Isolate* isolate = GetIsolate(); 4313 Isolate* isolate = GetIsolate();
4307 HandleScope scope(isolate); 4314 HandleScope scope(isolate);
4308 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 4315 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
4309 Handle<String> name_handle(String::cast(name)); 4316 Handle<String> name_handle(String::cast(name));
4310 Handle<JSObject> this_handle(this); 4317 Handle<JSObject> this_handle(this);
4311 if (!interceptor->deleter()->IsUndefined()) { 4318 if (!interceptor->deleter()->IsUndefined()) {
4312 v8::NamedPropertyDeleter deleter = 4319 v8::NamedPropertyDeleter deleter =
4313 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter()); 4320 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter());
4314 LOG(isolate, 4321 LOG(isolate,
4315 ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name)); 4322 ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name));
4316 CustomArguments args(isolate, interceptor->data(), this, this); 4323 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
4317 v8::AccessorInfo info(args.end()); 4324 v8::AccessorInfo info = args.NewInfo();
4318 v8::Handle<v8::Boolean> result; 4325 v8::Handle<v8::Boolean> result;
4319 { 4326 {
4320 // Leaving JavaScript. 4327 // Leaving JavaScript.
4321 VMState<EXTERNAL> state(isolate); 4328 VMState<EXTERNAL> state(isolate);
4322 result = deleter(v8::Utils::ToLocal(name_handle), info); 4329 result = args.GetCallbackResult(
4330 isolate, deleter, deleter(v8::Utils::ToLocal(name_handle), info));
4323 } 4331 }
4324 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 4332 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
4325 if (!result.IsEmpty()) { 4333 if (!result.IsEmpty()) {
4326 ASSERT(result->IsBoolean()); 4334 ASSERT(result->IsBoolean());
4327 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 4335 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
4328 result_internal->VerifyApiCallResultType(); 4336 result_internal->VerifyApiCallResultType();
4329 return *result_internal; 4337 return *result_internal;
4330 } 4338 }
4331 } 4339 }
4332 MaybeObject* raw_result = 4340 MaybeObject* raw_result =
(...skipping 10 matching lines...) Expand all
4343 // callbacks or interceptor calls. 4351 // callbacks or interceptor calls.
4344 AssertNoContextChange ncc; 4352 AssertNoContextChange ncc;
4345 HandleScope scope(isolate); 4353 HandleScope scope(isolate);
4346 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); 4354 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor());
4347 if (interceptor->deleter()->IsUndefined()) return heap->false_value(); 4355 if (interceptor->deleter()->IsUndefined()) return heap->false_value();
4348 v8::IndexedPropertyDeleter deleter = 4356 v8::IndexedPropertyDeleter deleter =
4349 v8::ToCData<v8::IndexedPropertyDeleter>(interceptor->deleter()); 4357 v8::ToCData<v8::IndexedPropertyDeleter>(interceptor->deleter());
4350 Handle<JSObject> this_handle(this); 4358 Handle<JSObject> this_handle(this);
4351 LOG(isolate, 4359 LOG(isolate,
4352 ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index)); 4360 ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index));
4353 CustomArguments args(isolate, interceptor->data(), this, this); 4361 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
4354 v8::AccessorInfo info(args.end()); 4362 v8::AccessorInfo info = args.NewInfo();
4355 v8::Handle<v8::Boolean> result; 4363 v8::Handle<v8::Boolean> result;
4356 { 4364 {
4357 // Leaving JavaScript. 4365 // Leaving JavaScript.
4358 VMState<EXTERNAL> state(isolate); 4366 VMState<EXTERNAL> state(isolate);
4359 result = deleter(index, info); 4367 result = args.GetCallbackResult(isolate, deleter, deleter(index, info));
4360 } 4368 }
4361 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 4369 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
4362 if (!result.IsEmpty()) { 4370 if (!result.IsEmpty()) {
4363 ASSERT(result->IsBoolean()); 4371 ASSERT(result->IsBoolean());
4364 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 4372 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
4365 result_internal->VerifyApiCallResultType(); 4373 result_internal->VerifyApiCallResultType();
4366 return *result_internal; 4374 return *result_internal;
4367 } 4375 }
4368 MaybeObject* raw_result = this_handle->GetElementsAccessor()->Delete( 4376 MaybeObject* raw_result = this_handle->GetElementsAccessor()->Delete(
4369 *this_handle, 4377 *this_handle,
(...skipping 5907 matching lines...) Expand 10 before | Expand all | Expand 10 after
10277 AssertNoContextChange ncc; 10285 AssertNoContextChange ncc;
10278 HandleScope scope(isolate); 10286 HandleScope scope(isolate);
10279 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); 10287 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor());
10280 Handle<JSObject> this_handle(this); 10288 Handle<JSObject> this_handle(this);
10281 Handle<Object> value_handle(value, isolate); 10289 Handle<Object> value_handle(value, isolate);
10282 if (!interceptor->setter()->IsUndefined()) { 10290 if (!interceptor->setter()->IsUndefined()) {
10283 v8::IndexedPropertySetter setter = 10291 v8::IndexedPropertySetter setter =
10284 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter()); 10292 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter());
10285 LOG(isolate, 10293 LOG(isolate,
10286 ApiIndexedPropertyAccess("interceptor-indexed-set", this, index)); 10294 ApiIndexedPropertyAccess("interceptor-indexed-set", this, index));
10287 CustomArguments args(isolate, interceptor->data(), this, this); 10295 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
10288 v8::AccessorInfo info(args.end()); 10296 v8::AccessorInfo info = args.NewInfo();
10289 v8::Handle<v8::Value> result; 10297 v8::Handle<v8::Value> result;
10290 { 10298 {
10291 // Leaving JavaScript. 10299 // Leaving JavaScript.
10292 VMState<EXTERNAL> state(isolate); 10300 VMState<EXTERNAL> state(isolate);
10293 result = setter(index, v8::Utils::ToLocal(value_handle), info); 10301 result = args.GetCallbackResult(
10302 isolate,
10303 setter,
10304 setter(index, v8::Utils::ToLocal(value_handle), info));
10294 } 10305 }
10295 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 10306 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
10296 if (!result.IsEmpty()) return *value_handle; 10307 if (!result.IsEmpty()) return *value_handle;
10297 } 10308 }
10298 MaybeObject* raw_result = 10309 MaybeObject* raw_result =
10299 this_handle->SetElementWithoutInterceptor(index, 10310 this_handle->SetElementWithoutInterceptor(index,
10300 *value_handle, 10311 *value_handle,
10301 attributes, 10312 attributes,
10302 strict_mode, 10313 strict_mode,
10303 check_prototype, 10314 check_prototype,
(...skipping 16 matching lines...) Expand all
10320 ExecutableAccessorInfo::cast(structure)); 10331 ExecutableAccessorInfo::cast(structure));
10321 Object* fun_obj = data->getter(); 10332 Object* fun_obj = data->getter();
10322 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); 10333 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj);
10323 if (call_fun == NULL) return isolate->heap()->undefined_value(); 10334 if (call_fun == NULL) return isolate->heap()->undefined_value();
10324 HandleScope scope(isolate); 10335 HandleScope scope(isolate);
10325 Handle<JSObject> self(JSObject::cast(receiver)); 10336 Handle<JSObject> self(JSObject::cast(receiver));
10326 Handle<JSObject> holder_handle(JSObject::cast(holder)); 10337 Handle<JSObject> holder_handle(JSObject::cast(holder));
10327 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 10338 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
10328 Handle<String> key = isolate->factory()->NumberToString(number); 10339 Handle<String> key = isolate->factory()->NumberToString(number);
10329 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key)); 10340 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key));
10330 CustomArguments args(isolate, data->data(), *self, *holder_handle); 10341 PropertyCallbackArguments
10331 v8::AccessorInfo info(args.end()); 10342 args(isolate, data->data(), *self, *holder_handle);
10343 v8::AccessorInfo info = args.NewInfo();
10332 v8::Handle<v8::Value> result; 10344 v8::Handle<v8::Value> result;
10333 { 10345 {
10334 // Leaving JavaScript. 10346 // Leaving JavaScript.
10335 VMState<EXTERNAL> state(isolate); 10347 VMState<EXTERNAL> state(isolate);
10336 result = call_fun(v8::Utils::ToLocal(key), info); 10348 result = args.GetCallbackResult(
10349 isolate, call_fun, call_fun(v8::Utils::ToLocal(key), info));
10337 } 10350 }
10338 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 10351 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
10339 if (result.IsEmpty()) return isolate->heap()->undefined_value(); 10352 if (result.IsEmpty()) return isolate->heap()->undefined_value();
10340 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 10353 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
10341 result_internal->VerifyApiCallResultType(); 10354 result_internal->VerifyApiCallResultType();
10342 return *result_internal; 10355 return *result_internal;
10343 } 10356 }
10344 10357
10345 // __defineGetter__ callback 10358 // __defineGetter__ callback
10346 if (structure->IsAccessorPair()) { 10359 if (structure->IsAccessorPair()) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
10387 Handle<JSObject> self(this); 10400 Handle<JSObject> self(this);
10388 Handle<JSObject> holder_handle(JSObject::cast(holder)); 10401 Handle<JSObject> holder_handle(JSObject::cast(holder));
10389 Handle<ExecutableAccessorInfo> data( 10402 Handle<ExecutableAccessorInfo> data(
10390 ExecutableAccessorInfo::cast(structure)); 10403 ExecutableAccessorInfo::cast(structure));
10391 Object* call_obj = data->setter(); 10404 Object* call_obj = data->setter();
10392 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); 10405 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj);
10393 if (call_fun == NULL) return value; 10406 if (call_fun == NULL) return value;
10394 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 10407 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
10395 Handle<String> key(isolate->factory()->NumberToString(number)); 10408 Handle<String> key(isolate->factory()->NumberToString(number));
10396 LOG(isolate, ApiNamedPropertyAccess("store", *self, *key)); 10409 LOG(isolate, ApiNamedPropertyAccess("store", *self, *key));
10397 CustomArguments args(isolate, data->data(), *self, *holder_handle); 10410 PropertyCallbackArguments
10398 v8::AccessorInfo info(args.end()); 10411 args(isolate, data->data(), *self, *holder_handle);
10412 v8::AccessorInfo info = args.NewInfo();
10399 { 10413 {
10400 // Leaving JavaScript. 10414 // Leaving JavaScript.
10401 VMState<EXTERNAL> state(isolate); 10415 VMState<EXTERNAL> state(isolate);
10402 call_fun(v8::Utils::ToLocal(key), 10416 call_fun(v8::Utils::ToLocal(key),
10403 v8::Utils::ToLocal(value_handle), 10417 v8::Utils::ToLocal(value_handle),
10404 info); 10418 info);
10405 } 10419 }
10406 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 10420 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
10407 return *value_handle; 10421 return *value_handle;
10408 } 10422 }
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
11266 AssertNoContextChange ncc; 11280 AssertNoContextChange ncc;
11267 HandleScope scope(isolate); 11281 HandleScope scope(isolate);
11268 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor(), isolate); 11282 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor(), isolate);
11269 Handle<Object> this_handle(receiver, isolate); 11283 Handle<Object> this_handle(receiver, isolate);
11270 Handle<JSObject> holder_handle(this, isolate); 11284 Handle<JSObject> holder_handle(this, isolate);
11271 if (!interceptor->getter()->IsUndefined()) { 11285 if (!interceptor->getter()->IsUndefined()) {
11272 v8::IndexedPropertyGetter getter = 11286 v8::IndexedPropertyGetter getter =
11273 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); 11287 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter());
11274 LOG(isolate, 11288 LOG(isolate,
11275 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); 11289 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index));
11276 CustomArguments args(isolate, interceptor->data(), receiver, this); 11290 PropertyCallbackArguments
11277 v8::AccessorInfo info(args.end()); 11291 args(isolate, interceptor->data(), receiver, this);
11292 v8::AccessorInfo info = args.NewInfo();
11278 v8::Handle<v8::Value> result; 11293 v8::Handle<v8::Value> result;
11279 { 11294 {
11280 // Leaving JavaScript. 11295 // Leaving JavaScript.
11281 VMState<EXTERNAL> state(isolate); 11296 VMState<EXTERNAL> state(isolate);
11282 result = getter(index, info); 11297 result = args.GetCallbackResult(isolate, getter, getter(index, info));
11283 } 11298 }
11284 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 11299 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
11285 if (!result.IsEmpty()) { 11300 if (!result.IsEmpty()) {
11286 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 11301 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
11287 result_internal->VerifyApiCallResultType(); 11302 result_internal->VerifyApiCallResultType();
11288 return *result_internal; 11303 return *result_internal;
11289 } 11304 }
11290 } 11305 }
11291 11306
11292 Heap* heap = holder_handle->GetHeap(); 11307 Heap* heap = holder_handle->GetHeap();
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
11576 HandleScope scope(isolate); 11591 HandleScope scope(isolate);
11577 Handle<Object> receiver_handle(receiver, isolate); 11592 Handle<Object> receiver_handle(receiver, isolate);
11578 Handle<JSObject> holder_handle(this); 11593 Handle<JSObject> holder_handle(this);
11579 Handle<String> name_handle(String::cast(name)); 11594 Handle<String> name_handle(String::cast(name));
11580 11595
11581 if (!interceptor->getter()->IsUndefined()) { 11596 if (!interceptor->getter()->IsUndefined()) {
11582 v8::NamedPropertyGetter getter = 11597 v8::NamedPropertyGetter getter =
11583 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); 11598 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
11584 LOG(isolate, 11599 LOG(isolate,
11585 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); 11600 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name));
11586 CustomArguments args(isolate, interceptor->data(), receiver, this); 11601 PropertyCallbackArguments
11587 v8::AccessorInfo info(args.end()); 11602 args(isolate, interceptor->data(), receiver, this);
11603 v8::AccessorInfo info = args.NewInfo();
11588 v8::Handle<v8::Value> result; 11604 v8::Handle<v8::Value> result;
11589 { 11605 {
11590 // Leaving JavaScript. 11606 // Leaving JavaScript.
11591 VMState<EXTERNAL> state(isolate); 11607 VMState<EXTERNAL> state(isolate);
11592 result = getter(v8::Utils::ToLocal(name_handle), info); 11608 result = args.GetCallbackResult(
11609 isolate, getter, getter(v8::Utils::ToLocal(name_handle), info));
11593 } 11610 }
11594 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 11611 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
11595 if (!result.IsEmpty()) { 11612 if (!result.IsEmpty()) {
11596 *attributes = NONE; 11613 *attributes = NONE;
11597 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 11614 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
11598 result_internal->VerifyApiCallResultType(); 11615 result_internal->VerifyApiCallResultType();
11599 return *result_internal; 11616 return *result_internal;
11600 } 11617 }
11601 } 11618 }
11602 11619
(...skipping 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after
14529 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14546 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14530 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14547 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14531 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14548 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14532 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14549 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14533 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14550 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14534 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14551 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14535 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14552 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14536 } 14553 }
14537 14554
14538 } } // namespace v8::internal 14555 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/stub-cache.cc » ('j') | src/x64/macro-assembler-x64.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698