OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3878 // Normalize the elements to enable attributes on the property. | 3878 // Normalize the elements to enable attributes on the property. |
3879 if (js_object->IsJSGlobalProxy()) { | 3879 if (js_object->IsJSGlobalProxy()) { |
3880 // We do not need to do access checks here since these has already | 3880 // We do not need to do access checks here since these has already |
3881 // been performed by the call to GetOwnProperty. | 3881 // been performed by the call to GetOwnProperty. |
3882 Handle<Object> proto(js_object->GetPrototype()); | 3882 Handle<Object> proto(js_object->GetPrototype()); |
3883 // If proxy is detached, ignore the assignment. Alternatively, | 3883 // If proxy is detached, ignore the assignment. Alternatively, |
3884 // we could throw an exception. | 3884 // we could throw an exception. |
3885 if (proto->IsNull()) return *obj_value; | 3885 if (proto->IsNull()) return *obj_value; |
3886 js_object = Handle<JSObject>::cast(proto); | 3886 js_object = Handle<JSObject>::cast(proto); |
3887 } | 3887 } |
| 3888 |
| 3889 // Don't allow element properties to be redefined on objects with external |
| 3890 // array elements. |
| 3891 if (js_object->HasExternalArrayElements()) { |
| 3892 Handle<Object> args[2] = { js_object, name }; |
| 3893 Handle<Object> error = |
| 3894 isolate->factory()->NewTypeError("redef_external_array_element", |
| 3895 HandleVector(args, 2)); |
| 3896 return isolate->Throw(*error); |
| 3897 } |
| 3898 |
3888 NormalizeElements(js_object); | 3899 NormalizeElements(js_object); |
3889 Handle<NumberDictionary> dictionary(js_object->element_dictionary()); | 3900 Handle<NumberDictionary> dictionary(js_object->element_dictionary()); |
3890 // Make sure that we never go back to fast case. | 3901 // Make sure that we never go back to fast case. |
3891 dictionary->set_requires_slow_elements(); | 3902 dictionary->set_requires_slow_elements(); |
3892 PropertyDetails details = PropertyDetails(attr, NORMAL); | 3903 PropertyDetails details = PropertyDetails(attr, NORMAL); |
3893 NumberDictionarySet(dictionary, index, obj_value, details); | 3904 NumberDictionarySet(dictionary, index, obj_value, details); |
3894 return *obj_value; | 3905 return *obj_value; |
3895 } | 3906 } |
3896 | 3907 |
3897 LookupResult result; | 3908 LookupResult result; |
(...skipping 8321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12219 } else { | 12230 } else { |
12220 // Handle last resort GC and make sure to allow future allocations | 12231 // Handle last resort GC and make sure to allow future allocations |
12221 // to grow the heap without causing GCs (if possible). | 12232 // to grow the heap without causing GCs (if possible). |
12222 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12233 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12223 isolate->heap()->CollectAllGarbage(false); | 12234 isolate->heap()->CollectAllGarbage(false); |
12224 } | 12235 } |
12225 } | 12236 } |
12226 | 12237 |
12227 | 12238 |
12228 } } // namespace v8::internal | 12239 } } // namespace v8::internal |
OLD | NEW |