OLD | NEW |
---|---|
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/code-stubs.h" | 10 #include "src/code-stubs.h" |
10 #include "src/extensions/externalize-string-extension.h" | 11 #include "src/extensions/externalize-string-extension.h" |
11 #include "src/extensions/free-buffer-extension.h" | 12 #include "src/extensions/free-buffer-extension.h" |
12 #include "src/extensions/gc-extension.h" | 13 #include "src/extensions/gc-extension.h" |
13 #include "src/extensions/ignition-statistics-extension.h" | 14 #include "src/extensions/ignition-statistics-extension.h" |
14 #include "src/extensions/statistics-extension.h" | 15 #include "src/extensions/statistics-extension.h" |
15 #include "src/extensions/trigger-failure-extension.h" | 16 #include "src/extensions/trigger-failure-extension.h" |
16 #include "src/heap/heap.h" | 17 #include "src/heap/heap.h" |
17 #include "src/isolate-inl.h" | 18 #include "src/isolate-inl.h" |
18 #include "src/snapshot/natives.h" | 19 #include "src/snapshot/natives.h" |
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1696 SimpleInstallFunction(math, "log10", Builtins::kMathLog10, 1, true); | 1697 SimpleInstallFunction(math, "log10", Builtins::kMathLog10, 1, true); |
1697 SimpleInstallFunction(math, "max", Builtins::kMathMax, 2, false); | 1698 SimpleInstallFunction(math, "max", Builtins::kMathMax, 2, false); |
1698 SimpleInstallFunction(math, "min", Builtins::kMathMin, 2, false); | 1699 SimpleInstallFunction(math, "min", Builtins::kMathMin, 2, false); |
1699 SimpleInstallFunction(math, "round", Builtins::kMathRound, 1, true); | 1700 SimpleInstallFunction(math, "round", Builtins::kMathRound, 1, true); |
1700 SimpleInstallFunction(math, "sin", Builtins::kMathSin, 1, true); | 1701 SimpleInstallFunction(math, "sin", Builtins::kMathSin, 1, true); |
1701 Handle<JSFunction> math_sqrt = | 1702 Handle<JSFunction> math_sqrt = |
1702 SimpleInstallFunction(math, "sqrt", Builtins::kMathSqrt, 1, true); | 1703 SimpleInstallFunction(math, "sqrt", Builtins::kMathSqrt, 1, true); |
1703 native_context()->set_math_sqrt(*math_sqrt); | 1704 native_context()->set_math_sqrt(*math_sqrt); |
1704 SimpleInstallFunction(math, "tan", Builtins::kMathTan, 1, true); | 1705 SimpleInstallFunction(math, "tan", Builtins::kMathTan, 1, true); |
1705 SimpleInstallFunction(math, "trunc", Builtins::kMathTrunc, 1, true); | 1706 SimpleInstallFunction(math, "trunc", Builtins::kMathTrunc, 1, true); |
1707 | |
1708 // Install math constants. | |
1709 double const kE = base::ieee754::exp(1.0); | |
1710 JSObject::AddProperty( | |
1711 math, factory->NewStringFromAsciiChecked("E"), factory->NewNumber(kE), | |
1712 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); | |
Yang
2016/06/21 05:40:30
Maybe we can have a helper function to get rid of
Benedikt Meurer
2016/06/21 05:42:55
Yeah, but let's do that separately. This CL is onl
| |
1713 JSObject::AddProperty( | |
1714 math, factory->NewStringFromAsciiChecked("LN10"), | |
1715 factory->NewNumber(base::ieee754::log(10.0)), | |
1716 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); | |
1717 JSObject::AddProperty( | |
1718 math, factory->NewStringFromAsciiChecked("LN2"), | |
1719 factory->NewNumber(base::ieee754::log(2.0)), | |
1720 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); | |
1721 JSObject::AddProperty( | |
1722 math, factory->NewStringFromAsciiChecked("LOG10E"), | |
1723 factory->NewNumber(base::ieee754::log10(kE)), | |
1724 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); | |
1725 JSObject::AddProperty( | |
1726 math, factory->NewStringFromAsciiChecked("LOG2E"), | |
1727 factory->NewNumber(base::ieee754::log2(kE)), | |
1728 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); | |
1706 } | 1729 } |
1707 | 1730 |
1708 { // -- A r r a y B u f f e r | 1731 { // -- A r r a y B u f f e r |
1709 Handle<JSFunction> array_buffer_fun = | 1732 Handle<JSFunction> array_buffer_fun = |
1710 InstallArrayBuffer(global, "ArrayBuffer"); | 1733 InstallArrayBuffer(global, "ArrayBuffer"); |
1711 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, | 1734 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, |
1712 Context::ARRAY_BUFFER_FUN_INDEX); | 1735 Context::ARRAY_BUFFER_FUN_INDEX); |
1713 } | 1736 } |
1714 | 1737 |
1715 { // -- T y p e d A r r a y | 1738 { // -- T y p e d A r r a y |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3956 } | 3979 } |
3957 | 3980 |
3958 | 3981 |
3959 // Called when the top-level V8 mutex is destroyed. | 3982 // Called when the top-level V8 mutex is destroyed. |
3960 void Bootstrapper::FreeThreadResources() { | 3983 void Bootstrapper::FreeThreadResources() { |
3961 DCHECK(!IsActive()); | 3984 DCHECK(!IsActive()); |
3962 } | 3985 } |
3963 | 3986 |
3964 } // namespace internal | 3987 } // namespace internal |
3965 } // namespace v8 | 3988 } // namespace v8 |
OLD | NEW |