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

Side by Side Diff: src/v8natives.js

Issue 103343005: ES6: Remove __proto__ setter poison pill (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Expand tests Created 6 years, 10 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 | « src/messages.js ('k') | test/mjsunit/proto-accessor.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 // 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if (IS_UNDEFINED(desc)) return desc; 396 if (IS_UNDEFINED(desc)) return desc;
397 397
398 if (IsDataDescriptor(desc)) { 398 if (IsDataDescriptor(desc)) {
399 return { value: desc.getValue(), 399 return { value: desc.getValue(),
400 writable: desc.isWritable(), 400 writable: desc.isWritable(),
401 enumerable: desc.isEnumerable(), 401 enumerable: desc.isEnumerable(),
402 configurable: desc.isConfigurable() }; 402 configurable: desc.isConfigurable() };
403 } 403 }
404 // Must be an AccessorDescriptor then. We never return a generic descriptor. 404 // Must be an AccessorDescriptor then. We never return a generic descriptor.
405 return { get: desc.getGet(), 405 return { get: desc.getGet(),
406 set: desc.getSet() === ObjectSetProto ? ObjectPoisonProto 406 set: desc.getSet(),
407 : desc.getSet(),
408 enumerable: desc.isEnumerable(), 407 enumerable: desc.isEnumerable(),
409 configurable: desc.isConfigurable() }; 408 configurable: desc.isConfigurable() };
410 } 409 }
411 410
412 411
413 // Harmony Proxies 412 // Harmony Proxies
414 function FromGenericPropertyDescriptor(desc) { 413 function FromGenericPropertyDescriptor(desc) {
415 if (IS_UNDEFINED(desc)) return desc; 414 if (IS_UNDEFINED(desc)) return desc;
416 var obj = new $Object(); 415 var obj = new $Object();
417 416
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 return %GetPrototype(this); 1395 return %GetPrototype(this);
1397 } 1396 }
1398 1397
1399 1398
1400 // Harmony __proto__ setter. 1399 // Harmony __proto__ setter.
1401 function ObjectSetProto(obj) { 1400 function ObjectSetProto(obj) {
1402 return %SetPrototype(this, obj); 1401 return %SetPrototype(this, obj);
1403 } 1402 }
1404 1403
1405 1404
1406 // Harmony __proto__ poison pill.
1407 function ObjectPoisonProto(obj) {
1408 throw MakeTypeError("proto_poison_pill", []);
1409 }
1410
1411
1412 function ObjectConstructor(x) { 1405 function ObjectConstructor(x) {
1413 if (%_IsConstructCall()) { 1406 if (%_IsConstructCall()) {
1414 if (x == null) return this; 1407 if (x == null) return this;
1415 return ToObject(x); 1408 return ToObject(x);
1416 } else { 1409 } else {
1417 if (x == null) return { }; 1410 if (x == null) return { };
1418 return ToObject(x); 1411 return ToObject(x);
1419 } 1412 }
1420 } 1413 }
1421 1414
1422 1415
1423 // ---------------------------------------------------------------------------- 1416 // ----------------------------------------------------------------------------
1424 // Object 1417 // Object
1425 1418
1426 function SetUpObject() { 1419 function SetUpObject() {
1427 %CheckIsBootstrapping(); 1420 %CheckIsBootstrapping();
1428 1421
1429 %SetNativeFlag($Object); 1422 %SetNativeFlag($Object);
1430 %SetCode($Object, ObjectConstructor); 1423 %SetCode($Object, ObjectConstructor);
1431 %FunctionSetName(ObjectPoisonProto, "__proto__");
1432 %FunctionRemovePrototype(ObjectPoisonProto);
1433 %SetExpectedNumberOfProperties($Object, 4); 1424 %SetExpectedNumberOfProperties($Object, 4);
1434 1425
1435 %SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM); 1426 %SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
1436 1427
1437 // Set up non-enumerable functions on the Object.prototype object. 1428 // Set up non-enumerable functions on the Object.prototype object.
1438 InstallFunctions($Object.prototype, DONT_ENUM, $Array( 1429 InstallFunctions($Object.prototype, DONT_ENUM, $Array(
1439 "toString", ObjectToString, 1430 "toString", ObjectToString,
1440 "toLocaleString", ObjectToLocaleString, 1431 "toLocaleString", ObjectToLocaleString,
1441 "valueOf", ObjectValueOf, 1432 "valueOf", ObjectValueOf,
1442 "hasOwnProperty", ObjectHasOwnProperty, 1433 "hasOwnProperty", ObjectHasOwnProperty,
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 // Eventually, we should move to a real event queue that allows to maintain 1895 // Eventually, we should move to a real event queue that allows to maintain
1905 // relative ordering of different kinds of tasks. 1896 // relative ordering of different kinds of tasks.
1906 1897
1907 RunMicrotasks.runners = new InternalArray; 1898 RunMicrotasks.runners = new InternalArray;
1908 1899
1909 function RunMicrotasks() { 1900 function RunMicrotasks() {
1910 while (%SetMicrotaskPending(false)) { 1901 while (%SetMicrotaskPending(false)) {
1911 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i](); 1902 for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i]();
1912 } 1903 }
1913 } 1904 }
OLDNEW
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/proto-accessor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698