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 4308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4319 } else { | 4319 } else { |
4320 js_object->set_elements(*extended_dictionary); | 4320 js_object->set_elements(*extended_dictionary); |
4321 } | 4321 } |
4322 } | 4322 } |
4323 return *obj_value; | 4323 return *obj_value; |
4324 } | 4324 } |
4325 | 4325 |
4326 LookupResult result(isolate); | 4326 LookupResult result(isolate); |
4327 js_object->LocalLookupRealNamedProperty(*name, &result); | 4327 js_object->LocalLookupRealNamedProperty(*name, &result); |
4328 | 4328 |
4329 // To be compatible with safari we do not change the value on API objects | 4329 // Special case for callback properties. |
4330 // in defineProperty. Firefox disagrees here, and actually changes the value. | 4330 if (result.IsProperty() && result.type() == CALLBACKS) { |
4331 if (result.IsProperty() && | 4331 Object* callback = result.GetCallbackObject(); |
4332 (result.type() == CALLBACKS) && | 4332 // To be compatible with safari we do not change the value on API objects |
4333 result.GetCallbackObject()->IsAccessorInfo()) { | 4333 // in defineProperty. Firefox disagrees here, and actually changes the value . |
rossberg
2011/12/19 16:47:44
80 characters
Michael Starzinger
2011/12/20 08:50:16
Done.
| |
4334 return isolate->heap()->undefined_value(); | 4334 if (callback->IsAccessorInfo()) { |
4335 return isolate->heap()->undefined_value(); | |
4336 } | |
4337 // Avoid redefining foreign callback as data property, just use the stored | |
4338 // setter to update the value instead. | |
4339 // TODO(mstarzinger): So far this only works if property attributes don't | |
4340 // change, this should be fixed once we cleanup the underlying code. | |
4341 if (callback->IsForeign() && result.GetAttributes() == attr) { | |
4342 return js_object->SetPropertyWithCallback(callback, | |
4343 *name, | |
4344 *obj_value, | |
4345 result.holder(), | |
4346 kNonStrictMode); | |
rossberg
2011/12/19 16:47:44
This should be KStrictMode, I think.
Michael Starzinger
2011/12/20 08:50:16
Done. On this code path it doesn't actually matter
| |
4347 } | |
4335 } | 4348 } |
4336 | 4349 |
4337 // Take special care when attributes are different and there is already | 4350 // Take special care when attributes are different and there is already |
4338 // a property. For simplicity we normalize the property which enables us | 4351 // a property. For simplicity we normalize the property which enables us |
4339 // to not worry about changing the instance_descriptor and creating a new | 4352 // to not worry about changing the instance_descriptor and creating a new |
4340 // map. The current version of SetObjectProperty does not handle attributes | 4353 // map. The current version of SetObjectProperty does not handle attributes |
4341 // correctly in the case where a property is a field and is reset with | 4354 // correctly in the case where a property is a field and is reset with |
4342 // new attributes. | 4355 // new attributes. |
4343 if (result.IsProperty() && | 4356 if (result.IsProperty() && |
4344 (attr != result.GetAttributes() || result.type() == CALLBACKS)) { | 4357 (attr != result.GetAttributes() || result.type() == CALLBACKS)) { |
(...skipping 9226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13571 } else { | 13584 } else { |
13572 // Handle last resort GC and make sure to allow future allocations | 13585 // Handle last resort GC and make sure to allow future allocations |
13573 // to grow the heap without causing GCs (if possible). | 13586 // to grow the heap without causing GCs (if possible). |
13574 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13587 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13575 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13588 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13576 } | 13589 } |
13577 } | 13590 } |
13578 | 13591 |
13579 | 13592 |
13580 } } // namespace v8::internal | 13593 } } // namespace v8::internal |
OLD | NEW |