Chromium Code Reviews| 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 4073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4084 | 4084 |
| 4085 // Special case for callback properties. | 4085 // Special case for callback properties. |
| 4086 if (result.IsPropertyCallbacks()) { | 4086 if (result.IsPropertyCallbacks()) { |
| 4087 Object* callback = result.GetCallbackObject(); | 4087 Object* callback = result.GetCallbackObject(); |
| 4088 // To be compatible with Safari we do not change the value on API objects | 4088 // To be compatible with Safari we do not change the value on API objects |
| 4089 // in Object.defineProperty(). Firefox disagrees here, and actually changes | 4089 // in Object.defineProperty(). Firefox disagrees here, and actually changes |
| 4090 // the value. | 4090 // the value. |
| 4091 if (callback->IsAccessorInfo()) { | 4091 if (callback->IsAccessorInfo()) { |
| 4092 return isolate->heap()->undefined_value(); | 4092 return isolate->heap()->undefined_value(); |
| 4093 } | 4093 } |
| 4094 // TODO(mstarzinger): The __proto__ property should actually be a real | |
| 4095 // JavaScript accessor instead of a foreign callback. But for now we just | |
| 4096 // avoid changing the writability attribute of this property. | |
| 4097 Handle<String> proto_string = isolate->factory()->proto_string(); | |
| 4098 if (callback->IsForeign() && proto_string->Equals(*name)) { | |
| 4099 attr = static_cast<PropertyAttributes>(attr & ~READ_ONLY); | |
|
rossberg
2013/03/04 16:04:42
As discussed offline, this should also filter DONT
Michael Starzinger
2013/03/04 16:24:58
Done.
| |
| 4100 } | |
| 4094 // Avoid redefining foreign callback as data property, just use the stored | 4101 // Avoid redefining foreign callback as data property, just use the stored |
| 4095 // setter to update the value instead. | 4102 // setter to update the value instead. |
| 4096 // TODO(mstarzinger): So far this only works if property attributes don't | 4103 // TODO(mstarzinger): So far this only works if property attributes don't |
| 4097 // change, this should be fixed once we cleanup the underlying code. | 4104 // change, this should be fixed once we cleanup the underlying code. |
| 4098 if (callback->IsForeign() && result.GetAttributes() == attr) { | 4105 if (callback->IsForeign() && result.GetAttributes() == attr) { |
| 4099 return js_object->SetPropertyWithCallback(callback, | 4106 return js_object->SetPropertyWithCallback(callback, |
| 4100 *name, | 4107 *name, |
| 4101 *obj_value, | 4108 *obj_value, |
| 4102 result.holder(), | 4109 result.holder(), |
| 4103 kStrictMode); | 4110 kStrictMode); |
| (...skipping 9206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13310 // Handle last resort GC and make sure to allow future allocations | 13317 // Handle last resort GC and make sure to allow future allocations |
| 13311 // to grow the heap without causing GCs (if possible). | 13318 // to grow the heap without causing GCs (if possible). |
| 13312 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13319 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13313 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13320 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13314 "Runtime::PerformGC"); | 13321 "Runtime::PerformGC"); |
| 13315 } | 13322 } |
| 13316 } | 13323 } |
| 13317 | 13324 |
| 13318 | 13325 |
| 13319 } } // namespace v8::internal | 13326 } } // namespace v8::internal |
| OLD | NEW |