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

Side by Side Diff: src/v8natives.js

Issue 1154233003: Introduce v8::Object::CreateDataProperty (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 6 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-api.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 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 var $functionSourceString; 5 var $functionSourceString;
6 var $globalEval; 6 var $globalEval;
7 var $objectDefineArrayProperty;
7 var $objectGetOwnPropertyDescriptor; 8 var $objectGetOwnPropertyDescriptor;
8 var $toCompletePropertyDescriptor; 9 var $toCompletePropertyDescriptor;
9 10
10 (function(global, utils) { 11 (function(global, utils) {
11 12
12 %CheckIsBootstrapping(); 13 %CheckIsBootstrapping();
13 14
14 // ---------------------------------------------------------------------------- 15 // ----------------------------------------------------------------------------
15 // Imports 16 // Imports
16 17
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 } 889 }
889 return true; 890 return true;
890 } 891 }
891 } 892 }
892 893
893 // Step 5 - Fallback to default implementation. 894 // Step 5 - Fallback to default implementation.
894 return DefineObjectProperty(obj, p, desc, should_throw); 895 return DefineObjectProperty(obj, p, desc, should_throw);
895 } 896 }
896 897
897 898
899 function DefineArrayPropertyFromAPI(obj, p, value) {
900 return DefineArrayProperty(obj, p, ToPropertyDescriptor({
901 value: value,
902 configurable: true,
903 enumerable: true,
904 writable: true
905 }),
906 false);
907 }
908
909
898 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies. 910 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies.
899 function DefineOwnProperty(obj, p, desc, should_throw) { 911 function DefineOwnProperty(obj, p, desc, should_throw) {
900 if (%_IsJSProxy(obj)) { 912 if (%_IsJSProxy(obj)) {
901 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 913 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
902 if (IS_SYMBOL(p)) return false; 914 if (IS_SYMBOL(p)) return false;
903 915
904 var attributes = FromGenericPropertyDescriptor(desc); 916 var attributes = FromGenericPropertyDescriptor(desc);
905 return DefineProxyProperty(obj, p, attributes, should_throw); 917 return DefineProxyProperty(obj, p, attributes, should_throw);
906 } else if (IS_ARRAY(obj)) { 918 } else if (IS_ARRAY(obj)) {
907 return DefineArrayProperty(obj, p, desc, should_throw); 919 return DefineArrayProperty(obj, p, desc, should_throw);
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 throw MakeTypeError(kNotAnIterator, iterator); 1830 throw MakeTypeError(kNotAnIterator, iterator);
1819 } 1831 }
1820 return iterator; 1832 return iterator;
1821 } 1833 }
1822 1834
1823 // ---------------------------------------------------------------------------- 1835 // ----------------------------------------------------------------------------
1824 // Exports 1836 // Exports
1825 1837
1826 $functionSourceString = FunctionSourceString; 1838 $functionSourceString = FunctionSourceString;
1827 $globalEval = GlobalEval; 1839 $globalEval = GlobalEval;
1840 $objectDefineArrayProperty = DefineArrayPropertyFromAPI;
1828 $objectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor; 1841 $objectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor;
1829 $toCompletePropertyDescriptor = ToCompletePropertyDescriptor; 1842 $toCompletePropertyDescriptor = ToCompletePropertyDescriptor;
1830 1843
1831 utils.ObjectDefineProperties = ObjectDefineProperties; 1844 utils.ObjectDefineProperties = ObjectDefineProperties;
1832 utils.ObjectDefineProperty = ObjectDefineProperty; 1845 utils.ObjectDefineProperty = ObjectDefineProperty;
1833 1846
1834 utils.Export(function(to) { 1847 utils.Export(function(to) {
1835 to.Delete = Delete; 1848 to.Delete = Delete;
1836 to.GetIterator = GetIterator; 1849 to.GetIterator = GetIterator;
1837 to.GetMethod = GetMethod; 1850 to.GetMethod = GetMethod;
1838 to.IsFinite = GlobalIsFinite; 1851 to.IsFinite = GlobalIsFinite;
1839 to.IsNaN = GlobalIsNaN; 1852 to.IsNaN = GlobalIsNaN;
1840 to.NewFunctionString = NewFunctionString; 1853 to.NewFunctionString = NewFunctionString;
1841 to.NumberIsNaN = NumberIsNaN; 1854 to.NumberIsNaN = NumberIsNaN;
1842 to.ObjectDefineProperty = ObjectDefineProperty; 1855 to.ObjectDefineProperty = ObjectDefineProperty;
1843 to.ObjectFreeze = ObjectFreezeJS; 1856 to.ObjectFreeze = ObjectFreezeJS;
1844 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; 1857 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys;
1845 to.ObjectHasOwnProperty = ObjectHasOwnProperty; 1858 to.ObjectHasOwnProperty = ObjectHasOwnProperty;
1846 to.ObjectIsFrozen = ObjectIsFrozen; 1859 to.ObjectIsFrozen = ObjectIsFrozen;
1847 to.ObjectIsSealed = ObjectIsSealed; 1860 to.ObjectIsSealed = ObjectIsSealed;
1848 to.ObjectToString = ObjectToString; 1861 to.ObjectToString = ObjectToString;
1849 to.OwnPropertyKeys = OwnPropertyKeys; 1862 to.OwnPropertyKeys = OwnPropertyKeys;
1850 to.ToNameArray = ToNameArray; 1863 to.ToNameArray = ToNameArray;
1851 }); 1864 });
1852 1865
1853 }) 1866 })
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698