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 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 // Harmony egal. | 1377 // Harmony egal. |
1378 function ObjectIs(obj1, obj2) { | 1378 function ObjectIs(obj1, obj2) { |
1379 if (obj1 === obj2) { | 1379 if (obj1 === obj2) { |
1380 return (obj1 !== 0) || (1 / obj1 === 1 / obj2); | 1380 return (obj1 !== 0) || (1 / obj1 === 1 / obj2); |
1381 } else { | 1381 } else { |
1382 return (obj1 !== obj1) && (obj2 !== obj2); | 1382 return (obj1 !== obj1) && (obj2 !== obj2); |
1383 } | 1383 } |
1384 } | 1384 } |
1385 | 1385 |
1386 | 1386 |
1387 // Harmony __proto__ getter. | 1387 // ECMA-262, Edition 6, section B.2.2.1.1 |
1388 function ObjectGetProto() { | 1388 function ObjectGetProto() { |
1389 return %GetPrototype(this); | 1389 return %GetPrototype(ToObject(this)); |
1390 } | 1390 } |
1391 | 1391 |
1392 | 1392 |
1393 // Harmony __proto__ setter. | 1393 // ECMA-262, Edition 6, section B.2.2.1.2 |
1394 function ObjectSetProto(obj) { | 1394 function ObjectSetProto(proto) { |
1395 return %SetPrototype(this, obj); | 1395 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__"); |
| 1396 |
| 1397 if (IS_SPEC_OBJECT(proto) || IS_NULL(proto) && IS_SPEC_OBJECT(this)) { |
| 1398 %SetPrototype(this, proto); |
| 1399 } |
1396 } | 1400 } |
1397 | 1401 |
1398 | 1402 |
1399 function ObjectConstructor(x) { | 1403 function ObjectConstructor(x) { |
1400 if (%_IsConstructCall()) { | 1404 if (%_IsConstructCall()) { |
1401 if (x == null) return this; | 1405 if (x == null) return this; |
1402 return ToObject(x); | 1406 return ToObject(x); |
1403 } else { | 1407 } else { |
1404 if (x == null) return { }; | 1408 if (x == null) return { }; |
1405 return ToObject(x); | 1409 return ToObject(x); |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 function RunMicrotasks() { | 1898 function RunMicrotasks() { |
1895 while (%SetMicrotaskPending(false)) { | 1899 while (%SetMicrotaskPending(false)) { |
1896 var microtasks = RunMicrotasks.queue; | 1900 var microtasks = RunMicrotasks.queue; |
1897 RunMicrotasks.queue = new InternalArray; | 1901 RunMicrotasks.queue = new InternalArray; |
1898 | 1902 |
1899 for (var i = 0; i < microtasks.length; i++) { | 1903 for (var i = 0; i < microtasks.length; i++) { |
1900 microtasks[i](); | 1904 microtasks[i](); |
1901 } | 1905 } |
1902 } | 1906 } |
1903 } | 1907 } |
OLD | NEW |