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

Unified Diff: src/api.cc

Issue 12210083: Renamed "symbols" to "internalized strings" throughout the code base, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Yang's comments Created 7 years, 10 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/accessors.cc ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index d3d472d79947cd208684db88d98cc633a551f48c..d2b78efe0ef9d649f361559ee80ecef10e7630e5 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1779,7 +1779,7 @@ v8::Local<Value> v8::TryCatch::StackTrace() const {
if (!raw_obj->IsJSObject()) return v8::Local<Value>();
i::HandleScope scope(isolate_);
i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
- i::Handle<i::String> name = isolate_->factory()->stack_symbol();
+ i::Handle<i::String> name = isolate_->factory()->stack_string();
if (!obj->HasProperty(*name)) return v8::Local<Value>();
i::Handle<i::Object> value = i::GetProperty(obj, name);
if (value.is_null()) return v8::Local<Value>();
@@ -1890,7 +1890,8 @@ static i::Handle<i::Object> CallV8HeapFunction(const char* name,
i::Handle<i::Object> argv[],
bool* has_pending_exception) {
i::Isolate* isolate = i::Isolate::Current();
- i::Handle<i::String> fmt_str = isolate->factory()->LookupUtf8Symbol(name);
+ i::Handle<i::String> fmt_str =
+ isolate->factory()->InternalizeUtf8String(name);
i::Object* object_fun =
isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str);
i::Handle<i::JSFunction> fun =
@@ -2283,7 +2284,7 @@ bool Value::IsDate() const {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Value::IsDate()")) return false;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
- return obj->HasSpecificClassOf(isolate->heap()->Date_symbol());
+ return obj->HasSpecificClassOf(isolate->heap()->Date_string());
}
@@ -2291,7 +2292,7 @@ bool Value::IsStringObject() const {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Value::IsStringObject()")) return false;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
- return obj->HasSpecificClassOf(isolate->heap()->String_symbol());
+ return obj->HasSpecificClassOf(isolate->heap()->String_string());
}
@@ -2299,16 +2300,16 @@ bool Value::IsNumberObject() const {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Value::IsNumberObject()")) return false;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
- return obj->HasSpecificClassOf(isolate->heap()->Number_symbol());
+ return obj->HasSpecificClassOf(isolate->heap()->Number_string());
}
static i::Object* LookupBuiltin(i::Isolate* isolate,
const char* builtin_name) {
- i::Handle<i::String> symbol =
- isolate->factory()->LookupUtf8Symbol(builtin_name);
+ i::Handle<i::String> string =
+ isolate->factory()->InternalizeUtf8String(builtin_name);
i::Handle<i::JSBuiltinsObject> builtins = isolate->js_builtins_object();
- return builtins->GetPropertyNoExceptionThrown(*symbol);
+ return builtins->GetPropertyNoExceptionThrown(*string);
}
@@ -2346,7 +2347,7 @@ bool Value::IsBooleanObject() const {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Value::IsBooleanObject()")) return false;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
- return obj->HasSpecificClassOf(isolate->heap()->Boolean_symbol());
+ return obj->HasSpecificClassOf(isolate->heap()->Boolean_string());
}
@@ -2538,7 +2539,7 @@ void v8::Date::CheckCast(v8::Value* that) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Date::Cast()")) return;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
- ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Date_symbol()),
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Date_string()),
"v8::Date::Cast()",
"Could not convert to date");
}
@@ -2548,7 +2549,7 @@ void v8::StringObject::CheckCast(v8::Value* that) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::StringObject::Cast()")) return;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
- ApiCheck(obj->HasSpecificClassOf(isolate->heap()->String_symbol()),
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->String_string()),
"v8::StringObject::Cast()",
"Could not convert to StringObject");
}
@@ -2558,7 +2559,7 @@ void v8::NumberObject::CheckCast(v8::Value* that) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::NumberObject::Cast()")) return;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
- ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Number_symbol()),
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Number_string()),
"v8::NumberObject::Cast()",
"Could not convert to NumberObject");
}
@@ -2568,7 +2569,7 @@ void v8::BooleanObject::CheckCast(v8::Value* that) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::BooleanObject::Cast()")) return;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
- ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Boolean_symbol()),
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Boolean_string()),
"v8::BooleanObject::Cast()",
"Could not convert to BooleanObject");
}
@@ -3358,10 +3359,10 @@ bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
- i::Handle<i::String> key_symbol = FACTORY->LookupSymbol(key_obj);
+ i::Handle<i::String> key_string = FACTORY->InternalizeString(key_obj);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
i::Handle<i::Object> result =
- i::JSObject::SetHiddenProperty(self, key_symbol, value_obj);
+ i::JSObject::SetHiddenProperty(self, key_string, value_obj);
return *result == *self;
}
@@ -3373,8 +3374,8 @@ v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
- i::Handle<i::String> key_symbol = FACTORY->LookupSymbol(key_obj);
- i::Handle<i::Object> result(self->GetHiddenProperty(*key_symbol), isolate);
+ i::Handle<i::String> key_string = FACTORY->InternalizeString(key_obj);
+ i::Handle<i::Object> result(self->GetHiddenProperty(*key_string), isolate);
if (result->IsUndefined()) return v8::Local<v8::Value>();
return Utils::ToLocal(result);
}
@@ -3387,8 +3388,8 @@ bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
- i::Handle<i::String> key_symbol = FACTORY->LookupSymbol(key_obj);
- self->DeleteHiddenProperty(*key_symbol);
+ i::Handle<i::String> key_string = FACTORY->InternalizeString(key_obj);
+ self->DeleteHiddenProperty(*key_string);
return true;
}
@@ -4822,7 +4823,7 @@ Local<String> v8::String::Empty() {
return v8::Local<String>();
}
LOG_API(isolate, "String::Empty()");
- return Utils::ToLocal(isolate->factory()->empty_symbol());
+ return Utils::ToLocal(isolate->factory()->empty_string());
}
@@ -4947,7 +4948,7 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
}
CHECK(resource && resource->data());
bool result = obj->MakeExternal(resource);
- if (result && !obj->IsSymbol()) {
+ if (result && !obj->IsInternalizedString()) {
isolate->heap()->external_string_table()->AddString(*obj);
}
return result;
@@ -4984,7 +4985,7 @@ bool v8::String::MakeExternal(
}
CHECK(resource && resource->data());
bool result = obj->MakeExternal(resource);
- if (result && !obj->IsSymbol()) {
+ if (result && !obj->IsInternalizedString()) {
isolate->heap()->external_string_table()->AddString(*obj);
}
return result;
@@ -5120,8 +5121,9 @@ void v8::Date::DateTimeConfigurationChangeNotification() {
i::HandleScope scope(isolate);
// Get the function ResetDateCache (defined in date.js).
- i::Handle<i::String> func_name_str = isolate->factory()->LookupOneByteSymbol(
- STATIC_ASCII_VECTOR("ResetDateCache"));
+ i::Handle<i::String> func_name_str =
+ isolate->factory()->InternalizeOneByteString(
+ STATIC_ASCII_VECTOR("ResetDateCache"));
i::MaybeObject* result =
isolate->js_builtins_object()->GetProperty(*func_name_str);
i::Object* object_func;
@@ -5151,7 +5153,7 @@ static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) {
if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm';
if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
ASSERT(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf)));
- return FACTORY->LookupOneByteSymbol(
+ return FACTORY->InternalizeOneByteString(
i::Vector<const uint8_t>(flags_buf, num_flags));
}
@@ -5256,7 +5258,7 @@ Local<String> v8::String::NewSymbol(const char* data, int length) {
LOG_API(isolate, "String::NewSymbol(char)");
ENTER_V8(isolate);
if (length == -1) length = i::StrLength(data);
- i::Handle<i::String> result = isolate->factory()->LookupUtf8Symbol(
+ i::Handle<i::String> result = isolate->factory()->InternalizeUtf8String(
i::Vector<const char>(data, length));
return Utils::ToLocal(result);
}
@@ -5951,7 +5953,7 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
i::Debug* isolate_debug = isolate->debug();
isolate_debug->Load();
i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
- i::Handle<i::String> name = isolate->factory()->LookupOneByteSymbol(
+ i::Handle<i::String> name = isolate->factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("MakeMirror"));
i::Handle<i::Object> fun_obj = i::GetProperty(debug, name);
i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
@@ -6014,11 +6016,11 @@ Handle<String> CpuProfileNode::GetFunctionName() const {
const i::CodeEntry* entry = node->entry();
if (!entry->has_name_prefix()) {
return Handle<String>(ToApi<String>(
- isolate->factory()->LookupUtf8Symbol(entry->name())));
+ isolate->factory()->InternalizeUtf8String(entry->name())));
} else {
return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
- isolate->factory()->LookupUtf8Symbol(entry->name_prefix()),
- isolate->factory()->LookupUtf8Symbol(entry->name()))));
+ isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
+ isolate->factory()->InternalizeUtf8String(entry->name()))));
}
}
@@ -6027,7 +6029,7 @@ Handle<String> CpuProfileNode::GetScriptResourceName() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
- return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
+ return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
node->entry()->resource_name())));
}
@@ -6113,7 +6115,7 @@ Handle<String> CpuProfile::GetTitle() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
- return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
+ return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
profile->title())));
}
@@ -6210,12 +6212,12 @@ Handle<Value> HeapGraphEdge::GetName() const {
case i::HeapGraphEdge::kInternal:
case i::HeapGraphEdge::kProperty:
case i::HeapGraphEdge::kShortcut:
- return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
- edge->name())));
+ return Handle<String>(ToApi<String>(
+ isolate->factory()->InternalizeUtf8String(edge->name())));
case i::HeapGraphEdge::kElement:
case i::HeapGraphEdge::kHidden:
- return Handle<Number>(ToApi<Number>(isolate->factory()->NewNumberFromInt(
- edge->index())));
+ return Handle<Number>(ToApi<Number>(
+ isolate->factory()->NewNumberFromInt(edge->index())));
default: UNREACHABLE();
}
return v8::Undefined();
@@ -6254,7 +6256,7 @@ HeapGraphNode::Type HeapGraphNode::GetType() const {
Handle<String> HeapGraphNode::GetName() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
- return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
+ return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
ToInternal(this)->name())));
}
@@ -6333,7 +6335,7 @@ unsigned HeapSnapshot::GetUid() const {
Handle<String> HeapSnapshot::GetTitle() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
- return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
+ return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
ToInternal(this)->title())));
}
« no previous file with comments | « src/accessors.cc ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698