| 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 9582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9593 | 9593 |
| 9594 if (result) { | 9594 if (result) { |
| 9595 return *output; | 9595 return *output; |
| 9596 } else { | 9596 } else { |
| 9597 return isolate->heap()->null_value(); | 9597 return isolate->heap()->null_value(); |
| 9598 } | 9598 } |
| 9599 } | 9599 } |
| 9600 | 9600 |
| 9601 | 9601 |
| 9602 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { | 9602 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateLocalTimezone) { |
| 9603 SealHandleScope shs(isolate); | 9603 HandleScope scope(isolate); |
| 9604 ASSERT(args.length() == 1); | 9604 ASSERT(args.length() == 1); |
| 9605 | 9605 |
| 9606 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 9606 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 9607 const char* zone = | 9607 const char* zone = |
| 9608 isolate->date_cache()->LocalTimezone(static_cast<int64_t>(x)); | 9608 isolate->date_cache()->LocalTimezone(static_cast<int64_t>(x)); |
| 9609 return isolate->heap()->AllocateStringFromUtf8(CStrVector(zone)); | 9609 return *isolate->factory()->NewStringFromUtf8(CStrVector(zone)); |
| 9610 } | 9610 } |
| 9611 | 9611 |
| 9612 | 9612 |
| 9613 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { | 9613 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateToUTC) { |
| 9614 HandleScope scope(isolate); | 9614 HandleScope scope(isolate); |
| 9615 ASSERT(args.length() == 1); | 9615 ASSERT(args.length() == 1); |
| 9616 | 9616 |
| 9617 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 9617 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 9618 int64_t time = isolate->date_cache()->ToUTC(static_cast<int64_t>(x)); | 9618 int64_t time = isolate->date_cache()->ToUTC(static_cast<int64_t>(x)); |
| 9619 | 9619 |
| (...skipping 3983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13603 } | 13603 } |
| 13604 return Smi::FromInt(usage); | 13604 return Smi::FromInt(usage); |
| 13605 } | 13605 } |
| 13606 | 13606 |
| 13607 #endif // ENABLE_DEBUGGER_SUPPORT | 13607 #endif // ENABLE_DEBUGGER_SUPPORT |
| 13608 | 13608 |
| 13609 | 13609 |
| 13610 #ifdef V8_I18N_SUPPORT | 13610 #ifdef V8_I18N_SUPPORT |
| 13611 RUNTIME_FUNCTION(MaybeObject*, Runtime_CanonicalizeLanguageTag) { | 13611 RUNTIME_FUNCTION(MaybeObject*, Runtime_CanonicalizeLanguageTag) { |
| 13612 HandleScope scope(isolate); | 13612 HandleScope scope(isolate); |
| 13613 Factory* factory = isolate->factory(); |
| 13613 | 13614 |
| 13614 ASSERT(args.length() == 1); | 13615 ASSERT(args.length() == 1); |
| 13615 CONVERT_ARG_HANDLE_CHECKED(String, locale_id_str, 0); | 13616 CONVERT_ARG_HANDLE_CHECKED(String, locale_id_str, 0); |
| 13616 | 13617 |
| 13617 v8::String::Utf8Value locale_id(v8::Utils::ToLocal(locale_id_str)); | 13618 v8::String::Utf8Value locale_id(v8::Utils::ToLocal(locale_id_str)); |
| 13618 | 13619 |
| 13619 // Return value which denotes invalid language tag. | 13620 // Return value which denotes invalid language tag. |
| 13620 const char* const kInvalidTag = "invalid-tag"; | 13621 const char* const kInvalidTag = "invalid-tag"; |
| 13621 | 13622 |
| 13622 UErrorCode error = U_ZERO_ERROR; | 13623 UErrorCode error = U_ZERO_ERROR; |
| 13623 char icu_result[ULOC_FULLNAME_CAPACITY]; | 13624 char icu_result[ULOC_FULLNAME_CAPACITY]; |
| 13624 int icu_length = 0; | 13625 int icu_length = 0; |
| 13625 | 13626 |
| 13626 uloc_forLanguageTag(*locale_id, icu_result, ULOC_FULLNAME_CAPACITY, | 13627 uloc_forLanguageTag(*locale_id, icu_result, ULOC_FULLNAME_CAPACITY, |
| 13627 &icu_length, &error); | 13628 &icu_length, &error); |
| 13628 if (U_FAILURE(error) || icu_length == 0) { | 13629 if (U_FAILURE(error) || icu_length == 0) { |
| 13629 return isolate->heap()->AllocateStringFromOneByte(CStrVector(kInvalidTag)); | 13630 return *factory->NewStringFromOneByte(OneByteVector(kInvalidTag)); |
| 13630 } | 13631 } |
| 13631 | 13632 |
| 13632 char result[ULOC_FULLNAME_CAPACITY]; | 13633 char result[ULOC_FULLNAME_CAPACITY]; |
| 13633 | 13634 |
| 13634 // Force strict BCP47 rules. | 13635 // Force strict BCP47 rules. |
| 13635 uloc_toLanguageTag(icu_result, result, ULOC_FULLNAME_CAPACITY, TRUE, &error); | 13636 uloc_toLanguageTag(icu_result, result, ULOC_FULLNAME_CAPACITY, TRUE, &error); |
| 13636 | 13637 |
| 13637 if (U_FAILURE(error)) { | 13638 if (U_FAILURE(error)) { |
| 13638 return isolate->heap()->AllocateStringFromOneByte(CStrVector(kInvalidTag)); | 13639 return *factory->NewStringFromOneByte(OneByteVector(kInvalidTag)); |
| 13639 } | 13640 } |
| 13640 | 13641 |
| 13641 return isolate->heap()->AllocateStringFromOneByte(CStrVector(result)); | 13642 return *factory->NewStringFromOneByte(OneByteVector(result)); |
| 13642 } | 13643 } |
| 13643 | 13644 |
| 13644 | 13645 |
| 13645 RUNTIME_FUNCTION(MaybeObject*, Runtime_AvailableLocalesOf) { | 13646 RUNTIME_FUNCTION(MaybeObject*, Runtime_AvailableLocalesOf) { |
| 13646 HandleScope scope(isolate); | 13647 HandleScope scope(isolate); |
| 13647 | 13648 |
| 13648 ASSERT(args.length() == 1); | 13649 ASSERT(args.length() == 1); |
| 13649 CONVERT_ARG_HANDLE_CHECKED(String, service, 0); | 13650 CONVERT_ARG_HANDLE_CHECKED(String, service, 0); |
| 13650 | 13651 |
| 13651 const icu::Locale* available_locales = NULL; | 13652 const icu::Locale* available_locales = NULL; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13683 isolate->factory()->NewStringFromAscii(CStrVector(result)), | 13684 isolate->factory()->NewStringFromAscii(CStrVector(result)), |
| 13684 isolate->factory()->NewNumber(i), | 13685 isolate->factory()->NewNumber(i), |
| 13685 NONE)); | 13686 NONE)); |
| 13686 } | 13687 } |
| 13687 | 13688 |
| 13688 return *locales; | 13689 return *locales; |
| 13689 } | 13690 } |
| 13690 | 13691 |
| 13691 | 13692 |
| 13692 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultICULocale) { | 13693 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultICULocale) { |
| 13693 SealHandleScope shs(isolate); | 13694 HandleScope scope(isolate); |
| 13695 Factory* factory = isolate->factory(); |
| 13694 | 13696 |
| 13695 ASSERT(args.length() == 0); | 13697 ASSERT(args.length() == 0); |
| 13696 | 13698 |
| 13697 icu::Locale default_locale; | 13699 icu::Locale default_locale; |
| 13698 | 13700 |
| 13699 // Set the locale | 13701 // Set the locale |
| 13700 char result[ULOC_FULLNAME_CAPACITY]; | 13702 char result[ULOC_FULLNAME_CAPACITY]; |
| 13701 UErrorCode status = U_ZERO_ERROR; | 13703 UErrorCode status = U_ZERO_ERROR; |
| 13702 uloc_toLanguageTag( | 13704 uloc_toLanguageTag( |
| 13703 default_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); | 13705 default_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); |
| 13704 if (U_SUCCESS(status)) { | 13706 if (U_SUCCESS(status)) { |
| 13705 return isolate->heap()->AllocateStringFromOneByte(CStrVector(result)); | 13707 return *factory->NewStringFromOneByte(OneByteVector(result)); |
| 13706 } | 13708 } |
| 13707 | 13709 |
| 13708 return isolate->heap()->AllocateStringFromOneByte(CStrVector("und")); | 13710 return *factory->NewStringFromOneByte(STATIC_ASCII_VECTOR("und")); |
| 13709 } | 13711 } |
| 13710 | 13712 |
| 13711 | 13713 |
| 13712 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLanguageTagVariants) { | 13714 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLanguageTagVariants) { |
| 13713 HandleScope scope(isolate); | 13715 HandleScope scope(isolate); |
| 13714 | 13716 |
| 13715 ASSERT(args.length() == 1); | 13717 ASSERT(args.length() == 1); |
| 13716 | 13718 |
| 13717 CONVERT_ARG_HANDLE_CHECKED(JSArray, input, 0); | 13719 CONVERT_ARG_HANDLE_CHECKED(JSArray, input, 0); |
| 13718 | 13720 |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14409 Handle<Object> result(error_object->GetHiddenProperty(*key), isolate); | 14411 Handle<Object> result(error_object->GetHiddenProperty(*key), isolate); |
| 14410 if (result->IsTheHole()) return isolate->heap()->undefined_value(); | 14412 if (result->IsTheHole()) return isolate->heap()->undefined_value(); |
| 14411 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); | 14413 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); |
| 14412 JSObject::DeleteHiddenProperty(error_object, key); | 14414 JSObject::DeleteHiddenProperty(error_object, key); |
| 14413 return *result; | 14415 return *result; |
| 14414 } | 14416 } |
| 14415 | 14417 |
| 14416 | 14418 |
| 14417 // Returns V8 version as a string. | 14419 // Returns V8 version as a string. |
| 14418 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) { | 14420 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetV8Version) { |
| 14419 SealHandleScope shs(isolate); | 14421 HandleScope scope(isolate); |
| 14420 ASSERT_EQ(args.length(), 0); | 14422 ASSERT_EQ(args.length(), 0); |
| 14421 | 14423 |
| 14422 const char* version_string = v8::V8::GetVersion(); | 14424 const char* version_string = v8::V8::GetVersion(); |
| 14423 | 14425 |
| 14424 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), | 14426 return *isolate->factory()->NewStringFromOneByte( |
| 14425 NOT_TENURED); | 14427 OneByteVector(version_string), NOT_TENURED); |
| 14426 } | 14428 } |
| 14427 | 14429 |
| 14428 | 14430 |
| 14429 RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { | 14431 RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { |
| 14430 SealHandleScope shs(isolate); | 14432 SealHandleScope shs(isolate); |
| 14431 ASSERT(args.length() == 1); | 14433 ASSERT(args.length() == 1); |
| 14432 CONVERT_SMI_ARG_CHECKED(message_id, 0); | 14434 CONVERT_SMI_ARG_CHECKED(message_id, 0); |
| 14433 const char* message = GetBailoutReason( | 14435 const char* message = GetBailoutReason( |
| 14434 static_cast<BailoutReason>(message_id)); | 14436 static_cast<BailoutReason>(message_id)); |
| 14435 OS::PrintError("abort: %s\n", message); | 14437 OS::PrintError("abort: %s\n", message); |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15081 } | 15083 } |
| 15082 } | 15084 } |
| 15083 | 15085 |
| 15084 | 15086 |
| 15085 void Runtime::OutOfMemory() { | 15087 void Runtime::OutOfMemory() { |
| 15086 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15088 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
| 15087 UNREACHABLE(); | 15089 UNREACHABLE(); |
| 15088 } | 15090 } |
| 15089 | 15091 |
| 15090 } } // namespace v8::internal | 15092 } } // namespace v8::internal |
| OLD | NEW |