| 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 3930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3941 // Normalize the elements to enable attributes on the property. | 3941 // Normalize the elements to enable attributes on the property. |
| 3942 if (js_object->IsJSGlobalProxy()) { | 3942 if (js_object->IsJSGlobalProxy()) { |
| 3943 // We do not need to do access checks here since these has already | 3943 // We do not need to do access checks here since these has already |
| 3944 // been performed by the call to GetOwnProperty. | 3944 // been performed by the call to GetOwnProperty. |
| 3945 Handle<Object> proto(js_object->GetPrototype()); | 3945 Handle<Object> proto(js_object->GetPrototype()); |
| 3946 // If proxy is detached, ignore the assignment. Alternatively, | 3946 // If proxy is detached, ignore the assignment. Alternatively, |
| 3947 // we could throw an exception. | 3947 // we could throw an exception. |
| 3948 if (proto->IsNull()) return *obj_value; | 3948 if (proto->IsNull()) return *obj_value; |
| 3949 js_object = Handle<JSObject>::cast(proto); | 3949 js_object = Handle<JSObject>::cast(proto); |
| 3950 } | 3950 } |
| 3951 |
| 3952 // Don't allow element properties to be redefined on objects with external |
| 3953 // array elements. |
| 3954 if (js_object->HasExternalArrayElements()) { |
| 3955 Handle<Object> args[2] = { js_object, name }; |
| 3956 Handle<Object> error = |
| 3957 isolate->factory()->NewTypeError("redef_external_array_element", |
| 3958 HandleVector(args, 2)); |
| 3959 return isolate->Throw(*error); |
| 3960 } |
| 3961 |
| 3951 Handle<NumberDictionary> dictionary = NormalizeElements(js_object); | 3962 Handle<NumberDictionary> dictionary = NormalizeElements(js_object); |
| 3952 // Make sure that we never go back to fast case. | 3963 // Make sure that we never go back to fast case. |
| 3953 dictionary->set_requires_slow_elements(); | 3964 dictionary->set_requires_slow_elements(); |
| 3954 PropertyDetails details = PropertyDetails(attr, NORMAL); | 3965 PropertyDetails details = PropertyDetails(attr, NORMAL); |
| 3955 Handle<NumberDictionary> extended_dictionary = | 3966 Handle<NumberDictionary> extended_dictionary = |
| 3956 NumberDictionarySet(dictionary, index, obj_value, details); | 3967 NumberDictionarySet(dictionary, index, obj_value, details); |
| 3957 if (*extended_dictionary != *dictionary) { | 3968 if (*extended_dictionary != *dictionary) { |
| 3958 if (js_object->GetElementsKind() == | 3969 if (js_object->GetElementsKind() == |
| 3959 JSObject::NON_STRICT_ARGUMENTS_ELEMENTS) { | 3970 JSObject::NON_STRICT_ARGUMENTS_ELEMENTS) { |
| 3960 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); | 3971 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); |
| (...skipping 8754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12715 } else { | 12726 } else { |
| 12716 // Handle last resort GC and make sure to allow future allocations | 12727 // Handle last resort GC and make sure to allow future allocations |
| 12717 // to grow the heap without causing GCs (if possible). | 12728 // to grow the heap without causing GCs (if possible). |
| 12718 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12729 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12719 isolate->heap()->CollectAllGarbage(false); | 12730 isolate->heap()->CollectAllGarbage(false); |
| 12720 } | 12731 } |
| 12721 } | 12732 } |
| 12722 | 12733 |
| 12723 | 12734 |
| 12724 } } // namespace v8::internal | 12735 } } // namespace v8::internal |
| OLD | NEW |