Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 402598f40e3b9fc9ed5b8caad9855ea85f7d2d27..b7de1eaaad9c29561ef27f018179b3519d1ce810 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -5419,6 +5419,8 @@ 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()); |
|
Yang
2014/03/21 12:32:18
Not using CHECK_NOT_EMPTY_HANDLE because this coul
|
| if (type == String::kUndetectableString) { |
| result->MarkAsUndetectable(); |
| } |
| @@ -5476,8 +5478,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 throw an exception. Change this if it does. |
| - CHECK_NOT_EMPTY_HANDLE(isolate, result); |
| + // We do not expect this to fail. Change this if it does. |
| + CHECK(!result.is_null()); |
| return Utils::ToLocal(result); |
| } |
| @@ -5485,14 +5487,22 @@ Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { |
| static i::Handle<i::String> NewExternalStringHandle( |
| i::Isolate* isolate, |
| v8::String::ExternalStringResource* resource) { |
| - return isolate->factory()->NewExternalStringFromTwoByte(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; |
| } |
| static i::Handle<i::String> NewExternalAsciiStringHandle( |
| i::Isolate* isolate, |
| v8::String::ExternalAsciiStringResource* resource) { |
| - return isolate->factory()->NewExternalStringFromAscii(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; |
| } |
| @@ -6146,6 +6156,8 @@ 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); |
| @@ -6972,8 +6984,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 throw an exception. Change this if it does. |
| - CHECK_NOT_EMPTY_HANDLE(isolate, cons); |
| + // We do not expect this to fail. Change this if it does. |
| + CHECK(!cons.is_null()); |
| return ToApiHandle<String>(cons); |
| } |
| } |