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/bootstrapper.cc

Issue 2402363002: [Math] implement Math.random as TFJ builtin. (Closed)
Patch Set: fix golden file Created 4 years, 2 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 SimpleInstallFunction(math, "imul", Builtins::kMathImul, 2, true); 1944 SimpleInstallFunction(math, "imul", Builtins::kMathImul, 2, true);
1945 SimpleInstallFunction(math, "log", Builtins::kMathLog, 1, true); 1945 SimpleInstallFunction(math, "log", Builtins::kMathLog, 1, true);
1946 SimpleInstallFunction(math, "log1p", Builtins::kMathLog1p, 1, true); 1946 SimpleInstallFunction(math, "log1p", Builtins::kMathLog1p, 1, true);
1947 SimpleInstallFunction(math, "log2", Builtins::kMathLog2, 1, true); 1947 SimpleInstallFunction(math, "log2", Builtins::kMathLog2, 1, true);
1948 SimpleInstallFunction(math, "log10", Builtins::kMathLog10, 1, true); 1948 SimpleInstallFunction(math, "log10", Builtins::kMathLog10, 1, true);
1949 SimpleInstallFunction(math, "max", Builtins::kMathMax, 2, false); 1949 SimpleInstallFunction(math, "max", Builtins::kMathMax, 2, false);
1950 SimpleInstallFunction(math, "min", Builtins::kMathMin, 2, false); 1950 SimpleInstallFunction(math, "min", Builtins::kMathMin, 2, false);
1951 Handle<JSFunction> math_pow = 1951 Handle<JSFunction> math_pow =
1952 SimpleInstallFunction(math, "pow", Builtins::kMathPow, 2, true); 1952 SimpleInstallFunction(math, "pow", Builtins::kMathPow, 2, true);
1953 native_context()->set_math_pow(*math_pow); 1953 native_context()->set_math_pow(*math_pow);
1954 SimpleInstallFunction(math, "random", Builtins::kMathRandom, 0, true);
1954 SimpleInstallFunction(math, "round", Builtins::kMathRound, 1, true); 1955 SimpleInstallFunction(math, "round", Builtins::kMathRound, 1, true);
1955 SimpleInstallFunction(math, "sign", Builtins::kMathSign, 1, true); 1956 SimpleInstallFunction(math, "sign", Builtins::kMathSign, 1, true);
1956 SimpleInstallFunction(math, "sin", Builtins::kMathSin, 1, true); 1957 SimpleInstallFunction(math, "sin", Builtins::kMathSin, 1, true);
1957 SimpleInstallFunction(math, "sinh", Builtins::kMathSinh, 1, true); 1958 SimpleInstallFunction(math, "sinh", Builtins::kMathSinh, 1, true);
1958 SimpleInstallFunction(math, "sqrt", Builtins::kMathSqrt, 1, true); 1959 SimpleInstallFunction(math, "sqrt", Builtins::kMathSqrt, 1, true);
1959 SimpleInstallFunction(math, "tan", Builtins::kMathTan, 1, true); 1960 SimpleInstallFunction(math, "tan", Builtins::kMathTan, 1, true);
1960 SimpleInstallFunction(math, "tanh", Builtins::kMathTanh, 1, true); 1961 SimpleInstallFunction(math, "tanh", Builtins::kMathTanh, 1, true);
1961 SimpleInstallFunction(math, "trunc", Builtins::kMathTrunc, 1, true); 1962 SimpleInstallFunction(math, "trunc", Builtins::kMathTrunc, 1, true);
1962 1963
1963 // Install math constants. 1964 // Install math constants.
(...skipping 22 matching lines...) Expand all
1986 math, factory->NewStringFromAsciiChecked("PI"), factory->NewNumber(kPI), 1987 math, factory->NewStringFromAsciiChecked("PI"), factory->NewNumber(kPI),
1987 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); 1988 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1988 JSObject::AddProperty( 1989 JSObject::AddProperty(
1989 math, factory->NewStringFromAsciiChecked("SQRT1_2"), 1990 math, factory->NewStringFromAsciiChecked("SQRT1_2"),
1990 factory->NewNumber(std::sqrt(0.5)), 1991 factory->NewNumber(std::sqrt(0.5)),
1991 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); 1992 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1992 JSObject::AddProperty( 1993 JSObject::AddProperty(
1993 math, factory->NewStringFromAsciiChecked("SQRT2"), 1994 math, factory->NewStringFromAsciiChecked("SQRT2"),
1994 factory->NewNumber(std::sqrt(2.0)), 1995 factory->NewNumber(std::sqrt(2.0)),
1995 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); 1996 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1997 JSObject::AddProperty(
1998 math, factory->to_string_tag_symbol(),
1999 factory->NewStringFromAsciiChecked("Math"),
2000 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
1996 } 2001 }
1997 2002
1998 { // -- A r r a y B u f f e r 2003 { // -- A r r a y B u f f e r
1999 Handle<JSFunction> array_buffer_fun = InstallArrayBuffer( 2004 Handle<JSFunction> array_buffer_fun = InstallArrayBuffer(
2000 global, "ArrayBuffer", Builtins::kArrayBufferPrototypeGetByteLength, 2005 global, "ArrayBuffer", Builtins::kArrayBufferPrototypeGetByteLength,
2001 BuiltinFunctionId::kArrayBufferByteLength); 2006 BuiltinFunctionId::kArrayBufferByteLength);
2002 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, 2007 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun,
2003 Context::ARRAY_BUFFER_FUN_INDEX); 2008 Context::ARRAY_BUFFER_FUN_INDEX);
2004 } 2009 }
2005 2010
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 } 4387 }
4383 4388
4384 4389
4385 // Called when the top-level V8 mutex is destroyed. 4390 // Called when the top-level V8 mutex is destroyed.
4386 void Bootstrapper::FreeThreadResources() { 4391 void Bootstrapper::FreeThreadResources() {
4387 DCHECK(!IsActive()); 4392 DCHECK(!IsActive());
4388 } 4393 }
4389 4394
4390 } // namespace internal 4395 } // namespace internal
4391 } // namespace v8 4396 } // namespace v8
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/builtins/builtins.h » ('j') | test/mjsunit/debug-script.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698