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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 JSObject::AddProperty(global, name, json_object, DONT_ENUM); | 1510 JSObject::AddProperty(global, name, json_object, DONT_ENUM); |
1511 } | 1511 } |
1512 | 1512 |
1513 { // -- M a t h | 1513 { // -- M a t h |
1514 Handle<String> name = factory->InternalizeUtf8String("Math"); | 1514 Handle<String> name = factory->InternalizeUtf8String("Math"); |
1515 Handle<JSFunction> cons = factory->NewFunction(name); | 1515 Handle<JSFunction> cons = factory->NewFunction(name); |
1516 JSFunction::SetInstancePrototype( | 1516 JSFunction::SetInstancePrototype( |
1517 cons, | 1517 cons, |
1518 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1518 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1519 cons->shared()->set_instance_class_name(*name); | 1519 cons->shared()->set_instance_class_name(*name); |
1520 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); | 1520 Handle<JSObject> math = factory->NewJSObject(cons, TENURED); |
1521 DCHECK(json_object->IsJSObject()); | 1521 DCHECK(math->IsJSObject()); |
1522 JSObject::AddProperty(global, name, json_object, DONT_ENUM); | 1522 JSObject::AddProperty(global, name, math, DONT_ENUM); |
| 1523 SimpleInstallFunction(math, "max", Builtins::kMathMax, 2, false); |
| 1524 SimpleInstallFunction(math, "min", Builtins::kMathMin, 2, false); |
1523 } | 1525 } |
1524 | 1526 |
1525 { // -- A r r a y B u f f e r | 1527 { // -- A r r a y B u f f e r |
1526 Handle<JSFunction> array_buffer_fun = | 1528 Handle<JSFunction> array_buffer_fun = |
1527 InstallArrayBuffer(global, "ArrayBuffer"); | 1529 InstallArrayBuffer(global, "ArrayBuffer"); |
1528 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, | 1530 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, |
1529 Context::ARRAY_BUFFER_FUN_INDEX); | 1531 Context::ARRAY_BUFFER_FUN_INDEX); |
1530 } | 1532 } |
1531 | 1533 |
1532 { // -- T y p e d A r r a y s | 1534 { // -- T y p e d A r r a y s |
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3628 } | 3630 } |
3629 | 3631 |
3630 | 3632 |
3631 // Called when the top-level V8 mutex is destroyed. | 3633 // Called when the top-level V8 mutex is destroyed. |
3632 void Bootstrapper::FreeThreadResources() { | 3634 void Bootstrapper::FreeThreadResources() { |
3633 DCHECK(!IsActive()); | 3635 DCHECK(!IsActive()); |
3634 } | 3636 } |
3635 | 3637 |
3636 } // namespace internal | 3638 } // namespace internal |
3637 } // namespace v8 | 3639 } // namespace v8 |
OLD | NEW |