Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Side by Side Diff: src/runtime.cc

Issue 62563002: Revert "Landing https://codereview.chromium.org/40133004 for mnita@google.com." due to test failure… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | test/intl/string/normalization.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14015 matching lines...) Expand 10 before | Expand all | Expand 10 after
14026 string_value1.length(), 14026 string_value1.length(),
14027 u_string2, 14027 u_string2,
14028 string_value2.length(), 14028 string_value2.length(),
14029 status); 14029 status);
14030 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); 14030 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation();
14031 14031
14032 return *isolate->factory()->NewNumberFromInt(result); 14032 return *isolate->factory()->NewNumberFromInt(result);
14033 } 14033 }
14034 14034
14035 14035
14036 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringNormalize) {
14037 HandleScope scope(isolate);
14038 static const UNormalizationMode normalizationForms[] =
14039 { UNORM_NFC, UNORM_NFD, UNORM_NFKC, UNORM_NFKD };
14040
14041 ASSERT(args.length() == 2);
14042
14043 CONVERT_ARG_HANDLE_CHECKED(String, stringValue, 0);
14044 CONVERT_NUMBER_CHECKED(int, form_id, Int32, args[1]);
14045
14046 v8::String::Value string_value(v8::Utils::ToLocal(stringValue));
14047 const UChar* u_value = reinterpret_cast<const UChar*>(*string_value);
14048
14049 // TODO(mnita): check Normalizer2 (not available in ICU 46)
14050 UErrorCode status = U_ZERO_ERROR;
14051 icu::UnicodeString result;
14052 icu::Normalizer::normalize(u_value, normalizationForms[form_id], 0,
14053 result, status);
14054 if (U_FAILURE(status)) {
14055 return isolate->heap()->undefined_value();
14056 }
14057
14058 return *isolate->factory()->NewStringFromTwoByte(
14059 Vector<const uint16_t>(
14060 reinterpret_cast<const uint16_t*>(result.getBuffer()),
14061 result.length()));
14062 }
14063
14064
14065 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateBreakIterator) { 14036 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateBreakIterator) {
14066 HandleScope scope(isolate); 14037 HandleScope scope(isolate);
14067 14038
14068 ASSERT(args.length() == 3); 14039 ASSERT(args.length() == 3);
14069 14040
14070 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); 14041 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0);
14071 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); 14042 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1);
14072 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); 14043 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
14073 14044
14074 Handle<ObjectTemplateInfo> break_iterator_template = 14045 Handle<ObjectTemplateInfo> break_iterator_template =
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
14865 // Handle last resort GC and make sure to allow future allocations 14836 // Handle last resort GC and make sure to allow future allocations
14866 // to grow the heap without causing GCs (if possible). 14837 // to grow the heap without causing GCs (if possible).
14867 isolate->counters()->gc_last_resort_from_js()->Increment(); 14838 isolate->counters()->gc_last_resort_from_js()->Increment();
14868 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14839 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14869 "Runtime::PerformGC"); 14840 "Runtime::PerformGC");
14870 } 14841 }
14871 } 14842 }
14872 14843
14873 14844
14874 } } // namespace v8::internal 14845 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/intl/string/normalization.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698