Revision: 12308
Author:   [email protected]
Date:     Tue Aug 14 05:16:38 2012
Log: Do checks when receiving external string resources through the API.

This is to find incorrect API usage.

[email protected]
BUG=140050

Review URL: https://chromiumcodereview.appspot.com/10836236
http://code.google.com/p/v8/source/detail?r=12308

Modified:
 /branches/bleeding_edge/src/api.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Mon Aug  6 06:49:13 2012
+++ /branches/bleeding_edge/src/api.cc  Tue Aug 14 05:16:38 2012
@@ -4790,6 +4790,7 @@
   EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
   LOG_API(isolate, "String::NewExternal");
   ENTER_V8(isolate);
+  CHECK(resource && resource->data());
   i::Handle<i::String> result = NewExternalStringHandle(isolate, resource);
   isolate->heap()->external_string_table()->AddString(*result);
   return Utils::ToLocal(result);
@@ -4810,6 +4811,7 @@
   if (isolate->heap()->IsInGCPostProcessing()) {
     return false;
   }
+  CHECK(resource && resource->data());
   bool result = obj->MakeExternal(resource);
   if (result && !obj->IsSymbol()) {
     isolate->heap()->external_string_table()->AddString(*obj);
@@ -4824,6 +4826,7 @@
   EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
   LOG_API(isolate, "String::NewExternal");
   ENTER_V8(isolate);
+  CHECK(resource && resource->data());
i::Handle<i::String> result = NewExternalAsciiStringHandle(isolate, resource);
   isolate->heap()->external_string_table()->AddString(*result);
   return Utils::ToLocal(result);
@@ -4845,6 +4848,7 @@
   if (isolate->heap()->IsInGCPostProcessing()) {
     return false;
   }
+  CHECK(resource && resource->data());
   bool result = obj->MakeExternal(resource);
   if (result && !obj->IsSymbol()) {
     isolate->heap()->external_string_table()->AddString(*obj);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to