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

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

Issue 2079233005: [builtins] Make sure the Math functions and constants agree. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update the unittests. Created 4 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
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 (function(global, utils) { 5 (function(global, utils) {
6 "use strict"; 6 "use strict";
7 7
8 %CheckIsBootstrapping(); 8 %CheckIsBootstrapping();
9 9
10 // ------------------------------------------------------------------- 10 // -------------------------------------------------------------------
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // ------------------------------------------------------------------- 120 // -------------------------------------------------------------------
121 121
122 %InstallToContext([ 122 %InstallToContext([
123 "math_pow", MathPowJS, 123 "math_pow", MathPowJS,
124 ]); 124 ]);
125 125
126 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM); 126 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM);
127 127
128 // Set up math constants. 128 // Set up math constants.
129 utils.InstallConstants(GlobalMath, [ 129 utils.InstallConstants(GlobalMath, [
130 // ECMA-262, section 15.8.1.1.
131 "E", 2.7182818284590452354,
132 // ECMA-262, section 15.8.1.2.
133 "LN10", 2.302585092994046,
134 // ECMA-262, section 15.8.1.3.
135 "LN2", 0.6931471805599453,
136 // ECMA-262, section 15.8.1.4.
137 "LOG2E", 1.4426950408889634,
138 "LOG10E", 0.4342944819032518,
139 "PI", 3.1415926535897932, 130 "PI", 3.1415926535897932,
140 "SQRT1_2", 0.7071067811865476, 131 "SQRT1_2", 0.7071067811865476,
141 "SQRT2", 1.4142135623730951 132 "SQRT2", 1.4142135623730951
Yang 2016/06/21 05:40:30 What about these three? Can we move them over to t
Benedikt Meurer 2016/06/21 05:42:55 Yeah, but let's do that separately. This CL is onl
142 ]); 133 ]);
143 134
144 // Set up non-enumerable functions of the Math object and 135 // Set up non-enumerable functions of the Math object and
145 // set their names. 136 // set their names.
146 utils.InstallFunctions(GlobalMath, DONT_ENUM, [ 137 utils.InstallFunctions(GlobalMath, DONT_ENUM, [
147 "random", MathRandom, 138 "random", MathRandom,
148 "abs", MathAbs, 139 "abs", MathAbs,
149 "pow", MathPowJS, 140 "pow", MathPowJS,
150 "sign", MathSign, 141 "sign", MathSign,
151 "asinh", MathAsinh, 142 "asinh", MathAsinh,
152 "acosh", MathAcosh, 143 "acosh", MathAcosh,
153 "hypot", MathHypot, 144 "hypot", MathHypot,
154 ]); 145 ]);
155 146
156 %SetForceInlineFlag(MathAbs); 147 %SetForceInlineFlag(MathAbs);
157 %SetForceInlineFlag(MathRandom); 148 %SetForceInlineFlag(MathRandom);
158 %SetForceInlineFlag(MathSign); 149 %SetForceInlineFlag(MathSign);
159 150
160 // ------------------------------------------------------------------- 151 // -------------------------------------------------------------------
161 // Exports 152 // Exports
162 153
163 utils.Export(function(to) { 154 utils.Export(function(to) {
164 to.MathAbs = MathAbs; 155 to.MathAbs = MathAbs;
165 to.IntRandom = MathRandomRaw; 156 to.IntRandom = MathRandomRaw;
166 }); 157 });
167 158
168 }) 159 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698