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

Side by Side Diff: src/objects.cc

Issue 225283005: Return MaybeHandle from SetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 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
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('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 // 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 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value); 2112 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value);
2113 PropertyCell::SetValueInferType(cell, value); 2113 PropertyCell::SetValueInferType(cell, value);
2114 value = cell; 2114 value = cell;
2115 } 2115 }
2116 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); 2116 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0);
2117 Handle<NameDictionary> result = NameDictionaryAdd(dict, name, value, details); 2117 Handle<NameDictionary> result = NameDictionaryAdd(dict, name, value, details);
2118 if (*dict != *result) object->set_properties(*result); 2118 if (*dict != *result) object->set_properties(*result);
2119 } 2119 }
2120 2120
2121 2121
2122 Handle<Object> JSObject::AddProperty(Handle<JSObject> object, 2122 MaybeHandle<Object> JSObject::AddProperty(
2123 Handle<Name> name, 2123 Handle<JSObject> object,
2124 Handle<Object> value, 2124 Handle<Name> name,
2125 PropertyAttributes attributes, 2125 Handle<Object> value,
2126 StrictMode strict_mode, 2126 PropertyAttributes attributes,
2127 JSReceiver::StoreFromKeyed store_mode, 2127 StrictMode strict_mode,
2128 ExtensibilityCheck extensibility_check, 2128 JSReceiver::StoreFromKeyed store_mode,
2129 ValueType value_type, 2129 ExtensibilityCheck extensibility_check,
2130 StoreMode mode, 2130 ValueType value_type,
2131 TransitionFlag transition_flag) { 2131 StoreMode mode,
2132 TransitionFlag transition_flag) {
2132 ASSERT(!object->IsJSGlobalProxy()); 2133 ASSERT(!object->IsJSGlobalProxy());
2133 Isolate* isolate = object->GetIsolate(); 2134 Isolate* isolate = object->GetIsolate();
2134 2135
2135 if (!name->IsUniqueName()) { 2136 if (!name->IsUniqueName()) {
2136 name = isolate->factory()->InternalizeString( 2137 name = isolate->factory()->InternalizeString(
2137 Handle<String>::cast(name)); 2138 Handle<String>::cast(name));
2138 } 2139 }
2139 2140
2140 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && 2141 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK &&
2141 !object->map()->is_extensible()) { 2142 !object->map()->is_extensible()) {
2142 if (strict_mode == SLOPPY) { 2143 if (strict_mode == SLOPPY) {
2143 return value; 2144 return value;
2144 } else { 2145 } else {
2145 Handle<Object> args[1] = { name }; 2146 Handle<Object> args[1] = { name };
2146 Handle<Object> error = isolate->factory()->NewTypeError( 2147 Handle<Object> error = isolate->factory()->NewTypeError(
2147 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); 2148 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args)));
2148 isolate->Throw(*error); 2149 return isolate->Throw<Object>(error);
2149 return Handle<Object>();
2150 } 2150 }
2151 } 2151 }
2152 2152
2153 if (object->HasFastProperties()) { 2153 if (object->HasFastProperties()) {
2154 // Ensure the descriptor array does not get too big. 2154 // Ensure the descriptor array does not get too big.
2155 if (object->map()->NumberOfOwnDescriptors() <= kMaxNumberOfDescriptors) { 2155 if (object->map()->NumberOfOwnDescriptors() <= kMaxNumberOfDescriptors) {
2156 // TODO(verwaest): Support other constants. 2156 // TODO(verwaest): Support other constants.
2157 // if (mode == ALLOW_AS_CONSTANT && 2157 // if (mode == ALLOW_AS_CONSTANT &&
2158 // !value->IsTheHole() && 2158 // !value->IsTheHole() &&
2159 // !value->IsConsString()) { 2159 // !value->IsConsString()) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 2199
2200 Execution::Call(isolate, 2200 Execution::Call(isolate,
2201 Handle<JSFunction>(isolate->observers_notify_change()), 2201 Handle<JSFunction>(isolate->observers_notify_change()),
2202 isolate->factory()->undefined_value(), 2202 isolate->factory()->undefined_value(),
2203 argc, args, 2203 argc, args,
2204 &threw); 2204 &threw);
2205 ASSERT(!threw); 2205 ASSERT(!threw);
2206 } 2206 }
2207 2207
2208 2208
2209 Handle<Object> JSObject::SetPropertyPostInterceptor( 2209 MaybeHandle<Object> JSObject::SetPropertyPostInterceptor(
2210 Handle<JSObject> object, 2210 Handle<JSObject> object,
2211 Handle<Name> name, 2211 Handle<Name> name,
2212 Handle<Object> value, 2212 Handle<Object> value,
2213 PropertyAttributes attributes, 2213 PropertyAttributes attributes,
2214 StrictMode strict_mode) { 2214 StrictMode strict_mode) {
2215 // Check local property, ignore interceptor. 2215 // Check local property, ignore interceptor.
2216 LookupResult result(object->GetIsolate()); 2216 Isolate* isolate = object->GetIsolate();
2217 LookupResult result(isolate);
2217 object->LocalLookupRealNamedProperty(*name, &result); 2218 object->LocalLookupRealNamedProperty(*name, &result);
2218 if (!result.IsFound()) { 2219 if (!result.IsFound()) {
2219 object->map()->LookupTransition(*object, *name, &result); 2220 object->map()->LookupTransition(*object, *name, &result);
2220 } 2221 }
2221 if (result.IsFound()) { 2222 if (result.IsFound()) {
2222 // An existing property or a map transition was found. Use set property to 2223 // An existing property or a map transition was found. Use set property to
2223 // handle all these cases. 2224 // handle all these cases.
2224 return SetPropertyForResult(object, &result, name, value, attributes, 2225 return SetPropertyForResult(object, &result, name, value, attributes,
2225 strict_mode, MAY_BE_STORE_FROM_KEYED); 2226 strict_mode, MAY_BE_STORE_FROM_KEYED);
2226 } 2227 }
2227 bool done = false; 2228 bool done = false;
2228 Handle<Object> result_object = SetPropertyViaPrototypes( 2229 Handle<Object> result_object;
2229 object, name, value, attributes, strict_mode, &done); 2230 ASSIGN_RETURN_ON_EXCEPTION(
2231 isolate, result_object,
2232 SetPropertyViaPrototypes(
2233 object, name, value, attributes, strict_mode, &done),
2234 Object);
2230 if (done) return result_object; 2235 if (done) return result_object;
2231 // Add a new real property. 2236 // Add a new real property.
2232 return AddProperty(object, name, value, attributes, strict_mode); 2237 return AddProperty(object, name, value, attributes, strict_mode);
2233 } 2238 }
2234 2239
2235 2240
2236 static void ReplaceSlowProperty(Handle<JSObject> object, 2241 static void ReplaceSlowProperty(Handle<JSObject> object,
2237 Handle<Name> name, 2242 Handle<Name> name,
2238 Handle<Object> value, 2243 Handle<Object> value,
2239 PropertyAttributes attributes) { 2244 PropertyAttributes attributes) {
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 int valid = updated->NumberOfOwnDescriptors(); 2835 int valid = updated->NumberOfOwnDescriptors();
2831 if (!updated_descriptors->IsMoreGeneralThan( 2836 if (!updated_descriptors->IsMoreGeneralThan(
2832 verbatim, valid, descriptors, old_descriptors)) { 2837 verbatim, valid, descriptors, old_descriptors)) {
2833 return Handle<Map>(); 2838 return Handle<Map>();
2834 } 2839 }
2835 2840
2836 return handle(updated); 2841 return handle(updated);
2837 } 2842 }
2838 2843
2839 2844
2840 Handle<Object> JSObject::SetPropertyWithInterceptor( 2845 MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(
2841 Handle<JSObject> object, 2846 Handle<JSObject> object,
2842 Handle<Name> name, 2847 Handle<Name> name,
2843 Handle<Object> value, 2848 Handle<Object> value,
2844 PropertyAttributes attributes, 2849 PropertyAttributes attributes,
2845 StrictMode strict_mode) { 2850 StrictMode strict_mode) {
2846 // TODO(rossberg): Support symbols in the API. 2851 // TODO(rossberg): Support symbols in the API.
2847 if (name->IsSymbol()) return value; 2852 if (name->IsSymbol()) return value;
2848 Isolate* isolate = object->GetIsolate(); 2853 Isolate* isolate = object->GetIsolate();
2849 Handle<String> name_string = Handle<String>::cast(name); 2854 Handle<String> name_string = Handle<String>::cast(name);
2850 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); 2855 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor());
2851 if (!interceptor->setter()->IsUndefined()) { 2856 if (!interceptor->setter()->IsUndefined()) {
2852 LOG(isolate, 2857 LOG(isolate,
2853 ApiNamedPropertyAccess("interceptor-named-set", *object, *name)); 2858 ApiNamedPropertyAccess("interceptor-named-set", *object, *name));
2854 PropertyCallbackArguments args( 2859 PropertyCallbackArguments args(
2855 isolate, interceptor->data(), *object, *object); 2860 isolate, interceptor->data(), *object, *object);
2856 v8::NamedPropertySetterCallback setter = 2861 v8::NamedPropertySetterCallback setter =
2857 v8::ToCData<v8::NamedPropertySetterCallback>(interceptor->setter()); 2862 v8::ToCData<v8::NamedPropertySetterCallback>(interceptor->setter());
2858 Handle<Object> value_unhole = value->IsTheHole() 2863 Handle<Object> value_unhole = value->IsTheHole()
2859 ? Handle<Object>(isolate->factory()->undefined_value()) : value; 2864 ? Handle<Object>(isolate->factory()->undefined_value()) : value;
2860 v8::Handle<v8::Value> result = args.Call(setter, 2865 v8::Handle<v8::Value> result = args.Call(setter,
2861 v8::Utils::ToLocal(name_string), 2866 v8::Utils::ToLocal(name_string),
2862 v8::Utils::ToLocal(value_unhole)); 2867 v8::Utils::ToLocal(value_unhole));
2863 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); 2868 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
2864 if (!result.IsEmpty()) return value; 2869 if (!result.IsEmpty()) return value;
2865 } 2870 }
2866 Handle<Object> result = 2871 return SetPropertyPostInterceptor(
2867 SetPropertyPostInterceptor(object, name, value, attributes, strict_mode); 2872 object, name, value, attributes, strict_mode);
2868 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
2869 return result;
2870 } 2873 }
2871 2874
2872 2875
2873 Handle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object, 2876 MaybeHandle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
2874 Handle<Name> name, 2877 Handle<Name> name,
2875 Handle<Object> value, 2878 Handle<Object> value,
2876 PropertyAttributes attributes, 2879 PropertyAttributes attributes,
2877 StrictMode strict_mode, 2880 StrictMode strict_mode,
2878 StoreFromKeyed store_mode) { 2881 StoreFromKeyed store_mode) {
2879 LookupResult result(object->GetIsolate()); 2882 LookupResult result(object->GetIsolate());
2880 object->LocalLookup(*name, &result, true); 2883 object->LocalLookup(*name, &result, true);
2881 if (!result.IsFound()) { 2884 if (!result.IsFound()) {
2882 object->map()->LookupTransition(JSObject::cast(*object), *name, &result); 2885 object->map()->LookupTransition(JSObject::cast(*object), *name, &result);
2883 } 2886 }
2884 return SetProperty(object, &result, name, value, attributes, strict_mode, 2887 return SetProperty(object, &result, name, value, attributes, strict_mode,
2885 store_mode); 2888 store_mode);
2886 } 2889 }
2887 2890
2888 2891
2889 Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object, 2892 MaybeHandle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
2890 Handle<Object> structure, 2893 Handle<Object> structure,
2891 Handle<Name> name, 2894 Handle<Name> name,
2892 Handle<Object> value, 2895 Handle<Object> value,
2893 Handle<JSObject> holder, 2896 Handle<JSObject> holder,
2894 StrictMode strict_mode) { 2897 StrictMode strict_mode) {
2895 Isolate* isolate = object->GetIsolate(); 2898 Isolate* isolate = object->GetIsolate();
2896 2899
2897 // We should never get here to initialize a const with the hole 2900 // We should never get here to initialize a const with the hole
2898 // value since a const declaration would conflict with the setter. 2901 // value since a const declaration would conflict with the setter.
2899 ASSERT(!value->IsTheHole()); 2902 ASSERT(!value->IsTheHole());
2900 2903
2901 // To accommodate both the old and the new api we switch on the 2904 // To accommodate both the old and the new api we switch on the
2902 // data structure used to store the callbacks. Eventually foreign 2905 // data structure used to store the callbacks. Eventually foreign
2903 // callbacks should be phased out. 2906 // callbacks should be phased out.
2904 if (structure->IsForeign()) { 2907 if (structure->IsForeign()) {
2905 AccessorDescriptor* callback = 2908 AccessorDescriptor* callback =
2906 reinterpret_cast<AccessorDescriptor*>( 2909 reinterpret_cast<AccessorDescriptor*>(
2907 Handle<Foreign>::cast(structure)->foreign_address()); 2910 Handle<Foreign>::cast(structure)->foreign_address());
2908 CALL_AND_RETRY_OR_DIE(isolate, 2911 CALL_AND_RETRY_OR_DIE(isolate,
2909 (callback->setter)( 2912 (callback->setter)(
2910 isolate, *object, *value, callback->data), 2913 isolate, *object, *value, callback->data),
2911 break, 2914 break,
2912 return Handle<Object>()); 2915 return Handle<Object>());
2913 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); 2916 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
2914 return value; 2917 return value;
2915 } 2918 }
2916 2919
2917 if (structure->IsExecutableAccessorInfo()) { 2920 if (structure->IsExecutableAccessorInfo()) {
2918 // api style callbacks 2921 // api style callbacks
2919 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(*structure); 2922 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(*structure);
2920 if (!data->IsCompatibleReceiver(*object)) { 2923 if (!data->IsCompatibleReceiver(*object)) {
2921 Handle<Object> args[2] = { name, object }; 2924 Handle<Object> args[2] = { name, object };
2922 Handle<Object> error = 2925 Handle<Object> error =
2923 isolate->factory()->NewTypeError("incompatible_method_receiver", 2926 isolate->factory()->NewTypeError("incompatible_method_receiver",
2924 HandleVector(args, 2927 HandleVector(args,
2925 ARRAY_SIZE(args))); 2928 ARRAY_SIZE(args)));
2926 isolate->Throw(*error); 2929 return isolate->Throw<Object>(error);
2927 return Handle<Object>();
2928 } 2930 }
2929 // TODO(rossberg): Support symbols in the API. 2931 // TODO(rossberg): Support symbols in the API.
2930 if (name->IsSymbol()) return value; 2932 if (name->IsSymbol()) return value;
2931 Object* call_obj = data->setter(); 2933 Object* call_obj = data->setter();
2932 v8::AccessorSetterCallback call_fun = 2934 v8::AccessorSetterCallback call_fun =
2933 v8::ToCData<v8::AccessorSetterCallback>(call_obj); 2935 v8::ToCData<v8::AccessorSetterCallback>(call_obj);
2934 if (call_fun == NULL) return value; 2936 if (call_fun == NULL) return value;
2935 Handle<String> key = Handle<String>::cast(name); 2937 Handle<String> key = Handle<String>::cast(name);
2936 LOG(isolate, ApiNamedPropertyAccess("store", *object, *name)); 2938 LOG(isolate, ApiNamedPropertyAccess("store", *object, *name));
2937 PropertyCallbackArguments args( 2939 PropertyCallbackArguments args(
2938 isolate, data->data(), *object, JSObject::cast(*holder)); 2940 isolate, data->data(), *object, JSObject::cast(*holder));
2939 args.Call(call_fun, 2941 args.Call(call_fun,
2940 v8::Utils::ToLocal(key), 2942 v8::Utils::ToLocal(key),
2941 v8::Utils::ToLocal(value)); 2943 v8::Utils::ToLocal(value));
2942 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); 2944 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
2943 return value; 2945 return value;
2944 } 2946 }
2945 2947
2946 if (structure->IsAccessorPair()) { 2948 if (structure->IsAccessorPair()) {
2947 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); 2949 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
2948 if (setter->IsSpecFunction()) { 2950 if (setter->IsSpecFunction()) {
2949 // TODO(rossberg): nicer would be to cast to some JSCallable here... 2951 // TODO(rossberg): nicer would be to cast to some JSCallable here...
2950 return SetPropertyWithDefinedSetter( 2952 return SetPropertyWithDefinedSetter(
2951 object, Handle<JSReceiver>::cast(setter), value); 2953 object, Handle<JSReceiver>::cast(setter), value);
2952 } else { 2954 } else {
2953 if (strict_mode == SLOPPY) return value; 2955 if (strict_mode == SLOPPY) return value;
2954 Handle<Object> args[2] = { name, holder }; 2956 Handle<Object> args[2] = { name, holder };
2955 Handle<Object> error = 2957 Handle<Object> error =
2956 isolate->factory()->NewTypeError("no_setter_in_callback", 2958 isolate->factory()->NewTypeError("no_setter_in_callback",
2957 HandleVector(args, 2)); 2959 HandleVector(args, 2));
2958 isolate->Throw(*error); 2960 return isolate->Throw<Object>(error);
2959 return Handle<Object>();
2960 } 2961 }
2961 } 2962 }
2962 2963
2963 // TODO(dcarney): Handle correctly. 2964 // TODO(dcarney): Handle correctly.
2964 if (structure->IsDeclaredAccessorInfo()) { 2965 if (structure->IsDeclaredAccessorInfo()) {
2965 return value; 2966 return value;
2966 } 2967 }
2967 2968
2968 UNREACHABLE(); 2969 UNREACHABLE();
2969 return Handle<Object>(); 2970 return MaybeHandle<Object>();
2970 } 2971 }
2971 2972
2972 2973
2973 Handle<Object> JSReceiver::SetPropertyWithDefinedSetter( 2974 Handle<Object> JSReceiver::SetPropertyWithDefinedSetter(
2974 Handle<JSReceiver> object, 2975 Handle<JSReceiver> object,
2975 Handle<JSReceiver> setter, 2976 Handle<JSReceiver> setter,
2976 Handle<Object> value) { 2977 Handle<Object> value) {
2977 Isolate* isolate = object->GetIsolate(); 2978 Isolate* isolate = object->GetIsolate();
2978 2979
2979 #ifdef ENABLE_DEBUGGER_SUPPORT 2980 #ifdef ENABLE_DEBUGGER_SUPPORT
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 return SetElementWithCallback(object, structure, index, value, js_proto, 3031 return SetElementWithCallback(object, structure, index, value, js_proto,
3031 strict_mode); 3032 strict_mode);
3032 } 3033 }
3033 } 3034 }
3034 } 3035 }
3035 *found = false; 3036 *found = false;
3036 return isolate->factory()->the_hole_value(); 3037 return isolate->factory()->the_hole_value();
3037 } 3038 }
3038 3039
3039 3040
3040 Handle<Object> JSObject::SetPropertyViaPrototypes(Handle<JSObject> object, 3041 MaybeHandle<Object> JSObject::SetPropertyViaPrototypes(
3041 Handle<Name> name, 3042 Handle<JSObject> object,
3042 Handle<Object> value, 3043 Handle<Name> name,
3043 PropertyAttributes attributes, 3044 Handle<Object> value,
3044 StrictMode strict_mode, 3045 PropertyAttributes attributes,
3045 bool* done) { 3046 StrictMode strict_mode,
3047 bool* done) {
3046 Isolate* isolate = object->GetIsolate(); 3048 Isolate* isolate = object->GetIsolate();
3047 3049
3048 *done = false; 3050 *done = false;
3049 // We could not find a local property so let's check whether there is an 3051 // We could not find a local property so let's check whether there is an
3050 // accessor that wants to handle the property, or whether the property is 3052 // accessor that wants to handle the property, or whether the property is
3051 // read-only on the prototype chain. 3053 // read-only on the prototype chain.
3052 LookupResult result(isolate); 3054 LookupResult result(isolate);
3053 object->LookupRealNamedPropertyInPrototypes(*name, &result); 3055 object->LookupRealNamedPropertyInPrototypes(*name, &result);
3054 if (result.IsFound()) { 3056 if (result.IsFound()) {
3055 switch (result.type()) { 3057 switch (result.type()) {
(...skipping 24 matching lines...) Expand all
3080 break; 3082 break;
3081 } 3083 }
3082 } 3084 }
3083 3085
3084 // If we get here with *done true, we have encountered a read-only property. 3086 // If we get here with *done true, we have encountered a read-only property.
3085 if (*done) { 3087 if (*done) {
3086 if (strict_mode == SLOPPY) return value; 3088 if (strict_mode == SLOPPY) return value;
3087 Handle<Object> args[] = { name, object }; 3089 Handle<Object> args[] = { name, object };
3088 Handle<Object> error = isolate->factory()->NewTypeError( 3090 Handle<Object> error = isolate->factory()->NewTypeError(
3089 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); 3091 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
3090 isolate->Throw(*error); 3092 return isolate->Throw<Object>(error);
3091 return Handle<Object>();
3092 } 3093 }
3093 return isolate->factory()->the_hole_value(); 3094 return isolate->factory()->the_hole_value();
3094 } 3095 }
3095 3096
3096 3097
3097 void Map::EnsureDescriptorSlack(Handle<Map> map, int slack) { 3098 void Map::EnsureDescriptorSlack(Handle<Map> map, int slack) {
3098 Handle<DescriptorArray> descriptors(map->instance_descriptors()); 3099 Handle<DescriptorArray> descriptors(map->instance_descriptors());
3099 if (slack <= descriptors->NumberOfSlackDescriptors()) return; 3100 if (slack <= descriptors->NumberOfSlackDescriptors()) return;
3100 int number_of_descriptors = descriptors->number_of_descriptors(); 3101 int number_of_descriptors = descriptors->number_of_descriptors();
3101 Isolate* isolate = map->GetIsolate(); 3102 Isolate* isolate = map->GetIsolate();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
3450 } 3451 }
3451 JSObject::cast(pt)->LocalLookupRealNamedProperty(name, result); 3452 JSObject::cast(pt)->LocalLookupRealNamedProperty(name, result);
3452 ASSERT(!(result->IsFound() && result->type() == INTERCEPTOR)); 3453 ASSERT(!(result->IsFound() && result->type() == INTERCEPTOR));
3453 if (result->IsFound()) return; 3454 if (result->IsFound()) return;
3454 } 3455 }
3455 result->NotFound(); 3456 result->NotFound();
3456 } 3457 }
3457 3458
3458 3459
3459 // We only need to deal with CALLBACKS and INTERCEPTORS 3460 // We only need to deal with CALLBACKS and INTERCEPTORS
3460 Handle<Object> JSObject::SetPropertyWithFailedAccessCheck( 3461 MaybeHandle<Object> JSObject::SetPropertyWithFailedAccessCheck(
3461 Handle<JSObject> object, 3462 Handle<JSObject> object,
3462 LookupResult* result, 3463 LookupResult* result,
3463 Handle<Name> name, 3464 Handle<Name> name,
3464 Handle<Object> value, 3465 Handle<Object> value,
3465 bool check_prototype, 3466 bool check_prototype,
3466 StrictMode strict_mode) { 3467 StrictMode strict_mode) {
3467 if (check_prototype && !result->IsProperty()) { 3468 if (check_prototype && !result->IsProperty()) {
3468 object->LookupRealNamedPropertyInPrototypes(*name, result); 3469 object->LookupRealNamedPropertyInPrototypes(*name, result);
3469 } 3470 }
3470 3471
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3513 } 3514 }
3514 default: { 3515 default: {
3515 break; 3516 break;
3516 } 3517 }
3517 } 3518 }
3518 } 3519 }
3519 } 3520 }
3520 3521
3521 Isolate* isolate = object->GetIsolate(); 3522 Isolate* isolate = object->GetIsolate();
3522 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_SET); 3523 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_SET);
3523 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); 3524 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
3524 return value; 3525 return value;
3525 } 3526 }
3526 3527
3527 3528
3528 Handle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object, 3529 MaybeHandle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
3529 LookupResult* result, 3530 LookupResult* result,
3530 Handle<Name> key, 3531 Handle<Name> key,
3531 Handle<Object> value, 3532 Handle<Object> value,
3532 PropertyAttributes attributes, 3533 PropertyAttributes attributes,
3533 StrictMode strict_mode, 3534 StrictMode strict_mode,
3534 StoreFromKeyed store_mode) { 3535 StoreFromKeyed store_mode) {
3535 if (result->IsHandler()) { 3536 if (result->IsHandler()) {
3536 return JSProxy::SetPropertyWithHandler(handle(result->proxy()), 3537 return JSProxy::SetPropertyWithHandler(handle(result->proxy()),
3537 object, key, value, attributes, strict_mode); 3538 object, key, value, attributes, strict_mode);
3538 } else { 3539 } else {
3539 return JSObject::SetPropertyForResult(Handle<JSObject>::cast(object), 3540 return JSObject::SetPropertyForResult(Handle<JSObject>::cast(object),
3540 result, key, value, attributes, strict_mode, store_mode); 3541 result, key, value, attributes, strict_mode, store_mode);
3541 } 3542 }
3542 } 3543 }
3543 3544
3544 3545
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
3879 Handle<Map> new_map = Map::CurrentMapForDeprecatedInternal(original_map); 3880 Handle<Map> new_map = Map::CurrentMapForDeprecatedInternal(original_map);
3880 if (new_map.is_null()) return Handle<Object>(); 3881 if (new_map.is_null()) return Handle<Object>();
3881 JSObject::MigrateToMap(object, new_map); 3882 JSObject::MigrateToMap(object, new_map);
3882 if (FLAG_trace_migration) { 3883 if (FLAG_trace_migration) {
3883 object->PrintInstanceMigration(stdout, *original_map, object->map()); 3884 object->PrintInstanceMigration(stdout, *original_map, object->map());
3884 } 3885 }
3885 return object; 3886 return object;
3886 } 3887 }
3887 3888
3888 3889
3889 Handle<Object> JSObject::SetPropertyUsingTransition( 3890 MaybeHandle<Object> JSObject::SetPropertyUsingTransition(
3890 Handle<JSObject> object, 3891 Handle<JSObject> object,
3891 LookupResult* lookup, 3892 LookupResult* lookup,
3892 Handle<Name> name, 3893 Handle<Name> name,
3893 Handle<Object> value, 3894 Handle<Object> value,
3894 PropertyAttributes attributes) { 3895 PropertyAttributes attributes) {
3895 Handle<Map> transition_map(lookup->GetTransitionTarget()); 3896 Handle<Map> transition_map(lookup->GetTransitionTarget());
3896 int descriptor = transition_map->LastAdded(); 3897 int descriptor = transition_map->LastAdded();
3897 3898
3898 DescriptorArray* descriptors = transition_map->instance_descriptors(); 3899 DescriptorArray* descriptors = transition_map->instance_descriptors();
3899 PropertyDetails details = descriptors->GetDetails(descriptor); 3900 PropertyDetails details = descriptors->GetDetails(descriptor);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4005 PropertyAttributes attributes) { 4006 PropertyAttributes attributes) {
4006 if (lookup->GetAttributes() == attributes) { 4007 if (lookup->GetAttributes() == attributes) {
4007 if (value->IsUninitialized()) return; 4008 if (value->IsUninitialized()) return;
4008 SetPropertyToField(lookup, name, value); 4009 SetPropertyToField(lookup, name, value);
4009 } else { 4010 } else {
4010 ConvertAndSetLocalProperty(lookup, name, value, attributes); 4011 ConvertAndSetLocalProperty(lookup, name, value, attributes);
4011 } 4012 }
4012 } 4013 }
4013 4014
4014 4015
4015 Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object, 4016 MaybeHandle<Object> JSObject::SetPropertyForResult(
4016 LookupResult* lookup, 4017 Handle<JSObject> object,
4017 Handle<Name> name, 4018 LookupResult* lookup,
4018 Handle<Object> value, 4019 Handle<Name> name,
4019 PropertyAttributes attributes, 4020 Handle<Object> value,
4020 StrictMode strict_mode, 4021 PropertyAttributes attributes,
4021 StoreFromKeyed store_mode) { 4022 StrictMode strict_mode,
4023 StoreFromKeyed store_mode) {
4022 Isolate* isolate = object->GetIsolate(); 4024 Isolate* isolate = object->GetIsolate();
4023 4025
4024 // Make sure that the top context does not change when doing callbacks or 4026 // Make sure that the top context does not change when doing callbacks or
4025 // interceptor calls. 4027 // interceptor calls.
4026 AssertNoContextChange ncc(isolate); 4028 AssertNoContextChange ncc(isolate);
4027 4029
4028 // Optimization for 2-byte strings often used as keys in a decompression 4030 // Optimization for 2-byte strings often used as keys in a decompression
4029 // dictionary. We internalize these short keys to avoid constantly 4031 // dictionary. We internalize these short keys to avoid constantly
4030 // reallocating them. 4032 // reallocating them.
4031 if (name->IsString() && !name->IsInternalizedString() && 4033 if (name->IsString() && !name->IsInternalizedString() &&
(...skipping 15 matching lines...) Expand all
4047 ASSERT(proto->IsJSGlobalObject()); 4049 ASSERT(proto->IsJSGlobalObject());
4048 return SetPropertyForResult(Handle<JSObject>::cast(proto), 4050 return SetPropertyForResult(Handle<JSObject>::cast(proto),
4049 lookup, name, value, attributes, strict_mode, store_mode); 4051 lookup, name, value, attributes, strict_mode, store_mode);
4050 } 4052 }
4051 4053
4052 ASSERT(!lookup->IsFound() || lookup->holder() == *object || 4054 ASSERT(!lookup->IsFound() || lookup->holder() == *object ||
4053 lookup->holder()->map()->is_hidden_prototype()); 4055 lookup->holder()->map()->is_hidden_prototype());
4054 4056
4055 if (!lookup->IsProperty() && !object->IsJSContextExtensionObject()) { 4057 if (!lookup->IsProperty() && !object->IsJSContextExtensionObject()) {
4056 bool done = false; 4058 bool done = false;
4057 Handle<Object> result_object = SetPropertyViaPrototypes( 4059 Handle<Object> result_object;
4058 object, name, value, attributes, strict_mode, &done); 4060 ASSIGN_RETURN_ON_EXCEPTION(
4061 isolate, result_object,
4062 SetPropertyViaPrototypes(
4063 object, name, value, attributes, strict_mode, &done),
4064 Object);
4059 if (done) return result_object; 4065 if (done) return result_object;
4060 } 4066 }
4061 4067
4062 if (!lookup->IsFound()) { 4068 if (!lookup->IsFound()) {
4063 // Neither properties nor transitions found. 4069 // Neither properties nor transitions found.
4064 return AddProperty( 4070 return AddProperty(
4065 object, name, value, attributes, strict_mode, store_mode); 4071 object, name, value, attributes, strict_mode, store_mode);
4066 } 4072 }
4067 4073
4068 if (lookup->IsProperty() && lookup->IsReadOnly()) { 4074 if (lookup->IsProperty() && lookup->IsReadOnly()) {
4069 if (strict_mode == STRICT) { 4075 if (strict_mode == STRICT) {
4070 Handle<Object> args[] = { name, object }; 4076 Handle<Object> args[] = { name, object };
4071 Handle<Object> error = isolate->factory()->NewTypeError( 4077 Handle<Object> error = isolate->factory()->NewTypeError(
4072 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); 4078 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
4073 isolate->Throw(*error); 4079 return isolate->Throw<Object>(error);
4074 return Handle<Object>();
4075 } else { 4080 } else {
4076 return value; 4081 return value;
4077 } 4082 }
4078 } 4083 }
4079 4084
4080 Handle<Object> old_value = isolate->factory()->the_hole_value(); 4085 Handle<Object> old_value = isolate->factory()->the_hole_value();
4081 bool is_observed = object->map()->is_observed() && 4086 bool is_observed = object->map()->is_observed() &&
4082 *name != isolate->heap()->hidden_string(); 4087 *name != isolate->heap()->hidden_string();
4083 if (is_observed && lookup->IsDataProperty()) { 4088 if (is_observed && lookup->IsDataProperty()) {
4084 old_value = Object::GetPropertyOrElement(object, name); 4089 old_value = Object::GetPropertyOrElement(object, name);
4085 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); 4090 CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
4086 } 4091 }
4087 4092
4088 // This is a real property that is not read-only, or it is a 4093 // This is a real property that is not read-only, or it is a
4089 // transition or null descriptor and there are no setters in the prototypes. 4094 // transition or null descriptor and there are no setters in the prototypes.
4090 Handle<Object> result = value; 4095 MaybeHandle<Object> maybe_result = value;
4091 if (lookup->IsTransition()) { 4096 if (lookup->IsTransition()) {
4092 result = SetPropertyUsingTransition(handle(lookup->holder()), lookup, 4097 maybe_result = SetPropertyUsingTransition(handle(lookup->holder()), lookup,
4093 name, value, attributes); 4098 name, value, attributes);
4094 } else { 4099 } else {
4095 switch (lookup->type()) { 4100 switch (lookup->type()) {
4096 case NORMAL: 4101 case NORMAL:
4097 SetNormalizedProperty(handle(lookup->holder()), lookup, value); 4102 SetNormalizedProperty(handle(lookup->holder()), lookup, value);
4098 break; 4103 break;
4099 case FIELD: 4104 case FIELD:
4100 SetPropertyToField(lookup, name, value); 4105 SetPropertyToField(lookup, name, value);
4101 break; 4106 break;
4102 case CONSTANT: 4107 case CONSTANT:
4103 // Only replace the constant if necessary. 4108 // Only replace the constant if necessary.
4104 if (*value == lookup->GetConstant()) return value; 4109 if (*value == lookup->GetConstant()) return value;
4105 SetPropertyToField(lookup, name, value); 4110 SetPropertyToField(lookup, name, value);
4106 break; 4111 break;
4107 case CALLBACKS: { 4112 case CALLBACKS: {
4108 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate); 4113 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate);
4109 return SetPropertyWithCallback(object, callback_object, name, value, 4114 return SetPropertyWithCallback(object, callback_object, name, value,
4110 handle(lookup->holder()), strict_mode); 4115 handle(lookup->holder()), strict_mode);
4111 } 4116 }
4112 case INTERCEPTOR: 4117 case INTERCEPTOR:
4113 result = SetPropertyWithInterceptor( 4118 maybe_result = SetPropertyWithInterceptor(
4114 handle(lookup->holder()), name, value, attributes, strict_mode); 4119 handle(lookup->holder()), name, value, attributes, strict_mode);
4115 break; 4120 break;
4116 case HANDLER: 4121 case HANDLER:
4117 case NONEXISTENT: 4122 case NONEXISTENT:
4118 UNREACHABLE(); 4123 UNREACHABLE();
4119 } 4124 }
4120 } 4125 }
4121 4126
4122 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>()); 4127 Handle<Object> result;
4128 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, maybe_result, Object);
4123 4129
4124 if (is_observed) { 4130 if (is_observed) {
4125 if (lookup->IsTransition()) { 4131 if (lookup->IsTransition()) {
4126 EnqueueChangeRecord(object, "add", name, old_value); 4132 EnqueueChangeRecord(object, "add", name, old_value);
4127 } else { 4133 } else {
4128 LookupResult new_lookup(isolate); 4134 LookupResult new_lookup(isolate);
4129 object->LocalLookup(*name, &new_lookup, true); 4135 object->LocalLookup(*name, &new_lookup, true);
4130 if (new_lookup.IsDataProperty()) { 4136 if (new_lookup.IsDataProperty()) {
4131 Handle<Object> new_value = Object::GetPropertyOrElement(object, name); 4137 Handle<Object> new_value = Object::GetPropertyOrElement(object, name);
4132 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); 4138 CHECK_NOT_EMPTY_HANDLE(isolate, new_value);
(...skipping 10 matching lines...) Expand all
4143 4149
4144 // Set a real local property, even if it is READ_ONLY. If the property is not 4150 // Set a real local property, even if it is READ_ONLY. If the property is not
4145 // present, add it with attributes NONE. This code is an exact clone of 4151 // present, add it with attributes NONE. This code is an exact clone of
4146 // SetProperty, with the check for IsReadOnly and the check for a 4152 // SetProperty, with the check for IsReadOnly and the check for a
4147 // callback setter removed. The two lines looking up the LookupResult 4153 // callback setter removed. The two lines looking up the LookupResult
4148 // result are also added. If one of the functions is changed, the other 4154 // result are also added. If one of the functions is changed, the other
4149 // should be. 4155 // should be.
4150 // Note that this method cannot be used to set the prototype of a function 4156 // Note that this method cannot be used to set the prototype of a function
4151 // because ConvertDescriptorToField() which is called in "case CALLBACKS:" 4157 // because ConvertDescriptorToField() which is called in "case CALLBACKS:"
4152 // doesn't handle function prototypes correctly. 4158 // doesn't handle function prototypes correctly.
4153 Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes( 4159 MaybeHandle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
4154 Handle<JSObject> object, 4160 Handle<JSObject> object,
4155 Handle<Name> name, 4161 Handle<Name> name,
4156 Handle<Object> value, 4162 Handle<Object> value,
4157 PropertyAttributes attributes, 4163 PropertyAttributes attributes,
4158 ValueType value_type, 4164 ValueType value_type,
4159 StoreMode mode, 4165 StoreMode mode,
4160 ExtensibilityCheck extensibility_check) { 4166 ExtensibilityCheck extensibility_check) {
4161 Isolate* isolate = object->GetIsolate(); 4167 Isolate* isolate = object->GetIsolate();
4162 4168
4163 // Make sure that the top context does not change when doing callbacks or 4169 // Make sure that the top context does not change when doing callbacks or
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4208 if (is_observed && lookup.IsProperty()) { 4214 if (is_observed && lookup.IsProperty()) {
4209 if (lookup.IsDataProperty()) { 4215 if (lookup.IsDataProperty()) {
4210 old_value = Object::GetPropertyOrElement(object, name); 4216 old_value = Object::GetPropertyOrElement(object, name);
4211 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); 4217 CHECK_NOT_EMPTY_HANDLE(isolate, old_value);
4212 } 4218 }
4213 old_attributes = lookup.GetAttributes(); 4219 old_attributes = lookup.GetAttributes();
4214 } 4220 }
4215 4221
4216 // Check of IsReadOnly removed from here in clone. 4222 // Check of IsReadOnly removed from here in clone.
4217 if (lookup.IsTransition()) { 4223 if (lookup.IsTransition()) {
4218 Handle<Object> result = SetPropertyUsingTransition( 4224 Handle<Object> result;
4219 handle(lookup.holder()), &lookup, name, value, attributes); 4225 ASSIGN_RETURN_ON_EXCEPTION(
4220 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>()); 4226 isolate, result,
4227 SetPropertyUsingTransition(
4228 handle(lookup.holder()), &lookup, name, value, attributes),
4229 Object);
4221 } else { 4230 } else {
4222 switch (lookup.type()) { 4231 switch (lookup.type()) {
4223 case NORMAL: 4232 case NORMAL:
4224 ReplaceSlowProperty(object, name, value, attributes); 4233 ReplaceSlowProperty(object, name, value, attributes);
4225 break; 4234 break;
4226 case FIELD: 4235 case FIELD:
4227 SetPropertyToFieldWithAttributes(&lookup, name, value, attributes); 4236 SetPropertyToFieldWithAttributes(&lookup, name, value, attributes);
4228 break; 4237 break;
4229 case CONSTANT: 4238 case CONSTANT:
4230 // Only replace the constant if necessary. 4239 // Only replace the constant if necessary.
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
5005 inline_value); 5014 inline_value);
5006 } 5015 }
5007 5016
5008 JSObject::SetLocalPropertyIgnoreAttributes( 5017 JSObject::SetLocalPropertyIgnoreAttributes(
5009 object, 5018 object,
5010 isolate->factory()->hidden_string(), 5019 isolate->factory()->hidden_string(),
5011 hashtable, 5020 hashtable,
5012 DONT_ENUM, 5021 DONT_ENUM,
5013 OPTIMAL_REPRESENTATION, 5022 OPTIMAL_REPRESENTATION,
5014 ALLOW_AS_CONSTANT, 5023 ALLOW_AS_CONSTANT,
5015 OMIT_EXTENSIBILITY_CHECK); 5024 OMIT_EXTENSIBILITY_CHECK).Assert();
5016 5025
5017 return hashtable; 5026 return hashtable;
5018 } 5027 }
5019 5028
5020 5029
5021 Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object, 5030 Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object,
5022 Handle<Object> value) { 5031 Handle<Object> value) {
5023 ASSERT(!object->IsJSGlobalProxy()); 5032 ASSERT(!object->IsJSGlobalProxy());
5024 5033
5025 Isolate* isolate = object->GetIsolate(); 5034 Isolate* isolate = object->GetIsolate();
(...skipping 18 matching lines...) Expand all
5044 } 5053 }
5045 } 5054 }
5046 } 5055 }
5047 5056
5048 SetLocalPropertyIgnoreAttributes(object, 5057 SetLocalPropertyIgnoreAttributes(object,
5049 isolate->factory()->hidden_string(), 5058 isolate->factory()->hidden_string(),
5050 value, 5059 value,
5051 DONT_ENUM, 5060 DONT_ENUM,
5052 OPTIMAL_REPRESENTATION, 5061 OPTIMAL_REPRESENTATION,
5053 ALLOW_AS_CONSTANT, 5062 ALLOW_AS_CONSTANT,
5054 OMIT_EXTENSIBILITY_CHECK); 5063 OMIT_EXTENSIBILITY_CHECK).Assert();
5055 return object; 5064 return object;
5056 } 5065 }
5057 5066
5058 5067
5059 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object, 5068 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object,
5060 Handle<Name> name, 5069 Handle<Name> name,
5061 DeleteMode mode) { 5070 DeleteMode mode) {
5062 // Check local property, ignore interceptor. 5071 // Check local property, ignore interceptor.
5063 Isolate* isolate = object->GetIsolate(); 5072 Isolate* isolate = object->GetIsolate();
5064 LookupResult result(isolate); 5073 LookupResult result(isolate);
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
5783 if (attributes != NONE) continue; 5792 if (attributes != NONE) continue;
5784 Handle<Object> value( 5793 Handle<Object> value(
5785 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(), 5794 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(),
5786 isolate); 5795 isolate);
5787 if (value->IsJSObject()) { 5796 if (value->IsJSObject()) {
5788 Handle<JSObject> result = VisitElementOrProperty( 5797 Handle<JSObject> result = VisitElementOrProperty(
5789 copy, Handle<JSObject>::cast(value)); 5798 copy, Handle<JSObject>::cast(value));
5790 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); 5799 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>());
5791 if (copying) { 5800 if (copying) {
5792 // Creating object copy for literals. No strict mode needed. 5801 // Creating object copy for literals. No strict mode needed.
5793 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetProperty( 5802 JSObject::SetProperty(
5794 copy, key_string, result, NONE, SLOPPY)); 5803 copy, key_string, result, NONE, SLOPPY).Assert();
5795 } 5804 }
5796 } 5805 }
5797 } 5806 }
5798 } 5807 }
5799 5808
5800 // Deep copy local elements. 5809 // Deep copy local elements.
5801 // Pixel elements cannot be created using an object literal. 5810 // Pixel elements cannot be created using an object literal.
5802 ASSERT(!copy->HasExternalArrayElements()); 5811 ASSERT(!copy->HasExternalArrayElements());
5803 switch (kind) { 5812 switch (kind) {
5804 case FAST_SMI_ELEMENTS: 5813 case FAST_SMI_ELEMENTS:
(...skipping 5607 matching lines...) Expand 10 before | Expand all | Expand 10 after
11412 for (int i = indices.length() - 1; i >= 0; i--) { 11421 for (int i = indices.length() - 1; i >= 0; i--) {
11413 // Skip deletions where the property was an accessor, leaving holes 11422 // Skip deletions where the property was an accessor, leaving holes
11414 // in the array of old values. 11423 // in the array of old values.
11415 if (old_values[i]->IsTheHole()) continue; 11424 if (old_values[i]->IsTheHole()) continue;
11416 JSObject::SetElement(deleted, indices[i] - index, old_values[i], NONE, 11425 JSObject::SetElement(deleted, indices[i] - index, old_values[i], NONE,
11417 SLOPPY); 11426 SLOPPY);
11418 } 11427 }
11419 11428
11420 SetProperty(deleted, isolate->factory()->length_string(), 11429 SetProperty(deleted, isolate->factory()->length_string(),
11421 isolate->factory()->NewNumberFromUint(delete_count), 11430 isolate->factory()->NewNumberFromUint(delete_count),
11422 NONE, SLOPPY); 11431 NONE, SLOPPY).Assert();
11423 } 11432 }
11424 11433
11425 EnqueueSpliceRecord(array, index, deleted, add_count); 11434 EnqueueSpliceRecord(array, index, deleted, add_count);
11426 11435
11427 return hresult; 11436 return hresult;
11428 } 11437 }
11429 11438
11430 11439
11431 Handle<Map> Map::GetPrototypeTransition(Handle<Map> map, 11440 Handle<Map> Map::GetPrototypeTransition(Handle<Map> map,
11432 Handle<Object> prototype) { 11441 Handle<Object> prototype) {
(...skipping 5018 matching lines...) Expand 10 before | Expand all | Expand 10 after
16451 #define ERROR_MESSAGES_TEXTS(C, T) T, 16460 #define ERROR_MESSAGES_TEXTS(C, T) T,
16452 static const char* error_messages_[] = { 16461 static const char* error_messages_[] = {
16453 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16462 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16454 }; 16463 };
16455 #undef ERROR_MESSAGES_TEXTS 16464 #undef ERROR_MESSAGES_TEXTS
16456 return error_messages_[reason]; 16465 return error_messages_[reason];
16457 } 16466 }
16458 16467
16459 16468
16460 } } // namespace v8::internal 16469 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698