| Index: src/harmony-math.js
|
| diff --git a/test/mjsunit/regress/readonly3.js b/src/harmony-math.js
|
| similarity index 72%
|
| copy from test/mjsunit/regress/readonly3.js
|
| copy to src/harmony-math.js
|
| index f81979d272217d768fa9c9c90a0b22ce34d1c15b..a4d3f2e8a5e9c5936630571644605402dee1199d 100644
|
| --- a/test/mjsunit/regress/readonly3.js
|
| +++ b/src/harmony-math.js
|
| @@ -25,41 +25,36 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -this.x = 0;
|
| -
|
| -var p = {};
|
| -Object.defineProperty(p, "x", {writable:false, value:5});
|
| -this.__proto__ = p;
|
| -
|
| -function s(v) {
|
| - v.x = 1;
|
| +'use strict';
|
| +
|
| +// ES6 draft 09-27-13, section 20.2.2.28.
|
| +function MathSign(x) {
|
| + x = TO_NUMBER_INLINE(x);
|
| + if (x > 0) return 1;
|
| + if (x < 0) return -1;
|
| + if (x === 0) return x;
|
| + return NAN;
|
| }
|
|
|
| -function s_strict(v) {
|
| - "use strict";
|
| - v.x = 1;
|
| -}
|
|
|
| -function c(p) {
|
| - return {__proto__: p};
|
| +// ES6 draft 09-27-13, section 20.2.2.34.
|
| +function MathTrunc(x) {
|
| + x = TO_NUMBER_INLINE(x);
|
| + if (x > 0) return MathFloor(x);
|
| + if (x < 0) return MathCeil(x);
|
| + if (x === 0) return x;
|
| + return NAN;
|
| }
|
|
|
| -var o1 = c(this);
|
| -var o2 = c(this);
|
|
|
| -// Initialize the store IC.
|
| -s(c(this));
|
| -s(c(this));
|
| -s_strict(c(this));
|
| -s_strict(c(this));
|
| +function ExtendMath() {
|
| + %CheckIsBootstrapping();
|
|
|
| -delete this.x;
|
| -
|
| -// Verify that direct setting fails.
|
| -o1.x = 20;
|
| -assertEquals(5, o1.x);
|
| + // Set up the non-enumerable functions on the Math object.
|
| + InstallFunctions($Math, DONT_ENUM, $Array(
|
| + "sign", MathSign,
|
| + "trunc", MathTrunc
|
| + ));
|
| +}
|
|
|
| -// Verify that setting through the IC fails.
|
| -s(o2);
|
| -assertEquals(5, o2.x);
|
| -assertThrows("s_strict(o2);", TypeError);
|
| +ExtendMath();
|
|
|