| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5030 // in Object.defineProperty(). Firefox disagrees here, and actually changes | 5030 // in Object.defineProperty(). Firefox disagrees here, and actually changes |
| 5031 // the value. | 5031 // the value. |
| 5032 if (callback->IsAccessorInfo()) { | 5032 if (callback->IsAccessorInfo()) { |
| 5033 return isolate->heap()->undefined_value(); | 5033 return isolate->heap()->undefined_value(); |
| 5034 } | 5034 } |
| 5035 // Avoid redefining foreign callback as data property, just use the stored | 5035 // Avoid redefining foreign callback as data property, just use the stored |
| 5036 // setter to update the value instead. | 5036 // setter to update the value instead. |
| 5037 // TODO(mstarzinger): So far this only works if property attributes don't | 5037 // TODO(mstarzinger): So far this only works if property attributes don't |
| 5038 // change, this should be fixed once we cleanup the underlying code. | 5038 // change, this should be fixed once we cleanup the underlying code. |
| 5039 if (callback->IsForeign() && result.GetAttributes() == attr) { | 5039 if (callback->IsForeign() && result.GetAttributes() == attr) { |
| 5040 return js_object->SetPropertyWithCallback(callback, | 5040 Handle<Object> result_object = |
| 5041 *name, | 5041 JSObject::SetPropertyWithCallback(js_object, |
| 5042 *obj_value, | 5042 handle(callback, isolate), |
| 5043 result.holder(), | 5043 name, |
| 5044 kStrictMode); | 5044 obj_value, |
| 5045 handle(result.holder()), |
| 5046 kStrictMode); |
| 5047 RETURN_IF_EMPTY_HANDLE(isolate, result_object); |
| 5048 return *result_object; |
| 5045 } | 5049 } |
| 5046 } | 5050 } |
| 5047 | 5051 |
| 5048 // Take special care when attributes are different and there is already | 5052 // Take special care when attributes are different and there is already |
| 5049 // a property. For simplicity we normalize the property which enables us | 5053 // a property. For simplicity we normalize the property which enables us |
| 5050 // to not worry about changing the instance_descriptor and creating a new | 5054 // to not worry about changing the instance_descriptor and creating a new |
| 5051 // map. The current version of SetObjectProperty does not handle attributes | 5055 // map. The current version of SetObjectProperty does not handle attributes |
| 5052 // correctly in the case where a property is a field and is reset with | 5056 // correctly in the case where a property is a field and is reset with |
| 5053 // new attributes. | 5057 // new attributes. |
| 5054 if (result.IsFound() && | 5058 if (result.IsFound() && |
| (...skipping 9765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14820 // Handle last resort GC and make sure to allow future allocations | 14824 // Handle last resort GC and make sure to allow future allocations |
| 14821 // to grow the heap without causing GCs (if possible). | 14825 // to grow the heap without causing GCs (if possible). |
| 14822 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14826 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14823 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14827 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14824 "Runtime::PerformGC"); | 14828 "Runtime::PerformGC"); |
| 14825 } | 14829 } |
| 14826 } | 14830 } |
| 14827 | 14831 |
| 14828 | 14832 |
| 14829 } } // namespace v8::internal | 14833 } } // namespace v8::internal |
| OLD | NEW |