Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: test/cctest/test-api.cc

Issue 136413003: Deprecate ScriptData::PreCompile which takes const char*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: just removing Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 00465e3a0a70577eda6a9b719cc9537ade4fcca1..fe6ec1f2ff8ee7a103839891f21b787b683e77ee 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -14786,8 +14786,8 @@ TEST(PreCompile) {
v8::V8::Initialize();
v8::Isolate* isolate = CcTest::isolate();
const char* script = "function foo(a) { return a+1; }";
- v8::ScriptData* sd =
- v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
+ v8::ScriptData* sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
+ isolate, script, v8::String::kNormalString, i::StrLength(script)));
CHECK_NE(sd->Length(), 0);
CHECK_NE(sd->Data(), NULL);
CHECK(!sd->HasError());
@@ -14799,8 +14799,8 @@ TEST(PreCompileWithError) {
v8::V8::Initialize();
v8::Isolate* isolate = CcTest::isolate();
const char* script = "function foo(a) { return 1 * * 2; }";
- v8::ScriptData* sd =
- v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
+ v8::ScriptData* sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
+ isolate, script, v8::String::kNormalString, i::StrLength(script)));
CHECK(sd->HasError());
delete sd;
}
@@ -14810,8 +14810,8 @@ TEST(Regress31661) {
v8::V8::Initialize();
v8::Isolate* isolate = CcTest::isolate();
const char* script = " The Definintive Guide";
- v8::ScriptData* sd =
- v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
+ v8::ScriptData* sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
+ isolate, script, v8::String::kNormalString, i::StrLength(script)));
CHECK(sd->HasError());
delete sd;
}
@@ -14822,8 +14822,8 @@ TEST(PreCompileSerialization) {
v8::V8::Initialize();
v8::Isolate* isolate = CcTest::isolate();
const char* script = "function foo(a) { return a+1; }";
- v8::ScriptData* sd =
- v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
+ v8::ScriptData* sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
+ isolate, script, v8::String::kNormalString, i::StrLength(script)));
// Serialize.
int serialized_data_length = sd->Length();
@@ -14866,8 +14866,8 @@ TEST(PreCompileInvalidPreparseDataError) {
const char* script = "function foo(){ return 5;}\n"
"function bar(){ return 6 + 7;} foo();";
- v8::ScriptData* sd =
- v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
+ v8::ScriptData* sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
+ isolate, script, v8::String::kNormalString, i::StrLength(script)));
CHECK(!sd->HasError());
// ScriptDataImpl private implementation details
const int kHeaderSize = i::PreparseDataConstants::kHeaderSize;
@@ -14893,7 +14893,8 @@ TEST(PreCompileInvalidPreparseDataError) {
// Overwrite function bar's start position with 200. The function entry
// will not be found when searching for it by position and we should fall
// back on eager compilation.
- sd = v8::ScriptData::PreCompile(isolate, script, i::StrLength(script));
+ sd = v8::ScriptData::PreCompile(v8::String::NewFromUtf8(
+ isolate, script, v8::String::kNormalString, i::StrLength(script)));
sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] =
200;
@@ -14904,42 +14905,6 @@ TEST(PreCompileInvalidPreparseDataError) {
}
-// Verifies that the Handle<String> and const char* versions of the API produce
-// the same results (at least for one trivial case).
-TEST(PreCompileAPIVariationsAreSame) {
- v8::V8::Initialize();
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
-
- const char* cstring = "function foo(a) { return a+1; }";
-
- v8::ScriptData* sd_from_cstring =
- v8::ScriptData::PreCompile(isolate, cstring, i::StrLength(cstring));
-
- TestAsciiResource* resource = new TestAsciiResource(cstring);
- v8::ScriptData* sd_from_external_string = v8::ScriptData::PreCompile(
- v8::String::NewExternal(isolate, resource));
-
- v8::ScriptData* sd_from_string = v8::ScriptData::PreCompile(
- v8::String::NewFromUtf8(isolate, cstring));
-
- CHECK_EQ(sd_from_cstring->Length(), sd_from_external_string->Length());
- CHECK_EQ(0, memcmp(sd_from_cstring->Data(),
- sd_from_external_string->Data(),
- sd_from_cstring->Length()));
-
- CHECK_EQ(sd_from_cstring->Length(), sd_from_string->Length());
- CHECK_EQ(0, memcmp(sd_from_cstring->Data(),
- sd_from_string->Data(),
- sd_from_cstring->Length()));
-
-
- delete sd_from_cstring;
- delete sd_from_external_string;
- delete sd_from_string;
-}
-
-
// This tests that we do not allow dictionary load/call inline caches
// to use functions that have not yet been compiled. The potential
// problem of loading a function that has not yet been compiled can
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698