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

Side by Side Diff: src/v8natives.js

Issue 548833002: [es6] implement Object.assign (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years 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
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 // ECMA-262 - 15.2.4.6 253 // ECMA-262 - 15.2.4.6
254 function ObjectIsPrototypeOf(V) { 254 function ObjectIsPrototypeOf(V) {
255 if (!IS_SPEC_OBJECT(V)) return false; 255 if (!IS_SPEC_OBJECT(V)) return false;
256 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.isPrototypeOf"); 256 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.isPrototypeOf");
257 return %IsInPrototypeChain(this, V); 257 return %IsInPrototypeChain(this, V);
258 } 258 }
259 259
260 260
261 // ECMA-262 - 15.2.4.6 261 // ECMA-262 - 15.2.4.6
262 function ObjectPropertyIsEnumerable(V) { 262 function ObjectPropertyIsEnumerableJS(O, V) {
263 var P = ToName(V); 263 var P = ToName(V);
264 if (%_IsJSProxy(this)) { 264 if (%_IsJSProxy(O)) {
265 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 265 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
266 if (IS_SYMBOL(V)) return false; 266 if (IS_SYMBOL(V)) return false;
267 267
268 var desc = GetOwnPropertyJS(this, P); 268 var desc = GetOwnPropertyJS(O, P);
269 return IS_UNDEFINED(desc) ? false : desc.isEnumerable(); 269 return IS_UNDEFINED(desc) ? false : desc.isEnumerable();
270 } 270 }
271 return %IsPropertyEnumerable(ToObject(this), P); 271 return %IsPropertyEnumerable(ToObject(O), P);
272 } 272 }
273 273
274 274
275 function ObjectPropertyIsEnumerable(V) {
276 return ObjectPropertyIsEnumerableJS(this, V);
277 }
278
279
275 // Extensions for providing property getters and setters. 280 // Extensions for providing property getters and setters.
276 function ObjectDefineGetter(name, fun) { 281 function ObjectDefineGetter(name, fun) {
277 var receiver = this; 282 var receiver = this;
278 if (receiver == null && !IS_UNDETECTABLE(receiver)) { 283 if (receiver == null && !IS_UNDETECTABLE(receiver)) {
279 receiver = %GlobalProxy(global); 284 receiver = %GlobalProxy(global);
280 } 285 }
281 if (!IS_SPEC_FUNCTION(fun)) { 286 if (!IS_SPEC_FUNCTION(fun)) {
282 throw new $TypeError( 287 throw new $TypeError(
283 'Object.prototype.__defineGetter__: Expecting function'); 288 'Object.prototype.__defineGetter__: Expecting function');
284 } 289 }
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 } 1905 }
1901 if (!IS_SPEC_FUNCTION(method)) { 1906 if (!IS_SPEC_FUNCTION(method)) {
1902 throw MakeTypeError('not_iterable', [obj]); 1907 throw MakeTypeError('not_iterable', [obj]);
1903 } 1908 }
1904 var iterator = %_CallFunction(obj, method); 1909 var iterator = %_CallFunction(obj, method);
1905 if (!IS_SPEC_OBJECT(iterator)) { 1910 if (!IS_SPEC_OBJECT(iterator)) {
1906 throw MakeTypeError('not_an_iterator', [iterator]); 1911 throw MakeTypeError('not_an_iterator', [iterator]);
1907 } 1912 }
1908 return iterator; 1913 return iterator;
1909 } 1914 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698