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

Unified Diff: src/runtime/runtime-i18n.cc

Issue 2173423002: Don't throw during a disallow-heap-allocation scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-i18n.cc
diff --git a/src/runtime/runtime-i18n.cc b/src/runtime/runtime-i18n.cc
index 0eca8fadaec9f12758017a80464983aa16e5a36c..faf67e0ac7cb819de11d057077e6536d3dfa712b 100644
--- a/src/runtime/runtime-i18n.cc
+++ b/src/runtime/runtime-i18n.cc
@@ -569,18 +569,22 @@ RUNTIME_FUNCTION(Runtime_InternalCompare) {
string1 = String::Flatten(string1);
string2 = String::Flatten(string2);
- DisallowHeapAllocation no_gc;
- int32_t length1 = string1->length();
- int32_t length2 = string2->length();
- String::FlatContent flat1 = string1->GetFlatContent();
- String::FlatContent flat2 = string2->GetFlatContent();
- base::SmartArrayPointer<uc16> sap1;
- base::SmartArrayPointer<uc16> sap2;
- const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1);
- const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2);
+
+ UCollationResult result;
UErrorCode status = U_ZERO_ERROR;
- UCollationResult result =
- collator->compare(string_val1, length1, string_val2, length2, status);
+ {
+ DisallowHeapAllocation no_gc;
+ int32_t length1 = string1->length();
+ int32_t length2 = string2->length();
+ String::FlatContent flat1 = string1->GetFlatContent();
+ String::FlatContent flat2 = string2->GetFlatContent();
+ base::SmartArrayPointer<uc16> sap1;
+ base::SmartArrayPointer<uc16> sap2;
+ const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1);
+ const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2);
+ result =
+ collator->compare(string_val1, length1, string_val2, length2, status);
+ }
if (U_FAILURE(status)) return isolate->ThrowIllegalOperation();
return *isolate->factory()->NewNumberFromInt(result);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698