If you define a getter on the prototype and cache its value by defining a property with the same name on the instance, sometimes the getter is called a second time, when the property is accessed. This can be reproduced on Safari 7.0.3 with the attached HTML page. A "TypeError: Attempting to change value of a readonly property" is thrown when the getter is called the second time and calls Object.defineProperty() again. The expected behavior would be that the getter is executed only once per instance.
Created attachment 231392 [details]
Note that the issue only happens if there are at least 9 objects created (the testcase creates 1000 of them, just in case). It seems that the issue here is a wrong optimization when the JIT compiler processes method Class.bar() - it will call the getter on the prototype directly, without checking whether the same property exists on the object instance.
The issue is only reproducible in Safari, neither Firefox nor Chrome show this behavior.
getter cache misoptimization?