Revision: 20481
Author: [email protected]
Date: Thu Apr 3 12:41:37 2014 UTC
Log: Return MaybeHandle from NewExternalStringFrom*.
[email protected]
Review URL: https://codereview.chromium.org/223653003
http://code.google.com/p/v8/source/detail?r=20481
Modified:
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/factory.h
/branches/bleeding_edge/test/cctest/test-api.cc
/branches/bleeding_edge/test/cctest/test-parsing.cc
/branches/bleeding_edge/test/cctest/test-strings.cc
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Apr 3 12:30:37 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Thu Apr 3 12:41:37 2014 UTC
@@ -5469,22 +5469,18 @@
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).ToHandleChecked();
}
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).ToHandleChecked();
}
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Wed Apr 2 13:30:36 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Thu Apr 3 12:41:37 2014 UTC
@@ -53,10 +53,10 @@
new NativesExternalStringResource(this,
source.start(),
source.length());
- Handle<String> source_code =
- isolate_->factory()->NewExternalStringFromAscii(resource);
// We do not expect this to throw an exception. Change this if it does.
- CHECK_NOT_EMPTY_HANDLE(isolate_, source_code);
+ Handle<String> source_code =
+ isolate_->factory()->NewExternalStringFromAscii(
+ resource).ToHandleChecked();
heap->natives_source_cache()->set(index, *source_code);
}
Handle<Object> cached_source(heap->natives_source_cache()->get(index),
@@ -2319,10 +2319,10 @@
return false;
}
}
- Handle<String> source_code =
- isolate->factory()->NewExternalStringFromAscii(extension->source());
// We do not expect this to throw an exception. Change this if it does.
- CHECK_NOT_EMPTY_HANDLE(isolate, source_code);
+ Handle<String> source_code =
+ isolate->factory()->NewExternalStringFromAscii(
+ extension->source()).ToHandleChecked();
bool result = CompileScriptCached(isolate,
CStrVector(extension->name()),
source_code,
=======================================
--- /branches/bleeding_edge/src/factory.cc Thu Apr 3 12:30:37 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc Thu Apr 3 12:41:37 2014 UTC
@@ -523,7 +523,7 @@
}
-Handle<String> Factory::NewExternalStringFromAscii(
+MaybeHandle<String> Factory::NewExternalStringFromAscii(
const ExternalAsciiString::Resource* resource) {
CALL_HEAP_FUNCTION(
isolate(),
@@ -532,7 +532,7 @@
}
-Handle<String> Factory::NewExternalStringFromTwoByte(
+MaybeHandle<String> Factory::NewExternalStringFromTwoByte(
const ExternalTwoByteString::Resource* resource) {
CALL_HEAP_FUNCTION(
isolate(),
=======================================
--- /branches/bleeding_edge/src/factory.h Thu Apr 3 12:30:37 2014 UTC
+++ /branches/bleeding_edge/src/factory.h Thu Apr 3 12:41:37 2014 UTC
@@ -166,9 +166,9 @@
// in the system: ASCII and two byte. Unlike other String types, it does
// not make sense to have a UTF-8 factory function for external strings,
// because we cannot change the underlying buffer.
- Handle<String> NewExternalStringFromAscii(
+ MaybeHandle<String> NewExternalStringFromAscii(
const ExternalAsciiString::Resource* resource);
- Handle<String> NewExternalStringFromTwoByte(
+ MaybeHandle<String> NewExternalStringFromTwoByte(
const ExternalTwoByteString::Resource* resource);
// Create a symbol.
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Mon Mar 31 12:40:32
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-api.cc Thu Apr 3 12:41:37
2014 UTC
@@ -15122,9 +15122,11 @@
i::StrLength(c_string)));
Local<String> lhs(v8::Utils::ToLocal(
- factory->NewExternalStringFromAscii(&ascii_resource)));
+ factory->NewExternalStringFromAscii(&ascii_resource)
+ .ToHandleChecked()));
Local<String> rhs(v8::Utils::ToLocal(
- factory->NewExternalStringFromAscii(&ascii_resource)));
+ factory->NewExternalStringFromAscii(&ascii_resource)
+ .ToHandleChecked()));
env->Global()->Set(v8_str("lhs"), lhs);
env->Global()->Set(v8_str("rhs"), rhs);
=======================================
--- /branches/bleeding_edge/test/cctest/test-parsing.cc Wed Apr 2 12:38:01
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-parsing.cc Thu Apr 3 12:41:37
2014 UTC
@@ -655,7 +655,7 @@
factory->NewStringFromAscii(ascii_vector));
TestExternalResource resource(uc16_buffer.get(), length);
i::Handle<i::String> uc16_string(
- factory->NewExternalStringFromTwoByte(&resource));
+ factory->NewExternalStringFromTwoByte(&resource).ToHandleChecked());
i::ExternalTwoByteStringUtf16CharacterStream uc16_stream(
i::Handle<i::ExternalTwoByteString>::cast(uc16_string), start, end);
=======================================
--- /branches/bleeding_edge/test/cctest/test-strings.cc Thu Apr 3 12:30:37
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-strings.cc Thu Apr 3 12:41:37
2014 UTC
@@ -1137,7 +1137,8 @@
v8::HandleScope scope(CcTest::isolate());
AsciiVectorResource resource(
i::Vector<const char>("abcdefghijklmnopqrstuvwxyz", 26));
- Handle<String> string = factory->NewExternalStringFromAscii(&resource);
+ Handle<String> string =
+ factory->NewExternalStringFromAscii(&resource).ToHandleChecked();
CHECK(string->IsExternalString());
Handle<String> slice = factory->NewSubString(string, 1, 25);
CHECK(slice->IsSlicedString());
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.