Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: src/v8natives.js

Issue 626323002: Object.is should use SameValue (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed last issues. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/object-is.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file relies on the fact that the following declarations have been made 5 // This file relies on the fact that the following declarations have been made
6 // in runtime.js: 6 // in runtime.js:
7 // var $Object = global.Object; 7 // var $Object = global.Object;
8 // var $Boolean = global.Boolean; 8 // var $Boolean = global.Boolean;
9 // var $Number = global.Number; 9 // var $Number = global.Number;
10 // var $Function = global.Function; 10 // var $Function = global.Function;
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 if (!IS_SPEC_OBJECT(obj)) { 1359 if (!IS_SPEC_OBJECT(obj)) {
1360 throw MakeTypeError("called_on_non_object", ["Object.isExtensible"]); 1360 throw MakeTypeError("called_on_non_object", ["Object.isExtensible"]);
1361 } 1361 }
1362 if (%IsJSProxy(obj)) { 1362 if (%IsJSProxy(obj)) {
1363 return true; 1363 return true;
1364 } 1364 }
1365 return %IsExtensible(obj); 1365 return %IsExtensible(obj);
1366 } 1366 }
1367 1367
1368 1368
1369 // Harmony egal. 1369 // ECMA-262, Edition 6, section 19.1.2.10
1370 function ObjectIs(obj1, obj2) { 1370 function ObjectIs(obj1, obj2) {
1371 if (obj1 === obj2) { 1371 return SameValue(obj1, obj2);
1372 return (obj1 !== 0) || (1 / obj1 === 1 / obj2);
1373 } else {
1374 return (obj1 !== obj1) && (obj2 !== obj2);
1375 }
1376 } 1372 }
1377 1373
1378 1374
1379 // ECMA-262, Edition 6, section B.2.2.1.1 1375 // ECMA-262, Edition 6, section B.2.2.1.1
1380 function ObjectGetProto() { 1376 function ObjectGetProto() {
1381 return %GetPrototype(ToObject(this)); 1377 return %GetPrototype(ToObject(this));
1382 } 1378 }
1383 1379
1384 1380
1385 // ECMA-262, Edition 6, section B.2.2.1.2 1381 // ECMA-262, Edition 6, section B.2.2.1.2
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 } 1899 }
1904 if (!IS_SPEC_FUNCTION(method)) { 1900 if (!IS_SPEC_FUNCTION(method)) {
1905 throw MakeTypeError('not_iterable', [obj]); 1901 throw MakeTypeError('not_iterable', [obj]);
1906 } 1902 }
1907 var iterator = %_CallFunction(obj, method); 1903 var iterator = %_CallFunction(obj, method);
1908 if (!IS_SPEC_OBJECT(iterator)) { 1904 if (!IS_SPEC_OBJECT(iterator)) {
1909 throw MakeTypeError('not_an_iterator', [iterator]); 1905 throw MakeTypeError('not_an_iterator', [iterator]);
1910 } 1906 }
1911 return iterator; 1907 return iterator;
1912 } 1908 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/object-is.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698