Revision: 14645
Author: [email protected]
Date: Mon May 13 07:18:05 2013
Log: stop using AsciiValue
[email protected]
BUG=
Review URL: https://codereview.chromium.org/15129002
http://code.google.com/p/v8/source/detail?r=14645
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/extensions/externalize-string-extension.cc
/branches/bleeding_edge/src/extensions/statistics-extension.cc
/branches/bleeding_edge/test/cctest/test-api.cc
/branches/bleeding_edge/test/cctest/test-debug.cc
/branches/bleeding_edge/test/cctest/test-deoptimization.cc
/branches/bleeding_edge/test/cctest/test-heap-profiler.cc
/branches/bleeding_edge/test/cctest/test-lockers.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Mon May 13 00:35:26 2013
+++ /branches/bleeding_edge/include/v8.h Mon May 13 07:18:05 2013
@@ -1789,6 +1789,7 @@
*/
class V8EXPORT AsciiValue {
public:
+ // TODO(dcarney): deprecate
explicit AsciiValue(Handle<v8::Value> obj);
~AsciiValue();
char* operator*() { return str_; }
=======================================
--- /branches/bleeding_edge/src/extensions/externalize-string-extension.cc
Thu Feb 28 09:03:34 2013
+++ /branches/bleeding_edge/src/extensions/externalize-string-extension.cc
Mon May 13 07:18:05 2013
@@ -63,10 +63,10 @@
v8::Handle<v8::FunctionTemplate>
ExternalizeStringExtension::GetNativeFunction(
v8::Handle<v8::String> str) {
- if (strcmp(*v8::String::AsciiValue(str), "externalizeString") == 0) {
+ if (strcmp(*v8::String::Utf8Value(str), "externalizeString") == 0) {
return
v8::FunctionTemplate::New(ExternalizeStringExtension::Externalize);
} else {
- ASSERT(strcmp(*v8::String::AsciiValue(str), "isAsciiString") == 0);
+ ASSERT(strcmp(*v8::String::Utf8Value(str), "isAsciiString") == 0);
return v8::FunctionTemplate::New(ExternalizeStringExtension::IsAscii);
}
}
=======================================
--- /branches/bleeding_edge/src/extensions/statistics-extension.cc Wed Aug
8 02:46:45 2012
+++ /branches/bleeding_edge/src/extensions/statistics-extension.cc Mon May
13 07:18:05 2013
@@ -36,7 +36,7 @@
v8::Handle<v8::FunctionTemplate> StatisticsExtension::GetNativeFunction(
v8::Handle<v8::String> str) {
- ASSERT(strcmp(*v8::String::AsciiValue(str), "getV8Statistics") == 0);
+ ASSERT(strcmp(*v8::String::Utf8Value(str), "getV8Statistics") == 0);
return v8::FunctionTemplate::New(StatisticsExtension::GetCounters);
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Fri May 10 07:04:51 2013
+++ /branches/bleeding_edge/test/cctest/test-api.cc Mon May 13 07:18:05 2013
@@ -80,8 +80,8 @@
static void ExpectString(const char* code, const char* expected) {
Local<Value> result = CompileRun(code);
CHECK(result->IsString());
- String::AsciiValue ascii(result);
- CHECK_EQ(expected, *ascii);
+ String::Utf8Value utf8(result);
+ CHECK_EQ(expected, *utf8);
}
static void ExpectInt32(const char* code, int expected) {
@@ -1440,8 +1440,8 @@
Handle<Value> InterceptorGetter(Local<String> name,
const AccessorInfo& info) {
// Intercept names that start with 'interceptor_'.
- String::AsciiValue ascii(name);
- char* name_str = *ascii;
+ String::Utf8Value utf8(name);
+ char* name_str = *utf8;
char prefix[] = "interceptor_";
int i;
for (i = 0; name_str[i] && prefix[i]; ++i) {
@@ -1701,7 +1701,7 @@
CHECK_EQ(echo_named_call_count, 1);
const char* code = "var str = 'oddle'; obj[str] + obj.poddle;";
v8::Handle<Value> str = CompileRun(code);
- String::AsciiValue value(str);
+ String::Utf8Value value(str);
CHECK_EQ(*value, "oddlepoddle");
// Check default behavior
CHECK_EQ(v8_compile("obj.flob = 10;")->Run()->Int32Value(), 10);
@@ -3186,7 +3186,7 @@
Local<Value> result = script->Run();
CHECK(result.IsEmpty());
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Exception());
+ String::Utf8Value exception_value(try_catch.Exception());
CHECK_EQ(*exception_value, "panama!");
}
@@ -3347,7 +3347,7 @@
CompileRun("({ toString: function() { throw 'exception';} })");
CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(exception));
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Exception());
+ String::Utf8Value exception_value(try_catch.Exception());
CHECK_EQ("exception", *exception_value);
try_catch.Reset();
}
@@ -3638,7 +3638,7 @@
static void CheckUncle(v8::TryCatch* try_catch) {
CHECK(try_catch->HasCaught());
- String::AsciiValue str_value(try_catch->Exception());
+ String::Utf8Value str_value(try_catch->Exception());
CHECK_EQ(*str_value, "uncle?");
try_catch->Reset();
}
@@ -4016,7 +4016,7 @@
Local<Value> result = script->Run();
CHECK(result.IsEmpty());
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Exception());
+ String::Utf8Value exception_value(try_catch.Exception());
CHECK_EQ("konto", *exception_value);
}
@@ -4388,7 +4388,7 @@
v8::TryCatch try_catch;
result = script_define->Run();
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Exception());
+ String::Utf8Value exception_value(try_catch.Exception());
CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
}
@@ -4433,7 +4433,7 @@
v8::TryCatch try_catch;
result = script_define->Run();
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Exception());
+ String::Utf8Value exception_value(try_catch.Exception());
CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
}
@@ -4551,7 +4551,7 @@
CompileRun("Object.defineProperty(obj1, 'x',"
"{get: function() { return 'func'; }})");
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Exception());
+ String::Utf8Value exception_value(try_catch.Exception());
CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
}
{
@@ -4559,7 +4559,7 @@
CompileRun("Object.defineProperty(obj2, 'x',"
"{get: function() { return 'func'; }})");
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Exception());
+ String::Utf8Value exception_value(try_catch.Exception());
CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x");
}
}
@@ -7186,10 +7186,10 @@
v8::Handle<Value>) {
v8::Handle<v8::Value> name_val = message->GetScriptResourceName();
CHECK(!name_val.IsEmpty() && name_val->IsString());
- v8::String::AsciiValue name(message->GetScriptResourceName());
+ v8::String::Utf8Value name(message->GetScriptResourceName());
CHECK_EQ(script_resource_name, *name);
CHECK_EQ(3, message->GetLineNumber());
- v8::String::AsciiValue source_line(message->GetSourceLine());
+ v8::String::Utf8Value source_line(message->GetSourceLine());
CHECK_EQ(" new o.foo();", *source_line);
}
@@ -9048,7 +9048,7 @@
"(function() { var o = new obj('tipli'); return o.a; })()");
CHECK(!try_catch.HasCaught());
CHECK(value->IsString());
- String::AsciiValue string_value1(value->ToString());
+ String::Utf8Value string_value1(value->ToString());
CHECK_EQ("tipli", *string_value1);
Local<Value> args2[] = { v8_str("tipli") };
@@ -9058,7 +9058,7 @@
value = object2->Get(v8_str("a"));
CHECK(!try_catch.HasCaught());
CHECK(value->IsString());
- String::AsciiValue string_value2(value->ToString());
+ String::Utf8Value string_value2(value->ToString());
CHECK_EQ("tipli", *string_value2);
// Call the Object's constructor with a Boolean.
@@ -9105,14 +9105,14 @@
value = CompileRun("new obj2(28)");
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value1(try_catch.Exception());
+ String::Utf8Value exception_value1(try_catch.Exception());
CHECK_EQ("TypeError: object is not a function", *exception_value1);
try_catch.Reset();
Local<Value> args[] = { v8_num(29) };
value = instance->CallAsConstructor(1, args);
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value2(try_catch.Exception());
+ String::Utf8Value exception_value2(try_catch.Exception());
CHECK_EQ("TypeError: #<Object> is not a function", *exception_value2);
try_catch.Reset();
}
@@ -9128,14 +9128,14 @@
value = CompileRun("new obj3(22)");
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value1(try_catch.Exception());
+ String::Utf8Value exception_value1(try_catch.Exception());
CHECK_EQ("22", *exception_value1);
try_catch.Reset();
Local<Value> args[] = { v8_num(23) };
value = instance->CallAsConstructor(1, args);
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value2(try_catch.Exception());
+ String::Utf8Value exception_value2(try_catch.Exception());
CHECK_EQ("23", *exception_value2);
try_catch.Reset();
}
@@ -9465,7 +9465,7 @@
value = CompileRun("obj2(28)");
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value1(try_catch.Exception());
+ String::Utf8Value exception_value1(try_catch.Exception());
CHECK_EQ("TypeError: Property 'obj2' of object #<Object> is not a
function",
*exception_value1);
try_catch.Reset();
@@ -9476,7 +9476,7 @@
value = instance->CallAsFunction(instance, 1, args);
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value2(try_catch.Exception());
+ String::Utf8Value exception_value2(try_catch.Exception());
CHECK_EQ("TypeError: [object Object] is not a function",
*exception_value2);
try_catch.Reset();
}
@@ -9493,14 +9493,14 @@
// Catch the exception which is thrown by call-as-function handler
value = CompileRun("obj3(22)");
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value1(try_catch.Exception());
+ String::Utf8Value exception_value1(try_catch.Exception());
CHECK_EQ("22", *exception_value1);
try_catch.Reset();
v8::Handle<Value> args[] = { v8_num(23) };
value = instance->CallAsFunction(instance, 1, args);
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value2(try_catch.Exception());
+ String::Utf8Value exception_value2(try_catch.Exception());
CHECK_EQ("23", *exception_value2);
try_catch.Reset();
}
@@ -12450,9 +12450,9 @@
CHECK_EQ(92, message->GetEndPosition());
CHECK_EQ(2, message->GetStartColumn());
CHECK_EQ(3, message->GetEndColumn());
- v8::String::AsciiValue line(message->GetSourceLine());
+ v8::String::Utf8Value line(message->GetSourceLine());
CHECK_EQ(" throw 'nirk';", *line);
- v8::String::AsciiValue name(message->GetScriptResourceName());
+ v8::String::Utf8Value name(message->GetScriptResourceName());
CHECK_EQ(resource_name, *name);
}
@@ -12524,7 +12524,7 @@
context->Global()->Set(v8_str("obj"), t->NewInstance());
v8::Handle<v8::Value> value = CompileRun("obj.asdf.name");
CHECK(value->IsString());
- v8::String::AsciiValue name(value);
+ v8::String::Utf8Value name(value);
CHECK_EQ("asdf", *name);
}
@@ -12996,7 +12996,7 @@
Local<String> source = String::New(script);
Local<Script> compiled_script = Script::New(source, NULL, sd);
CHECK(try_catch.HasCaught());
- String::AsciiValue exception_value(try_catch.Message()->Get());
+ String::Utf8Value exception_value(try_catch.Message()->Get());
CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar",
*exception_value);
@@ -16265,11 +16265,11 @@
env->Global()->Get(v8::String::New("g")));
v8::ScriptOrigin script_origin_f = f->GetScriptOrigin();
- CHECK_EQ("test",
*v8::String::AsciiValue(script_origin_f.ResourceName()));
+ CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName()));
CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value());
v8::ScriptOrigin script_origin_g = g->GetScriptOrigin();
- CHECK_EQ("test",
*v8::String::AsciiValue(script_origin_g.ResourceName()));
+ CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName()));
CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value());
}
@@ -16282,7 +16282,7 @@
v8::Script::Compile(script, &origin)->Run();
v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::New("f")));
- CHECK_EQ("foo.bar.baz", *v8::String::AsciiValue(f->GetInferredName()));
+ CHECK_EQ("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName()));
}
THREADED_TEST(ScriptLineNumber) {
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Wed May 8 00:45:16
2013
+++ /branches/bleeding_edge/test/cctest/test-debug.cc Mon May 13 07:18:05
2013
@@ -850,8 +850,8 @@
v8::Handle<v8::Value> result =
evaluate_check_function->Call(exec_state, argc, argv);
if (!result->IsTrue()) {
- v8::String::AsciiValue ascii(checks[i].expected->ToString());
- V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *ascii);
+ v8::String::Utf8Value utf8(checks[i].expected->ToString());
+ V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8);
}
}
}
@@ -923,7 +923,7 @@
v8::Handle<v8::Value> result = frame_function_name->Call(exec_state,
argc, argv);
CHECK(result->IsString());
- v8::String::AsciiValue function_name(result->ToString());
+ v8::String::Utf8Value function_name(result->ToString());
CHECK_EQ(1, StrLength(*function_name));
CHECK_EQ((*function_name)[0],
expected_step_sequence[break_point_hit_count]);
@@ -4285,7 +4285,7 @@
static v8::Handle<v8::Value> NamedGetter(v8::Local<v8::String> name,
const v8::AccessorInfo& info) {
- v8::String::AsciiValue n(name);
+ v8::String::Utf8Value n(name);
if (strcmp(*n, "a") == 0) {
return v8::String::New("AA");
} else if (strcmp(*n, "b") == 0) {
@@ -7008,7 +7008,7 @@
static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck(
v8::Local<v8::String> name,
const v8::AccessorInfo& info) {
- CHECK_EQ(0, strcmp(*v8::String::AsciiValue(name), "a"));
+ CHECK_EQ(0, strcmp(*v8::String::Utf8Value(name), "a"));
v8::Handle<v8::Context> current = v8::Context::GetCurrent();
CHECK(current == debugee_context);
CHECK(current != debugger_context);
=======================================
--- /branches/bleeding_edge/test/cctest/test-deoptimization.cc Fri Mar 15
05:06:53 2013
+++ /branches/bleeding_edge/test/cctest/test-deoptimization.cc Mon May 13
07:18:05 2013
@@ -376,8 +376,8 @@
CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
v8::Handle<v8::Value> result = env->Global()->Get(v8_str("result"));
CHECK(result->IsString());
- v8::String::AsciiValue ascii(result);
- CHECK_EQ("a+an X", *ascii);
+ v8::String::Utf8Value utf8(result);
+ CHECK_EQ("a+an X", *utf8);
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current()));
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Wed May 8
08:02:08 2013
+++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Mon May 13
07:18:05 2013
@@ -108,7 +108,7 @@
const char* name) {
for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = node->GetChild(i);
- v8::String::AsciiValue prop_name(prop->GetName());
+ v8::String::Utf8Value prop_name(prop->GetName());
if (prop->GetType() == type && strcmp(name, *prop_name) == 0)
return prop->GetToNode();
}
@@ -121,7 +121,7 @@
const v8::HeapGraphEdge* prop = node->GetChild(i);
const v8::HeapGraphNode* node = prop->GetToNode();
if (node->GetType() == v8::HeapGraphNode::kString) {
- v8::String::AsciiValue node_name(node->GetName());
+ v8::String::Utf8Value node_name(node->GetName());
if (strcmp(contents, *node_name) == 0) return true;
}
}
@@ -285,7 +285,7 @@
GetProperty(global, v8::HeapGraphEdge::kProperty, "anonymous");
CHECK_NE(NULL, anonymous);
CHECK_EQ(v8::HeapGraphNode::kClosure, anonymous->GetType());
- v8::String::AsciiValue anonymous_name(anonymous->GetName());
+ v8::String::Utf8Value anonymous_name(anonymous->GetName());
CHECK_EQ("", *anonymous_name);
// Find references to code.
@@ -1079,16 +1079,16 @@
uint16_t class_id, v8::Handle<v8::Value> wrapper) {
if (class_id == 1) {
if (wrapper->IsString()) {
- v8::String::AsciiValue ascii(wrapper);
- if (strcmp(*ascii, "AAA") == 0)
+ v8::String::Utf8Value utf8(wrapper);
+ if (strcmp(*utf8, "AAA") == 0)
return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100);
- else if (strcmp(*ascii, "BBB") == 0)
+ else if (strcmp(*utf8, "BBB") == 0)
return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100);
}
} else if (class_id == 2) {
if (wrapper->IsString()) {
- v8::String::AsciiValue ascii(wrapper);
- if (strcmp(*ascii, "CCC") == 0)
+ v8::String::Utf8Value utf8(wrapper);
+ if (strcmp(*utf8, "CCC") == 0)
return new TestRetainedObjectInfo(2, "ccc-group", "ccc");
}
}
@@ -1254,7 +1254,7 @@
int implicit_targets_count = 0;
for (int i = 0, count = obj1->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = obj1->GetChild(i);
- v8::String::AsciiValue prop_name(prop->GetName());
+ v8::String::Utf8Value prop_name(prop->GetName());
if (prop->GetType() == v8::HeapGraphEdge::kInternal &&
strcmp("native", *prop_name) == 0) {
++implicit_targets_count;
@@ -1692,7 +1692,7 @@
for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) {
const v8::HeapGraphEdge* edge = strong_roots->GetChild(i);
CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType());
- v8::String::AsciiValue name(edge->GetName());
+ v8::String::Utf8Value name(edge->GetName());
CHECK(isalpha(**name));
}
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-lockers.cc Wed May 8 00:45:16
2013
+++ /branches/bleeding_edge/test/cctest/test-lockers.cc Mon May 13 07:18:05
2013
@@ -648,7 +648,7 @@
v8::Handle<String> source = v8::String::New("1+1");
v8::Handle<Script> script = v8::Script::Compile(source);
v8::Handle<Value> result = script->Run();
- v8::String::AsciiValue ascii(result);
+ v8::String::Utf8Value utf8(result);
}
isolate->Dispose();
}
--
--
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/groups/opt_out.