| 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 4068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4079 // Normalize the elements to enable attributes on the property. | 4079 // Normalize the elements to enable attributes on the property. |
| 4080 if (js_object->IsJSGlobalProxy()) { | 4080 if (js_object->IsJSGlobalProxy()) { |
| 4081 // We do not need to do access checks here since these has already | 4081 // We do not need to do access checks here since these has already |
| 4082 // been performed by the call to GetOwnProperty. | 4082 // been performed by the call to GetOwnProperty. |
| 4083 Handle<Object> proto(js_object->GetPrototype()); | 4083 Handle<Object> proto(js_object->GetPrototype()); |
| 4084 // If proxy is detached, ignore the assignment. Alternatively, | 4084 // If proxy is detached, ignore the assignment. Alternatively, |
| 4085 // we could throw an exception. | 4085 // we could throw an exception. |
| 4086 if (proto->IsNull()) return *obj_value; | 4086 if (proto->IsNull()) return *obj_value; |
| 4087 js_object = Handle<JSObject>::cast(proto); | 4087 js_object = Handle<JSObject>::cast(proto); |
| 4088 } | 4088 } |
| 4089 |
| 4090 // Don't allow element properties to be redefined on objects with external |
| 4091 // array elements. |
| 4092 if (js_object->HasExternalArrayElements()) { |
| 4093 Handle<Object> args[2] = { js_object, name }; |
| 4094 Handle<Object> error = |
| 4095 isolate->factory()->NewTypeError("redef_external_array_element", |
| 4096 HandleVector(args, 2)); |
| 4097 return isolate->Throw(*error); |
| 4098 } |
| 4099 |
| 4089 Handle<NumberDictionary> dictionary = NormalizeElements(js_object); | 4100 Handle<NumberDictionary> dictionary = NormalizeElements(js_object); |
| 4090 // Make sure that we never go back to fast case. | 4101 // Make sure that we never go back to fast case. |
| 4091 dictionary->set_requires_slow_elements(); | 4102 dictionary->set_requires_slow_elements(); |
| 4092 PropertyDetails details = PropertyDetails(attr, NORMAL); | 4103 PropertyDetails details = PropertyDetails(attr, NORMAL); |
| 4093 Handle<NumberDictionary> extended_dictionary = | 4104 Handle<NumberDictionary> extended_dictionary = |
| 4094 NumberDictionarySet(dictionary, index, obj_value, details); | 4105 NumberDictionarySet(dictionary, index, obj_value, details); |
| 4095 if (*extended_dictionary != *dictionary) { | 4106 if (*extended_dictionary != *dictionary) { |
| 4096 if (js_object->GetElementsKind() == | 4107 if (js_object->GetElementsKind() == |
| 4097 JSObject::NON_STRICT_ARGUMENTS_ELEMENTS) { | 4108 JSObject::NON_STRICT_ARGUMENTS_ELEMENTS) { |
| 4098 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); | 4109 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); |
| (...skipping 8888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12987 } else { | 12998 } else { |
| 12988 // Handle last resort GC and make sure to allow future allocations | 12999 // Handle last resort GC and make sure to allow future allocations |
| 12989 // to grow the heap without causing GCs (if possible). | 13000 // to grow the heap without causing GCs (if possible). |
| 12990 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13001 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12991 isolate->heap()->CollectAllGarbage(false); | 13002 isolate->heap()->CollectAllGarbage(false); |
| 12992 } | 13003 } |
| 12993 } | 13004 } |
| 12994 | 13005 |
| 12995 | 13006 |
| 12996 } } // namespace v8::internal | 13007 } } // namespace v8::internal |
| OLD | NEW |