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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 #ifdef ENABLE_DEBUGGER_SUPPORT | 548 #ifdef ENABLE_DEBUGGER_SUPPORT |
549 Debug* debug = isolate->debug(); | 549 Debug* debug = isolate->debug(); |
550 // Handle stepping into a getter if step into is active. | 550 // Handle stepping into a getter if step into is active. |
551 // TODO(rossberg): should this apply to getters that are function proxies? | 551 // TODO(rossberg): should this apply to getters that are function proxies? |
552 if (debug->StepInActive() && getter->IsJSFunction()) { | 552 if (debug->StepInActive() && getter->IsJSFunction()) { |
553 debug->HandleStepIn( | 553 debug->HandleStepIn( |
554 Handle<JSFunction>::cast(getter), Handle<Object>::null(), 0, false); | 554 Handle<JSFunction>::cast(getter), Handle<Object>::null(), 0, false); |
555 } | 555 } |
556 #endif | 556 #endif |
557 | 557 |
558 bool has_pending_exception; | 558 return Execution::Call(isolate, getter, receiver, 0, NULL, true); |
559 Handle<Object> result = Execution::Call( | |
560 isolate, getter, receiver, 0, NULL, &has_pending_exception, true); | |
561 // Check for pending exception and return the result. | |
562 if (has_pending_exception) return MaybeHandle<Object>(); | |
563 return result; | |
564 } | 559 } |
565 | 560 |
566 | 561 |
567 // Only deal with CALLBACKS and INTERCEPTOR | 562 // Only deal with CALLBACKS and INTERCEPTOR |
568 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( | 563 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( |
569 Handle<JSObject> object, | 564 Handle<JSObject> object, |
570 Handle<Object> receiver, | 565 Handle<Object> receiver, |
571 LookupResult* result, | 566 LookupResult* result, |
572 Handle<Name> name, | 567 Handle<Name> name, |
573 PropertyAttributes* attributes) { | 568 PropertyAttributes* attributes) { |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 Handle<Name> name, | 2201 Handle<Name> name, |
2207 Handle<Object> old_value) { | 2202 Handle<Object> old_value) { |
2208 Isolate* isolate = object->GetIsolate(); | 2203 Isolate* isolate = object->GetIsolate(); |
2209 HandleScope scope(isolate); | 2204 HandleScope scope(isolate); |
2210 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); | 2205 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); |
2211 if (object->IsJSGlobalObject()) { | 2206 if (object->IsJSGlobalObject()) { |
2212 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate); | 2207 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate); |
2213 } | 2208 } |
2214 Handle<Object> args[] = { type, object, name, old_value }; | 2209 Handle<Object> args[] = { type, object, name, old_value }; |
2215 int argc = name.is_null() ? 2 : old_value->IsTheHole() ? 3 : 4; | 2210 int argc = name.is_null() ? 2 : old_value->IsTheHole() ? 3 : 4; |
2216 bool threw; | |
2217 | 2211 |
2218 Execution::Call(isolate, | 2212 Execution::Call(isolate, |
2219 Handle<JSFunction>(isolate->observers_notify_change()), | 2213 Handle<JSFunction>(isolate->observers_notify_change()), |
2220 isolate->factory()->undefined_value(), | 2214 isolate->factory()->undefined_value(), |
2221 argc, args, | 2215 argc, args).Assert(); |
2222 &threw); | |
2223 ASSERT(!threw); | |
2224 } | 2216 } |
2225 | 2217 |
2226 | 2218 |
2227 MaybeHandle<Object> JSObject::SetPropertyPostInterceptor( | 2219 MaybeHandle<Object> JSObject::SetPropertyPostInterceptor( |
2228 Handle<JSObject> object, | 2220 Handle<JSObject> object, |
2229 Handle<Name> name, | 2221 Handle<Name> name, |
2230 Handle<Object> value, | 2222 Handle<Object> value, |
2231 PropertyAttributes attributes, | 2223 PropertyAttributes attributes, |
2232 StrictMode strict_mode) { | 2224 StrictMode strict_mode) { |
2233 // Check local property, ignore interceptor. | 2225 // Check local property, ignore interceptor. |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2996 // TODO(dcarney): Handle correctly. | 2988 // TODO(dcarney): Handle correctly. |
2997 if (structure->IsDeclaredAccessorInfo()) { | 2989 if (structure->IsDeclaredAccessorInfo()) { |
2998 return value; | 2990 return value; |
2999 } | 2991 } |
3000 | 2992 |
3001 UNREACHABLE(); | 2993 UNREACHABLE(); |
3002 return MaybeHandle<Object>(); | 2994 return MaybeHandle<Object>(); |
3003 } | 2995 } |
3004 | 2996 |
3005 | 2997 |
3006 Handle<Object> JSReceiver::SetPropertyWithDefinedSetter( | 2998 MaybeHandle<Object> JSReceiver::SetPropertyWithDefinedSetter( |
3007 Handle<JSReceiver> object, | 2999 Handle<JSReceiver> object, |
3008 Handle<JSReceiver> setter, | 3000 Handle<JSReceiver> setter, |
3009 Handle<Object> value) { | 3001 Handle<Object> value) { |
3010 Isolate* isolate = object->GetIsolate(); | 3002 Isolate* isolate = object->GetIsolate(); |
3011 | 3003 |
3012 #ifdef ENABLE_DEBUGGER_SUPPORT | 3004 #ifdef ENABLE_DEBUGGER_SUPPORT |
3013 Debug* debug = isolate->debug(); | 3005 Debug* debug = isolate->debug(); |
3014 // Handle stepping into a setter if step into is active. | 3006 // Handle stepping into a setter if step into is active. |
3015 // TODO(rossberg): should this apply to getters that are function proxies? | 3007 // TODO(rossberg): should this apply to getters that are function proxies? |
3016 if (debug->StepInActive() && setter->IsJSFunction()) { | 3008 if (debug->StepInActive() && setter->IsJSFunction()) { |
3017 debug->HandleStepIn( | 3009 debug->HandleStepIn( |
3018 Handle<JSFunction>::cast(setter), Handle<Object>::null(), 0, false); | 3010 Handle<JSFunction>::cast(setter), Handle<Object>::null(), 0, false); |
3019 } | 3011 } |
3020 #endif | 3012 #endif |
3021 | 3013 |
3022 bool has_pending_exception; | |
3023 Handle<Object> argv[] = { value }; | 3014 Handle<Object> argv[] = { value }; |
3024 Execution::Call( | 3015 RETURN_ON_EXCEPTION( |
3025 isolate, setter, object, ARRAY_SIZE(argv), argv, &has_pending_exception); | 3016 isolate, |
3026 // Check for pending exception and return the result. | 3017 Execution::Call(isolate, setter, object, ARRAY_SIZE(argv), argv), |
3027 if (has_pending_exception) return Handle<Object>(); | 3018 Object); |
3028 return value; | 3019 return value; |
3029 } | 3020 } |
3030 | 3021 |
3031 | 3022 |
3032 MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes( | 3023 MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes( |
3033 Handle<JSObject> object, | 3024 Handle<JSObject> object, |
3034 uint32_t index, | 3025 uint32_t index, |
3035 Handle<Object> value, | 3026 Handle<Object> value, |
3036 bool* found, | 3027 bool* found, |
3037 StrictMode strict_mode) { | 3028 StrictMode strict_mode) { |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3683 ARRAY_SIZE(args), | 3674 ARRAY_SIZE(args), |
3684 args), | 3675 args), |
3685 Object); | 3676 Object); |
3686 | 3677 |
3687 if (result->IsUndefined()) { | 3678 if (result->IsUndefined()) { |
3688 *done = false; | 3679 *done = false; |
3689 return isolate->factory()->the_hole_value(); | 3680 return isolate->factory()->the_hole_value(); |
3690 } | 3681 } |
3691 | 3682 |
3692 // Emulate [[GetProperty]] semantics for proxies. | 3683 // Emulate [[GetProperty]] semantics for proxies. |
3693 bool has_pending_exception; | |
3694 Handle<Object> argv[] = { result }; | 3684 Handle<Object> argv[] = { result }; |
3695 Handle<Object> desc = Execution::Call( | 3685 Handle<Object> desc; |
3696 isolate, isolate->to_complete_property_descriptor(), result, | 3686 ASSIGN_RETURN_ON_EXCEPTION( |
3697 ARRAY_SIZE(argv), argv, &has_pending_exception); | 3687 isolate, desc, |
3698 if (has_pending_exception) return MaybeHandle<Object>(); | 3688 Execution::Call(isolate, |
| 3689 isolate->to_complete_property_descriptor(), |
| 3690 result, |
| 3691 ARRAY_SIZE(argv), |
| 3692 argv), |
| 3693 Object); |
3699 | 3694 |
3700 // [[GetProperty]] requires to check that all properties are configurable. | 3695 // [[GetProperty]] requires to check that all properties are configurable. |
3701 Handle<String> configurable_name = | 3696 Handle<String> configurable_name = |
3702 isolate->factory()->InternalizeOneByteString( | 3697 isolate->factory()->InternalizeOneByteString( |
3703 STATIC_ASCII_VECTOR("configurable_")); | 3698 STATIC_ASCII_VECTOR("configurable_")); |
3704 Handle<Object> configurable = Object::GetProperty(desc, configurable_name); | 3699 Handle<Object> configurable = Object::GetProperty(desc, configurable_name); |
3705 ASSERT(!configurable.is_null()); | 3700 ASSERT(!configurable.is_null()); |
3706 ASSERT(configurable->IsTrue() || configurable->IsFalse()); | 3701 ASSERT(configurable->IsTrue() || configurable->IsFalse()); |
3707 if (configurable->IsFalse()) { | 3702 if (configurable->IsFalse()) { |
3708 Handle<String> trap = | 3703 Handle<String> trap = |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3813 isolate, result, | 3808 isolate, result, |
3814 proxy->CallTrap(proxy, | 3809 proxy->CallTrap(proxy, |
3815 "getPropertyDescriptor", | 3810 "getPropertyDescriptor", |
3816 Handle<Object>(), | 3811 Handle<Object>(), |
3817 ARRAY_SIZE(args), | 3812 ARRAY_SIZE(args), |
3818 args), | 3813 args), |
3819 NONE); | 3814 NONE); |
3820 | 3815 |
3821 if (result->IsUndefined()) return ABSENT; | 3816 if (result->IsUndefined()) return ABSENT; |
3822 | 3817 |
3823 bool has_pending_exception; | |
3824 Handle<Object> argv[] = { result }; | 3818 Handle<Object> argv[] = { result }; |
3825 Handle<Object> desc = Execution::Call( | 3819 Handle<Object> desc; |
3826 isolate, isolate->to_complete_property_descriptor(), result, | 3820 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
3827 ARRAY_SIZE(argv), argv, &has_pending_exception); | 3821 isolate, desc, |
3828 if (has_pending_exception) return NONE; | 3822 Execution::Call(isolate, |
| 3823 isolate->to_complete_property_descriptor(), |
| 3824 result, |
| 3825 ARRAY_SIZE(argv), |
| 3826 argv), |
| 3827 NONE); |
3829 | 3828 |
3830 // Convert result to PropertyAttributes. | 3829 // Convert result to PropertyAttributes. |
3831 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( | 3830 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( |
3832 STATIC_ASCII_VECTOR("enumerable_")); | 3831 STATIC_ASCII_VECTOR("enumerable_")); |
3833 Handle<Object> enumerable = Object::GetProperty(desc, enum_n); | 3832 Handle<Object> enumerable = Object::GetProperty(desc, enum_n); |
3834 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, enumerable, NONE); | 3833 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, enumerable, NONE); |
3835 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( | 3834 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( |
3836 STATIC_ASCII_VECTOR("configurable_")); | 3835 STATIC_ASCII_VECTOR("configurable_")); |
3837 Handle<Object> configurable = Object::GetProperty(desc, conf_n); | 3836 Handle<Object> configurable = Object::GetProperty(desc, conf_n); |
3838 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, configurable, NONE); | 3837 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, configurable, NONE); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3917 if (trap->IsUndefined()) { | 3916 if (trap->IsUndefined()) { |
3918 if (derived.is_null()) { | 3917 if (derived.is_null()) { |
3919 Handle<Object> args[] = { handler, trap_name }; | 3918 Handle<Object> args[] = { handler, trap_name }; |
3920 Handle<Object> error = isolate->factory()->NewTypeError( | 3919 Handle<Object> error = isolate->factory()->NewTypeError( |
3921 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); | 3920 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); |
3922 return isolate->Throw<Object>(error); | 3921 return isolate->Throw<Object>(error); |
3923 } | 3922 } |
3924 trap = Handle<Object>(derived); | 3923 trap = Handle<Object>(derived); |
3925 } | 3924 } |
3926 | 3925 |
3927 bool threw; | 3926 return Execution::Call(isolate, trap, handler, argc, argv); |
3928 return Execution::Call(isolate, trap, handler, argc, argv, &threw); | |
3929 } | 3927 } |
3930 | 3928 |
3931 | 3929 |
3932 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) { | 3930 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) { |
3933 ASSERT(object->map()->inobject_properties() == map->inobject_properties()); | 3931 ASSERT(object->map()->inobject_properties() == map->inobject_properties()); |
3934 ElementsKind obj_kind = object->map()->elements_kind(); | 3932 ElementsKind obj_kind = object->map()->elements_kind(); |
3935 ElementsKind map_kind = map->elements_kind(); | 3933 ElementsKind map_kind = map->elements_kind(); |
3936 if (map_kind != obj_kind) { | 3934 if (map_kind != obj_kind) { |
3937 ElementsKind to_kind = map_kind; | 3935 ElementsKind to_kind = map_kind; |
3938 if (IsMoreGeneralElementsKindTransition(map_kind, obj_kind) || | 3936 if (IsMoreGeneralElementsKindTransition(map_kind, obj_kind) || |
(...skipping 7410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11349 uint32_t add_count) { | 11347 uint32_t add_count) { |
11350 Isolate* isolate = object->GetIsolate(); | 11348 Isolate* isolate = object->GetIsolate(); |
11351 HandleScope scope(isolate); | 11349 HandleScope scope(isolate); |
11352 Handle<Object> index_object = isolate->factory()->NewNumberFromUint(index); | 11350 Handle<Object> index_object = isolate->factory()->NewNumberFromUint(index); |
11353 Handle<Object> add_count_object = | 11351 Handle<Object> add_count_object = |
11354 isolate->factory()->NewNumberFromUint(add_count); | 11352 isolate->factory()->NewNumberFromUint(add_count); |
11355 | 11353 |
11356 Handle<Object> args[] = | 11354 Handle<Object> args[] = |
11357 { object, index_object, deleted, add_count_object }; | 11355 { object, index_object, deleted, add_count_object }; |
11358 | 11356 |
11359 bool threw; | |
11360 Execution::Call(isolate, | 11357 Execution::Call(isolate, |
11361 Handle<JSFunction>(isolate->observers_enqueue_splice()), | 11358 Handle<JSFunction>(isolate->observers_enqueue_splice()), |
11362 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, | 11359 isolate->factory()->undefined_value(), |
11363 &threw); | 11360 ARRAY_SIZE(args), |
11364 ASSERT(!threw); | 11361 args).Assert(); |
11365 } | 11362 } |
11366 | 11363 |
11367 | 11364 |
11368 static void BeginPerformSplice(Handle<JSArray> object) { | 11365 static void BeginPerformSplice(Handle<JSArray> object) { |
11369 Isolate* isolate = object->GetIsolate(); | 11366 Isolate* isolate = object->GetIsolate(); |
11370 HandleScope scope(isolate); | 11367 HandleScope scope(isolate); |
11371 Handle<Object> args[] = { object }; | 11368 Handle<Object> args[] = { object }; |
11372 | 11369 |
11373 bool threw; | |
11374 Execution::Call(isolate, | 11370 Execution::Call(isolate, |
11375 Handle<JSFunction>(isolate->observers_begin_perform_splice()), | 11371 Handle<JSFunction>(isolate->observers_begin_perform_splice()), |
11376 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, | 11372 isolate->factory()->undefined_value(), |
11377 &threw); | 11373 ARRAY_SIZE(args), |
11378 ASSERT(!threw); | 11374 args).Assert(); |
11379 } | 11375 } |
11380 | 11376 |
11381 | 11377 |
11382 static void EndPerformSplice(Handle<JSArray> object) { | 11378 static void EndPerformSplice(Handle<JSArray> object) { |
11383 Isolate* isolate = object->GetIsolate(); | 11379 Isolate* isolate = object->GetIsolate(); |
11384 HandleScope scope(isolate); | 11380 HandleScope scope(isolate); |
11385 Handle<Object> args[] = { object }; | 11381 Handle<Object> args[] = { object }; |
11386 | 11382 |
11387 bool threw; | |
11388 Execution::Call(isolate, | 11383 Execution::Call(isolate, |
11389 Handle<JSFunction>(isolate->observers_end_perform_splice()), | 11384 Handle<JSFunction>(isolate->observers_end_perform_splice()), |
11390 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, | 11385 isolate->factory()->undefined_value(), |
11391 &threw); | 11386 ARRAY_SIZE(args), |
11392 ASSERT(!threw); | 11387 args).Assert(); |
11393 } | 11388 } |
11394 | 11389 |
11395 | 11390 |
11396 MaybeHandle<Object> JSArray::SetElementsLength( | 11391 MaybeHandle<Object> JSArray::SetElementsLength( |
11397 Handle<JSArray> array, | 11392 Handle<JSArray> array, |
11398 Handle<Object> new_length_handle) { | 11393 Handle<Object> new_length_handle) { |
11399 // We should never end in here with a pixel or external array. | 11394 // We should never end in here with a pixel or external array. |
11400 ASSERT(array->AllowsSetElementsLength()); | 11395 ASSERT(array->AllowsSetElementsLength()); |
11401 if (!array->map()->is_observed()) { | 11396 if (!array->map()->is_observed()) { |
11402 return array->GetElementsAccessor()->SetLength(array, new_length_handle); | 11397 return array->GetElementsAccessor()->SetLength(array, new_length_handle); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11996 if (structure->IsDeclaredAccessorInfo()) { | 11991 if (structure->IsDeclaredAccessorInfo()) { |
11997 return GetDeclaredAccessorProperty( | 11992 return GetDeclaredAccessorProperty( |
11998 receiver, Handle<DeclaredAccessorInfo>::cast(structure), isolate); | 11993 receiver, Handle<DeclaredAccessorInfo>::cast(structure), isolate); |
11999 } | 11994 } |
12000 | 11995 |
12001 UNREACHABLE(); | 11996 UNREACHABLE(); |
12002 return MaybeHandle<Object>(); | 11997 return MaybeHandle<Object>(); |
12003 } | 11998 } |
12004 | 11999 |
12005 | 12000 |
12006 Handle<Object> JSObject::SetElementWithCallback(Handle<JSObject> object, | 12001 MaybeHandle<Object> JSObject::SetElementWithCallback(Handle<JSObject> object, |
12007 Handle<Object> structure, | 12002 Handle<Object> structure, |
12008 uint32_t index, | 12003 uint32_t index, |
12009 Handle<Object> value, | 12004 Handle<Object> value, |
12010 Handle<JSObject> holder, | 12005 Handle<JSObject> holder, |
12011 StrictMode strict_mode) { | 12006 StrictMode strict_mode) { |
12012 Isolate* isolate = object->GetIsolate(); | 12007 Isolate* isolate = object->GetIsolate(); |
12013 | 12008 |
12014 // We should never get here to initialize a const with the hole | 12009 // We should never get here to initialize a const with the hole |
12015 // value since a const declaration would conflict with the setter. | 12010 // value since a const declaration would conflict with the setter. |
12016 ASSERT(!value->IsTheHole()); | 12011 ASSERT(!value->IsTheHole()); |
12017 | 12012 |
12018 // To accommodate both the old and the new api we switch on the | 12013 // To accommodate both the old and the new api we switch on the |
12019 // data structure used to store the callbacks. Eventually foreign | 12014 // data structure used to store the callbacks. Eventually foreign |
12020 // callbacks should be phased out. | 12015 // callbacks should be phased out. |
12021 ASSERT(!structure->IsForeign()); | 12016 ASSERT(!structure->IsForeign()); |
12022 | 12017 |
12023 if (structure->IsExecutableAccessorInfo()) { | 12018 if (structure->IsExecutableAccessorInfo()) { |
12024 // api style callbacks | 12019 // api style callbacks |
12025 Handle<ExecutableAccessorInfo> data = | 12020 Handle<ExecutableAccessorInfo> data = |
12026 Handle<ExecutableAccessorInfo>::cast(structure); | 12021 Handle<ExecutableAccessorInfo>::cast(structure); |
12027 Object* call_obj = data->setter(); | 12022 Object* call_obj = data->setter(); |
12028 v8::AccessorSetterCallback call_fun = | 12023 v8::AccessorSetterCallback call_fun = |
12029 v8::ToCData<v8::AccessorSetterCallback>(call_obj); | 12024 v8::ToCData<v8::AccessorSetterCallback>(call_obj); |
12030 if (call_fun == NULL) return value; | 12025 if (call_fun == NULL) return value; |
12031 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); | 12026 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); |
12032 Handle<String> key(isolate->factory()->NumberToString(number)); | 12027 Handle<String> key(isolate->factory()->NumberToString(number)); |
12033 LOG(isolate, ApiNamedPropertyAccess("store", *object, *key)); | 12028 LOG(isolate, ApiNamedPropertyAccess("store", *object, *key)); |
12034 PropertyCallbackArguments | 12029 PropertyCallbackArguments |
12035 args(isolate, data->data(), *object, *holder); | 12030 args(isolate, data->data(), *object, *holder); |
12036 args.Call(call_fun, | 12031 args.Call(call_fun, |
12037 v8::Utils::ToLocal(key), | 12032 v8::Utils::ToLocal(key), |
12038 v8::Utils::ToLocal(value)); | 12033 v8::Utils::ToLocal(value)); |
12039 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); | 12034 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
12040 return value; | 12035 return value; |
12041 } | 12036 } |
12042 | 12037 |
12043 if (structure->IsAccessorPair()) { | 12038 if (structure->IsAccessorPair()) { |
12044 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); | 12039 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); |
12045 if (setter->IsSpecFunction()) { | 12040 if (setter->IsSpecFunction()) { |
12046 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 12041 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
12047 return SetPropertyWithDefinedSetter( | 12042 return SetPropertyWithDefinedSetter( |
12048 object, Handle<JSReceiver>::cast(setter), value); | 12043 object, Handle<JSReceiver>::cast(setter), value); |
12049 } else { | 12044 } else { |
12050 if (strict_mode == SLOPPY) return value; | 12045 if (strict_mode == SLOPPY) return value; |
12051 Handle<Object> key(isolate->factory()->NewNumberFromUint(index)); | 12046 Handle<Object> key(isolate->factory()->NewNumberFromUint(index)); |
12052 Handle<Object> args[2] = { key, holder }; | 12047 Handle<Object> args[2] = { key, holder }; |
12053 Handle<Object> error = isolate->factory()->NewTypeError( | 12048 Handle<Object> error = isolate->factory()->NewTypeError( |
12054 "no_setter_in_callback", HandleVector(args, 2)); | 12049 "no_setter_in_callback", HandleVector(args, 2)); |
12055 isolate->Throw(*error); | 12050 return isolate->Throw<Object>(error); |
12056 return Handle<Object>(); | |
12057 } | 12051 } |
12058 } | 12052 } |
12059 | 12053 |
12060 // TODO(dcarney): Handle correctly. | 12054 // TODO(dcarney): Handle correctly. |
12061 if (structure->IsDeclaredAccessorInfo()) return value; | 12055 if (structure->IsDeclaredAccessorInfo()) return value; |
12062 | 12056 |
12063 UNREACHABLE(); | 12057 UNREACHABLE(); |
12064 return Handle<Object>(); | 12058 return MaybeHandle<Object>(); |
12065 } | 12059 } |
12066 | 12060 |
12067 | 12061 |
12068 bool JSObject::HasFastArgumentsElements() { | 12062 bool JSObject::HasFastArgumentsElements() { |
12069 Heap* heap = GetHeap(); | 12063 Heap* heap = GetHeap(); |
12070 if (!elements()->IsFixedArray()) return false; | 12064 if (!elements()->IsFixedArray()) return false; |
12071 FixedArray* elements = FixedArray::cast(this->elements()); | 12065 FixedArray* elements = FixedArray::cast(this->elements()); |
12072 if (elements->map() != heap->sloppy_arguments_elements_map()) { | 12066 if (elements->map() != heap->sloppy_arguments_elements_map()) { |
12073 return false; | 12067 return false; |
12074 } | 12068 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12489 Handle<Object> value, | 12483 Handle<Object> value, |
12490 PropertyAttributes attributes, | 12484 PropertyAttributes attributes, |
12491 StrictMode strict_mode, | 12485 StrictMode strict_mode, |
12492 bool check_prototype, | 12486 bool check_prototype, |
12493 SetPropertyMode set_mode) { | 12487 SetPropertyMode set_mode) { |
12494 Isolate* isolate = object->GetIsolate(); | 12488 Isolate* isolate = object->GetIsolate(); |
12495 | 12489 |
12496 if (object->HasExternalArrayElements() || | 12490 if (object->HasExternalArrayElements() || |
12497 object->HasFixedTypedArrayElements()) { | 12491 object->HasFixedTypedArrayElements()) { |
12498 if (!value->IsNumber() && !value->IsUndefined()) { | 12492 if (!value->IsNumber() && !value->IsUndefined()) { |
12499 bool has_exception; | 12493 ASSIGN_RETURN_ON_EXCEPTION( |
12500 Handle<Object> number = | 12494 isolate, value, |
12501 Execution::ToNumber(isolate, value, &has_exception); | 12495 Execution::ToNumber(isolate, value), Object); |
12502 if (has_exception) return MaybeHandle<Object>(); | |
12503 value = number; | |
12504 } | 12496 } |
12505 } | 12497 } |
12506 | 12498 |
12507 // Check access rights if needed. | 12499 // Check access rights if needed. |
12508 if (object->IsAccessCheckNeeded()) { | 12500 if (object->IsAccessCheckNeeded()) { |
12509 if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_SET)) { | 12501 if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_SET)) { |
12510 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_SET); | 12502 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_SET); |
12511 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 12503 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
12512 return value; | 12504 return value; |
12513 } | 12505 } |
(...skipping 4128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16642 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16634 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16643 static const char* error_messages_[] = { | 16635 static const char* error_messages_[] = { |
16644 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16636 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16645 }; | 16637 }; |
16646 #undef ERROR_MESSAGES_TEXTS | 16638 #undef ERROR_MESSAGES_TEXTS |
16647 return error_messages_[reason]; | 16639 return error_messages_[reason]; |
16648 } | 16640 } |
16649 | 16641 |
16650 | 16642 |
16651 } } // namespace v8::internal | 16643 } } // namespace v8::internal |
OLD | NEW |