OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 assertEquals(1, smi20); | 256 assertEquals(1, smi20); |
257 assertEquals(1.5, dbl20); | 257 assertEquals(1.5, dbl20); |
258 assertEquals(some_object20, obj20); | 258 assertEquals(some_object20, obj20); |
259 | 259 |
260 assertEquals(100, o20.smi); | 260 assertEquals(100, o20.smi); |
261 assertEquals(100, o20.dbl); | 261 assertEquals(100, o20.dbl); |
262 assertEquals(100, o20.dbl); | 262 assertEquals(100, o20.dbl); |
263 | 263 |
264 function attr_mismatch_obj(v, writable) { | 264 function attr_mismatch_obj(v, writable) { |
265 var o = {}; | 265 var o = {}; |
| 266 // Assign twice to make the field non-constant. |
| 267 // TODO(ishell): update test once constant field tracking is done. |
| 268 o.some_value = 0; |
266 o.some_value = v; | 269 o.some_value = v; |
267 Object.defineProperty(o, "second_value", {value:10, writable:writable}); | 270 Object.defineProperty(o, "second_value", {value:10, writable:writable}); |
268 return o; | 271 return o; |
269 } | 272 } |
270 | 273 |
271 function is_writable(o, p) { | 274 function is_writable(o, p) { |
272 return Object.getOwnPropertyDescriptor(o,p).writable; | 275 return Object.getOwnPropertyDescriptor(o,p).writable; |
273 } | 276 } |
274 | 277 |
275 var writable = attr_mismatch_obj(10, true); | 278 var writable = attr_mismatch_obj(10, true); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 var o = {"s_to_t":18}; | 400 var o = {"s_to_t":18}; |
398 o.s_to_t = a; | 401 o.s_to_t = a; |
399 return o; | 402 return o; |
400 } | 403 } |
401 | 404 |
402 var st1 = smi_to_object(true); | 405 var st1 = smi_to_object(true); |
403 var st2 = smi_to_object(false); | 406 var st2 = smi_to_object(false); |
404 assertTrue(%HaveSameMap(st1, st2)); | 407 assertTrue(%HaveSameMap(st1, st2)); |
405 assertEquals(true, st1.s_to_t); | 408 assertEquals(true, st1.s_to_t); |
406 assertEquals(false, st2.s_to_t); | 409 assertEquals(false, st2.s_to_t); |
OLD | NEW |