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

Side by Side Diff: src/js/runtime.js

Issue 1879053003: Replace DefineIndexedProperty with %CreateDataProperty (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/js/regexp.js ('k') | src/js/typedarray.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. 5 // This files contains runtime support implemented in JavaScript.
6 6
7 // CAUTION: Some of the functions specified in this file are called 7 // CAUTION: Some of the functions specified in this file are called
8 // directly from compiled code. These are the functions with names in 8 // directly from compiled code. These are the functions with names in
9 // ALL CAPS. The compiled code passes the first argument in 'this'. 9 // ALL CAPS. The compiled code passes the first argument in 'this'.
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 // ---------------------------------------------------------------------------- 37 // ----------------------------------------------------------------------------
38 38
39 39
40 /* --------------------------------- 40 /* ---------------------------------
41 - - - U t i l i t i e s - - - 41 - - - U t i l i t i e s - - -
42 --------------------------------- 42 ---------------------------------
43 */ 43 */
44 44
45 45
46 // This function should be called rather than %AddElement in contexts where the
47 // argument might not be less than 2**32-1. ES2015 ToLength semantics mean that
48 // this is a concern at basically all callsites.
49 function AddIndexedProperty(obj, index, value) {
50 if (index === TO_UINT32(index) && index !== kMaxUint32) {
51 %AddElement(obj, index, value);
52 } else {
53 %AddNamedProperty(obj, TO_STRING(index), value, NONE);
54 }
55 }
56 %SetForceInlineFlag(AddIndexedProperty);
57
58
59 function ToPositiveInteger(x, rangeErrorIndex) { 46 function ToPositiveInteger(x, rangeErrorIndex) {
60 var i = TO_INTEGER_MAP_MINUS_ZERO(x); 47 var i = TO_INTEGER_MAP_MINUS_ZERO(x);
61 if (i < 0) throw MakeRangeError(rangeErrorIndex); 48 if (i < 0) throw MakeRangeError(rangeErrorIndex);
62 return i; 49 return i;
63 } 50 }
64 51
65 52
66 function MaxSimple(a, b) { 53 function MaxSimple(a, b) {
67 return a > b ? a : b; 54 return a > b ? a : b;
68 } 55 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // possible due to code generation for array literals. When 102 // possible due to code generation for array literals. When
116 // generating code for a array literal a boilerplate array is created 103 // generating code for a array literal a boilerplate array is created
117 // that is cloned when running the code. It is essential that the 104 // that is cloned when running the code. It is essential that the
118 // boilerplate gets the right prototype. 105 // boilerplate gets the right prototype.
119 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); 106 %FunctionSetPrototype(GlobalArray, new GlobalArray(0));
120 107
121 // ---------------------------------------------------------------------------- 108 // ----------------------------------------------------------------------------
122 // Exports 109 // Exports
123 110
124 utils.Export(function(to) { 111 utils.Export(function(to) {
125 to.AddIndexedProperty = AddIndexedProperty;
126 to.MaxSimple = MaxSimple; 112 to.MaxSimple = MaxSimple;
127 to.MinSimple = MinSimple; 113 to.MinSimple = MinSimple;
128 to.ToPositiveInteger = ToPositiveInteger; 114 to.ToPositiveInteger = ToPositiveInteger;
129 to.SpeciesConstructor = SpeciesConstructor; 115 to.SpeciesConstructor = SpeciesConstructor;
130 }); 116 });
131 117
132 }) 118 })
OLDNEW
« no previous file with comments | « src/js/regexp.js ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698