| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if (IS_UNDEFINED(desc)) return desc; | 390 if (IS_UNDEFINED(desc)) return desc; |
| 391 | 391 |
| 392 if (IsDataDescriptor(desc)) { | 392 if (IsDataDescriptor(desc)) { |
| 393 return { value: desc.getValue(), | 393 return { value: desc.getValue(), |
| 394 writable: desc.isWritable(), | 394 writable: desc.isWritable(), |
| 395 enumerable: desc.isEnumerable(), | 395 enumerable: desc.isEnumerable(), |
| 396 configurable: desc.isConfigurable() }; | 396 configurable: desc.isConfigurable() }; |
| 397 } | 397 } |
| 398 // Must be an AccessorDescriptor then. We never return a generic descriptor. | 398 // Must be an AccessorDescriptor then. We never return a generic descriptor. |
| 399 return { get: desc.getGet(), | 399 return { get: desc.getGet(), |
| 400 set: desc.getSet() === ObjectSetProto ? ObjectPoisonProto | 400 set: desc.getSet(), |
| 401 : desc.getSet(), | |
| 402 enumerable: desc.isEnumerable(), | 401 enumerable: desc.isEnumerable(), |
| 403 configurable: desc.isConfigurable() }; | 402 configurable: desc.isConfigurable() }; |
| 404 } | 403 } |
| 405 | 404 |
| 406 | 405 |
| 407 // Harmony Proxies | 406 // Harmony Proxies |
| 408 function FromGenericPropertyDescriptor(desc) { | 407 function FromGenericPropertyDescriptor(desc) { |
| 409 if (IS_UNDEFINED(desc)) return desc; | 408 if (IS_UNDEFINED(desc)) return desc; |
| 410 var obj = new $Object(); | 409 var obj = new $Object(); |
| 411 | 410 |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 return %GetPrototype(this); | 1389 return %GetPrototype(this); |
| 1391 } | 1390 } |
| 1392 | 1391 |
| 1393 | 1392 |
| 1394 // Harmony __proto__ setter. | 1393 // Harmony __proto__ setter. |
| 1395 function ObjectSetProto(obj) { | 1394 function ObjectSetProto(obj) { |
| 1396 return %SetPrototype(this, obj); | 1395 return %SetPrototype(this, obj); |
| 1397 } | 1396 } |
| 1398 | 1397 |
| 1399 | 1398 |
| 1400 // Harmony __proto__ poison pill. | |
| 1401 function ObjectPoisonProto(obj) { | |
| 1402 throw MakeTypeError("proto_poison_pill", []); | |
| 1403 } | |
| 1404 | |
| 1405 | |
| 1406 function ObjectConstructor(x) { | 1399 function ObjectConstructor(x) { |
| 1407 if (%_IsConstructCall()) { | 1400 if (%_IsConstructCall()) { |
| 1408 if (x == null) return this; | 1401 if (x == null) return this; |
| 1409 return ToObject(x); | 1402 return ToObject(x); |
| 1410 } else { | 1403 } else { |
| 1411 if (x == null) return { }; | 1404 if (x == null) return { }; |
| 1412 return ToObject(x); | 1405 return ToObject(x); |
| 1413 } | 1406 } |
| 1414 } | 1407 } |
| 1415 | 1408 |
| 1416 | 1409 |
| 1417 // ---------------------------------------------------------------------------- | 1410 // ---------------------------------------------------------------------------- |
| 1418 // Object | 1411 // Object |
| 1419 | 1412 |
| 1420 function SetUpObject() { | 1413 function SetUpObject() { |
| 1421 %CheckIsBootstrapping(); | 1414 %CheckIsBootstrapping(); |
| 1422 | 1415 |
| 1423 %SetNativeFlag($Object); | 1416 %SetNativeFlag($Object); |
| 1424 %SetCode($Object, ObjectConstructor); | 1417 %SetCode($Object, ObjectConstructor); |
| 1425 %FunctionSetName(ObjectPoisonProto, "__proto__"); | |
| 1426 %FunctionRemovePrototype(ObjectPoisonProto); | |
| 1427 %SetExpectedNumberOfProperties($Object, 4); | 1418 %SetExpectedNumberOfProperties($Object, 4); |
| 1428 | 1419 |
| 1429 %SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM); | 1420 %SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM); |
| 1430 | 1421 |
| 1431 // Set up non-enumerable functions on the Object.prototype object. | 1422 // Set up non-enumerable functions on the Object.prototype object. |
| 1432 InstallFunctions($Object.prototype, DONT_ENUM, $Array( | 1423 InstallFunctions($Object.prototype, DONT_ENUM, $Array( |
| 1433 "toString", ObjectToString, | 1424 "toString", ObjectToString, |
| 1434 "toLocaleString", ObjectToLocaleString, | 1425 "toLocaleString", ObjectToLocaleString, |
| 1435 "valueOf", ObjectValueOf, | 1426 "valueOf", ObjectValueOf, |
| 1436 "hasOwnProperty", ObjectHasOwnProperty, | 1427 "hasOwnProperty", ObjectHasOwnProperty, |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 // Eventually, we should move to a real event queue that allows to maintain | 1889 // Eventually, we should move to a real event queue that allows to maintain |
| 1899 // relative ordering of different kinds of tasks. | 1890 // relative ordering of different kinds of tasks. |
| 1900 | 1891 |
| 1901 RunMicrotasks.runners = new InternalArray; | 1892 RunMicrotasks.runners = new InternalArray; |
| 1902 | 1893 |
| 1903 function RunMicrotasks() { | 1894 function RunMicrotasks() { |
| 1904 while (%SetMicrotaskPending(false)) { | 1895 while (%SetMicrotaskPending(false)) { |
| 1905 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i](); | 1896 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i](); |
| 1906 } | 1897 } |
| 1907 } | 1898 } |
| OLD | NEW |