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

Side by Side Diff: src/v8natives.js

Issue 9616016: Make the runtime entry for setting/changing accessors "atomic". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review comments. Created 8 years, 9 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/runtime.cc ('k') | src/x64/full-codegen-x64.cc » ('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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 827 }
828 828
829 var value = void 0; // Default value is undefined. 829 var value = void 0; // Default value is undefined.
830 if (desc.hasValue()) { 830 if (desc.hasValue()) {
831 value = desc.getValue(); 831 value = desc.getValue();
832 } else if (!IS_UNDEFINED(current) && IsDataDescriptor(current)) { 832 } else if (!IS_UNDEFINED(current) && IsDataDescriptor(current)) {
833 value = current.getValue(); 833 value = current.getValue();
834 } 834 }
835 835
836 %DefineOrRedefineDataProperty(obj, p, value, flag); 836 %DefineOrRedefineDataProperty(obj, p, value, flag);
837 } else if (IsGenericDescriptor(desc)) {
838 // Step 12 - updating an existing accessor property with generic
839 // descriptor. Changing flags only.
840 %DefineOrRedefineAccessorProperty(obj, p, GETTER, current.getGet(), flag);
841 } else { 837 } else {
842 // There are 3 cases that lead here: 838 // There are 3 cases that lead here:
843 // Step 4b - defining a new accessor property. 839 // Step 4b - defining a new accessor property.
844 // Steps 9c & 12 - replacing an existing data property with an accessor 840 // Steps 9c & 12 - replacing an existing data property with an accessor
845 // property. 841 // property.
846 // Step 12 - updating an existing accessor property with an accessor 842 // Step 12 - updating an existing accessor property with an accessor
847 // descriptor. 843 // descriptor.
848 if (desc.hasGetter()) { 844 var getter = desc.hasGetter() ? desc.getGet() : null;
849 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); 845 var setter = desc.hasSetter() ? desc.getSet() : null;
850 } 846 %DefineOrRedefineAccessorProperty(obj, p, getter, setter, flag);
851 if (desc.hasSetter()) {
852 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag);
853 }
854 } 847 }
855 return true; 848 return true;
856 } 849 }
857 850
858 851
859 // ES5 section 15.4.5.1. 852 // ES5 section 15.4.5.1.
860 function DefineArrayProperty(obj, p, desc, should_throw) { 853 function DefineArrayProperty(obj, p, desc, should_throw) {
861 // Note that the length of an array is not actually stored as part of the 854 // Note that the length of an array is not actually stored as part of the
862 // property, hence we use generated code throughout this function instead of 855 // property, hence we use generated code throughout this function instead of
863 // DefineObjectProperty() to modify its value. 856 // DefineObjectProperty() to modify its value.
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 1638
1646 function SetUpFunction() { 1639 function SetUpFunction() {
1647 %CheckIsBootstrapping(); 1640 %CheckIsBootstrapping();
1648 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1641 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1649 "bind", FunctionBind, 1642 "bind", FunctionBind,
1650 "toString", FunctionToString 1643 "toString", FunctionToString
1651 )); 1644 ));
1652 } 1645 }
1653 1646
1654 SetUpFunction(); 1647 SetUpFunction();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698