| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 Handle<Object> name(args[0], isolate); | 626 Handle<Object> name(args[0], isolate); |
| 627 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); | 627 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
| 628 Symbol* symbol; | 628 Symbol* symbol; |
| 629 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); | 629 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); |
| 630 if (!maybe->To(&symbol)) return maybe; | 630 if (!maybe->To(&symbol)) return maybe; |
| 631 if (name->IsString()) symbol->set_name(*name); | 631 if (name->IsString()) symbol->set_name(*name); |
| 632 return symbol; | 632 return symbol; |
| 633 } | 633 } |
| 634 | 634 |
| 635 | 635 |
| 636 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewSymbolWrapper) { | 636 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) { |
| 637 ASSERT(args.length() == 1); | |
| 638 CONVERT_ARG_CHECKED(Symbol, symbol, 0); | |
| 639 return symbol->ToObject(isolate); | |
| 640 } | |
| 641 | |
| 642 | |
| 643 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolDescription) { | |
| 644 SealHandleScope shs(isolate); | 637 SealHandleScope shs(isolate); |
| 645 ASSERT(args.length() == 1); | 638 ASSERT(args.length() == 1); |
| 646 CONVERT_ARG_CHECKED(Symbol, symbol, 0); | 639 CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
| 647 return symbol->name(); | 640 return symbol->name(); |
| 648 } | 641 } |
| 649 | 642 |
| 650 | 643 |
| 651 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { | 644 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { |
| 652 SealHandleScope shs(isolate); | 645 SealHandleScope shs(isolate); |
| 653 ASSERT(args.length() == 1); | 646 ASSERT(args.length() == 1); |
| (...skipping 5887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6541 args, isolate, isolate->runtime_state()->to_lower_mapping()); | 6534 args, isolate, isolate->runtime_state()->to_lower_mapping()); |
| 6542 } | 6535 } |
| 6543 | 6536 |
| 6544 | 6537 |
| 6545 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToUpperCase) { | 6538 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToUpperCase) { |
| 6546 return ConvertCase( | 6539 return ConvertCase( |
| 6547 args, isolate, isolate->runtime_state()->to_upper_mapping()); | 6540 args, isolate, isolate->runtime_state()->to_upper_mapping()); |
| 6548 } | 6541 } |
| 6549 | 6542 |
| 6550 | 6543 |
| 6544 static inline bool IsTrimWhiteSpace(unibrow::uchar c) { |
| 6545 return unibrow::WhiteSpace::Is(c) || c == 0x200b || c == 0xfeff; |
| 6546 } |
| 6547 |
| 6548 |
| 6551 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) { | 6549 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) { |
| 6552 HandleScope scope(isolate); | 6550 HandleScope scope(isolate); |
| 6553 ASSERT(args.length() == 3); | 6551 ASSERT(args.length() == 3); |
| 6554 | 6552 |
| 6555 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); | 6553 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); |
| 6556 CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1); | 6554 CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1); |
| 6557 CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2); | 6555 CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2); |
| 6558 | 6556 |
| 6559 string = FlattenGetString(string); | 6557 string = FlattenGetString(string); |
| 6560 int length = string->length(); | 6558 int length = string->length(); |
| 6561 | 6559 |
| 6562 int left = 0; | 6560 int left = 0; |
| 6563 UnicodeCache* unicode_cache = isolate->unicode_cache(); | |
| 6564 if (trimLeft) { | 6561 if (trimLeft) { |
| 6565 while (left < length && | 6562 while (left < length && IsTrimWhiteSpace(string->Get(left))) { |
| 6566 unicode_cache->IsWhiteSpaceOrLineTerminator(string->Get(left))) { | |
| 6567 left++; | 6563 left++; |
| 6568 } | 6564 } |
| 6569 } | 6565 } |
| 6570 | 6566 |
| 6571 int right = length; | 6567 int right = length; |
| 6572 if (trimRight) { | 6568 if (trimRight) { |
| 6573 while (right > left && | 6569 while (right > left && IsTrimWhiteSpace(string->Get(right - 1))) { |
| 6574 unicode_cache->IsWhiteSpaceOrLineTerminator( | |
| 6575 string->Get(right - 1))) { | |
| 6576 right--; | 6570 right--; |
| 6577 } | 6571 } |
| 6578 } | 6572 } |
| 6579 | 6573 |
| 6580 return *isolate->factory()->NewSubString(string, left, right); | 6574 return *isolate->factory()->NewSubString(string, left, right); |
| 6581 } | 6575 } |
| 6582 | 6576 |
| 6583 | 6577 |
| 6584 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) { | 6578 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) { |
| 6585 HandleScope handle_scope(isolate); | 6579 HandleScope handle_scope(isolate); |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7647 } | 7641 } |
| 7648 { MaybeObject* maybe_obj = isolate->heap()->PrepareForCompare(y); | 7642 { MaybeObject* maybe_obj = isolate->heap()->PrepareForCompare(y); |
| 7649 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 7643 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 7650 } | 7644 } |
| 7651 | 7645 |
| 7652 return (x->IsFlat() && y->IsFlat()) ? FlatStringCompare(x, y) | 7646 return (x->IsFlat() && y->IsFlat()) ? FlatStringCompare(x, y) |
| 7653 : StringCharacterStreamCompare(isolate->runtime_state(), x, y); | 7647 : StringCharacterStreamCompare(isolate->runtime_state(), x, y); |
| 7654 } | 7648 } |
| 7655 | 7649 |
| 7656 | 7650 |
| 7657 #define RUNTIME_UNARY_MATH(NAME) \ | 7651 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_acos) { |
| 7658 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_##NAME) { \ | 7652 SealHandleScope shs(isolate); |
| 7659 SealHandleScope shs(isolate); \ | 7653 ASSERT(args.length() == 1); |
| 7660 ASSERT(args.length() == 1); \ | 7654 isolate->counters()->math_acos()->Increment(); |
| 7661 isolate->counters()->math_##NAME()->Increment(); \ | |
| 7662 CONVERT_DOUBLE_ARG_CHECKED(x, 0); \ | |
| 7663 return isolate->heap()->AllocateHeapNumber(std::NAME(x)); \ | |
| 7664 } | |
| 7665 | 7655 |
| 7666 RUNTIME_UNARY_MATH(acos) | 7656 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7667 RUNTIME_UNARY_MATH(asin) | 7657 return isolate->heap()->AllocateHeapNumber(std::acos(x)); |
| 7668 RUNTIME_UNARY_MATH(atan) | |
| 7669 RUNTIME_UNARY_MATH(log) | |
| 7670 #undef RUNTIME_UNARY_MATH | |
| 7671 | |
| 7672 | |
| 7673 // Cube root approximation, refer to: http://metamerist.com/cbrt/cbrt.htm | |
| 7674 // Using initial approximation adapted from Kahan's cbrt and 4 iterations | |
| 7675 // of Newton's method. | |
| 7676 inline double CubeRootNewtonIteration(double approx, double x) { | |
| 7677 return (1.0 / 3.0) * (x / (approx * approx) + 2 * approx); | |
| 7678 } | 7658 } |
| 7679 | 7659 |
| 7680 | 7660 |
| 7681 inline double CubeRoot(double x) { | 7661 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_asin) { |
| 7682 static const uint64_t magic = V8_2PART_UINT64_C(0x2A9F7893, 00000000); | 7662 SealHandleScope shs(isolate); |
| 7683 uint64_t xhigh = double_to_uint64(x); | 7663 ASSERT(args.length() == 1); |
| 7684 double approx = uint64_to_double(xhigh / 3 + magic); | 7664 isolate->counters()->math_asin()->Increment(); |
| 7685 | 7665 |
| 7686 approx = CubeRootNewtonIteration(approx, x); | 7666 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7687 approx = CubeRootNewtonIteration(approx, x); | 7667 return isolate->heap()->AllocateHeapNumber(std::asin(x)); |
| 7688 approx = CubeRootNewtonIteration(approx, x); | |
| 7689 return CubeRootNewtonIteration(approx, x); | |
| 7690 } | 7668 } |
| 7691 | 7669 |
| 7692 | 7670 |
| 7693 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_cbrt) { | 7671 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan) { |
| 7694 SealHandleScope shs(isolate); | 7672 SealHandleScope shs(isolate); |
| 7695 ASSERT(args.length() == 1); | 7673 ASSERT(args.length() == 1); |
| 7674 isolate->counters()->math_atan()->Increment(); |
| 7675 |
| 7696 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7676 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7697 if (x == 0 || std::isinf(x)) return args[0]; | 7677 return isolate->heap()->AllocateHeapNumber(std::atan(x)); |
| 7698 double result = (x > 0) ? CubeRoot(x) : -CubeRoot(-x); | |
| 7699 return isolate->heap()->AllocateHeapNumber(result); | |
| 7700 } | 7678 } |
| 7701 | 7679 |
| 7702 | 7680 |
| 7703 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_log1p) { | |
| 7704 SealHandleScope shs(isolate); | |
| 7705 ASSERT(args.length() == 1); | |
| 7706 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | |
| 7707 | |
| 7708 double x_abs = std::fabs(x); | |
| 7709 // Use Taylor series to approximate. With y = x + 1; | |
| 7710 // log(y) at 1 == log(1) + log'(1)(y-1)/1! + log''(1)(y-1)^2/2! + ... | |
| 7711 // == 0 + x - x^2/2 + x^3/3 ... | |
| 7712 // The closer x is to 0, the fewer terms are required. | |
| 7713 static const double threshold_2 = 1.0 / 0x00800000; | |
| 7714 static const double threshold_3 = 1.0 / 0x00008000; | |
| 7715 static const double threshold_7 = 1.0 / 0x00000080; | |
| 7716 | |
| 7717 double result; | |
| 7718 if (x_abs < threshold_2) { | |
| 7719 result = x * (1.0/1.0 - x * 1.0/2.0); | |
| 7720 } else if (x_abs < threshold_3) { | |
| 7721 result = x * (1.0/1.0 - x * (1.0/2.0 - x * (1.0/3.0))); | |
| 7722 } else if (x_abs < threshold_7) { | |
| 7723 result = x * (1.0/1.0 - x * (1.0/2.0 - x * ( | |
| 7724 1.0/3.0 - x * (1.0/4.0 - x * ( | |
| 7725 1.0/5.0 - x * (1.0/6.0 - x * ( | |
| 7726 1.0/7.0))))))); | |
| 7727 } else { // Use regular log if not close enough to 0. | |
| 7728 result = std::log(1.0 + x); | |
| 7729 } | |
| 7730 return isolate->heap()->AllocateHeapNumber(result); | |
| 7731 } | |
| 7732 | |
| 7733 | |
| 7734 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_expm1) { | |
| 7735 SealHandleScope shs(isolate); | |
| 7736 ASSERT(args.length() == 1); | |
| 7737 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | |
| 7738 | |
| 7739 double x_abs = std::fabs(x); | |
| 7740 // Use Taylor series to approximate. | |
| 7741 // exp(x) - 1 at 0 == -1 + exp(0) + exp'(0)*x/1! + exp''(0)*x^2/2! + ... | |
| 7742 // == x/1! + x^2/2! + x^3/3! + ... | |
| 7743 // The closer x is to 0, the fewer terms are required. | |
| 7744 static const double threshold_2 = 1.0 / 0x00400000; | |
| 7745 static const double threshold_3 = 1.0 / 0x00004000; | |
| 7746 static const double threshold_6 = 1.0 / 0x00000040; | |
| 7747 | |
| 7748 double result; | |
| 7749 if (x_abs < threshold_2) { | |
| 7750 result = x * (1.0/1.0 + x * (1.0/2.0)); | |
| 7751 } else if (x_abs < threshold_3) { | |
| 7752 result = x * (1.0/1.0 + x * (1.0/2.0 + x * (1.0/6.0))); | |
| 7753 } else if (x_abs < threshold_6) { | |
| 7754 result = x * (1.0/1.0 + x * (1.0/2.0 + x * ( | |
| 7755 1.0/6.0 + x * (1.0/24.0 + x * ( | |
| 7756 1.0/120.0 + x * (1.0/720.0)))))); | |
| 7757 } else { // Use regular exp if not close enough to 0. | |
| 7758 result = std::exp(x) - 1.0; | |
| 7759 } | |
| 7760 return isolate->heap()->AllocateHeapNumber(result); | |
| 7761 } | |
| 7762 | |
| 7763 | |
| 7764 static const double kPiDividedBy4 = 0.78539816339744830962; | 7681 static const double kPiDividedBy4 = 0.78539816339744830962; |
| 7765 | 7682 |
| 7766 | 7683 |
| 7767 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) { | 7684 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) { |
| 7768 SealHandleScope shs(isolate); | 7685 SealHandleScope shs(isolate); |
| 7769 ASSERT(args.length() == 2); | 7686 ASSERT(args.length() == 2); |
| 7770 isolate->counters()->math_atan2()->Increment(); | 7687 isolate->counters()->math_atan2()->Increment(); |
| 7771 | 7688 |
| 7772 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7689 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7773 CONVERT_DOUBLE_ARG_CHECKED(y, 1); | 7690 CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 7801 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_floor) { | 7718 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_floor) { |
| 7802 SealHandleScope shs(isolate); | 7719 SealHandleScope shs(isolate); |
| 7803 ASSERT(args.length() == 1); | 7720 ASSERT(args.length() == 1); |
| 7804 isolate->counters()->math_floor()->Increment(); | 7721 isolate->counters()->math_floor()->Increment(); |
| 7805 | 7722 |
| 7806 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7723 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7807 return isolate->heap()->NumberFromDouble(std::floor(x)); | 7724 return isolate->heap()->NumberFromDouble(std::floor(x)); |
| 7808 } | 7725 } |
| 7809 | 7726 |
| 7810 | 7727 |
| 7728 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_log) { |
| 7729 SealHandleScope shs(isolate); |
| 7730 ASSERT(args.length() == 1); |
| 7731 isolate->counters()->math_log()->Increment(); |
| 7732 |
| 7733 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7734 return isolate->heap()->AllocateHeapNumber(std::log(x)); |
| 7735 } |
| 7736 |
| 7737 |
| 7811 // Slow version of Math.pow. We check for fast paths for special cases. | 7738 // Slow version of Math.pow. We check for fast paths for special cases. |
| 7812 // Used if SSE2/VFP3 is not available. | 7739 // Used if SSE2/VFP3 is not available. |
| 7813 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) { | 7740 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) { |
| 7814 SealHandleScope shs(isolate); | 7741 SealHandleScope shs(isolate); |
| 7815 ASSERT(args.length() == 2); | 7742 ASSERT(args.length() == 2); |
| 7816 isolate->counters()->math_pow()->Increment(); | 7743 isolate->counters()->math_pow()->Increment(); |
| 7817 | 7744 |
| 7818 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7745 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7819 | 7746 |
| 7820 // If the second argument is a smi, it is much faster to call the | 7747 // If the second argument is a smi, it is much faster to call the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7896 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) { | 7823 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) { |
| 7897 SealHandleScope shs(isolate); | 7824 SealHandleScope shs(isolate); |
| 7898 ASSERT(args.length() == 1); | 7825 ASSERT(args.length() == 1); |
| 7899 isolate->counters()->math_sqrt()->Increment(); | 7826 isolate->counters()->math_sqrt()->Increment(); |
| 7900 | 7827 |
| 7901 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7828 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7902 return isolate->heap()->AllocateHeapNumber(fast_sqrt(x)); | 7829 return isolate->heap()->AllocateHeapNumber(fast_sqrt(x)); |
| 7903 } | 7830 } |
| 7904 | 7831 |
| 7905 | 7832 |
| 7906 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_fround) { | |
| 7907 SealHandleScope shs(isolate); | |
| 7908 ASSERT(args.length() == 1); | |
| 7909 | |
| 7910 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | |
| 7911 float xf = static_cast<float>(x); | |
| 7912 return isolate->heap()->AllocateHeapNumber(xf); | |
| 7913 } | |
| 7914 | |
| 7915 | |
| 7916 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { | 7833 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { |
| 7917 SealHandleScope shs(isolate); | 7834 SealHandleScope shs(isolate); |
| 7918 ASSERT(args.length() == 2); | 7835 ASSERT(args.length() == 2); |
| 7919 | 7836 |
| 7920 CONVERT_SMI_ARG_CHECKED(year, 0); | 7837 CONVERT_SMI_ARG_CHECKED(year, 0); |
| 7921 CONVERT_SMI_ARG_CHECKED(month, 1); | 7838 CONVERT_SMI_ARG_CHECKED(month, 1); |
| 7922 | 7839 |
| 7923 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); | 7840 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); |
| 7924 } | 7841 } |
| 7925 | 7842 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8551 } | 8468 } |
| 8552 | 8469 |
| 8553 | 8470 |
| 8554 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearFunctionTypeFeedback) { | 8471 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearFunctionTypeFeedback) { |
| 8555 HandleScope scope(isolate); | 8472 HandleScope scope(isolate); |
| 8556 ASSERT(args.length() == 1); | 8473 ASSERT(args.length() == 1); |
| 8557 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8474 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8558 Code* unoptimized = function->shared()->code(); | 8475 Code* unoptimized = function->shared()->code(); |
| 8559 if (unoptimized->kind() == Code::FUNCTION) { | 8476 if (unoptimized->kind() == Code::FUNCTION) { |
| 8560 unoptimized->ClearInlineCaches(); | 8477 unoptimized->ClearInlineCaches(); |
| 8561 unoptimized->ClearTypeFeedbackInfo(isolate->heap()); | 8478 unoptimized->ClearTypeFeedbackCells(isolate->heap()); |
| 8562 } | 8479 } |
| 8563 return isolate->heap()->undefined_value(); | 8480 return isolate->heap()->undefined_value(); |
| 8564 } | 8481 } |
| 8565 | 8482 |
| 8566 | 8483 |
| 8567 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) { | 8484 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) { |
| 8568 SealHandleScope shs(isolate); | 8485 SealHandleScope shs(isolate); |
| 8569 #if defined(USE_SIMULATOR) | 8486 #if defined(USE_SIMULATOR) |
| 8570 return isolate->heap()->true_value(); | 8487 return isolate->heap()->true_value(); |
| 8571 #else | 8488 #else |
| (...skipping 5770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14342 | 14259 |
| 14343 const char* version_string = v8::V8::GetVersion(); | 14260 const char* version_string = v8::V8::GetVersion(); |
| 14344 | 14261 |
| 14345 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), | 14262 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), |
| 14346 NOT_TENURED); | 14263 NOT_TENURED); |
| 14347 } | 14264 } |
| 14348 | 14265 |
| 14349 | 14266 |
| 14350 RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { | 14267 RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { |
| 14351 SealHandleScope shs(isolate); | 14268 SealHandleScope shs(isolate); |
| 14352 ASSERT(args.length() == 1); | 14269 ASSERT(args.length() == 2); |
| 14353 CONVERT_SMI_ARG_CHECKED(message_id, 0); | 14270 OS::PrintError("abort: %s\n", |
| 14354 const char* message = GetBailoutReason( | 14271 reinterpret_cast<char*>(args[0]) + args.smi_at(1)); |
| 14355 static_cast<BailoutReason>(message_id)); | |
| 14356 OS::PrintError("abort: %s\n", message); | |
| 14357 isolate->PrintStack(stderr); | 14272 isolate->PrintStack(stderr); |
| 14358 OS::Abort(); | 14273 OS::Abort(); |
| 14359 UNREACHABLE(); | 14274 UNREACHABLE(); |
| 14360 return NULL; | 14275 return NULL; |
| 14361 } | 14276 } |
| 14362 | 14277 |
| 14363 | 14278 |
| 14364 RUNTIME_FUNCTION(MaybeObject*, Runtime_AbortJS) { | 14279 RUNTIME_FUNCTION(MaybeObject*, Runtime_AbortJS) { |
| 14365 HandleScope scope(isolate); | 14280 HandleScope scope(isolate); |
| 14366 ASSERT(args.length() == 1); | 14281 ASSERT(args.length() == 1); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14675 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetMicrotaskPending) { | 14590 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetMicrotaskPending) { |
| 14676 SealHandleScope shs(isolate); | 14591 SealHandleScope shs(isolate); |
| 14677 ASSERT(args.length() == 1); | 14592 ASSERT(args.length() == 1); |
| 14678 CONVERT_BOOLEAN_ARG_CHECKED(new_state, 0); | 14593 CONVERT_BOOLEAN_ARG_CHECKED(new_state, 0); |
| 14679 bool old_state = isolate->microtask_pending(); | 14594 bool old_state = isolate->microtask_pending(); |
| 14680 isolate->set_microtask_pending(new_state); | 14595 isolate->set_microtask_pending(new_state); |
| 14681 return isolate->heap()->ToBoolean(old_state); | 14596 return isolate->heap()->ToBoolean(old_state); |
| 14682 } | 14597 } |
| 14683 | 14598 |
| 14684 | 14599 |
| 14685 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunMicrotasks) { | |
| 14686 HandleScope scope(isolate); | |
| 14687 ASSERT(args.length() == 0); | |
| 14688 Execution::RunMicrotasks(isolate); | |
| 14689 return isolate->heap()->undefined_value(); | |
| 14690 } | |
| 14691 | |
| 14692 | |
| 14693 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetMicrotaskState) { | |
| 14694 SealHandleScope shs(isolate); | |
| 14695 ASSERT(args.length() == 0); | |
| 14696 return isolate->heap()->microtask_state(); | |
| 14697 } | |
| 14698 | |
| 14699 | |
| 14700 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) { | 14600 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) { |
| 14701 SealHandleScope shs(isolate); | 14601 SealHandleScope shs(isolate); |
| 14702 ASSERT(args.length() == 0); | 14602 ASSERT(args.length() == 0); |
| 14703 return isolate->heap()->observation_state(); | 14603 return isolate->heap()->observation_state(); |
| 14704 } | 14604 } |
| 14705 | 14605 |
| 14706 | 14606 |
| 14707 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObservationWeakMapCreate) { | 14607 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObservationWeakMapCreate) { |
| 14708 HandleScope scope(isolate); | 14608 HandleScope scope(isolate); |
| 14709 ASSERT(args.length() == 0); | 14609 ASSERT(args.length() == 0); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14965 // Handle last resort GC and make sure to allow future allocations | 14865 // Handle last resort GC and make sure to allow future allocations |
| 14966 // to grow the heap without causing GCs (if possible). | 14866 // to grow the heap without causing GCs (if possible). |
| 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14867 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14868 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14969 "Runtime::PerformGC"); | 14869 "Runtime::PerformGC"); |
| 14970 } | 14870 } |
| 14971 } | 14871 } |
| 14972 | 14872 |
| 14973 | 14873 |
| 14974 } } // namespace v8::internal | 14874 } } // namespace v8::internal |
| OLD | NEW |