| 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 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4225 CONVERT_CHECKED(Smi, flag, args[3]); | 4225 CONVERT_CHECKED(Smi, flag, args[3]); |
| 4226 int unchecked = flag->value(); | 4226 int unchecked = flag->value(); |
| 4227 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 4227 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 4228 | 4228 |
| 4229 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 4229 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
| 4230 | 4230 |
| 4231 // Check if this is an element. | 4231 // Check if this is an element. |
| 4232 uint32_t index; | 4232 uint32_t index; |
| 4233 bool is_element = name->AsArrayIndex(&index); | 4233 bool is_element = name->AsArrayIndex(&index); |
| 4234 | 4234 |
| 4235 // Special case for elements if any of the flags are true. | 4235 // Special case for elements if any of the flags might be involved. |
| 4236 // If elements are in fast case we always implicitly assume that: | 4236 // If elements are in fast case we always implicitly assume that: |
| 4237 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. | 4237 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. |
| 4238 if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) && | 4238 if (is_element && (attr != NONE || |
| 4239 is_element) { | 4239 js_object->HasLocalElement(index) == JSObject::DICTIONARY_ELEMENT)) { |
| 4240 // Normalize the elements to enable attributes on the property. | 4240 // Normalize the elements to enable attributes on the property. |
| 4241 if (js_object->IsJSGlobalProxy()) { | 4241 if (js_object->IsJSGlobalProxy()) { |
| 4242 // We do not need to do access checks here since these has already | 4242 // We do not need to do access checks here since these has already |
| 4243 // been performed by the call to GetOwnProperty. | 4243 // been performed by the call to GetOwnProperty. |
| 4244 Handle<Object> proto(js_object->GetPrototype()); | 4244 Handle<Object> proto(js_object->GetPrototype()); |
| 4245 // If proxy is detached, ignore the assignment. Alternatively, | 4245 // If proxy is detached, ignore the assignment. Alternatively, |
| 4246 // we could throw an exception. | 4246 // we could throw an exception. |
| 4247 if (proto->IsNull()) return *obj_value; | 4247 if (proto->IsNull()) return *obj_value; |
| 4248 js_object = Handle<JSObject>::cast(proto); | 4248 js_object = Handle<JSObject>::cast(proto); |
| 4249 } | 4249 } |
| (...skipping 9161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13411 } else { | 13411 } else { |
| 13412 // Handle last resort GC and make sure to allow future allocations | 13412 // Handle last resort GC and make sure to allow future allocations |
| 13413 // to grow the heap without causing GCs (if possible). | 13413 // to grow the heap without causing GCs (if possible). |
| 13414 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13414 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13415 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13415 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 13416 } | 13416 } |
| 13417 } | 13417 } |
| 13418 | 13418 |
| 13419 | 13419 |
| 13420 } } // namespace v8::internal | 13420 } } // namespace v8::internal |
| OLD | NEW |