| 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 5081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5092 | 5092 |
| 5093 // Special case for callback properties. | 5093 // Special case for callback properties. |
| 5094 if (lookup.IsPropertyCallbacks()) { | 5094 if (lookup.IsPropertyCallbacks()) { |
| 5095 Handle<Object> callback(lookup.GetCallbackObject(), isolate); | 5095 Handle<Object> callback(lookup.GetCallbackObject(), isolate); |
| 5096 // To be compatible with Safari we do not change the value on API objects | 5096 // To be compatible with Safari we do not change the value on API objects |
| 5097 // in Object.defineProperty(). Firefox disagrees here, and actually changes | 5097 // in Object.defineProperty(). Firefox disagrees here, and actually changes |
| 5098 // the value. | 5098 // the value. |
| 5099 if (callback->IsAccessorInfo()) { | 5099 if (callback->IsAccessorInfo()) { |
| 5100 return isolate->heap()->undefined_value(); | 5100 return isolate->heap()->undefined_value(); |
| 5101 } | 5101 } |
| 5102 // Avoid redefining foreign callback as data property, just use the stored | 5102 // Provided a read-only property isn't being reconfigured, avoid redefining |
| 5103 // setter to update the value instead. | 5103 // foreign callback as data property, just use the stored setter to update |
| 5104 // the value instead. |
| 5104 // TODO(mstarzinger): So far this only works if property attributes don't | 5105 // TODO(mstarzinger): So far this only works if property attributes don't |
| 5105 // change, this should be fixed once we cleanup the underlying code. | 5106 // change, this should be fixed once we cleanup the underlying code. |
| 5106 if (callback->IsForeign() && lookup.GetAttributes() == attr) { | 5107 if (callback->IsForeign() && |
| 5108 lookup.GetAttributes() == attr && |
| 5109 !(attr & READ_ONLY)) { |
| 5107 Handle<Object> result_object = | 5110 Handle<Object> result_object = |
| 5108 JSObject::SetPropertyWithCallback(js_object, | 5111 JSObject::SetPropertyWithCallback(js_object, |
| 5109 callback, | 5112 callback, |
| 5110 name, | 5113 name, |
| 5111 obj_value, | 5114 obj_value, |
| 5112 handle(lookup.holder()), | 5115 handle(lookup.holder()), |
| 5113 kStrictMode); | 5116 kStrictMode); |
| 5114 RETURN_IF_EMPTY_HANDLE(isolate, result_object); | 5117 RETURN_IF_EMPTY_HANDLE(isolate, result_object); |
| 5115 return *result_object; | 5118 return *result_object; |
| 5116 } | 5119 } |
| (...skipping 9751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14868 // Handle last resort GC and make sure to allow future allocations | 14871 // Handle last resort GC and make sure to allow future allocations |
| 14869 // to grow the heap without causing GCs (if possible). | 14872 // to grow the heap without causing GCs (if possible). |
| 14870 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14873 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14871 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14874 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14872 "Runtime::PerformGC"); | 14875 "Runtime::PerformGC"); |
| 14873 } | 14876 } |
| 14874 } | 14877 } |
| 14875 | 14878 |
| 14876 | 14879 |
| 14877 } } // namespace v8::internal | 14880 } } // namespace v8::internal |
| OLD | NEW |