Commit b774c3ed authored by dcarney@chromium.org's avatar dcarney@chromium.org

stop using AsciiValue

TBR=svenpanne@chomium.org
BUG=

Review URL: https://codereview.chromium.org/15129002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14645 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c1bc396c
...@@ -1789,6 +1789,7 @@ class V8EXPORT String : public Primitive { ...@@ -1789,6 +1789,7 @@ class V8EXPORT String : public Primitive {
*/ */
class V8EXPORT AsciiValue { class V8EXPORT AsciiValue {
public: public:
// TODO(dcarney): deprecate
explicit AsciiValue(Handle<v8::Value> obj); explicit AsciiValue(Handle<v8::Value> obj);
~AsciiValue(); ~AsciiValue();
char* operator*() { return str_; } char* operator*() { return str_; }
......
...@@ -63,10 +63,10 @@ const char* const ExternalizeStringExtension::kSource = ...@@ -63,10 +63,10 @@ const char* const ExternalizeStringExtension::kSource =
v8::Handle<v8::FunctionTemplate> ExternalizeStringExtension::GetNativeFunction( v8::Handle<v8::FunctionTemplate> ExternalizeStringExtension::GetNativeFunction(
v8::Handle<v8::String> str) { 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); return v8::FunctionTemplate::New(ExternalizeStringExtension::Externalize);
} else { } else {
ASSERT(strcmp(*v8::String::AsciiValue(str), "isAsciiString") == 0); ASSERT(strcmp(*v8::String::Utf8Value(str), "isAsciiString") == 0);
return v8::FunctionTemplate::New(ExternalizeStringExtension::IsAscii); return v8::FunctionTemplate::New(ExternalizeStringExtension::IsAscii);
} }
} }
......
...@@ -36,7 +36,7 @@ const char* const StatisticsExtension::kSource = ...@@ -36,7 +36,7 @@ const char* const StatisticsExtension::kSource =
v8::Handle<v8::FunctionTemplate> StatisticsExtension::GetNativeFunction( v8::Handle<v8::FunctionTemplate> StatisticsExtension::GetNativeFunction(
v8::Handle<v8::String> str) { 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); return v8::FunctionTemplate::New(StatisticsExtension::GetCounters);
} }
......
This diff is collapsed.
...@@ -850,8 +850,8 @@ static void DebugEventEvaluate(v8::DebugEvent event, ...@@ -850,8 +850,8 @@ static void DebugEventEvaluate(v8::DebugEvent event,
v8::Handle<v8::Value> result = v8::Handle<v8::Value> result =
evaluate_check_function->Call(exec_state, argc, argv); evaluate_check_function->Call(exec_state, argc, argv);
if (!result->IsTrue()) { if (!result->IsTrue()) {
v8::String::AsciiValue ascii(checks[i].expected->ToString()); v8::String::Utf8Value utf8(checks[i].expected->ToString());
V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *ascii); V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8);
} }
} }
} }
...@@ -923,7 +923,7 @@ static void DebugEventStepSequence(v8::DebugEvent event, ...@@ -923,7 +923,7 @@ static void DebugEventStepSequence(v8::DebugEvent event,
v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, v8::Handle<v8::Value> result = frame_function_name->Call(exec_state,
argc, argv); argc, argv);
CHECK(result->IsString()); 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(1, StrLength(*function_name));
CHECK_EQ((*function_name)[0], CHECK_EQ((*function_name)[0],
expected_step_sequence[break_point_hit_count]); expected_step_sequence[break_point_hit_count]);
...@@ -4285,7 +4285,7 @@ static v8::Handle<v8::Array> IndexedEnum(const v8::AccessorInfo&) { ...@@ -4285,7 +4285,7 @@ static v8::Handle<v8::Array> IndexedEnum(const v8::AccessorInfo&) {
static v8::Handle<v8::Value> NamedGetter(v8::Local<v8::String> name, static v8::Handle<v8::Value> NamedGetter(v8::Local<v8::String> name,
const v8::AccessorInfo& info) { const v8::AccessorInfo& info) {
v8::String::AsciiValue n(name); v8::String::Utf8Value n(name);
if (strcmp(*n, "a") == 0) { if (strcmp(*n, "a") == 0) {
return v8::String::New("AA"); return v8::String::New("AA");
} else if (strcmp(*n, "b") == 0) { } else if (strcmp(*n, "b") == 0) {
...@@ -7008,7 +7008,7 @@ v8::Handle<v8::Context> debugger_context; ...@@ -7008,7 +7008,7 @@ v8::Handle<v8::Context> debugger_context;
static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck( static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck(
v8::Local<v8::String> name, v8::Local<v8::String> name,
const v8::AccessorInfo& info) { 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(); v8::Handle<v8::Context> current = v8::Context::GetCurrent();
CHECK(current == debugee_context); CHECK(current == debugee_context);
CHECK(current != debugger_context); CHECK(current != debugger_context);
......
...@@ -376,8 +376,8 @@ TEST(DeoptimizeBinaryOperationADDString) { ...@@ -376,8 +376,8 @@ TEST(DeoptimizeBinaryOperationADDString) {
CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
v8::Handle<v8::Value> result = env->Global()->Get(v8_str("result")); v8::Handle<v8::Value> result = env->Global()->Get(v8_str("result"));
CHECK(result->IsString()); CHECK(result->IsString());
v8::String::AsciiValue ascii(result); v8::String::Utf8Value utf8(result);
CHECK_EQ("a+an X", *ascii); CHECK_EQ("a+an X", *utf8);
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current()));
} }
......
...@@ -108,7 +108,7 @@ static const v8::HeapGraphNode* GetProperty(const v8::HeapGraphNode* node, ...@@ -108,7 +108,7 @@ static const v8::HeapGraphNode* GetProperty(const v8::HeapGraphNode* node,
const char* name) { const char* name) {
for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) { for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = node->GetChild(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) if (prop->GetType() == type && strcmp(name, *prop_name) == 0)
return prop->GetToNode(); return prop->GetToNode();
} }
...@@ -121,7 +121,7 @@ static bool HasString(const v8::HeapGraphNode* node, const char* contents) { ...@@ -121,7 +121,7 @@ static bool HasString(const v8::HeapGraphNode* node, const char* contents) {
const v8::HeapGraphEdge* prop = node->GetChild(i); const v8::HeapGraphEdge* prop = node->GetChild(i);
const v8::HeapGraphNode* node = prop->GetToNode(); const v8::HeapGraphNode* node = prop->GetToNode();
if (node->GetType() == v8::HeapGraphNode::kString) { 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; if (strcmp(contents, *node_name) == 0) return true;
} }
} }
...@@ -285,7 +285,7 @@ TEST(HeapSnapshotCodeObjects) { ...@@ -285,7 +285,7 @@ TEST(HeapSnapshotCodeObjects) {
GetProperty(global, v8::HeapGraphEdge::kProperty, "anonymous"); GetProperty(global, v8::HeapGraphEdge::kProperty, "anonymous");
CHECK_NE(NULL, anonymous); CHECK_NE(NULL, anonymous);
CHECK_EQ(v8::HeapGraphNode::kClosure, anonymous->GetType()); 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); CHECK_EQ("", *anonymous_name);
// Find references to code. // Find references to code.
...@@ -1079,16 +1079,16 @@ class TestRetainedObjectInfo : public v8::RetainedObjectInfo { ...@@ -1079,16 +1079,16 @@ class TestRetainedObjectInfo : public v8::RetainedObjectInfo {
uint16_t class_id, v8::Handle<v8::Value> wrapper) { uint16_t class_id, v8::Handle<v8::Value> wrapper) {
if (class_id == 1) { if (class_id == 1) {
if (wrapper->IsString()) { if (wrapper->IsString()) {
v8::String::AsciiValue ascii(wrapper); v8::String::Utf8Value utf8(wrapper);
if (strcmp(*ascii, "AAA") == 0) if (strcmp(*utf8, "AAA") == 0)
return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100); 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); return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100);
} }
} else if (class_id == 2) { } else if (class_id == 2) {
if (wrapper->IsString()) { if (wrapper->IsString()) {
v8::String::AsciiValue ascii(wrapper); v8::String::Utf8Value utf8(wrapper);
if (strcmp(*ascii, "CCC") == 0) if (strcmp(*utf8, "CCC") == 0)
return new TestRetainedObjectInfo(2, "ccc-group", "ccc"); return new TestRetainedObjectInfo(2, "ccc-group", "ccc");
} }
} }
...@@ -1254,7 +1254,7 @@ TEST(HeapSnapshotImplicitReferences) { ...@@ -1254,7 +1254,7 @@ TEST(HeapSnapshotImplicitReferences) {
int implicit_targets_count = 0; int implicit_targets_count = 0;
for (int i = 0, count = obj1->GetChildrenCount(); i < count; ++i) { for (int i = 0, count = obj1->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = obj1->GetChild(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 && if (prop->GetType() == v8::HeapGraphEdge::kInternal &&
strcmp("native", *prop_name) == 0) { strcmp("native", *prop_name) == 0) {
++implicit_targets_count; ++implicit_targets_count;
...@@ -1692,7 +1692,7 @@ TEST(AllStrongGcRootsHaveNames) { ...@@ -1692,7 +1692,7 @@ TEST(AllStrongGcRootsHaveNames) {
for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) { for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) {
const v8::HeapGraphEdge* edge = strong_roots->GetChild(i); const v8::HeapGraphEdge* edge = strong_roots->GetChild(i);
CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType()); CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType());
v8::String::AsciiValue name(edge->GetName()); v8::String::Utf8Value name(edge->GetName());
CHECK(isalpha(**name)); CHECK(isalpha(**name));
} }
} }
......
...@@ -648,7 +648,7 @@ TEST(Regress1433) { ...@@ -648,7 +648,7 @@ TEST(Regress1433) {
v8::Handle<String> source = v8::String::New("1+1"); v8::Handle<String> source = v8::String::New("1+1");
v8::Handle<Script> script = v8::Script::Compile(source); v8::Handle<Script> script = v8::Script::Compile(source);
v8::Handle<Value> result = script->Run(); v8::Handle<Value> result = script->Run();
v8::String::AsciiValue ascii(result); v8::String::Utf8Value utf8(result);
} }
isolate->Dispose(); isolate->Dispose();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment