| 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 5050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5061 | 5061 |
| 5062 // Special case for callback properties. | 5062 // Special case for callback properties. |
| 5063 if (lookup.IsPropertyCallbacks()) { | 5063 if (lookup.IsPropertyCallbacks()) { |
| 5064 Handle<Object> callback(lookup.GetCallbackObject(), isolate); | 5064 Handle<Object> callback(lookup.GetCallbackObject(), isolate); |
| 5065 // To be compatible with Safari we do not change the value on API objects | 5065 // To be compatible with Safari we do not change the value on API objects |
| 5066 // in Object.defineProperty(). Firefox disagrees here, and actually changes | 5066 // in Object.defineProperty(). Firefox disagrees here, and actually changes |
| 5067 // the value. | 5067 // the value. |
| 5068 if (callback->IsAccessorInfo()) { | 5068 if (callback->IsAccessorInfo()) { |
| 5069 return isolate->heap()->undefined_value(); | 5069 return isolate->heap()->undefined_value(); |
| 5070 } | 5070 } |
| 5071 // Provided a read-only property isn't being reconfigured, avoid redefining | 5071 // Avoid redefining foreign callback as data property, just use the stored |
| 5072 // foreign callback as data property, just use the stored setter to update | 5072 // setter to update the value instead. |
| 5073 // the value instead. | |
| 5074 // TODO(mstarzinger): So far this only works if property attributes don't | 5073 // TODO(mstarzinger): So far this only works if property attributes don't |
| 5075 // change, this should be fixed once we cleanup the underlying code. | 5074 // change, this should be fixed once we cleanup the underlying code. |
| 5076 if (callback->IsForeign() && | 5075 if (callback->IsForeign() && lookup.GetAttributes() == attr) { |
| 5077 lookup.GetAttributes() == attr && | |
| 5078 !(attr & READ_ONLY)) { | |
| 5079 Handle<Object> result_object = | 5076 Handle<Object> result_object = |
| 5080 JSObject::SetPropertyWithCallback(js_object, | 5077 JSObject::SetPropertyWithCallback(js_object, |
| 5081 callback, | 5078 callback, |
| 5082 name, | 5079 name, |
| 5083 obj_value, | 5080 obj_value, |
| 5084 handle(lookup.holder()), | 5081 handle(lookup.holder()), |
| 5085 kStrictMode); | 5082 kStrictMode); |
| 5086 RETURN_IF_EMPTY_HANDLE(isolate, result_object); | 5083 RETURN_IF_EMPTY_HANDLE(isolate, result_object); |
| 5087 return *result_object; | 5084 return *result_object; |
| 5088 } | 5085 } |
| (...skipping 9779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14868 // Handle last resort GC and make sure to allow future allocations | 14865 // Handle last resort GC and make sure to allow future allocations |
| 14869 // to grow the heap without causing GCs (if possible). | 14866 // to grow the heap without causing GCs (if possible). |
| 14870 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14867 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14871 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14868 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14872 "Runtime::PerformGC"); | 14869 "Runtime::PerformGC"); |
| 14873 } | 14870 } |
| 14874 } | 14871 } |
| 14875 | 14872 |
| 14876 | 14873 |
| 14877 } } // namespace v8::internal | 14874 } } // namespace v8::internal |
| OLD | NEW |