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 13735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13746 | 13746 |
13747 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { | 13747 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { |
13748 HandleScope scope(isolate); | 13748 HandleScope scope(isolate); |
13749 | 13749 |
13750 ASSERT(args.length() == 2); | 13750 ASSERT(args.length() == 2); |
13751 | 13751 |
13752 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); | 13752 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); |
13753 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1); | 13753 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1); |
13754 | 13754 |
13755 bool has_pending_exception = false; | 13755 bool has_pending_exception = false; |
13756 double value = Execution::ToNumber(number, &has_pending_exception)->Number(); | 13756 Handle<Object> value = Execution::ToNumber(number, &has_pending_exception); |
13757 if (has_pending_exception) { | 13757 if (has_pending_exception) { |
13758 ASSERT(isolate->has_pending_exception()); | 13758 ASSERT(isolate->has_pending_exception()); |
13759 return Failure::Exception(); | 13759 return Failure::Exception(); |
13760 } | 13760 } |
13761 | 13761 |
13762 icu::DecimalFormat* number_format = | 13762 icu::DecimalFormat* number_format = |
13763 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); | 13763 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); |
13764 if (!number_format) return isolate->ThrowIllegalOperation(); | 13764 if (!number_format) return isolate->ThrowIllegalOperation(); |
13765 | 13765 |
13766 icu::UnicodeString result; | 13766 icu::UnicodeString result; |
13767 number_format->format(value, result); | 13767 number_format->format(value->Number(), result); |
13768 | 13768 |
13769 return *isolate->factory()->NewStringFromTwoByte( | 13769 return *isolate->factory()->NewStringFromTwoByte( |
13770 Vector<const uint16_t>( | 13770 Vector<const uint16_t>( |
13771 reinterpret_cast<const uint16_t*>(result.getBuffer()), | 13771 reinterpret_cast<const uint16_t*>(result.getBuffer()), |
13772 result.length())); | 13772 result.length())); |
13773 } | 13773 } |
13774 | 13774 |
13775 | 13775 |
13776 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberParse) { | 13776 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberParse) { |
13777 HandleScope scope(isolate); | 13777 HandleScope scope(isolate); |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14491 // Handle last resort GC and make sure to allow future allocations | 14491 // Handle last resort GC and make sure to allow future allocations |
14492 // to grow the heap without causing GCs (if possible). | 14492 // to grow the heap without causing GCs (if possible). |
14493 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14493 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14494 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14494 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14495 "Runtime::PerformGC"); | 14495 "Runtime::PerformGC"); |
14496 } | 14496 } |
14497 } | 14497 } |
14498 | 14498 |
14499 | 14499 |
14500 } } // namespace v8::internal | 14500 } } // namespace v8::internal |
OLD | NEW |