Commit a189839c authored by jochen's avatar jochen Committed by Commit bot

Don't throw during a disallow-heap-allocation scope

Exception throwing will allocate

R=bmeurer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2173423002
Cr-Commit-Position: refs/heads/master@{#37997}
parent 98681421
...@@ -569,18 +569,22 @@ RUNTIME_FUNCTION(Runtime_InternalCompare) { ...@@ -569,18 +569,22 @@ RUNTIME_FUNCTION(Runtime_InternalCompare) {
string1 = String::Flatten(string1); string1 = String::Flatten(string1);
string2 = String::Flatten(string2); string2 = String::Flatten(string2);
DisallowHeapAllocation no_gc;
int32_t length1 = string1->length(); UCollationResult result;
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);
UErrorCode status = U_ZERO_ERROR; 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(); if (U_FAILURE(status)) return isolate->ThrowIllegalOperation();
return *isolate->factory()->NewNumberFromInt(result); return *isolate->factory()->NewNumberFromInt(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment