Rename LookupSymbol calls to use Utf8 or OneByte in names.

R=yangguo@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11597007
Patch from Dan Carney <dcarney@google.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13229 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2012-12-17 15:56:16 +00:00
parent 6e953d51af
commit 19a6575ea3
25 changed files with 226 additions and 180 deletions

View File

@ -1953,7 +1953,7 @@ 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()->LookupAsciiSymbol(name);
i::Handle<i::String> fmt_str = isolate->factory()->LookupUtf8Symbol(name);
i::Object* object_fun =
isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str);
i::Handle<i::JSFunction> fun =
@ -2369,7 +2369,7 @@ bool Value::IsNumberObject() const {
static i::Object* LookupBuiltin(i::Isolate* isolate,
const char* builtin_name) {
i::Handle<i::String> symbol =
isolate->factory()->LookupAsciiSymbol(builtin_name);
isolate->factory()->LookupUtf8Symbol(builtin_name);
i::Handle<i::JSBuiltinsObject> builtins = isolate->js_builtins_object();
return builtins->GetPropertyNoExceptionThrown(*symbol);
}
@ -5129,8 +5129,8 @@ 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()->LookupAsciiSymbol("ResetDateCache");
i::Handle<i::String> func_name_str = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("ResetDateCache"));
i::MaybeObject* result =
isolate->js_builtins_object()->GetProperty(*func_name_str);
i::Object* object_func;
@ -5160,7 +5160,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->LookupSymbol(
return FACTORY->LookupOneByteSymbol(
i::Vector<const char>(flags_buf, num_flags));
}
@ -5265,8 +5265,8 @@ 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()->LookupSymbol(i::Vector<const char>(data, length));
i::Handle<i::String> result = isolate->factory()->LookupUtf8Symbol(
i::Vector<const char>(data, length));
return Utils::ToLocal(result);
}
@ -5960,8 +5960,8 @@ 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()->LookupAsciiSymbol("MakeMirror");
i::Handle<i::String> name = isolate->factory()->LookupOneByteSymbol(
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);
v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
@ -6023,11 +6023,11 @@ Handle<String> CpuProfileNode::GetFunctionName() const {
const i::CodeEntry* entry = node->entry();
if (!entry->has_name_prefix()) {
return Handle<String>(ToApi<String>(
isolate->factory()->LookupAsciiSymbol(entry->name())));
isolate->factory()->LookupUtf8Symbol(entry->name())));
} else {
return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
isolate->factory()->LookupAsciiSymbol(entry->name_prefix()),
isolate->factory()->LookupAsciiSymbol(entry->name()))));
isolate->factory()->LookupUtf8Symbol(entry->name_prefix()),
isolate->factory()->LookupUtf8Symbol(entry->name()))));
}
}
@ -6036,7 +6036,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()->LookupAsciiSymbol(
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
node->entry()->resource_name())));
}
@ -6122,7 +6122,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()->LookupAsciiSymbol(
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
profile->title())));
}
@ -6219,7 +6219,7 @@ Handle<Value> HeapGraphEdge::GetName() const {
case i::HeapGraphEdge::kInternal:
case i::HeapGraphEdge::kProperty:
case i::HeapGraphEdge::kShortcut:
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
edge->name())));
case i::HeapGraphEdge::kElement:
case i::HeapGraphEdge::kHidden:
@ -6263,7 +6263,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()->LookupAsciiSymbol(
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
ToInternal(this)->name())));
}
@ -6342,7 +6342,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()->LookupAsciiSymbol(
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
ToInternal(this)->title())));
}

View File

@ -353,7 +353,7 @@ static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
bool is_ecma_native) {
Isolate* isolate = target->GetIsolate();
Factory* factory = isolate->factory();
Handle<String> symbol = factory->LookupAsciiSymbol(name);
Handle<String> symbol = factory->LookupUtf8Symbol(name);
Handle<Code> call_code = Handle<Code>(isolate->builtins()->builtin(call));
Handle<JSFunction> function = prototype.is_null() ?
factory->NewFunctionWithoutPrototype(symbol, call_code) :
@ -488,7 +488,8 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
// Allocate the empty function as the prototype for function ECMAScript
// 262 15.3.4.
Handle<String> symbol = factory->LookupAsciiSymbol("Empty");
Handle<String> symbol =
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("Empty"));
Handle<JSFunction> empty_function =
factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE);
@ -570,7 +571,8 @@ void Genesis::SetStrictFunctionInstanceDescriptor(
// ECMAScript 5th Edition, 13.2.3
Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
if (throw_type_error_function.is_null()) {
Handle<String> name = factory()->LookupAsciiSymbol("ThrowTypeError");
Handle<String> name = factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("ThrowTypeError"));
throw_type_error_function =
factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE);
Handle<Code> code(isolate()->builtins()->builtin(
@ -771,7 +773,8 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
factory()->OuterGlobalObject);
}
Handle<String> global_name = factory()->LookupAsciiSymbol("global");
Handle<String> global_name = factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("global"));
global_proxy_function->shared()->set_instance_class_name(*global_name);
global_proxy_function->initial_map()->set_is_access_check_needed(true);
@ -811,7 +814,8 @@ void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) {
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
ForceSetProperty(builtins_global,
factory()->LookupAsciiSymbol("global"),
factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("global")),
inner_global,
attributes);
// Set up the reference from the global object to the builtins object.
@ -1049,7 +1053,8 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
// Make sure we can recognize argument objects at runtime.
// This is done by introducing an anonymous function with
// class_name equals 'Arguments'.
Handle<String> symbol = factory->LookupAsciiSymbol("Arguments");
Handle<String> symbol = factory->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("Arguments"));
Handle<Code> code = Handle<Code>(
isolate->builtins()->builtin(Builtins::kIllegal));
Handle<JSObject> prototype =
@ -1207,7 +1212,8 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
code,
true);
Handle<String> name = factory->LookupAsciiSymbol("context_extension");
Handle<String> name =
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("context_extension"));
context_extension_fun->shared()->set_instance_class_name(*name);
native_context()->set_context_extension_function(*context_extension_fun);
}
@ -1381,11 +1387,12 @@ bool Genesis::CompileScriptCached(Vector<const char> name,
}
#define INSTALL_NATIVE(Type, name, var) \
Handle<String> var##_name = factory()->LookupAsciiSymbol(name); \
Object* var##_native = \
native_context()->builtins()->GetPropertyNoExceptionThrown( \
*var##_name); \
#define INSTALL_NATIVE(Type, name, var) \
Handle<String> var##_name = \
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR(name)); \
Object* var##_native = \
native_context()->builtins()->GetPropertyNoExceptionThrown( \
*var##_name); \
native_context()->set_##var(Type::cast(var##_native));
@ -1439,7 +1446,8 @@ bool Genesis::InstallNatives() {
JS_BUILTINS_OBJECT_TYPE,
JSBuiltinsObject::kSize, code, true);
Handle<String> name = factory()->LookupAsciiSymbol("builtins");
Handle<String> name =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("builtins"));
builtins_fun->shared()->set_instance_class_name(*name);
builtins_fun->initial_map()->set_dictionary_map(true);
builtins_fun->initial_map()->set_prototype(heap()->null_value());
@ -1458,7 +1466,8 @@ bool Genesis::InstallNatives() {
// global object.
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
Handle<String> global_symbol = factory()->LookupAsciiSymbol("global");
Handle<String> global_symbol =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("global"));
Handle<Object> global_obj(native_context()->global_object());
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
@ -1501,41 +1510,49 @@ bool Genesis::InstallNatives() {
Handle<Foreign> script_source(
factory()->NewForeign(&Accessors::ScriptSource));
Handle<Foreign> script_name(factory()->NewForeign(&Accessors::ScriptName));
Handle<String> id_symbol(factory()->LookupAsciiSymbol("id"));
Handle<String> id_symbol(factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("id")));
Handle<Foreign> script_id(factory()->NewForeign(&Accessors::ScriptId));
Handle<String> line_offset_symbol(
factory()->LookupAsciiSymbol("line_offset"));
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("line_offset")));
Handle<Foreign> script_line_offset(
factory()->NewForeign(&Accessors::ScriptLineOffset));
Handle<String> column_offset_symbol(
factory()->LookupAsciiSymbol("column_offset"));
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("column_offset")));
Handle<Foreign> script_column_offset(
factory()->NewForeign(&Accessors::ScriptColumnOffset));
Handle<String> data_symbol(factory()->LookupAsciiSymbol("data"));
Handle<String> data_symbol(factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("data")));
Handle<Foreign> script_data(factory()->NewForeign(&Accessors::ScriptData));
Handle<String> type_symbol(factory()->LookupAsciiSymbol("type"));
Handle<String> type_symbol(factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("type")));
Handle<Foreign> script_type(factory()->NewForeign(&Accessors::ScriptType));
Handle<String> compilation_type_symbol(
factory()->LookupAsciiSymbol("compilation_type"));
factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("compilation_type")));
Handle<Foreign> script_compilation_type(
factory()->NewForeign(&Accessors::ScriptCompilationType));
Handle<String> line_ends_symbol(factory()->LookupAsciiSymbol("line_ends"));
Handle<String> line_ends_symbol(factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("line_ends")));
Handle<Foreign> script_line_ends(
factory()->NewForeign(&Accessors::ScriptLineEnds));
Handle<String> context_data_symbol(
factory()->LookupAsciiSymbol("context_data"));
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("context_data")));
Handle<Foreign> script_context_data(
factory()->NewForeign(&Accessors::ScriptContextData));
Handle<String> eval_from_script_symbol(
factory()->LookupAsciiSymbol("eval_from_script"));
factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("eval_from_script")));
Handle<Foreign> script_eval_from_script(
factory()->NewForeign(&Accessors::ScriptEvalFromScript));
Handle<String> eval_from_script_position_symbol(
factory()->LookupAsciiSymbol("eval_from_script_position"));
factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("eval_from_script_position")));
Handle<Foreign> script_eval_from_script_position(
factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition));
Handle<String> eval_from_function_name_symbol(
factory()->LookupAsciiSymbol("eval_from_function_name"));
factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("eval_from_function_name")));
Handle<Foreign> script_eval_from_function_name(
factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName));
PropertyAttributes attribs =
@ -1855,13 +1872,13 @@ static Handle<JSObject> ResolveBuiltinIdHolder(
const char* period_pos = strchr(holder_expr, '.');
if (period_pos == NULL) {
return Handle<JSObject>::cast(
GetProperty(global, factory->LookupAsciiSymbol(holder_expr)));
GetProperty(global, factory->LookupUtf8Symbol(holder_expr)));
}
ASSERT_EQ(".prototype", period_pos);
Vector<const char> property(holder_expr,
static_cast<int>(period_pos - holder_expr));
Handle<JSFunction> function = Handle<JSFunction>::cast(
GetProperty(global, factory->LookupSymbol(property)));
GetProperty(global, factory->LookupUtf8Symbol(property)));
return Handle<JSObject>(JSObject::cast(function->prototype()));
}
@ -1870,7 +1887,7 @@ static void InstallBuiltinFunctionId(Handle<JSObject> holder,
const char* function_name,
BuiltinFunctionId id) {
Factory* factory = holder->GetIsolate()->factory();
Handle<String> name = factory->LookupAsciiSymbol(function_name);
Handle<String> name = factory->LookupUtf8Symbol(function_name);
Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
Handle<JSFunction> function(JSFunction::cast(function_object));
function->shared()->set_function_data(Smi::FromInt(id));
@ -1961,7 +1978,7 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
native_context->global_object()));
// Expose the natives in global if a name for it is specified.
if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
Handle<String> natives = factory->LookupAsciiSymbol(FLAG_expose_natives_as);
Handle<String> natives = factory->LookupUtf8Symbol(FLAG_expose_natives_as);
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
global, natives,
@ -1971,7 +1988,8 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
Handle<Object> Error = GetProperty(global, "Error");
if (Error->IsJSObject()) {
Handle<String> name = factory->LookupAsciiSymbol("stackTraceLimit");
Handle<String> name =
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stackTraceLimit"));
Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit));
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
@ -1993,7 +2011,7 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
native_context->security_token());
Handle<String> debug_string =
factory->LookupAsciiSymbol(FLAG_expose_debug_as);
factory->LookupUtf8Symbol(FLAG_expose_debug_as);
Handle<Object> global_proxy(debug->debug_context()->global_proxy());
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
@ -2137,7 +2155,7 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
Factory* factory = builtins->GetIsolate()->factory();
for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
Handle<String> name = factory->LookupAsciiSymbol(Builtins::GetName(id));
Handle<String> name = factory->LookupUtf8Symbol(Builtins::GetName(id));
Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
Handle<JSFunction> function
= Handle<JSFunction>(JSFunction::cast(function_object));

View File

@ -836,7 +836,8 @@ bool Debug::Load() {
isolate_->set_context(*context);
// Expose the builtins object in the debugger context.
Handle<String> key = isolate_->factory()->LookupAsciiSymbol("builtins");
Handle<String> key = isolate_->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("builtins"));
Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object());
RETURN_IF_EMPTY_HANDLE_VALUE(
isolate_,
@ -1100,7 +1101,8 @@ bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
// Get the function IsBreakPointTriggered (defined in debug-debugger.js).
Handle<String> is_break_point_triggered_symbol =
factory->LookupAsciiSymbol("IsBreakPointTriggered");
factory->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("IsBreakPointTriggered"));
Handle<JSFunction> check_break_point =
Handle<JSFunction>(JSFunction::cast(
debug_context()->global_object()->GetPropertyNoExceptionThrown(
@ -2425,8 +2427,8 @@ void Debug::ClearMirrorCache() {
ASSERT(isolate_->context() == *Debug::debug_context());
// Clear the mirror cache.
Handle<String> function_name =
isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache"));
Handle<String> function_name = isolate_->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("ClearMirrorCache"));
Handle<Object> fun(
Isolate::Current()->global_object()->GetPropertyNoExceptionThrown(
*function_name));
@ -2554,7 +2556,7 @@ Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
// Create the execution state object.
Handle<String> constructor_str =
isolate_->factory()->LookupSymbol(constructor_name);
isolate_->factory()->LookupUtf8Symbol(constructor_name);
Handle<Object> constructor(
isolate_->global_object()->GetPropertyNoExceptionThrown(
*constructor_str));
@ -2785,7 +2787,8 @@ void Debugger::OnAfterCompile(Handle<Script> script,
// Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
Handle<String> update_script_break_points_symbol =
isolate_->factory()->LookupAsciiSymbol("UpdateScriptBreakPoints");
isolate_->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("UpdateScriptBreakPoints"));
Handle<Object> update_script_break_points =
Handle<Object>(debug->debug_context()->global_object()->
GetPropertyNoExceptionThrown(*update_script_break_points_symbol));

View File

@ -158,9 +158,9 @@ Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() {
// Symbols are created in the old generation (data space).
Handle<String> Factory::LookupSymbol(Vector<const char> string) {
Handle<String> Factory::LookupUtf8Symbol(Vector<const char> string) {
CALL_HEAP_FUNCTION(isolate(),
isolate()->heap()->LookupSymbol(string),
isolate()->heap()->LookupUtf8Symbol(string),
String);
}
@ -171,18 +171,18 @@ Handle<String> Factory::LookupSymbol(Handle<String> string) {
String);
}
Handle<String> Factory::LookupAsciiSymbol(Vector<const char> string) {
Handle<String> Factory::LookupOneByteSymbol(Vector<const char> string) {
CALL_HEAP_FUNCTION(isolate(),
isolate()->heap()->LookupAsciiSymbol(string),
isolate()->heap()->LookupOneByteSymbol(string),
String);
}
Handle<String> Factory::LookupAsciiSymbol(Handle<SeqOneByteString> string,
Handle<String> Factory::LookupOneByteSymbol(Handle<SeqOneByteString> string,
int from,
int length) {
CALL_HEAP_FUNCTION(isolate(),
isolate()->heap()->LookupAsciiSymbol(string,
isolate()->heap()->LookupOneByteSymbol(string,
from,
length),
String);
@ -741,7 +741,7 @@ Handle<String> Factory::EmergencyNewError(const char* type,
Handle<Object> Factory::NewError(const char* maker,
const char* type,
Handle<JSArray> args) {
Handle<String> make_str = LookupAsciiSymbol(maker);
Handle<String> make_str = LookupUtf8Symbol(maker);
Handle<Object> fun_obj(
isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str));
// If the builtins haven't been properly configured yet this error
@ -750,7 +750,7 @@ Handle<Object> Factory::NewError(const char* maker,
return EmergencyNewError(type, args);
}
Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj);
Handle<Object> type_obj = LookupAsciiSymbol(type);
Handle<Object> type_obj = LookupUtf8Symbol(type);
Handle<Object> argv[] = { type_obj, args };
// Invoke the JavaScript factory method. If an exception is thrown while
@ -772,7 +772,7 @@ Handle<Object> Factory::NewError(Handle<String> message) {
Handle<Object> Factory::NewError(const char* constructor,
Handle<String> message) {
Handle<String> constr = LookupAsciiSymbol(constructor);
Handle<String> constr = LookupUtf8Symbol(constructor);
Handle<JSFunction> fun = Handle<JSFunction>(
JSFunction::cast(isolate()->js_builtins_object()->
GetPropertyNoExceptionThrown(*constr)));

View File

@ -79,16 +79,16 @@ class Factory {
Handle<TypeFeedbackInfo> NewTypeFeedbackInfo();
Handle<String> LookupSymbol(Vector<const char> str);
Handle<String> LookupUtf8Symbol(Vector<const char> str);
Handle<String> LookupUtf8Symbol(const char* str) {
return LookupUtf8Symbol(CStrVector(str));
}
Handle<String> LookupSymbol(Handle<String> str);
Handle<String> LookupAsciiSymbol(Vector<const char> str);
Handle<String> LookupAsciiSymbol(Handle<SeqOneByteString>,
Handle<String> LookupOneByteSymbol(Vector<const char> str);
Handle<String> LookupOneByteSymbol(Handle<SeqOneByteString>,
int from,
int length);
Handle<String> LookupTwoByteSymbol(Vector<const uc16> str);
Handle<String> LookupAsciiSymbol(const char* str) {
return LookupSymbol(CStrVector(str));
}
// String creation functions. Most of the string creation functions take

View File

@ -282,7 +282,7 @@ Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object,
Handle<Object> GetProperty(Handle<JSReceiver> obj,
const char* name) {
Isolate* isolate = obj->GetIsolate();
Handle<String> str = isolate->factory()->LookupAsciiSymbol(name);
Handle<String> str = isolate->factory()->LookupUtf8Symbol(name);
CALL_HEAP_FUNCTION(isolate, obj->GetProperty(*str), Object);
}
@ -596,7 +596,8 @@ v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver,
Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) {
Isolate* isolate = script->GetIsolate();
Handle<String> name_or_source_url_key =
isolate->factory()->LookupAsciiSymbol("nameOrSourceURL");
isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("nameOrSourceURL"));
Handle<JSValue> script_wrapper = GetScriptWrapper(script);
Handle<Object> property = GetProperty(script_wrapper,
name_or_source_url_key);

View File

@ -2776,7 +2776,7 @@ bool Heap::CreateInitialObjects() {
for (unsigned i = 0; i < ARRAY_SIZE(constant_symbol_table); i++) {
{ MaybeObject* maybe_obj =
LookupAsciiSymbol(constant_symbol_table[i].contents);
LookupUtf8Symbol(constant_symbol_table[i].contents);
if (!maybe_obj->ToObject(&obj)) return false;
}
roots_[constant_symbol_table[i].index] = String::cast(obj);
@ -3610,7 +3610,8 @@ MaybeObject* Heap::LookupSingleCharacterStringFromCode(uint16_t code) {
char buffer[1];
buffer[0] = static_cast<char>(code);
Object* result;
MaybeObject* maybe_result = LookupSymbol(Vector<const char>(buffer, 1));
MaybeObject* maybe_result =
LookupOneByteSymbol(Vector<const char>(buffer, 1));
if (!maybe_result->ToObject(&result)) return maybe_result;
single_character_string_cache()->set(code, result);
@ -4461,7 +4462,7 @@ MaybeObject* Heap::ReinitializeJSReceiver(
SharedFunctionInfo* shared = NULL;
if (type == JS_FUNCTION_TYPE) {
String* name;
maybe = LookupAsciiSymbol("<freezing call trap>");
maybe = LookupOneByteSymbol(STATIC_ASCII_VECTOR("<freezing call trap>"));
if (!maybe->To<String>(&name)) return maybe;
maybe = AllocateSharedFunctionInfo(name);
if (!maybe->To<SharedFunctionInfo>(&shared)) return maybe;
@ -5554,11 +5555,11 @@ void Heap::Verify() {
#endif
MaybeObject* Heap::LookupSymbol(Vector<const char> string) {
MaybeObject* Heap::LookupUtf8Symbol(Vector<const char> string) {
Object* symbol = NULL;
Object* new_table;
{ MaybeObject* maybe_new_table =
symbol_table()->LookupSymbol(string, &symbol);
symbol_table()->LookupUtf8Symbol(string, &symbol);
if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table;
}
// Can't use set_symbol_table because SymbolTable::cast knows that
@ -5569,11 +5570,11 @@ MaybeObject* Heap::LookupSymbol(Vector<const char> string) {
}
MaybeObject* Heap::LookupAsciiSymbol(Vector<const char> string) {
MaybeObject* Heap::LookupOneByteSymbol(Vector<const char> string) {
Object* symbol = NULL;
Object* new_table;
{ MaybeObject* maybe_new_table =
symbol_table()->LookupAsciiSymbol(string, &symbol);
symbol_table()->LookupOneByteSymbol(string, &symbol);
if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table;
}
// Can't use set_symbol_table because SymbolTable::cast knows that
@ -5584,13 +5585,13 @@ MaybeObject* Heap::LookupAsciiSymbol(Vector<const char> string) {
}
MaybeObject* Heap::LookupAsciiSymbol(Handle<SeqOneByteString> string,
MaybeObject* Heap::LookupOneByteSymbol(Handle<SeqOneByteString> string,
int from,
int length) {
Object* symbol = NULL;
Object* new_table;
{ MaybeObject* maybe_new_table =
symbol_table()->LookupSubStringAsciiSymbol(string,
symbol_table()->LookupSubStringOneByteSymbol(string,
from,
length,
&symbol);

View File

@ -1066,14 +1066,14 @@ class Heap {
// Returns Failure::RetryAfterGC(requested_bytes, space) if allocation
// failed.
// Please note this function does not perform a garbage collection.
MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str);
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Vector<const char> str);
MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str);
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(const char* str) {
return LookupSymbol(CStrVector(str));
MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str);
MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(const char* str) {
return LookupUtf8Symbol(CStrVector(str));
}
MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const char> str);
MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str);
MUST_USE_RESULT MaybeObject* LookupSymbol(String* str);
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(
MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(
Handle<SeqOneByteString> string, int from, int length);
bool LookupSymbolIfExists(String* str, String** symbol);

View File

@ -657,15 +657,21 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
int limit = Max(frame_limit, 0);
Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit);
Handle<String> column_key = factory()->LookupAsciiSymbol("column");
Handle<String> line_key = factory()->LookupAsciiSymbol("lineNumber");
Handle<String> script_key = factory()->LookupAsciiSymbol("scriptName");
Handle<String> column_key =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("column"));
Handle<String> line_key =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("lineNumber"));
Handle<String> script_key =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("scriptName"));
Handle<String> script_name_or_source_url_key =
factory()->LookupAsciiSymbol("scriptNameOrSourceURL");
Handle<String> function_key = factory()->LookupAsciiSymbol("functionName");
Handle<String> eval_key = factory()->LookupAsciiSymbol("isEval");
factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("scriptNameOrSourceURL"));
Handle<String> function_key =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("functionName"));
Handle<String> eval_key =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("isEval"));
Handle<String> constructor_key =
factory()->LookupAsciiSymbol("isConstructor");
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("isConstructor"));
StackTraceFrameIterator it(this);
int frames_seen = 0;
@ -1155,7 +1161,8 @@ bool Isolate::ShouldReportException(bool* can_be_caught_externally,
bool Isolate::IsErrorObject(Handle<Object> obj) {
if (!obj->IsJSObject()) return false;
String* error_key = *(factory()->LookupAsciiSymbol("$Error"));
String* error_key =
*(factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("$Error")));
Object* error_constructor =
js_builtins_object()->GetPropertyNoExceptionThrown(error_key);
@ -1236,7 +1243,8 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
bool failed = false;
exception_arg = Execution::ToDetailString(exception_arg, &failed);
if (failed) {
exception_arg = factory()->LookupAsciiSymbol("exception");
exception_arg =
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("exception"));
}
}
Handle<Object> message_obj = MessageHandler::MakeMessageObject(

View File

@ -685,9 +685,7 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
int length = position_ - beg_pos;
Handle<String> result;
if (seq_ascii && is_symbol) {
result = factory()->LookupAsciiSymbol(seq_source_,
beg_pos,
length);
result = factory()->LookupOneByteSymbol(seq_source_, beg_pos, length);
} else {
result = factory()->NewRawOneByteString(length, pretenure_);
char* dest = SeqOneByteString::cast(*result)->GetChars();

View File

@ -216,7 +216,8 @@ BasicJsonStringifier::BasicJsonStringifier(Isolate* isolate)
factory_->ToObject(factory_->empty_string()));
part_length_ = kInitialPartLength;
current_part_ = factory_->NewRawOneByteString(kInitialPartLength);
tojson_symbol_ = factory_->LookupAsciiSymbol("toJSON");
tojson_symbol_ =
factory_->LookupOneByteSymbol(STATIC_ASCII_VECTOR("toJSON"));
stack_ = factory_->NewJSArray(8);
}

View File

@ -952,11 +952,11 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
Factory* factory = isolate->factory();
Handle<String> start_pos_key =
factory->LookupAsciiSymbol("startPosition");
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("startPosition"));
Handle<String> end_pos_key =
factory->LookupAsciiSymbol("endPosition");
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("endPosition"));
Handle<String> script_obj_key =
factory->LookupAsciiSymbol("scriptObject");
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("scriptObject"));
Handle<Smi> start_pos(Smi::FromInt(message_location.start_pos()));
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()));
Handle<JSValue> script_obj = GetScriptWrapper(message_location.script());

View File

@ -61,7 +61,7 @@ Handle<JSMessageObject> MessageHandler::MakeMessageObject(
Vector< Handle<Object> > args,
Handle<String> stack_trace,
Handle<JSArray> stack_frames) {
Handle<String> type_handle = FACTORY->LookupAsciiSymbol(type);
Handle<String> type_handle = FACTORY->LookupUtf8Symbol(type);
Handle<FixedArray> arguments_elements =
FACTORY->NewFixedArray(args.length());
for (int i = 0; i < args.length(); i++) {
@ -149,7 +149,8 @@ void MessageHandler::ReportMessage(Isolate* isolate,
Handle<String> MessageHandler::GetMessage(Handle<Object> data) {
Handle<String> fmt_str = FACTORY->LookupAsciiSymbol("FormatMessage");
Handle<String> fmt_str =
FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("FormatMessage"));
Handle<JSFunction> fun =
Handle<JSFunction>(
JSFunction::cast(
@ -168,7 +169,7 @@ Handle<String> MessageHandler::GetMessage(Handle<Object> data) {
&caught_exception);
if (caught_exception || !result->IsString()) {
return FACTORY->LookupAsciiSymbol("<error>");
return FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("<error>"));
}
Handle<String> result_string = Handle<String>::cast(result);
// A string that has been obtained from JS code in this way is

View File

@ -1753,7 +1753,7 @@ void JSObject::EnqueueChangeRecord(Handle<JSObject> object,
Handle<Object> old_value) {
Isolate* isolate = object->GetIsolate();
HandleScope scope;
Handle<String> type = isolate->factory()->LookupAsciiSymbol(type_str);
Handle<String> type = isolate->factory()->LookupUtf8Symbol(type_str);
if (object->IsJSGlobalObject()) {
object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate);
}
@ -2656,15 +2656,16 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
if (has_pending_exception) return Failure::Exception();
// [[GetProperty]] requires to check that all properties are configurable.
Handle<String> configurable_name =
isolate->factory()->LookupAsciiSymbol("configurable_");
Handle<String> configurable_name = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("configurable_"));
Handle<Object> configurable(
v8::internal::GetProperty(desc, configurable_name));
ASSERT(!isolate->has_pending_exception());
ASSERT(configurable->IsTrue() || configurable->IsFalse());
if (configurable->IsFalse()) {
Handle<String> trap =
isolate->factory()->LookupAsciiSymbol("getPropertyDescriptor");
isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("getPropertyDescriptor"));
Handle<Object> args[] = { handler, trap, name };
Handle<Object> error = isolate->factory()->NewTypeError(
"proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
@ -2674,13 +2675,15 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
// Check for DataDescriptor.
Handle<String> hasWritable_name =
isolate->factory()->LookupAsciiSymbol("hasWritable_");
isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("hasWritable_"));
Handle<Object> hasWritable(v8::internal::GetProperty(desc, hasWritable_name));
ASSERT(!isolate->has_pending_exception());
ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse());
if (hasWritable->IsTrue()) {
Handle<String> writable_name =
isolate->factory()->LookupAsciiSymbol("writable_");
isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("writable_"));
Handle<Object> writable(v8::internal::GetProperty(desc, writable_name));
ASSERT(!isolate->has_pending_exception());
ASSERT(writable->IsTrue() || writable->IsFalse());
@ -2694,7 +2697,8 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
}
// We have an AccessorDescriptor.
Handle<String> set_name = isolate->factory()->LookupAsciiSymbol("set_");
Handle<String> set_name = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("set_"));
Handle<Object> setter(v8::internal::GetProperty(desc, set_name));
ASSERT(!isolate->has_pending_exception());
if (!setter->IsUndefined()) {
@ -2726,7 +2730,8 @@ MUST_USE_RESULT MaybeObject* JSProxy::DeletePropertyWithHandler(
Object* bool_result = result->ToBoolean();
if (mode == STRICT_DELETION && bool_result == GetHeap()->false_value()) {
Handle<Object> handler(receiver->handler());
Handle<String> trap_name = isolate->factory()->LookupAsciiSymbol("delete");
Handle<String> trap_name = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("delete"));
Handle<Object> args[] = { handler, trap_name };
Handle<Object> error = isolate->factory()->NewTypeError(
"handler_failed", HandleVector(args, ARRAY_SIZE(args)));
@ -2772,19 +2777,22 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
if (has_pending_exception) return NONE;
// Convert result to PropertyAttributes.
Handle<String> enum_n = isolate->factory()->LookupAsciiSymbol("enumerable");
Handle<String> enum_n = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("enumerable"));
Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_n));
if (isolate->has_pending_exception()) return NONE;
Handle<String> conf_n = isolate->factory()->LookupAsciiSymbol("configurable");
Handle<String> conf_n = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("configurable"));
Handle<Object> configurable(v8::internal::GetProperty(desc, conf_n));
if (isolate->has_pending_exception()) return NONE;
Handle<String> writ_n = isolate->factory()->LookupAsciiSymbol("writable");
Handle<String> writ_n = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("writable"));
Handle<Object> writable(v8::internal::GetProperty(desc, writ_n));
if (isolate->has_pending_exception()) return NONE;
if (configurable->IsFalse()) {
Handle<String> trap =
isolate->factory()->LookupAsciiSymbol("getPropertyDescriptor");
Handle<String> trap = isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("getPropertyDescriptor"));
Handle<Object> args[] = { handler, trap, name };
Handle<Object> error = isolate->factory()->NewTypeError(
"proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
@ -2844,7 +2852,7 @@ MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name,
Isolate* isolate = GetIsolate();
Handle<Object> handler(this->handler());
Handle<String> trap_name = isolate->factory()->LookupAsciiSymbol(name);
Handle<String> trap_name = isolate->factory()->LookupUtf8Symbol(name);
Handle<Object> trap(v8::internal::GetProperty(handler, trap_name));
if (isolate->has_pending_exception()) return trap;
@ -8326,7 +8334,7 @@ MaybeObject* Oddball::Initialize(const char* to_string,
byte kind) {
String* symbol;
{ MaybeObject* maybe_symbol =
Isolate::Current()->heap()->LookupAsciiSymbol(to_string);
Isolate::Current()->heap()->LookupUtf8Symbol(CStrVector(to_string));
if (!maybe_symbol->To(&symbol)) return maybe_symbol;
}
set_to_string(symbol);
@ -12707,21 +12715,21 @@ bool SymbolTable::LookupTwoCharsSymbolIfExists(uint32_t c1,
}
MaybeObject* SymbolTable::LookupSymbol(Vector<const char> str,
Object** s) {
MaybeObject* SymbolTable::LookupUtf8Symbol(Vector<const char> str,
Object** s) {
Utf8SymbolKey key(str, GetHeap()->HashSeed());
return LookupKey(&key, s);
}
MaybeObject* SymbolTable::LookupAsciiSymbol(Vector<const char> str,
Object** s) {
MaybeObject* SymbolTable::LookupOneByteSymbol(Vector<const char> str,
Object** s) {
AsciiSymbolKey key(str, GetHeap()->HashSeed());
return LookupKey(&key, s);
}
MaybeObject* SymbolTable::LookupSubStringAsciiSymbol(
MaybeObject* SymbolTable::LookupSubStringOneByteSymbol(
Handle<SeqOneByteString> str,
int from,
int length,

View File

@ -3026,10 +3026,11 @@ class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> {
// added. The return value is the symbol table which might have
// been enlarged. If the return value is not a failure, the symbol
// pointer *s is set to the symbol found.
MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str, Object** s);
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Vector<const char> str,
Object** s);
MUST_USE_RESULT MaybeObject* LookupSubStringAsciiSymbol(
MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str,
Object** s);
MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const char> str,
Object** s);
MUST_USE_RESULT MaybeObject* LookupSubStringOneByteSymbol(
Handle<SeqOneByteString> str,
int from,
int length,

View File

@ -254,7 +254,7 @@ Handle<String> Parser::LookupSymbol(int symbol_id) {
if (static_cast<unsigned>(symbol_id)
>= static_cast<unsigned>(symbol_cache_.length())) {
if (scanner().is_literal_ascii()) {
return isolate()->factory()->LookupAsciiSymbol(
return isolate()->factory()->LookupOneByteSymbol(
scanner().literal_ascii_string());
} else {
return isolate()->factory()->LookupTwoByteSymbol(
@ -275,7 +275,7 @@ Handle<String> Parser::LookupCachedSymbol(int symbol_id) {
Handle<String> result = symbol_cache_.at(symbol_id);
if (result.is_null()) {
if (scanner().is_literal_ascii()) {
result = isolate()->factory()->LookupAsciiSymbol(
result = isolate()->factory()->LookupOneByteSymbol(
scanner().literal_ascii_string());
} else {
result = isolate()->factory()->LookupTwoByteSymbol(
@ -3988,7 +3988,7 @@ ObjectLiteral::Property* Parser::ParseObjectLiteralGetSet(bool is_getter,
next == Token::STRING || is_keyword) {
Handle<String> name;
if (is_keyword) {
name = isolate_->factory()->LookupAsciiSymbol(Token::String(next));
name = isolate_->factory()->LookupUtf8Symbol(Token::String(next));
} else {
name = GetSymbol(CHECK_OK);
}

View File

@ -1843,7 +1843,7 @@ static Handle<JSFunction> InstallBuiltin(Isolate* isolate,
Handle<JSObject> holder,
const char* name,
Builtins::Name builtin_name) {
Handle<String> key = isolate->factory()->LookupAsciiSymbol(name);
Handle<String> key = isolate->factory()->LookupUtf8Symbol(name);
Handle<Code> code(isolate->builtins()->builtin(builtin_name));
Handle<JSFunction> optimized =
isolate->factory()->NewFunction(key,
@ -7844,8 +7844,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ForceParallelRecompile) {
HandleScope handle_scope(isolate);
ASSERT(FLAG_parallel_recompilation && FLAG_manual_parallel_recompilation);
if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
return isolate->Throw(
*isolate->factory()->LookupAsciiSymbol("Recompile queue is full."));
return isolate->Throw(*isolate->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("Recompile queue is full.")));
}
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
fun->ReplaceCode(isolate->builtins()->builtin(Builtins::kParallelRecompile));
@ -12809,7 +12809,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) {
const char* error_message =
LiveEdit::RestartFrame(it.frame(), isolate->runtime_zone());
if (error_message) {
return *(isolate->factory()->LookupAsciiSymbol(error_message));
return *(isolate->factory()->LookupUtf8Symbol(error_message));
}
return heap->true_value();
}
@ -13586,7 +13586,7 @@ MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap,
for (int i = 0; i < kNumFunctions; ++i) {
Object* name_symbol;
{ MaybeObject* maybe_name_symbol =
heap->LookupAsciiSymbol(kIntrinsicFunctions[i].name);
heap->LookupUtf8Symbol(kIntrinsicFunctions[i].name);
if (!maybe_name_symbol->ToObject(&name_symbol)) return maybe_name_symbol;
}
StringDictionary* string_dictionary = StringDictionary::cast(dictionary);

View File

@ -1386,9 +1386,8 @@ void Scope::AllocateModulesRecursively(Scope* host_scope) {
if (already_resolved()) return;
if (is_module_scope()) {
ASSERT(interface_->IsFrozen());
const char raw_name[] = ".module";
Handle<String> name = isolate_->factory()->LookupSymbol(
Vector<const char>(raw_name, StrLength(raw_name)));
Handle<String> name = isolate_->factory()->LookupOneByteSymbol(
STATIC_ASCII_VECTOR(".module"));
ASSERT(module_var_ == NULL);
module_var_ = host_scope->NewInternal(name);
++host_scope->num_modules_;

View File

@ -522,6 +522,8 @@ class ScopedVector : public Vector<T> {
DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedVector);
};
#define STATIC_ASCII_VECTOR(x) \
v8::internal::Vector<const char>(x, ARRAY_SIZE(x)-1)
inline Vector<const char> CStrVector(const char* data) {
return Vector<const char>(data, StrLength(data));

View File

@ -94,7 +94,7 @@ static void InitializeVM() {
static MaybeObject* GetGlobalProperty(const char* name) {
Handle<String> symbol = FACTORY->LookupAsciiSymbol(name);
Handle<String> symbol = FACTORY->LookupUtf8Symbol(name);
return Isolate::Current()->context()->global_object()->GetProperty(*symbol);
}
@ -102,7 +102,7 @@ static MaybeObject* GetGlobalProperty(const char* name) {
static void SetGlobalProperty(const char* name, Object* value) {
Isolate* isolate = Isolate::Current();
Handle<Object> object(value);
Handle<String> symbol = FACTORY->LookupAsciiSymbol(name);
Handle<String> symbol = FACTORY->LookupUtf8Symbol(name);
Handle<JSObject> global(Isolate::Current()->context()->global_object());
SetProperty(isolate, global, symbol, object, NONE, kNonStrictMode);
}
@ -294,13 +294,16 @@ TEST(C2JSFrames) {
Execution::Call(fun0, global, 0, NULL, &has_pending_exception);
CHECK(!has_pending_exception);
Object* foo_symbol = FACTORY->LookupAsciiSymbol("foo")->ToObjectChecked();
Object* foo_symbol =
FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("foo"))->
ToObjectChecked();
MaybeObject* fun1_object = Isolate::Current()->context()->global_object()->
GetProperty(String::cast(foo_symbol));
Handle<Object> fun1(fun1_object->ToObjectChecked());
CHECK(fun1->IsJSFunction());
Handle<Object> argv[] = { FACTORY->LookupAsciiSymbol("hello") };
Handle<Object> argv[] =
{ FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("hello")) };
Execution::Call(Handle<JSFunction>::cast(fun1),
global,
ARRAY_SIZE(argv),

View File

@ -156,7 +156,7 @@ class DebugLocalContext {
Handle<JSGlobalProxy> global(Handle<JSGlobalProxy>::cast(
v8::Utils::OpenHandle(*context_->Global())));
Handle<v8::internal::String> debug_string =
FACTORY->LookupAsciiSymbol("debug");
FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("debug"));
SetProperty(isolate, global, debug_string,
Handle<Object>(debug->debug_context()->global_proxy()), DONT_ENUM,
::v8::internal::kNonStrictMode);

View File

@ -218,10 +218,10 @@ TEST(GarbageCollection) {
// Check GC.
HEAP->CollectGarbage(NEW_SPACE);
Handle<String> name = FACTORY->LookupAsciiSymbol("theFunction");
Handle<String> prop_name = FACTORY->LookupAsciiSymbol("theSlot");
Handle<String> prop_namex = FACTORY->LookupAsciiSymbol("theSlotx");
Handle<String> obj_name = FACTORY->LookupAsciiSymbol("theObject");
Handle<String> name = FACTORY->LookupUtf8Symbol("theFunction");
Handle<String> prop_name = FACTORY->LookupUtf8Symbol("theSlot");
Handle<String> prop_namex = FACTORY->LookupUtf8Symbol("theSlotx");
Handle<String> obj_name = FACTORY->LookupUtf8Symbol("theObject");
{
v8::HandleScope inner_scope;
@ -536,12 +536,12 @@ static const char* not_so_random_string_table[] = {
static void CheckSymbols(const char** strings) {
for (const char* string = *strings; *strings != 0; string = *strings++) {
Object* a;
MaybeObject* maybe_a = HEAP->LookupAsciiSymbol(string);
// LookupAsciiSymbol may return a failure if a GC is needed.
MaybeObject* maybe_a = HEAP->LookupUtf8Symbol(string);
// LookupUtf8Symbol may return a failure if a GC is needed.
if (!maybe_a->ToObject(&a)) continue;
CHECK(a->IsSymbol());
Object* b;
MaybeObject* maybe_b = HEAP->LookupAsciiSymbol(string);
MaybeObject* maybe_b = HEAP->LookupUtf8Symbol(string);
if (!maybe_b->ToObject(&b)) continue;
CHECK_EQ(b, a);
CHECK(String::cast(b)->IsEqualTo(CStrVector(string)));
@ -561,14 +561,14 @@ TEST(FunctionAllocation) {
InitializeVM();
v8::HandleScope sc;
Handle<String> name = FACTORY->LookupAsciiSymbol("theFunction");
Handle<String> name = FACTORY->LookupUtf8Symbol("theFunction");
Handle<JSFunction> function =
FACTORY->NewFunction(name, FACTORY->undefined_value());
Handle<Map> initial_map =
FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
function->set_initial_map(*initial_map);
Handle<String> prop_name = FACTORY->LookupAsciiSymbol("theSlot");
Handle<String> prop_name = FACTORY->LookupUtf8Symbol("theSlot");
Handle<JSObject> obj = FACTORY->NewJSObject(function);
obj->SetProperty(
*prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
@ -590,8 +590,8 @@ TEST(ObjectProperties) {
JSFunction* object_function = JSFunction::cast(raw_object);
Handle<JSFunction> constructor(object_function);
Handle<JSObject> obj = FACTORY->NewJSObject(constructor);
Handle<String> first = FACTORY->LookupAsciiSymbol("first");
Handle<String> second = FACTORY->LookupAsciiSymbol("second");
Handle<String> first = FACTORY->LookupUtf8Symbol("first");
Handle<String> second = FACTORY->LookupUtf8Symbol("second");
// check for empty
CHECK(!obj->HasLocalProperty(*first));
@ -640,12 +640,12 @@ TEST(ObjectProperties) {
Handle<String> s1 = FACTORY->NewStringFromAscii(CStrVector(string1));
obj->SetProperty(
*s1, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
Handle<String> s1_symbol = FACTORY->LookupAsciiSymbol(string1);
Handle<String> s1_symbol = FACTORY->LookupUtf8Symbol(string1);
CHECK(obj->HasLocalProperty(*s1_symbol));
// check symbol and string match
const char* string2 = "fugl";
Handle<String> s2_symbol = FACTORY->LookupAsciiSymbol(string2);
Handle<String> s2_symbol = FACTORY->LookupUtf8Symbol(string2);
obj->SetProperty(
*s2_symbol, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
Handle<String> s2 = FACTORY->NewStringFromAscii(CStrVector(string2));
@ -657,14 +657,14 @@ TEST(JSObjectMaps) {
InitializeVM();
v8::HandleScope sc;
Handle<String> name = FACTORY->LookupAsciiSymbol("theFunction");
Handle<String> name = FACTORY->LookupUtf8Symbol("theFunction");
Handle<JSFunction> function =
FACTORY->NewFunction(name, FACTORY->undefined_value());
Handle<Map> initial_map =
FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
function->set_initial_map(*initial_map);
Handle<String> prop_name = FACTORY->LookupAsciiSymbol("theSlot");
Handle<String> prop_name = FACTORY->LookupUtf8Symbol("theSlot");
Handle<JSObject> obj = FACTORY->NewJSObject(function);
// Set a propery
@ -681,7 +681,7 @@ TEST(JSArray) {
InitializeVM();
v8::HandleScope sc;
Handle<String> name = FACTORY->LookupAsciiSymbol("Array");
Handle<String> name = FACTORY->LookupUtf8Symbol("Array");
Object* raw_object = Isolate::Current()->context()->global_object()->
GetProperty(*name)->ToObjectChecked();
Handle<JSFunction> function = Handle<JSFunction>(
@ -734,8 +734,8 @@ TEST(JSObjectCopy) {
JSFunction* object_function = JSFunction::cast(raw_object);
Handle<JSFunction> constructor(object_function);
Handle<JSObject> obj = FACTORY->NewJSObject(constructor);
Handle<String> first = FACTORY->LookupAsciiSymbol("first");
Handle<String> second = FACTORY->LookupAsciiSymbol("second");
Handle<String> first = FACTORY->LookupUtf8Symbol("first");
Handle<String> second = FACTORY->LookupUtf8Symbol("second");
obj->SetProperty(
*first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
@ -790,10 +790,10 @@ TEST(StringAllocation) {
non_ascii[3 * i + 2] = chars[2];
}
Handle<String> non_ascii_sym =
FACTORY->LookupSymbol(Vector<const char>(non_ascii, 3 * length));
FACTORY->LookupUtf8Symbol(Vector<const char>(non_ascii, 3 * length));
CHECK_EQ(length, non_ascii_sym->length());
Handle<String> ascii_sym =
FACTORY->LookupSymbol(Vector<const char>(ascii, length));
FACTORY->LookupOneByteSymbol(Vector<const char>(ascii, length));
CHECK_EQ(length, ascii_sym->length());
Handle<String> non_ascii_str =
FACTORY->NewStringFromUtf8(Vector<const char>(non_ascii, 3 * length));
@ -970,7 +970,7 @@ TEST(TestCodeFlushing) {
" var z = x + y;"
"};"
"foo()";
Handle<String> foo_name = FACTORY->LookupAsciiSymbol("foo");
Handle<String> foo_name = FACTORY->LookupUtf8Symbol("foo");
// This compile will add the code to the compilation cache.
{ v8::HandleScope scope;
@ -1017,7 +1017,7 @@ TEST(TestCodeFlushingIncremental) {
" var z = x + y;"
"};"
"foo()";
Handle<String> foo_name = FACTORY->LookupAsciiSymbol("foo");
Handle<String> foo_name = FACTORY->LookupUtf8Symbol("foo");
// This compile will add the code to the compilation cache.
{ v8::HandleScope scope;
@ -1087,8 +1087,8 @@ TEST(TestCodeFlushingIncrementalScavenge) {
" var x = 23;"
"};"
"bar();";
Handle<String> foo_name = FACTORY->LookupAsciiSymbol("foo");
Handle<String> bar_name = FACTORY->LookupAsciiSymbol("bar");
Handle<String> foo_name = FACTORY->LookupUtf8Symbol("foo");
Handle<String> bar_name = FACTORY->LookupUtf8Symbol("bar");
// Perfrom one initial GC to enable code flushing.
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
@ -1149,7 +1149,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
" var z = x + y;"
"};"
"foo()";
Handle<String> foo_name = FACTORY->LookupAsciiSymbol("foo");
Handle<String> foo_name = FACTORY->LookupUtf8Symbol("foo");
// This compile will add the code to the compilation cache.
{ v8::HandleScope scope;
@ -2493,7 +2493,7 @@ TEST(Regression144230) {
// Fourth is the tricky part. Make sure the code containing the CallIC is
// visited first without clearing the IC. The shared function info is then
// visited later, causing the CallIC to be cleared.
Handle<String> name = FACTORY->LookupAsciiSymbol("call");
Handle<String> name = FACTORY->LookupUtf8Symbol("call");
Handle<GlobalObject> global(ISOLATE->context()->global_object());
MaybeObject* maybe_call = global->GetProperty(*name);
JSFunction* call = JSFunction::cast(maybe_call->ToObjectChecked());

View File

@ -183,7 +183,7 @@ TEST(MarkCompactCollector) {
// allocate a garbage
String* func_name =
String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked());
String::cast(HEAP->LookupUtf8Symbol("theFunction")->ToObjectChecked());
SharedFunctionInfo* function_share = SharedFunctionInfo::cast(
HEAP->AllocateSharedFunctionInfo(func_name)->ToObjectChecked());
JSFunction* function = JSFunction::cast(
@ -202,7 +202,7 @@ TEST(MarkCompactCollector) {
HEAP->CollectGarbage(OLD_POINTER_SPACE);
func_name =
String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked());
String::cast(HEAP->LookupUtf8Symbol("theFunction")->ToObjectChecked());
CHECK(Isolate::Current()->context()->global_object()->
HasLocalProperty(func_name));
Object* func_value = Isolate::Current()->context()->global_object()->
@ -212,11 +212,11 @@ TEST(MarkCompactCollector) {
obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked());
String* obj_name =
String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked());
String::cast(HEAP->LookupUtf8Symbol("theObject")->ToObjectChecked());
Isolate::Current()->context()->global_object()->SetProperty(
obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked();
String* prop_name =
String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked());
String::cast(HEAP->LookupUtf8Symbol("theSlot")->ToObjectChecked());
obj->SetProperty(prop_name,
Smi::FromInt(23),
NONE,
@ -225,7 +225,7 @@ TEST(MarkCompactCollector) {
HEAP->CollectGarbage(OLD_POINTER_SPACE);
obj_name =
String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked());
String::cast(HEAP->LookupUtf8Symbol("theObject")->ToObjectChecked());
CHECK(Isolate::Current()->context()->global_object()->
HasLocalProperty(obj_name));
CHECK(Isolate::Current()->context()->global_object()->
@ -233,7 +233,7 @@ TEST(MarkCompactCollector) {
obj = JSObject::cast(Isolate::Current()->context()->global_object()->
GetProperty(obj_name)->ToObjectChecked());
prop_name =
String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked());
String::cast(HEAP->LookupUtf8Symbol("theSlot")->ToObjectChecked());
CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23));
}

View File

@ -83,7 +83,8 @@ TEST(CrankshaftRandom) {
CompileRun("function f() { return Math.random(); }");
Object* symbol = FACTORY->LookupAsciiSymbol("f")->ToObjectChecked();
Object* symbol = FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("f"))->
ToObjectChecked();
MaybeObject* fun_object =
context->global_object()->GetProperty(String::cast(symbol));
Handle<JSFunction> fun(JSFunction::cast(fun_object->ToObjectChecked()));

View File

@ -291,7 +291,8 @@ static void SanityCheck() {
CHECK(Isolate::Current()->global_object()->IsJSObject());
CHECK(Isolate::Current()->native_context()->IsContext());
CHECK(HEAP->symbol_table()->IsSymbolTable());
CHECK(!FACTORY->LookupAsciiSymbol("Empty")->IsFailure());
CHECK(!FACTORY->LookupOneByteSymbol(
STATIC_ASCII_VECTOR("Empty"))->IsFailure());
}