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 13703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13714 | 13714 |
13715 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { | 13715 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { |
13716 HandleScope scope(isolate); | 13716 HandleScope scope(isolate); |
13717 | 13717 |
13718 ASSERT(args.length() == 2); | 13718 ASSERT(args.length() == 2); |
13719 | 13719 |
13720 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); | 13720 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); |
13721 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1); | 13721 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1); |
13722 | 13722 |
13723 bool has_pending_exception = false; | 13723 bool has_pending_exception = false; |
13724 Handle<Object> value = Execution::ToNumber(date, &has_pending_exception); | 13724 Handle<Object> value = |
| 13725 Execution::ToNumber(isolate, date, &has_pending_exception); |
13725 if (has_pending_exception) { | 13726 if (has_pending_exception) { |
13726 ASSERT(isolate->has_pending_exception()); | 13727 ASSERT(isolate->has_pending_exception()); |
13727 return Failure::Exception(); | 13728 return Failure::Exception(); |
13728 } | 13729 } |
13729 | 13730 |
13730 icu::SimpleDateFormat* date_format = | 13731 icu::SimpleDateFormat* date_format = |
13731 DateFormat::UnpackDateFormat(isolate, date_format_holder); | 13732 DateFormat::UnpackDateFormat(isolate, date_format_holder); |
13732 if (!date_format) return isolate->ThrowIllegalOperation(); | 13733 if (!date_format) return isolate->ThrowIllegalOperation(); |
13733 | 13734 |
13734 icu::UnicodeString result; | 13735 icu::UnicodeString result; |
(...skipping 19 matching lines...) Expand all Loading... |
13754 icu::SimpleDateFormat* date_format = | 13755 icu::SimpleDateFormat* date_format = |
13755 DateFormat::UnpackDateFormat(isolate, date_format_holder); | 13756 DateFormat::UnpackDateFormat(isolate, date_format_holder); |
13756 if (!date_format) return isolate->ThrowIllegalOperation(); | 13757 if (!date_format) return isolate->ThrowIllegalOperation(); |
13757 | 13758 |
13758 UErrorCode status = U_ZERO_ERROR; | 13759 UErrorCode status = U_ZERO_ERROR; |
13759 UDate date = date_format->parse(u_date, status); | 13760 UDate date = date_format->parse(u_date, status); |
13760 if (U_FAILURE(status)) return isolate->heap()->undefined_value(); | 13761 if (U_FAILURE(status)) return isolate->heap()->undefined_value(); |
13761 | 13762 |
13762 bool has_pending_exception = false; | 13763 bool has_pending_exception = false; |
13763 Handle<JSDate> result = Handle<JSDate>::cast( | 13764 Handle<JSDate> result = Handle<JSDate>::cast( |
13764 Execution::NewDate(static_cast<double>(date), &has_pending_exception)); | 13765 Execution::NewDate( |
| 13766 isolate, static_cast<double>(date), &has_pending_exception)); |
13765 if (has_pending_exception) { | 13767 if (has_pending_exception) { |
13766 ASSERT(isolate->has_pending_exception()); | 13768 ASSERT(isolate->has_pending_exception()); |
13767 return Failure::Exception(); | 13769 return Failure::Exception(); |
13768 } | 13770 } |
13769 return *result; | 13771 return *result; |
13770 } | 13772 } |
13771 | 13773 |
13772 | 13774 |
13773 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateNumberFormat) { | 13775 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateNumberFormat) { |
13774 HandleScope scope(isolate); | 13776 HandleScope scope(isolate); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13816 | 13818 |
13817 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { | 13819 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { |
13818 HandleScope scope(isolate); | 13820 HandleScope scope(isolate); |
13819 | 13821 |
13820 ASSERT(args.length() == 2); | 13822 ASSERT(args.length() == 2); |
13821 | 13823 |
13822 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); | 13824 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); |
13823 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1); | 13825 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1); |
13824 | 13826 |
13825 bool has_pending_exception = false; | 13827 bool has_pending_exception = false; |
13826 Handle<Object> value = Execution::ToNumber(number, &has_pending_exception); | 13828 Handle<Object> value = Execution::ToNumber( |
| 13829 isolate, number, &has_pending_exception); |
13827 if (has_pending_exception) { | 13830 if (has_pending_exception) { |
13828 ASSERT(isolate->has_pending_exception()); | 13831 ASSERT(isolate->has_pending_exception()); |
13829 return Failure::Exception(); | 13832 return Failure::Exception(); |
13830 } | 13833 } |
13831 | 13834 |
13832 icu::DecimalFormat* number_format = | 13835 icu::DecimalFormat* number_format = |
13833 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); | 13836 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); |
13834 if (!number_format) return isolate->ThrowIllegalOperation(); | 13837 if (!number_format) return isolate->ThrowIllegalOperation(); |
13835 | 13838 |
13836 icu::UnicodeString result; | 13839 icu::UnicodeString result; |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14720 // Handle last resort GC and make sure to allow future allocations | 14723 // Handle last resort GC and make sure to allow future allocations |
14721 // to grow the heap without causing GCs (if possible). | 14724 // to grow the heap without causing GCs (if possible). |
14722 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14725 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14723 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14726 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14724 "Runtime::PerformGC"); | 14727 "Runtime::PerformGC"); |
14725 } | 14728 } |
14726 } | 14729 } |
14727 | 14730 |
14728 | 14731 |
14729 } } // namespace v8::internal | 14732 } } // namespace v8::internal |
OLD | NEW |