| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // ECMA-262 - 15.2.4.2 | 240 // ECMA-262 - 15.2.4.2 |
| 241 function ObjectToString() { | 241 function ObjectToString() { |
| 242 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; | 242 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; |
| 243 if (IS_NULL(this)) return "[object Null]"; | 243 if (IS_NULL(this)) return "[object Null]"; |
| 244 return "[object " + %_ClassOf(ToObject(this)) + "]"; | 244 return "[object " + %_ClassOf(ToObject(this)) + "]"; |
| 245 } | 245 } |
| 246 | 246 |
| 247 | 247 |
| 248 // ECMA-262 - 15.2.4.3 | 248 // ECMA-262 - 15.2.4.3 |
| 249 function ObjectToLocaleString() { | 249 function ObjectToLocaleString() { |
| 250 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 250 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString"); |
| 251 throw MakeTypeError("called_on_null_or_undefined", | |
| 252 ["Object.prototype.toLocaleString"]); | |
| 253 } | |
| 254 return this.toString(); | 251 return this.toString(); |
| 255 } | 252 } |
| 256 | 253 |
| 257 | 254 |
| 258 // ECMA-262 - 15.2.4.4 | 255 // ECMA-262 - 15.2.4.4 |
| 259 function ObjectValueOf() { | 256 function ObjectValueOf() { |
| 260 return ToObject(this); | 257 return ToObject(this); |
| 261 } | 258 } |
| 262 | 259 |
| 263 | 260 |
| 264 // ECMA-262 - 15.2.4.5 | 261 // ECMA-262 - 15.2.4.5 |
| 265 function ObjectHasOwnProperty(V) { | 262 function ObjectHasOwnProperty(V) { |
| 266 if (%IsJSProxy(this)) { | 263 if (%IsJSProxy(this)) { |
| 267 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 264 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
| 268 if (IS_SYMBOL(V)) return false; | 265 if (IS_SYMBOL(V)) return false; |
| 269 | 266 |
| 270 var handler = %GetHandler(this); | 267 var handler = %GetHandler(this); |
| 271 return CallTrap1(handler, "hasOwn", DerivedHasOwnTrap, ToName(V)); | 268 return CallTrap1(handler, "hasOwn", DerivedHasOwnTrap, ToName(V)); |
| 272 } | 269 } |
| 273 return %HasLocalProperty(TO_OBJECT_INLINE(this), ToName(V)); | 270 return %HasLocalProperty(TO_OBJECT_INLINE(this), ToName(V)); |
| 274 } | 271 } |
| 275 | 272 |
| 276 | 273 |
| 277 // ECMA-262 - 15.2.4.6 | 274 // ECMA-262 - 15.2.4.6 |
| 278 function ObjectIsPrototypeOf(V) { | 275 function ObjectIsPrototypeOf(V) { |
| 279 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 276 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.isPrototypeOf"); |
| 280 throw MakeTypeError("called_on_null_or_undefined", | |
| 281 ["Object.prototype.isPrototypeOf"]); | |
| 282 } | |
| 283 if (!IS_SPEC_OBJECT(V)) return false; | 277 if (!IS_SPEC_OBJECT(V)) return false; |
| 284 return %IsInPrototypeChain(this, V); | 278 return %IsInPrototypeChain(this, V); |
| 285 } | 279 } |
| 286 | 280 |
| 287 | 281 |
| 288 // ECMA-262 - 15.2.4.6 | 282 // ECMA-262 - 15.2.4.6 |
| 289 function ObjectPropertyIsEnumerable(V) { | 283 function ObjectPropertyIsEnumerable(V) { |
| 290 var P = ToName(V); | 284 var P = ToName(V); |
| 291 if (%IsJSProxy(this)) { | 285 if (%IsJSProxy(this)) { |
| 292 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 286 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 // Eventually, we should move to a real event queue that allows to maintain | 1898 // Eventually, we should move to a real event queue that allows to maintain |
| 1905 // relative ordering of different kinds of tasks. | 1899 // relative ordering of different kinds of tasks. |
| 1906 | 1900 |
| 1907 RunMicrotasks.runners = new InternalArray; | 1901 RunMicrotasks.runners = new InternalArray; |
| 1908 | 1902 |
| 1909 function RunMicrotasks() { | 1903 function RunMicrotasks() { |
| 1910 while (%SetMicrotaskPending(false)) { | 1904 while (%SetMicrotaskPending(false)) { |
| 1911 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i](); | 1905 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i](); |
| 1912 } | 1906 } |
| 1913 } | 1907 } |
| OLD | NEW |