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/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 | 1498 |
1499 | 1499 |
1500 #define INSTALL_NATIVE(Type, name, var) \ | 1500 #define INSTALL_NATIVE(Type, name, var) \ |
1501 Handle<String> var##_name = \ | 1501 Handle<String> var##_name = \ |
1502 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR(name)); \ | 1502 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR(name)); \ |
1503 Handle<Object> var##_native = \ | 1503 Handle<Object> var##_native = \ |
1504 Object::GetProperty(handle(native_context()->builtins()), var##_name) \ | 1504 Object::GetProperty(handle(native_context()->builtins()), var##_name) \ |
1505 .ToHandleChecked(); \ | 1505 .ToHandleChecked(); \ |
1506 native_context()->set_##var(Type::cast(*var##_native)); | 1506 native_context()->set_##var(Type::cast(*var##_native)); |
1507 | 1507 |
1508 #define INSTALL_NATIVE_MATH(name) \ | |
1509 { \ | |
1510 Handle<Object> fun = \ | |
1511 ResolveBuiltinIdHolder(native_context(), "Math." #name); \ | |
1512 native_context()->set_math_##name##_fun(JSFunction::cast(*fun)); \ | |
1513 } | |
1514 | 1508 |
1515 void Genesis::InstallNativeFunctions() { | 1509 void Genesis::InstallNativeFunctions() { |
1516 HandleScope scope(isolate()); | 1510 HandleScope scope(isolate()); |
1517 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); | 1511 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); |
1518 | 1512 |
1519 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); | 1513 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); |
1520 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); | 1514 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); |
1521 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); | 1515 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); |
1522 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); | 1516 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); |
1523 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); | 1517 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); |
(...skipping 26 matching lines...) Expand all Loading... |
1550 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", | 1544 INSTALL_NATIVE(JSFunction, "NativeObjectObserve", |
1551 native_object_observe); | 1545 native_object_observe); |
1552 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", | 1546 INSTALL_NATIVE(JSFunction, "NativeObjectGetNotifier", |
1553 native_object_get_notifier); | 1547 native_object_get_notifier); |
1554 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", | 1548 INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange", |
1555 native_object_notifier_perform_change); | 1549 native_object_notifier_perform_change); |
1556 | 1550 |
1557 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); | 1551 INSTALL_NATIVE(Symbol, "symbolIterator", iterator_symbol); |
1558 INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol); | 1552 INSTALL_NATIVE(Symbol, "symbolUnscopables", unscopables_symbol); |
1559 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); | 1553 INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator); |
1560 | |
1561 INSTALL_NATIVE_MATH(abs) | |
1562 INSTALL_NATIVE_MATH(acos) | |
1563 INSTALL_NATIVE_MATH(asin) | |
1564 INSTALL_NATIVE_MATH(atan) | |
1565 INSTALL_NATIVE_MATH(atan2) | |
1566 INSTALL_NATIVE_MATH(ceil) | |
1567 INSTALL_NATIVE_MATH(cos) | |
1568 INSTALL_NATIVE_MATH(exp) | |
1569 INSTALL_NATIVE_MATH(floor) | |
1570 INSTALL_NATIVE_MATH(imul) | |
1571 INSTALL_NATIVE_MATH(log) | |
1572 INSTALL_NATIVE_MATH(max) | |
1573 INSTALL_NATIVE_MATH(min) | |
1574 INSTALL_NATIVE_MATH(pow) | |
1575 INSTALL_NATIVE_MATH(random) | |
1576 INSTALL_NATIVE_MATH(round) | |
1577 INSTALL_NATIVE_MATH(sin) | |
1578 INSTALL_NATIVE_MATH(sqrt) | |
1579 INSTALL_NATIVE_MATH(tan) | |
1580 } | 1554 } |
1581 | 1555 |
1582 | 1556 |
1583 void Genesis::InstallExperimentalNativeFunctions() { | 1557 void Genesis::InstallExperimentalNativeFunctions() { |
1584 if (FLAG_harmony_proxies) { | 1558 if (FLAG_harmony_proxies) { |
1585 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1559 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
1586 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1560 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
1587 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1561 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
1588 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1562 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
1589 } | 1563 } |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2739 return from + sizeof(NestingCounterType); | 2713 return from + sizeof(NestingCounterType); |
2740 } | 2714 } |
2741 | 2715 |
2742 | 2716 |
2743 // Called when the top-level V8 mutex is destroyed. | 2717 // Called when the top-level V8 mutex is destroyed. |
2744 void Bootstrapper::FreeThreadResources() { | 2718 void Bootstrapper::FreeThreadResources() { |
2745 DCHECK(!IsActive()); | 2719 DCHECK(!IsActive()); |
2746 } | 2720 } |
2747 | 2721 |
2748 } } // namespace v8::internal | 2722 } } // namespace v8::internal |
OLD | NEW |