Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 31e8193ef118ae4556568333396d77fea71b7c1e..c89b61937923f99f49bf44da5de976038c850901 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -5403,8 +5403,6 @@ inline Local<String> NewString(Isolate* v8_isolate, |
if (length == -1) length = StringLength(data); |
i::Handle<i::String> result = NewString( |
isolate->factory(), type, i::Vector<const Char>(data, length)); |
- // We do not expect this to fail. Change this if it does. |
- CHECK(!result.is_null()); |
if (type == String::kUndetectableString) { |
result->MarkAsUndetectable(); |
} |
@@ -5462,8 +5460,8 @@ Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { |
i::Handle<i::String> right_string = Utils::OpenHandle(*right); |
i::Handle<i::String> result = isolate->factory()->NewConsString(left_string, |
right_string); |
- // We do not expect this to fail. Change this if it does. |
- CHECK(!result.is_null()); |
+ // We do not expect this to throw an exception. Change this if it does. |
+ CHECK_NOT_EMPTY_HANDLE(isolate, result); |
return Utils::ToLocal(result); |
} |
@@ -5471,22 +5469,14 @@ Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { |
static i::Handle<i::String> NewExternalStringHandle( |
i::Isolate* isolate, |
v8::String::ExternalStringResource* resource) { |
- i::Handle<i::String> result = |
- isolate->factory()->NewExternalStringFromTwoByte(resource); |
- // We do not expect this to fail. Change this if it does. |
- CHECK(!result.is_null()); |
- return result; |
+ return isolate->factory()->NewExternalStringFromTwoByte(resource); |
} |
static i::Handle<i::String> NewExternalAsciiStringHandle( |
i::Isolate* isolate, |
v8::String::ExternalAsciiStringResource* resource) { |
- i::Handle<i::String> result = |
- isolate->factory()->NewExternalStringFromAscii(resource); |
- // We do not expect this to fail. Change this if it does. |
- CHECK(!result.is_null()); |
- return result; |
+ return isolate->factory()->NewExternalStringFromAscii(resource); |
} |
@@ -6140,8 +6130,6 @@ Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) { |
if (length == -1) length = i::StrLength(data); |
i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8( |
i::Vector<const char>(data, length)); |
- // We do not expect this to fail. Change this if it does. |
- CHECK(!name.is_null()); |
result->set_name(*name); |
} |
return Utils::ToLocal(result); |
@@ -6963,8 +6951,8 @@ Handle<String> CpuProfileNode::GetFunctionName() const { |
i::Handle<i::String> cons = isolate->factory()->NewConsString( |
isolate->factory()->InternalizeUtf8String(entry->name_prefix()), |
isolate->factory()->InternalizeUtf8String(entry->name())); |
- // We do not expect this to fail. Change this if it does. |
- CHECK(!cons.is_null()); |
+ // We do not expect this to throw an exception. Change this if it does. |
+ CHECK_NOT_EMPTY_HANDLE(isolate, cons); |
return ToApiHandle<String>(cons); |
} |
} |