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:
parent
6e953d51af
commit
19a6575ea3
34
src/api.cc
34
src/api.cc
@ -1953,7 +1953,7 @@ static i::Handle<i::Object> CallV8HeapFunction(const char* name,
|
|||||||
i::Handle<i::Object> argv[],
|
i::Handle<i::Object> argv[],
|
||||||
bool* has_pending_exception) {
|
bool* has_pending_exception) {
|
||||||
i::Isolate* isolate = i::Isolate::Current();
|
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 =
|
i::Object* object_fun =
|
||||||
isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str);
|
isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str);
|
||||||
i::Handle<i::JSFunction> fun =
|
i::Handle<i::JSFunction> fun =
|
||||||
@ -2369,7 +2369,7 @@ bool Value::IsNumberObject() const {
|
|||||||
static i::Object* LookupBuiltin(i::Isolate* isolate,
|
static i::Object* LookupBuiltin(i::Isolate* isolate,
|
||||||
const char* builtin_name) {
|
const char* builtin_name) {
|
||||||
i::Handle<i::String> symbol =
|
i::Handle<i::String> symbol =
|
||||||
isolate->factory()->LookupAsciiSymbol(builtin_name);
|
isolate->factory()->LookupUtf8Symbol(builtin_name);
|
||||||
i::Handle<i::JSBuiltinsObject> builtins = isolate->js_builtins_object();
|
i::Handle<i::JSBuiltinsObject> builtins = isolate->js_builtins_object();
|
||||||
return builtins->GetPropertyNoExceptionThrown(*symbol);
|
return builtins->GetPropertyNoExceptionThrown(*symbol);
|
||||||
}
|
}
|
||||||
@ -5129,8 +5129,8 @@ void v8::Date::DateTimeConfigurationChangeNotification() {
|
|||||||
|
|
||||||
i::HandleScope scope(isolate);
|
i::HandleScope scope(isolate);
|
||||||
// Get the function ResetDateCache (defined in date.js).
|
// Get the function ResetDateCache (defined in date.js).
|
||||||
i::Handle<i::String> func_name_str =
|
i::Handle<i::String> func_name_str = isolate->factory()->LookupOneByteSymbol(
|
||||||
isolate->factory()->LookupAsciiSymbol("ResetDateCache");
|
STATIC_ASCII_VECTOR("ResetDateCache"));
|
||||||
i::MaybeObject* result =
|
i::MaybeObject* result =
|
||||||
isolate->js_builtins_object()->GetProperty(*func_name_str);
|
isolate->js_builtins_object()->GetProperty(*func_name_str);
|
||||||
i::Object* object_func;
|
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::kMultiline) != 0) flags_buf[num_flags++] = 'm';
|
||||||
if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
|
if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
|
||||||
ASSERT(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf)));
|
ASSERT(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf)));
|
||||||
return FACTORY->LookupSymbol(
|
return FACTORY->LookupOneByteSymbol(
|
||||||
i::Vector<const char>(flags_buf, num_flags));
|
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)");
|
LOG_API(isolate, "String::NewSymbol(char)");
|
||||||
ENTER_V8(isolate);
|
ENTER_V8(isolate);
|
||||||
if (length == -1) length = i::StrLength(data);
|
if (length == -1) length = i::StrLength(data);
|
||||||
i::Handle<i::String> result =
|
i::Handle<i::String> result = isolate->factory()->LookupUtf8Symbol(
|
||||||
isolate->factory()->LookupSymbol(i::Vector<const char>(data, length));
|
i::Vector<const char>(data, length));
|
||||||
return Utils::ToLocal(result);
|
return Utils::ToLocal(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5960,8 +5960,8 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
|
|||||||
i::Debug* isolate_debug = isolate->debug();
|
i::Debug* isolate_debug = isolate->debug();
|
||||||
isolate_debug->Load();
|
isolate_debug->Load();
|
||||||
i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
|
i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
|
||||||
i::Handle<i::String> name =
|
i::Handle<i::String> name = isolate->factory()->LookupOneByteSymbol(
|
||||||
isolate->factory()->LookupAsciiSymbol("MakeMirror");
|
STATIC_ASCII_VECTOR("MakeMirror"));
|
||||||
i::Handle<i::Object> fun_obj = i::GetProperty(debug, name);
|
i::Handle<i::Object> fun_obj = i::GetProperty(debug, name);
|
||||||
i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
|
i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
|
||||||
v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
|
v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
|
||||||
@ -6023,11 +6023,11 @@ Handle<String> CpuProfileNode::GetFunctionName() const {
|
|||||||
const i::CodeEntry* entry = node->entry();
|
const i::CodeEntry* entry = node->entry();
|
||||||
if (!entry->has_name_prefix()) {
|
if (!entry->has_name_prefix()) {
|
||||||
return Handle<String>(ToApi<String>(
|
return Handle<String>(ToApi<String>(
|
||||||
isolate->factory()->LookupAsciiSymbol(entry->name())));
|
isolate->factory()->LookupUtf8Symbol(entry->name())));
|
||||||
} else {
|
} else {
|
||||||
return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
|
return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
|
||||||
isolate->factory()->LookupAsciiSymbol(entry->name_prefix()),
|
isolate->factory()->LookupUtf8Symbol(entry->name_prefix()),
|
||||||
isolate->factory()->LookupAsciiSymbol(entry->name()))));
|
isolate->factory()->LookupUtf8Symbol(entry->name()))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6036,7 +6036,7 @@ Handle<String> CpuProfileNode::GetScriptResourceName() const {
|
|||||||
i::Isolate* isolate = i::Isolate::Current();
|
i::Isolate* isolate = i::Isolate::Current();
|
||||||
IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
|
IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
|
||||||
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
|
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())));
|
node->entry()->resource_name())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6122,7 +6122,7 @@ Handle<String> CpuProfile::GetTitle() const {
|
|||||||
i::Isolate* isolate = i::Isolate::Current();
|
i::Isolate* isolate = i::Isolate::Current();
|
||||||
IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
|
IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
|
||||||
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
|
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())));
|
profile->title())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6219,7 +6219,7 @@ Handle<Value> HeapGraphEdge::GetName() const {
|
|||||||
case i::HeapGraphEdge::kInternal:
|
case i::HeapGraphEdge::kInternal:
|
||||||
case i::HeapGraphEdge::kProperty:
|
case i::HeapGraphEdge::kProperty:
|
||||||
case i::HeapGraphEdge::kShortcut:
|
case i::HeapGraphEdge::kShortcut:
|
||||||
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
|
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
|
||||||
edge->name())));
|
edge->name())));
|
||||||
case i::HeapGraphEdge::kElement:
|
case i::HeapGraphEdge::kElement:
|
||||||
case i::HeapGraphEdge::kHidden:
|
case i::HeapGraphEdge::kHidden:
|
||||||
@ -6263,7 +6263,7 @@ HeapGraphNode::Type HeapGraphNode::GetType() const {
|
|||||||
Handle<String> HeapGraphNode::GetName() const {
|
Handle<String> HeapGraphNode::GetName() const {
|
||||||
i::Isolate* isolate = i::Isolate::Current();
|
i::Isolate* isolate = i::Isolate::Current();
|
||||||
IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
|
IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
|
||||||
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
|
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
|
||||||
ToInternal(this)->name())));
|
ToInternal(this)->name())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6342,7 +6342,7 @@ unsigned HeapSnapshot::GetUid() const {
|
|||||||
Handle<String> HeapSnapshot::GetTitle() const {
|
Handle<String> HeapSnapshot::GetTitle() const {
|
||||||
i::Isolate* isolate = i::Isolate::Current();
|
i::Isolate* isolate = i::Isolate::Current();
|
||||||
IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
|
IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
|
||||||
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
|
return Handle<String>(ToApi<String>(isolate->factory()->LookupUtf8Symbol(
|
||||||
ToInternal(this)->title())));
|
ToInternal(this)->title())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
|
|||||||
bool is_ecma_native) {
|
bool is_ecma_native) {
|
||||||
Isolate* isolate = target->GetIsolate();
|
Isolate* isolate = target->GetIsolate();
|
||||||
Factory* factory = isolate->factory();
|
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<Code> call_code = Handle<Code>(isolate->builtins()->builtin(call));
|
||||||
Handle<JSFunction> function = prototype.is_null() ?
|
Handle<JSFunction> function = prototype.is_null() ?
|
||||||
factory->NewFunctionWithoutPrototype(symbol, call_code) :
|
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
|
// Allocate the empty function as the prototype for function ECMAScript
|
||||||
// 262 15.3.4.
|
// 262 15.3.4.
|
||||||
Handle<String> symbol = factory->LookupAsciiSymbol("Empty");
|
Handle<String> symbol =
|
||||||
|
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("Empty"));
|
||||||
Handle<JSFunction> empty_function =
|
Handle<JSFunction> empty_function =
|
||||||
factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE);
|
factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE);
|
||||||
|
|
||||||
@ -570,7 +571,8 @@ void Genesis::SetStrictFunctionInstanceDescriptor(
|
|||||||
// ECMAScript 5th Edition, 13.2.3
|
// ECMAScript 5th Edition, 13.2.3
|
||||||
Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
|
Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
|
||||||
if (throw_type_error_function.is_null()) {
|
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 =
|
throw_type_error_function =
|
||||||
factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE);
|
factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE);
|
||||||
Handle<Code> code(isolate()->builtins()->builtin(
|
Handle<Code> code(isolate()->builtins()->builtin(
|
||||||
@ -771,7 +773,8 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
|
|||||||
factory()->OuterGlobalObject);
|
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->shared()->set_instance_class_name(*global_name);
|
||||||
global_proxy_function->initial_map()->set_is_access_check_needed(true);
|
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 const PropertyAttributes attributes =
|
||||||
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
|
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
|
||||||
ForceSetProperty(builtins_global,
|
ForceSetProperty(builtins_global,
|
||||||
factory()->LookupAsciiSymbol("global"),
|
factory()->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("global")),
|
||||||
inner_global,
|
inner_global,
|
||||||
attributes);
|
attributes);
|
||||||
// Set up the reference from the global object to the builtins object.
|
// 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.
|
// Make sure we can recognize argument objects at runtime.
|
||||||
// This is done by introducing an anonymous function with
|
// This is done by introducing an anonymous function with
|
||||||
// class_name equals 'Arguments'.
|
// class_name equals 'Arguments'.
|
||||||
Handle<String> symbol = factory->LookupAsciiSymbol("Arguments");
|
Handle<String> symbol = factory->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("Arguments"));
|
||||||
Handle<Code> code = Handle<Code>(
|
Handle<Code> code = Handle<Code>(
|
||||||
isolate->builtins()->builtin(Builtins::kIllegal));
|
isolate->builtins()->builtin(Builtins::kIllegal));
|
||||||
Handle<JSObject> prototype =
|
Handle<JSObject> prototype =
|
||||||
@ -1207,7 +1212,8 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
|||||||
code,
|
code,
|
||||||
true);
|
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);
|
context_extension_fun->shared()->set_instance_class_name(*name);
|
||||||
native_context()->set_context_extension_function(*context_extension_fun);
|
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) \
|
#define INSTALL_NATIVE(Type, name, var) \
|
||||||
Handle<String> var##_name = factory()->LookupAsciiSymbol(name); \
|
Handle<String> var##_name = \
|
||||||
Object* var##_native = \
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR(name)); \
|
||||||
native_context()->builtins()->GetPropertyNoExceptionThrown( \
|
Object* var##_native = \
|
||||||
*var##_name); \
|
native_context()->builtins()->GetPropertyNoExceptionThrown( \
|
||||||
|
*var##_name); \
|
||||||
native_context()->set_##var(Type::cast(var##_native));
|
native_context()->set_##var(Type::cast(var##_native));
|
||||||
|
|
||||||
|
|
||||||
@ -1439,7 +1446,8 @@ bool Genesis::InstallNatives() {
|
|||||||
JS_BUILTINS_OBJECT_TYPE,
|
JS_BUILTINS_OBJECT_TYPE,
|
||||||
JSBuiltinsObject::kSize, code, true);
|
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->shared()->set_instance_class_name(*name);
|
||||||
builtins_fun->initial_map()->set_dictionary_map(true);
|
builtins_fun->initial_map()->set_dictionary_map(true);
|
||||||
builtins_fun->initial_map()->set_prototype(heap()->null_value());
|
builtins_fun->initial_map()->set_prototype(heap()->null_value());
|
||||||
@ -1458,7 +1466,8 @@ bool Genesis::InstallNatives() {
|
|||||||
// global object.
|
// global object.
|
||||||
static const PropertyAttributes attributes =
|
static const PropertyAttributes attributes =
|
||||||
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
|
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());
|
Handle<Object> global_obj(native_context()->global_object());
|
||||||
CHECK_NOT_EMPTY_HANDLE(isolate(),
|
CHECK_NOT_EMPTY_HANDLE(isolate(),
|
||||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||||
@ -1501,41 +1510,49 @@ bool Genesis::InstallNatives() {
|
|||||||
Handle<Foreign> script_source(
|
Handle<Foreign> script_source(
|
||||||
factory()->NewForeign(&Accessors::ScriptSource));
|
factory()->NewForeign(&Accessors::ScriptSource));
|
||||||
Handle<Foreign> script_name(factory()->NewForeign(&Accessors::ScriptName));
|
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<Foreign> script_id(factory()->NewForeign(&Accessors::ScriptId));
|
||||||
Handle<String> line_offset_symbol(
|
Handle<String> line_offset_symbol(
|
||||||
factory()->LookupAsciiSymbol("line_offset"));
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("line_offset")));
|
||||||
Handle<Foreign> script_line_offset(
|
Handle<Foreign> script_line_offset(
|
||||||
factory()->NewForeign(&Accessors::ScriptLineOffset));
|
factory()->NewForeign(&Accessors::ScriptLineOffset));
|
||||||
Handle<String> column_offset_symbol(
|
Handle<String> column_offset_symbol(
|
||||||
factory()->LookupAsciiSymbol("column_offset"));
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("column_offset")));
|
||||||
Handle<Foreign> script_column_offset(
|
Handle<Foreign> script_column_offset(
|
||||||
factory()->NewForeign(&Accessors::ScriptColumnOffset));
|
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<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<Foreign> script_type(factory()->NewForeign(&Accessors::ScriptType));
|
||||||
Handle<String> compilation_type_symbol(
|
Handle<String> compilation_type_symbol(
|
||||||
factory()->LookupAsciiSymbol("compilation_type"));
|
factory()->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("compilation_type")));
|
||||||
Handle<Foreign> script_compilation_type(
|
Handle<Foreign> script_compilation_type(
|
||||||
factory()->NewForeign(&Accessors::ScriptCompilationType));
|
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(
|
Handle<Foreign> script_line_ends(
|
||||||
factory()->NewForeign(&Accessors::ScriptLineEnds));
|
factory()->NewForeign(&Accessors::ScriptLineEnds));
|
||||||
Handle<String> context_data_symbol(
|
Handle<String> context_data_symbol(
|
||||||
factory()->LookupAsciiSymbol("context_data"));
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("context_data")));
|
||||||
Handle<Foreign> script_context_data(
|
Handle<Foreign> script_context_data(
|
||||||
factory()->NewForeign(&Accessors::ScriptContextData));
|
factory()->NewForeign(&Accessors::ScriptContextData));
|
||||||
Handle<String> eval_from_script_symbol(
|
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(
|
Handle<Foreign> script_eval_from_script(
|
||||||
factory()->NewForeign(&Accessors::ScriptEvalFromScript));
|
factory()->NewForeign(&Accessors::ScriptEvalFromScript));
|
||||||
Handle<String> eval_from_script_position_symbol(
|
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(
|
Handle<Foreign> script_eval_from_script_position(
|
||||||
factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition));
|
factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition));
|
||||||
Handle<String> eval_from_function_name_symbol(
|
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(
|
Handle<Foreign> script_eval_from_function_name(
|
||||||
factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName));
|
factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName));
|
||||||
PropertyAttributes attribs =
|
PropertyAttributes attribs =
|
||||||
@ -1855,13 +1872,13 @@ static Handle<JSObject> ResolveBuiltinIdHolder(
|
|||||||
const char* period_pos = strchr(holder_expr, '.');
|
const char* period_pos = strchr(holder_expr, '.');
|
||||||
if (period_pos == NULL) {
|
if (period_pos == NULL) {
|
||||||
return Handle<JSObject>::cast(
|
return Handle<JSObject>::cast(
|
||||||
GetProperty(global, factory->LookupAsciiSymbol(holder_expr)));
|
GetProperty(global, factory->LookupUtf8Symbol(holder_expr)));
|
||||||
}
|
}
|
||||||
ASSERT_EQ(".prototype", period_pos);
|
ASSERT_EQ(".prototype", period_pos);
|
||||||
Vector<const char> property(holder_expr,
|
Vector<const char> property(holder_expr,
|
||||||
static_cast<int>(period_pos - holder_expr));
|
static_cast<int>(period_pos - holder_expr));
|
||||||
Handle<JSFunction> function = Handle<JSFunction>::cast(
|
Handle<JSFunction> function = Handle<JSFunction>::cast(
|
||||||
GetProperty(global, factory->LookupSymbol(property)));
|
GetProperty(global, factory->LookupUtf8Symbol(property)));
|
||||||
return Handle<JSObject>(JSObject::cast(function->prototype()));
|
return Handle<JSObject>(JSObject::cast(function->prototype()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1870,7 +1887,7 @@ static void InstallBuiltinFunctionId(Handle<JSObject> holder,
|
|||||||
const char* function_name,
|
const char* function_name,
|
||||||
BuiltinFunctionId id) {
|
BuiltinFunctionId id) {
|
||||||
Factory* factory = holder->GetIsolate()->factory();
|
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();
|
Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
|
||||||
Handle<JSFunction> function(JSFunction::cast(function_object));
|
Handle<JSFunction> function(JSFunction::cast(function_object));
|
||||||
function->shared()->set_function_data(Smi::FromInt(id));
|
function->shared()->set_function_data(Smi::FromInt(id));
|
||||||
@ -1961,7 +1978,7 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
|
|||||||
native_context->global_object()));
|
native_context->global_object()));
|
||||||
// Expose the natives in global if a name for it is specified.
|
// Expose the natives in global if a name for it is specified.
|
||||||
if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
|
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,
|
CHECK_NOT_EMPTY_HANDLE(isolate,
|
||||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||||
global, natives,
|
global, natives,
|
||||||
@ -1971,7 +1988,8 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
|
|||||||
|
|
||||||
Handle<Object> Error = GetProperty(global, "Error");
|
Handle<Object> Error = GetProperty(global, "Error");
|
||||||
if (Error->IsJSObject()) {
|
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));
|
Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit));
|
||||||
CHECK_NOT_EMPTY_HANDLE(isolate,
|
CHECK_NOT_EMPTY_HANDLE(isolate,
|
||||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||||
@ -1993,7 +2011,7 @@ void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
|
|||||||
native_context->security_token());
|
native_context->security_token());
|
||||||
|
|
||||||
Handle<String> debug_string =
|
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());
|
Handle<Object> global_proxy(debug->debug_context()->global_proxy());
|
||||||
CHECK_NOT_EMPTY_HANDLE(isolate,
|
CHECK_NOT_EMPTY_HANDLE(isolate,
|
||||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||||
@ -2137,7 +2155,7 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
|
|||||||
Factory* factory = builtins->GetIsolate()->factory();
|
Factory* factory = builtins->GetIsolate()->factory();
|
||||||
for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
|
for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
|
||||||
Builtins::JavaScript id = static_cast<Builtins::JavaScript>(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);
|
Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
|
||||||
Handle<JSFunction> function
|
Handle<JSFunction> function
|
||||||
= Handle<JSFunction>(JSFunction::cast(function_object));
|
= Handle<JSFunction>(JSFunction::cast(function_object));
|
||||||
|
15
src/debug.cc
15
src/debug.cc
@ -836,7 +836,8 @@ bool Debug::Load() {
|
|||||||
isolate_->set_context(*context);
|
isolate_->set_context(*context);
|
||||||
|
|
||||||
// Expose the builtins object in the debugger 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());
|
Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object());
|
||||||
RETURN_IF_EMPTY_HANDLE_VALUE(
|
RETURN_IF_EMPTY_HANDLE_VALUE(
|
||||||
isolate_,
|
isolate_,
|
||||||
@ -1100,7 +1101,8 @@ bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
|
|||||||
|
|
||||||
// Get the function IsBreakPointTriggered (defined in debug-debugger.js).
|
// Get the function IsBreakPointTriggered (defined in debug-debugger.js).
|
||||||
Handle<String> is_break_point_triggered_symbol =
|
Handle<String> is_break_point_triggered_symbol =
|
||||||
factory->LookupAsciiSymbol("IsBreakPointTriggered");
|
factory->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("IsBreakPointTriggered"));
|
||||||
Handle<JSFunction> check_break_point =
|
Handle<JSFunction> check_break_point =
|
||||||
Handle<JSFunction>(JSFunction::cast(
|
Handle<JSFunction>(JSFunction::cast(
|
||||||
debug_context()->global_object()->GetPropertyNoExceptionThrown(
|
debug_context()->global_object()->GetPropertyNoExceptionThrown(
|
||||||
@ -2425,8 +2427,8 @@ void Debug::ClearMirrorCache() {
|
|||||||
ASSERT(isolate_->context() == *Debug::debug_context());
|
ASSERT(isolate_->context() == *Debug::debug_context());
|
||||||
|
|
||||||
// Clear the mirror cache.
|
// Clear the mirror cache.
|
||||||
Handle<String> function_name =
|
Handle<String> function_name = isolate_->factory()->LookupOneByteSymbol(
|
||||||
isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache"));
|
STATIC_ASCII_VECTOR("ClearMirrorCache"));
|
||||||
Handle<Object> fun(
|
Handle<Object> fun(
|
||||||
Isolate::Current()->global_object()->GetPropertyNoExceptionThrown(
|
Isolate::Current()->global_object()->GetPropertyNoExceptionThrown(
|
||||||
*function_name));
|
*function_name));
|
||||||
@ -2554,7 +2556,7 @@ Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
|
|||||||
|
|
||||||
// Create the execution state object.
|
// Create the execution state object.
|
||||||
Handle<String> constructor_str =
|
Handle<String> constructor_str =
|
||||||
isolate_->factory()->LookupSymbol(constructor_name);
|
isolate_->factory()->LookupUtf8Symbol(constructor_name);
|
||||||
Handle<Object> constructor(
|
Handle<Object> constructor(
|
||||||
isolate_->global_object()->GetPropertyNoExceptionThrown(
|
isolate_->global_object()->GetPropertyNoExceptionThrown(
|
||||||
*constructor_str));
|
*constructor_str));
|
||||||
@ -2785,7 +2787,8 @@ void Debugger::OnAfterCompile(Handle<Script> script,
|
|||||||
|
|
||||||
// Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
|
// Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
|
||||||
Handle<String> update_script_break_points_symbol =
|
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> update_script_break_points =
|
||||||
Handle<Object>(debug->debug_context()->global_object()->
|
Handle<Object>(debug->debug_context()->global_object()->
|
||||||
GetPropertyNoExceptionThrown(*update_script_break_points_symbol));
|
GetPropertyNoExceptionThrown(*update_script_break_points_symbol));
|
||||||
|
@ -158,9 +158,9 @@ Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() {
|
|||||||
|
|
||||||
|
|
||||||
// Symbols are created in the old generation (data space).
|
// 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(),
|
CALL_HEAP_FUNCTION(isolate(),
|
||||||
isolate()->heap()->LookupSymbol(string),
|
isolate()->heap()->LookupUtf8Symbol(string),
|
||||||
String);
|
String);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,18 +171,18 @@ Handle<String> Factory::LookupSymbol(Handle<String> string) {
|
|||||||
String);
|
String);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle<String> Factory::LookupAsciiSymbol(Vector<const char> string) {
|
Handle<String> Factory::LookupOneByteSymbol(Vector<const char> string) {
|
||||||
CALL_HEAP_FUNCTION(isolate(),
|
CALL_HEAP_FUNCTION(isolate(),
|
||||||
isolate()->heap()->LookupAsciiSymbol(string),
|
isolate()->heap()->LookupOneByteSymbol(string),
|
||||||
String);
|
String);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Handle<String> Factory::LookupAsciiSymbol(Handle<SeqOneByteString> string,
|
Handle<String> Factory::LookupOneByteSymbol(Handle<SeqOneByteString> string,
|
||||||
int from,
|
int from,
|
||||||
int length) {
|
int length) {
|
||||||
CALL_HEAP_FUNCTION(isolate(),
|
CALL_HEAP_FUNCTION(isolate(),
|
||||||
isolate()->heap()->LookupAsciiSymbol(string,
|
isolate()->heap()->LookupOneByteSymbol(string,
|
||||||
from,
|
from,
|
||||||
length),
|
length),
|
||||||
String);
|
String);
|
||||||
@ -741,7 +741,7 @@ Handle<String> Factory::EmergencyNewError(const char* type,
|
|||||||
Handle<Object> Factory::NewError(const char* maker,
|
Handle<Object> Factory::NewError(const char* maker,
|
||||||
const char* type,
|
const char* type,
|
||||||
Handle<JSArray> args) {
|
Handle<JSArray> args) {
|
||||||
Handle<String> make_str = LookupAsciiSymbol(maker);
|
Handle<String> make_str = LookupUtf8Symbol(maker);
|
||||||
Handle<Object> fun_obj(
|
Handle<Object> fun_obj(
|
||||||
isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str));
|
isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str));
|
||||||
// If the builtins haven't been properly configured yet this error
|
// 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);
|
return EmergencyNewError(type, args);
|
||||||
}
|
}
|
||||||
Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj);
|
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 };
|
Handle<Object> argv[] = { type_obj, args };
|
||||||
|
|
||||||
// Invoke the JavaScript factory method. If an exception is thrown while
|
// 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<Object> Factory::NewError(const char* constructor,
|
||||||
Handle<String> message) {
|
Handle<String> message) {
|
||||||
Handle<String> constr = LookupAsciiSymbol(constructor);
|
Handle<String> constr = LookupUtf8Symbol(constructor);
|
||||||
Handle<JSFunction> fun = Handle<JSFunction>(
|
Handle<JSFunction> fun = Handle<JSFunction>(
|
||||||
JSFunction::cast(isolate()->js_builtins_object()->
|
JSFunction::cast(isolate()->js_builtins_object()->
|
||||||
GetPropertyNoExceptionThrown(*constr)));
|
GetPropertyNoExceptionThrown(*constr)));
|
||||||
|
@ -79,16 +79,16 @@ class Factory {
|
|||||||
|
|
||||||
Handle<TypeFeedbackInfo> NewTypeFeedbackInfo();
|
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> LookupSymbol(Handle<String> str);
|
||||||
Handle<String> LookupAsciiSymbol(Vector<const char> str);
|
Handle<String> LookupOneByteSymbol(Vector<const char> str);
|
||||||
Handle<String> LookupAsciiSymbol(Handle<SeqOneByteString>,
|
Handle<String> LookupOneByteSymbol(Handle<SeqOneByteString>,
|
||||||
int from,
|
int from,
|
||||||
int length);
|
int length);
|
||||||
Handle<String> LookupTwoByteSymbol(Vector<const uc16> str);
|
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
|
// String creation functions. Most of the string creation functions take
|
||||||
|
@ -282,7 +282,7 @@ Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object,
|
|||||||
Handle<Object> GetProperty(Handle<JSReceiver> obj,
|
Handle<Object> GetProperty(Handle<JSReceiver> obj,
|
||||||
const char* name) {
|
const char* name) {
|
||||||
Isolate* isolate = obj->GetIsolate();
|
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);
|
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) {
|
Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) {
|
||||||
Isolate* isolate = script->GetIsolate();
|
Isolate* isolate = script->GetIsolate();
|
||||||
Handle<String> name_or_source_url_key =
|
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<JSValue> script_wrapper = GetScriptWrapper(script);
|
||||||
Handle<Object> property = GetProperty(script_wrapper,
|
Handle<Object> property = GetProperty(script_wrapper,
|
||||||
name_or_source_url_key);
|
name_or_source_url_key);
|
||||||
|
19
src/heap.cc
19
src/heap.cc
@ -2776,7 +2776,7 @@ bool Heap::CreateInitialObjects() {
|
|||||||
|
|
||||||
for (unsigned i = 0; i < ARRAY_SIZE(constant_symbol_table); i++) {
|
for (unsigned i = 0; i < ARRAY_SIZE(constant_symbol_table); i++) {
|
||||||
{ MaybeObject* maybe_obj =
|
{ MaybeObject* maybe_obj =
|
||||||
LookupAsciiSymbol(constant_symbol_table[i].contents);
|
LookupUtf8Symbol(constant_symbol_table[i].contents);
|
||||||
if (!maybe_obj->ToObject(&obj)) return false;
|
if (!maybe_obj->ToObject(&obj)) return false;
|
||||||
}
|
}
|
||||||
roots_[constant_symbol_table[i].index] = String::cast(obj);
|
roots_[constant_symbol_table[i].index] = String::cast(obj);
|
||||||
@ -3610,7 +3610,8 @@ MaybeObject* Heap::LookupSingleCharacterStringFromCode(uint16_t code) {
|
|||||||
char buffer[1];
|
char buffer[1];
|
||||||
buffer[0] = static_cast<char>(code);
|
buffer[0] = static_cast<char>(code);
|
||||||
Object* result;
|
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;
|
if (!maybe_result->ToObject(&result)) return maybe_result;
|
||||||
single_character_string_cache()->set(code, result);
|
single_character_string_cache()->set(code, result);
|
||||||
@ -4461,7 +4462,7 @@ MaybeObject* Heap::ReinitializeJSReceiver(
|
|||||||
SharedFunctionInfo* shared = NULL;
|
SharedFunctionInfo* shared = NULL;
|
||||||
if (type == JS_FUNCTION_TYPE) {
|
if (type == JS_FUNCTION_TYPE) {
|
||||||
String* name;
|
String* name;
|
||||||
maybe = LookupAsciiSymbol("<freezing call trap>");
|
maybe = LookupOneByteSymbol(STATIC_ASCII_VECTOR("<freezing call trap>"));
|
||||||
if (!maybe->To<String>(&name)) return maybe;
|
if (!maybe->To<String>(&name)) return maybe;
|
||||||
maybe = AllocateSharedFunctionInfo(name);
|
maybe = AllocateSharedFunctionInfo(name);
|
||||||
if (!maybe->To<SharedFunctionInfo>(&shared)) return maybe;
|
if (!maybe->To<SharedFunctionInfo>(&shared)) return maybe;
|
||||||
@ -5554,11 +5555,11 @@ void Heap::Verify() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
MaybeObject* Heap::LookupSymbol(Vector<const char> string) {
|
MaybeObject* Heap::LookupUtf8Symbol(Vector<const char> string) {
|
||||||
Object* symbol = NULL;
|
Object* symbol = NULL;
|
||||||
Object* new_table;
|
Object* new_table;
|
||||||
{ MaybeObject* maybe_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;
|
if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table;
|
||||||
}
|
}
|
||||||
// Can't use set_symbol_table because SymbolTable::cast knows that
|
// 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* symbol = NULL;
|
||||||
Object* new_table;
|
Object* new_table;
|
||||||
{ MaybeObject* maybe_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;
|
if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table;
|
||||||
}
|
}
|
||||||
// Can't use set_symbol_table because SymbolTable::cast knows that
|
// 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 from,
|
||||||
int length) {
|
int length) {
|
||||||
Object* symbol = NULL;
|
Object* symbol = NULL;
|
||||||
Object* new_table;
|
Object* new_table;
|
||||||
{ MaybeObject* maybe_new_table =
|
{ MaybeObject* maybe_new_table =
|
||||||
symbol_table()->LookupSubStringAsciiSymbol(string,
|
symbol_table()->LookupSubStringOneByteSymbol(string,
|
||||||
from,
|
from,
|
||||||
length,
|
length,
|
||||||
&symbol);
|
&symbol);
|
||||||
|
12
src/heap.h
12
src/heap.h
@ -1066,14 +1066,14 @@ class Heap {
|
|||||||
// Returns Failure::RetryAfterGC(requested_bytes, space) if allocation
|
// Returns Failure::RetryAfterGC(requested_bytes, space) if allocation
|
||||||
// failed.
|
// failed.
|
||||||
// Please note this function does not perform a garbage collection.
|
// Please note this function does not perform a garbage collection.
|
||||||
MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str);
|
MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str);
|
||||||
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Vector<const char> str);
|
MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(const char* str) {
|
||||||
MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str);
|
return LookupUtf8Symbol(CStrVector(str));
|
||||||
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(const char* str) {
|
|
||||||
return LookupSymbol(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* LookupSymbol(String* str);
|
||||||
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(
|
MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(
|
||||||
Handle<SeqOneByteString> string, int from, int length);
|
Handle<SeqOneByteString> string, int from, int length);
|
||||||
|
|
||||||
bool LookupSymbolIfExists(String* str, String** symbol);
|
bool LookupSymbolIfExists(String* str, String** symbol);
|
||||||
|
@ -657,15 +657,21 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
|
|||||||
int limit = Max(frame_limit, 0);
|
int limit = Max(frame_limit, 0);
|
||||||
Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit);
|
Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit);
|
||||||
|
|
||||||
Handle<String> column_key = factory()->LookupAsciiSymbol("column");
|
Handle<String> column_key =
|
||||||
Handle<String> line_key = factory()->LookupAsciiSymbol("lineNumber");
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("column"));
|
||||||
Handle<String> script_key = factory()->LookupAsciiSymbol("scriptName");
|
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 =
|
Handle<String> script_name_or_source_url_key =
|
||||||
factory()->LookupAsciiSymbol("scriptNameOrSourceURL");
|
factory()->LookupOneByteSymbol(
|
||||||
Handle<String> function_key = factory()->LookupAsciiSymbol("functionName");
|
STATIC_ASCII_VECTOR("scriptNameOrSourceURL"));
|
||||||
Handle<String> eval_key = factory()->LookupAsciiSymbol("isEval");
|
Handle<String> function_key =
|
||||||
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("functionName"));
|
||||||
|
Handle<String> eval_key =
|
||||||
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("isEval"));
|
||||||
Handle<String> constructor_key =
|
Handle<String> constructor_key =
|
||||||
factory()->LookupAsciiSymbol("isConstructor");
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("isConstructor"));
|
||||||
|
|
||||||
StackTraceFrameIterator it(this);
|
StackTraceFrameIterator it(this);
|
||||||
int frames_seen = 0;
|
int frames_seen = 0;
|
||||||
@ -1155,7 +1161,8 @@ bool Isolate::ShouldReportException(bool* can_be_caught_externally,
|
|||||||
bool Isolate::IsErrorObject(Handle<Object> obj) {
|
bool Isolate::IsErrorObject(Handle<Object> obj) {
|
||||||
if (!obj->IsJSObject()) return false;
|
if (!obj->IsJSObject()) return false;
|
||||||
|
|
||||||
String* error_key = *(factory()->LookupAsciiSymbol("$Error"));
|
String* error_key =
|
||||||
|
*(factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("$Error")));
|
||||||
Object* error_constructor =
|
Object* error_constructor =
|
||||||
js_builtins_object()->GetPropertyNoExceptionThrown(error_key);
|
js_builtins_object()->GetPropertyNoExceptionThrown(error_key);
|
||||||
|
|
||||||
@ -1236,7 +1243,8 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
|
|||||||
bool failed = false;
|
bool failed = false;
|
||||||
exception_arg = Execution::ToDetailString(exception_arg, &failed);
|
exception_arg = Execution::ToDetailString(exception_arg, &failed);
|
||||||
if (failed) {
|
if (failed) {
|
||||||
exception_arg = factory()->LookupAsciiSymbol("exception");
|
exception_arg =
|
||||||
|
factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("exception"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Handle<Object> message_obj = MessageHandler::MakeMessageObject(
|
Handle<Object> message_obj = MessageHandler::MakeMessageObject(
|
||||||
|
@ -685,9 +685,7 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
|
|||||||
int length = position_ - beg_pos;
|
int length = position_ - beg_pos;
|
||||||
Handle<String> result;
|
Handle<String> result;
|
||||||
if (seq_ascii && is_symbol) {
|
if (seq_ascii && is_symbol) {
|
||||||
result = factory()->LookupAsciiSymbol(seq_source_,
|
result = factory()->LookupOneByteSymbol(seq_source_, beg_pos, length);
|
||||||
beg_pos,
|
|
||||||
length);
|
|
||||||
} else {
|
} else {
|
||||||
result = factory()->NewRawOneByteString(length, pretenure_);
|
result = factory()->NewRawOneByteString(length, pretenure_);
|
||||||
char* dest = SeqOneByteString::cast(*result)->GetChars();
|
char* dest = SeqOneByteString::cast(*result)->GetChars();
|
||||||
|
@ -216,7 +216,8 @@ BasicJsonStringifier::BasicJsonStringifier(Isolate* isolate)
|
|||||||
factory_->ToObject(factory_->empty_string()));
|
factory_->ToObject(factory_->empty_string()));
|
||||||
part_length_ = kInitialPartLength;
|
part_length_ = kInitialPartLength;
|
||||||
current_part_ = factory_->NewRawOneByteString(kInitialPartLength);
|
current_part_ = factory_->NewRawOneByteString(kInitialPartLength);
|
||||||
tojson_symbol_ = factory_->LookupAsciiSymbol("toJSON");
|
tojson_symbol_ =
|
||||||
|
factory_->LookupOneByteSymbol(STATIC_ASCII_VECTOR("toJSON"));
|
||||||
stack_ = factory_->NewJSArray(8);
|
stack_ = factory_->NewJSArray(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,11 +952,11 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
|
|||||||
|
|
||||||
Factory* factory = isolate->factory();
|
Factory* factory = isolate->factory();
|
||||||
Handle<String> start_pos_key =
|
Handle<String> start_pos_key =
|
||||||
factory->LookupAsciiSymbol("startPosition");
|
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("startPosition"));
|
||||||
Handle<String> end_pos_key =
|
Handle<String> end_pos_key =
|
||||||
factory->LookupAsciiSymbol("endPosition");
|
factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("endPosition"));
|
||||||
Handle<String> script_obj_key =
|
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> start_pos(Smi::FromInt(message_location.start_pos()));
|
||||||
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()));
|
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()));
|
||||||
Handle<JSValue> script_obj = GetScriptWrapper(message_location.script());
|
Handle<JSValue> script_obj = GetScriptWrapper(message_location.script());
|
||||||
|
@ -61,7 +61,7 @@ Handle<JSMessageObject> MessageHandler::MakeMessageObject(
|
|||||||
Vector< Handle<Object> > args,
|
Vector< Handle<Object> > args,
|
||||||
Handle<String> stack_trace,
|
Handle<String> stack_trace,
|
||||||
Handle<JSArray> stack_frames) {
|
Handle<JSArray> stack_frames) {
|
||||||
Handle<String> type_handle = FACTORY->LookupAsciiSymbol(type);
|
Handle<String> type_handle = FACTORY->LookupUtf8Symbol(type);
|
||||||
Handle<FixedArray> arguments_elements =
|
Handle<FixedArray> arguments_elements =
|
||||||
FACTORY->NewFixedArray(args.length());
|
FACTORY->NewFixedArray(args.length());
|
||||||
for (int i = 0; i < args.length(); i++) {
|
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> 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> fun =
|
||||||
Handle<JSFunction>(
|
Handle<JSFunction>(
|
||||||
JSFunction::cast(
|
JSFunction::cast(
|
||||||
@ -168,7 +169,7 @@ Handle<String> MessageHandler::GetMessage(Handle<Object> data) {
|
|||||||
&caught_exception);
|
&caught_exception);
|
||||||
|
|
||||||
if (caught_exception || !result->IsString()) {
|
if (caught_exception || !result->IsString()) {
|
||||||
return FACTORY->LookupAsciiSymbol("<error>");
|
return FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("<error>"));
|
||||||
}
|
}
|
||||||
Handle<String> result_string = Handle<String>::cast(result);
|
Handle<String> result_string = Handle<String>::cast(result);
|
||||||
// A string that has been obtained from JS code in this way is
|
// A string that has been obtained from JS code in this way is
|
||||||
|
@ -1753,7 +1753,7 @@ void JSObject::EnqueueChangeRecord(Handle<JSObject> object,
|
|||||||
Handle<Object> old_value) {
|
Handle<Object> old_value) {
|
||||||
Isolate* isolate = object->GetIsolate();
|
Isolate* isolate = object->GetIsolate();
|
||||||
HandleScope scope;
|
HandleScope scope;
|
||||||
Handle<String> type = isolate->factory()->LookupAsciiSymbol(type_str);
|
Handle<String> type = isolate->factory()->LookupUtf8Symbol(type_str);
|
||||||
if (object->IsJSGlobalObject()) {
|
if (object->IsJSGlobalObject()) {
|
||||||
object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate);
|
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();
|
if (has_pending_exception) return Failure::Exception();
|
||||||
|
|
||||||
// [[GetProperty]] requires to check that all properties are configurable.
|
// [[GetProperty]] requires to check that all properties are configurable.
|
||||||
Handle<String> configurable_name =
|
Handle<String> configurable_name = isolate->factory()->LookupOneByteSymbol(
|
||||||
isolate->factory()->LookupAsciiSymbol("configurable_");
|
STATIC_ASCII_VECTOR("configurable_"));
|
||||||
Handle<Object> configurable(
|
Handle<Object> configurable(
|
||||||
v8::internal::GetProperty(desc, configurable_name));
|
v8::internal::GetProperty(desc, configurable_name));
|
||||||
ASSERT(!isolate->has_pending_exception());
|
ASSERT(!isolate->has_pending_exception());
|
||||||
ASSERT(configurable->IsTrue() || configurable->IsFalse());
|
ASSERT(configurable->IsTrue() || configurable->IsFalse());
|
||||||
if (configurable->IsFalse()) {
|
if (configurable->IsFalse()) {
|
||||||
Handle<String> trap =
|
Handle<String> trap =
|
||||||
isolate->factory()->LookupAsciiSymbol("getPropertyDescriptor");
|
isolate->factory()->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("getPropertyDescriptor"));
|
||||||
Handle<Object> args[] = { handler, trap, name };
|
Handle<Object> args[] = { handler, trap, name };
|
||||||
Handle<Object> error = isolate->factory()->NewTypeError(
|
Handle<Object> error = isolate->factory()->NewTypeError(
|
||||||
"proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
|
"proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
|
||||||
@ -2674,13 +2675,15 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
|
|||||||
|
|
||||||
// Check for DataDescriptor.
|
// Check for DataDescriptor.
|
||||||
Handle<String> hasWritable_name =
|
Handle<String> hasWritable_name =
|
||||||
isolate->factory()->LookupAsciiSymbol("hasWritable_");
|
isolate->factory()->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("hasWritable_"));
|
||||||
Handle<Object> hasWritable(v8::internal::GetProperty(desc, hasWritable_name));
|
Handle<Object> hasWritable(v8::internal::GetProperty(desc, hasWritable_name));
|
||||||
ASSERT(!isolate->has_pending_exception());
|
ASSERT(!isolate->has_pending_exception());
|
||||||
ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse());
|
ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse());
|
||||||
if (hasWritable->IsTrue()) {
|
if (hasWritable->IsTrue()) {
|
||||||
Handle<String> writable_name =
|
Handle<String> writable_name =
|
||||||
isolate->factory()->LookupAsciiSymbol("writable_");
|
isolate->factory()->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("writable_"));
|
||||||
Handle<Object> writable(v8::internal::GetProperty(desc, writable_name));
|
Handle<Object> writable(v8::internal::GetProperty(desc, writable_name));
|
||||||
ASSERT(!isolate->has_pending_exception());
|
ASSERT(!isolate->has_pending_exception());
|
||||||
ASSERT(writable->IsTrue() || writable->IsFalse());
|
ASSERT(writable->IsTrue() || writable->IsFalse());
|
||||||
@ -2694,7 +2697,8 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We have an AccessorDescriptor.
|
// 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));
|
Handle<Object> setter(v8::internal::GetProperty(desc, set_name));
|
||||||
ASSERT(!isolate->has_pending_exception());
|
ASSERT(!isolate->has_pending_exception());
|
||||||
if (!setter->IsUndefined()) {
|
if (!setter->IsUndefined()) {
|
||||||
@ -2726,7 +2730,8 @@ MUST_USE_RESULT MaybeObject* JSProxy::DeletePropertyWithHandler(
|
|||||||
Object* bool_result = result->ToBoolean();
|
Object* bool_result = result->ToBoolean();
|
||||||
if (mode == STRICT_DELETION && bool_result == GetHeap()->false_value()) {
|
if (mode == STRICT_DELETION && bool_result == GetHeap()->false_value()) {
|
||||||
Handle<Object> handler(receiver->handler());
|
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> args[] = { handler, trap_name };
|
||||||
Handle<Object> error = isolate->factory()->NewTypeError(
|
Handle<Object> error = isolate->factory()->NewTypeError(
|
||||||
"handler_failed", HandleVector(args, ARRAY_SIZE(args)));
|
"handler_failed", HandleVector(args, ARRAY_SIZE(args)));
|
||||||
@ -2772,19 +2777,22 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
|
|||||||
if (has_pending_exception) return NONE;
|
if (has_pending_exception) return NONE;
|
||||||
|
|
||||||
// Convert result to PropertyAttributes.
|
// 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));
|
Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_n));
|
||||||
if (isolate->has_pending_exception()) return NONE;
|
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));
|
Handle<Object> configurable(v8::internal::GetProperty(desc, conf_n));
|
||||||
if (isolate->has_pending_exception()) return NONE;
|
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));
|
Handle<Object> writable(v8::internal::GetProperty(desc, writ_n));
|
||||||
if (isolate->has_pending_exception()) return NONE;
|
if (isolate->has_pending_exception()) return NONE;
|
||||||
|
|
||||||
if (configurable->IsFalse()) {
|
if (configurable->IsFalse()) {
|
||||||
Handle<String> trap =
|
Handle<String> trap = isolate->factory()->LookupOneByteSymbol(
|
||||||
isolate->factory()->LookupAsciiSymbol("getPropertyDescriptor");
|
STATIC_ASCII_VECTOR("getPropertyDescriptor"));
|
||||||
Handle<Object> args[] = { handler, trap, name };
|
Handle<Object> args[] = { handler, trap, name };
|
||||||
Handle<Object> error = isolate->factory()->NewTypeError(
|
Handle<Object> error = isolate->factory()->NewTypeError(
|
||||||
"proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
|
"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();
|
Isolate* isolate = GetIsolate();
|
||||||
Handle<Object> handler(this->handler());
|
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));
|
Handle<Object> trap(v8::internal::GetProperty(handler, trap_name));
|
||||||
if (isolate->has_pending_exception()) return trap;
|
if (isolate->has_pending_exception()) return trap;
|
||||||
|
|
||||||
@ -8326,7 +8334,7 @@ MaybeObject* Oddball::Initialize(const char* to_string,
|
|||||||
byte kind) {
|
byte kind) {
|
||||||
String* symbol;
|
String* symbol;
|
||||||
{ MaybeObject* maybe_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;
|
if (!maybe_symbol->To(&symbol)) return maybe_symbol;
|
||||||
}
|
}
|
||||||
set_to_string(symbol);
|
set_to_string(symbol);
|
||||||
@ -12707,21 +12715,21 @@ bool SymbolTable::LookupTwoCharsSymbolIfExists(uint32_t c1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MaybeObject* SymbolTable::LookupSymbol(Vector<const char> str,
|
MaybeObject* SymbolTable::LookupUtf8Symbol(Vector<const char> str,
|
||||||
Object** s) {
|
Object** s) {
|
||||||
Utf8SymbolKey key(str, GetHeap()->HashSeed());
|
Utf8SymbolKey key(str, GetHeap()->HashSeed());
|
||||||
return LookupKey(&key, s);
|
return LookupKey(&key, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MaybeObject* SymbolTable::LookupAsciiSymbol(Vector<const char> str,
|
MaybeObject* SymbolTable::LookupOneByteSymbol(Vector<const char> str,
|
||||||
Object** s) {
|
Object** s) {
|
||||||
AsciiSymbolKey key(str, GetHeap()->HashSeed());
|
AsciiSymbolKey key(str, GetHeap()->HashSeed());
|
||||||
return LookupKey(&key, s);
|
return LookupKey(&key, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MaybeObject* SymbolTable::LookupSubStringAsciiSymbol(
|
MaybeObject* SymbolTable::LookupSubStringOneByteSymbol(
|
||||||
Handle<SeqOneByteString> str,
|
Handle<SeqOneByteString> str,
|
||||||
int from,
|
int from,
|
||||||
int length,
|
int length,
|
||||||
|
@ -3026,10 +3026,11 @@ class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> {
|
|||||||
// added. The return value is the symbol table which might have
|
// added. The return value is the symbol table which might have
|
||||||
// been enlarged. If the return value is not a failure, the symbol
|
// been enlarged. If the return value is not a failure, the symbol
|
||||||
// pointer *s is set to the symbol found.
|
// pointer *s is set to the symbol found.
|
||||||
MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str, Object** s);
|
MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str,
|
||||||
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Vector<const char> str,
|
Object** s);
|
||||||
Object** s);
|
MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const char> str,
|
||||||
MUST_USE_RESULT MaybeObject* LookupSubStringAsciiSymbol(
|
Object** s);
|
||||||
|
MUST_USE_RESULT MaybeObject* LookupSubStringOneByteSymbol(
|
||||||
Handle<SeqOneByteString> str,
|
Handle<SeqOneByteString> str,
|
||||||
int from,
|
int from,
|
||||||
int length,
|
int length,
|
||||||
|
@ -254,7 +254,7 @@ Handle<String> Parser::LookupSymbol(int symbol_id) {
|
|||||||
if (static_cast<unsigned>(symbol_id)
|
if (static_cast<unsigned>(symbol_id)
|
||||||
>= static_cast<unsigned>(symbol_cache_.length())) {
|
>= static_cast<unsigned>(symbol_cache_.length())) {
|
||||||
if (scanner().is_literal_ascii()) {
|
if (scanner().is_literal_ascii()) {
|
||||||
return isolate()->factory()->LookupAsciiSymbol(
|
return isolate()->factory()->LookupOneByteSymbol(
|
||||||
scanner().literal_ascii_string());
|
scanner().literal_ascii_string());
|
||||||
} else {
|
} else {
|
||||||
return isolate()->factory()->LookupTwoByteSymbol(
|
return isolate()->factory()->LookupTwoByteSymbol(
|
||||||
@ -275,7 +275,7 @@ Handle<String> Parser::LookupCachedSymbol(int symbol_id) {
|
|||||||
Handle<String> result = symbol_cache_.at(symbol_id);
|
Handle<String> result = symbol_cache_.at(symbol_id);
|
||||||
if (result.is_null()) {
|
if (result.is_null()) {
|
||||||
if (scanner().is_literal_ascii()) {
|
if (scanner().is_literal_ascii()) {
|
||||||
result = isolate()->factory()->LookupAsciiSymbol(
|
result = isolate()->factory()->LookupOneByteSymbol(
|
||||||
scanner().literal_ascii_string());
|
scanner().literal_ascii_string());
|
||||||
} else {
|
} else {
|
||||||
result = isolate()->factory()->LookupTwoByteSymbol(
|
result = isolate()->factory()->LookupTwoByteSymbol(
|
||||||
@ -3988,7 +3988,7 @@ ObjectLiteral::Property* Parser::ParseObjectLiteralGetSet(bool is_getter,
|
|||||||
next == Token::STRING || is_keyword) {
|
next == Token::STRING || is_keyword) {
|
||||||
Handle<String> name;
|
Handle<String> name;
|
||||||
if (is_keyword) {
|
if (is_keyword) {
|
||||||
name = isolate_->factory()->LookupAsciiSymbol(Token::String(next));
|
name = isolate_->factory()->LookupUtf8Symbol(Token::String(next));
|
||||||
} else {
|
} else {
|
||||||
name = GetSymbol(CHECK_OK);
|
name = GetSymbol(CHECK_OK);
|
||||||
}
|
}
|
||||||
|
@ -1843,7 +1843,7 @@ static Handle<JSFunction> InstallBuiltin(Isolate* isolate,
|
|||||||
Handle<JSObject> holder,
|
Handle<JSObject> holder,
|
||||||
const char* name,
|
const char* name,
|
||||||
Builtins::Name builtin_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<Code> code(isolate->builtins()->builtin(builtin_name));
|
||||||
Handle<JSFunction> optimized =
|
Handle<JSFunction> optimized =
|
||||||
isolate->factory()->NewFunction(key,
|
isolate->factory()->NewFunction(key,
|
||||||
@ -7844,8 +7844,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ForceParallelRecompile) {
|
|||||||
HandleScope handle_scope(isolate);
|
HandleScope handle_scope(isolate);
|
||||||
ASSERT(FLAG_parallel_recompilation && FLAG_manual_parallel_recompilation);
|
ASSERT(FLAG_parallel_recompilation && FLAG_manual_parallel_recompilation);
|
||||||
if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
|
if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
|
||||||
return isolate->Throw(
|
return isolate->Throw(*isolate->factory()->LookupOneByteSymbol(
|
||||||
*isolate->factory()->LookupAsciiSymbol("Recompile queue is full."));
|
STATIC_ASCII_VECTOR("Recompile queue is full.")));
|
||||||
}
|
}
|
||||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
|
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
|
||||||
fun->ReplaceCode(isolate->builtins()->builtin(Builtins::kParallelRecompile));
|
fun->ReplaceCode(isolate->builtins()->builtin(Builtins::kParallelRecompile));
|
||||||
@ -12809,7 +12809,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) {
|
|||||||
const char* error_message =
|
const char* error_message =
|
||||||
LiveEdit::RestartFrame(it.frame(), isolate->runtime_zone());
|
LiveEdit::RestartFrame(it.frame(), isolate->runtime_zone());
|
||||||
if (error_message) {
|
if (error_message) {
|
||||||
return *(isolate->factory()->LookupAsciiSymbol(error_message));
|
return *(isolate->factory()->LookupUtf8Symbol(error_message));
|
||||||
}
|
}
|
||||||
return heap->true_value();
|
return heap->true_value();
|
||||||
}
|
}
|
||||||
@ -13586,7 +13586,7 @@ MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap,
|
|||||||
for (int i = 0; i < kNumFunctions; ++i) {
|
for (int i = 0; i < kNumFunctions; ++i) {
|
||||||
Object* name_symbol;
|
Object* name_symbol;
|
||||||
{ MaybeObject* maybe_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;
|
if (!maybe_name_symbol->ToObject(&name_symbol)) return maybe_name_symbol;
|
||||||
}
|
}
|
||||||
StringDictionary* string_dictionary = StringDictionary::cast(dictionary);
|
StringDictionary* string_dictionary = StringDictionary::cast(dictionary);
|
||||||
|
@ -1386,9 +1386,8 @@ void Scope::AllocateModulesRecursively(Scope* host_scope) {
|
|||||||
if (already_resolved()) return;
|
if (already_resolved()) return;
|
||||||
if (is_module_scope()) {
|
if (is_module_scope()) {
|
||||||
ASSERT(interface_->IsFrozen());
|
ASSERT(interface_->IsFrozen());
|
||||||
const char raw_name[] = ".module";
|
Handle<String> name = isolate_->factory()->LookupOneByteSymbol(
|
||||||
Handle<String> name = isolate_->factory()->LookupSymbol(
|
STATIC_ASCII_VECTOR(".module"));
|
||||||
Vector<const char>(raw_name, StrLength(raw_name)));
|
|
||||||
ASSERT(module_var_ == NULL);
|
ASSERT(module_var_ == NULL);
|
||||||
module_var_ = host_scope->NewInternal(name);
|
module_var_ = host_scope->NewInternal(name);
|
||||||
++host_scope->num_modules_;
|
++host_scope->num_modules_;
|
||||||
|
@ -522,6 +522,8 @@ class ScopedVector : public Vector<T> {
|
|||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedVector);
|
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) {
|
inline Vector<const char> CStrVector(const char* data) {
|
||||||
return Vector<const char>(data, StrLength(data));
|
return Vector<const char>(data, StrLength(data));
|
||||||
|
@ -94,7 +94,7 @@ static void InitializeVM() {
|
|||||||
|
|
||||||
|
|
||||||
static MaybeObject* GetGlobalProperty(const char* name) {
|
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);
|
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) {
|
static void SetGlobalProperty(const char* name, Object* value) {
|
||||||
Isolate* isolate = Isolate::Current();
|
Isolate* isolate = Isolate::Current();
|
||||||
Handle<Object> object(value);
|
Handle<Object> object(value);
|
||||||
Handle<String> symbol = FACTORY->LookupAsciiSymbol(name);
|
Handle<String> symbol = FACTORY->LookupUtf8Symbol(name);
|
||||||
Handle<JSObject> global(Isolate::Current()->context()->global_object());
|
Handle<JSObject> global(Isolate::Current()->context()->global_object());
|
||||||
SetProperty(isolate, global, symbol, object, NONE, kNonStrictMode);
|
SetProperty(isolate, global, symbol, object, NONE, kNonStrictMode);
|
||||||
}
|
}
|
||||||
@ -294,13 +294,16 @@ TEST(C2JSFrames) {
|
|||||||
Execution::Call(fun0, global, 0, NULL, &has_pending_exception);
|
Execution::Call(fun0, global, 0, NULL, &has_pending_exception);
|
||||||
CHECK(!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()->
|
MaybeObject* fun1_object = Isolate::Current()->context()->global_object()->
|
||||||
GetProperty(String::cast(foo_symbol));
|
GetProperty(String::cast(foo_symbol));
|
||||||
Handle<Object> fun1(fun1_object->ToObjectChecked());
|
Handle<Object> fun1(fun1_object->ToObjectChecked());
|
||||||
CHECK(fun1->IsJSFunction());
|
CHECK(fun1->IsJSFunction());
|
||||||
|
|
||||||
Handle<Object> argv[] = { FACTORY->LookupAsciiSymbol("hello") };
|
Handle<Object> argv[] =
|
||||||
|
{ FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("hello")) };
|
||||||
Execution::Call(Handle<JSFunction>::cast(fun1),
|
Execution::Call(Handle<JSFunction>::cast(fun1),
|
||||||
global,
|
global,
|
||||||
ARRAY_SIZE(argv),
|
ARRAY_SIZE(argv),
|
||||||
|
@ -156,7 +156,7 @@ class DebugLocalContext {
|
|||||||
Handle<JSGlobalProxy> global(Handle<JSGlobalProxy>::cast(
|
Handle<JSGlobalProxy> global(Handle<JSGlobalProxy>::cast(
|
||||||
v8::Utils::OpenHandle(*context_->Global())));
|
v8::Utils::OpenHandle(*context_->Global())));
|
||||||
Handle<v8::internal::String> debug_string =
|
Handle<v8::internal::String> debug_string =
|
||||||
FACTORY->LookupAsciiSymbol("debug");
|
FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("debug"));
|
||||||
SetProperty(isolate, global, debug_string,
|
SetProperty(isolate, global, debug_string,
|
||||||
Handle<Object>(debug->debug_context()->global_proxy()), DONT_ENUM,
|
Handle<Object>(debug->debug_context()->global_proxy()), DONT_ENUM,
|
||||||
::v8::internal::kNonStrictMode);
|
::v8::internal::kNonStrictMode);
|
||||||
|
@ -218,10 +218,10 @@ TEST(GarbageCollection) {
|
|||||||
// Check GC.
|
// Check GC.
|
||||||
HEAP->CollectGarbage(NEW_SPACE);
|
HEAP->CollectGarbage(NEW_SPACE);
|
||||||
|
|
||||||
Handle<String> name = FACTORY->LookupAsciiSymbol("theFunction");
|
Handle<String> name = FACTORY->LookupUtf8Symbol("theFunction");
|
||||||
Handle<String> prop_name = FACTORY->LookupAsciiSymbol("theSlot");
|
Handle<String> prop_name = FACTORY->LookupUtf8Symbol("theSlot");
|
||||||
Handle<String> prop_namex = FACTORY->LookupAsciiSymbol("theSlotx");
|
Handle<String> prop_namex = FACTORY->LookupUtf8Symbol("theSlotx");
|
||||||
Handle<String> obj_name = FACTORY->LookupAsciiSymbol("theObject");
|
Handle<String> obj_name = FACTORY->LookupUtf8Symbol("theObject");
|
||||||
|
|
||||||
{
|
{
|
||||||
v8::HandleScope inner_scope;
|
v8::HandleScope inner_scope;
|
||||||
@ -536,12 +536,12 @@ static const char* not_so_random_string_table[] = {
|
|||||||
static void CheckSymbols(const char** strings) {
|
static void CheckSymbols(const char** strings) {
|
||||||
for (const char* string = *strings; *strings != 0; string = *strings++) {
|
for (const char* string = *strings; *strings != 0; string = *strings++) {
|
||||||
Object* a;
|
Object* a;
|
||||||
MaybeObject* maybe_a = HEAP->LookupAsciiSymbol(string);
|
MaybeObject* maybe_a = HEAP->LookupUtf8Symbol(string);
|
||||||
// LookupAsciiSymbol may return a failure if a GC is needed.
|
// LookupUtf8Symbol may return a failure if a GC is needed.
|
||||||
if (!maybe_a->ToObject(&a)) continue;
|
if (!maybe_a->ToObject(&a)) continue;
|
||||||
CHECK(a->IsSymbol());
|
CHECK(a->IsSymbol());
|
||||||
Object* b;
|
Object* b;
|
||||||
MaybeObject* maybe_b = HEAP->LookupAsciiSymbol(string);
|
MaybeObject* maybe_b = HEAP->LookupUtf8Symbol(string);
|
||||||
if (!maybe_b->ToObject(&b)) continue;
|
if (!maybe_b->ToObject(&b)) continue;
|
||||||
CHECK_EQ(b, a);
|
CHECK_EQ(b, a);
|
||||||
CHECK(String::cast(b)->IsEqualTo(CStrVector(string)));
|
CHECK(String::cast(b)->IsEqualTo(CStrVector(string)));
|
||||||
@ -561,14 +561,14 @@ TEST(FunctionAllocation) {
|
|||||||
InitializeVM();
|
InitializeVM();
|
||||||
|
|
||||||
v8::HandleScope sc;
|
v8::HandleScope sc;
|
||||||
Handle<String> name = FACTORY->LookupAsciiSymbol("theFunction");
|
Handle<String> name = FACTORY->LookupUtf8Symbol("theFunction");
|
||||||
Handle<JSFunction> function =
|
Handle<JSFunction> function =
|
||||||
FACTORY->NewFunction(name, FACTORY->undefined_value());
|
FACTORY->NewFunction(name, FACTORY->undefined_value());
|
||||||
Handle<Map> initial_map =
|
Handle<Map> initial_map =
|
||||||
FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
||||||
function->set_initial_map(*initial_map);
|
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);
|
Handle<JSObject> obj = FACTORY->NewJSObject(function);
|
||||||
obj->SetProperty(
|
obj->SetProperty(
|
||||||
*prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
|
*prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
|
||||||
@ -590,8 +590,8 @@ TEST(ObjectProperties) {
|
|||||||
JSFunction* object_function = JSFunction::cast(raw_object);
|
JSFunction* object_function = JSFunction::cast(raw_object);
|
||||||
Handle<JSFunction> constructor(object_function);
|
Handle<JSFunction> constructor(object_function);
|
||||||
Handle<JSObject> obj = FACTORY->NewJSObject(constructor);
|
Handle<JSObject> obj = FACTORY->NewJSObject(constructor);
|
||||||
Handle<String> first = FACTORY->LookupAsciiSymbol("first");
|
Handle<String> first = FACTORY->LookupUtf8Symbol("first");
|
||||||
Handle<String> second = FACTORY->LookupAsciiSymbol("second");
|
Handle<String> second = FACTORY->LookupUtf8Symbol("second");
|
||||||
|
|
||||||
// check for empty
|
// check for empty
|
||||||
CHECK(!obj->HasLocalProperty(*first));
|
CHECK(!obj->HasLocalProperty(*first));
|
||||||
@ -640,12 +640,12 @@ TEST(ObjectProperties) {
|
|||||||
Handle<String> s1 = FACTORY->NewStringFromAscii(CStrVector(string1));
|
Handle<String> s1 = FACTORY->NewStringFromAscii(CStrVector(string1));
|
||||||
obj->SetProperty(
|
obj->SetProperty(
|
||||||
*s1, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
*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(obj->HasLocalProperty(*s1_symbol));
|
||||||
|
|
||||||
// check symbol and string match
|
// check symbol and string match
|
||||||
const char* string2 = "fugl";
|
const char* string2 = "fugl";
|
||||||
Handle<String> s2_symbol = FACTORY->LookupAsciiSymbol(string2);
|
Handle<String> s2_symbol = FACTORY->LookupUtf8Symbol(string2);
|
||||||
obj->SetProperty(
|
obj->SetProperty(
|
||||||
*s2_symbol, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
*s2_symbol, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
||||||
Handle<String> s2 = FACTORY->NewStringFromAscii(CStrVector(string2));
|
Handle<String> s2 = FACTORY->NewStringFromAscii(CStrVector(string2));
|
||||||
@ -657,14 +657,14 @@ TEST(JSObjectMaps) {
|
|||||||
InitializeVM();
|
InitializeVM();
|
||||||
|
|
||||||
v8::HandleScope sc;
|
v8::HandleScope sc;
|
||||||
Handle<String> name = FACTORY->LookupAsciiSymbol("theFunction");
|
Handle<String> name = FACTORY->LookupUtf8Symbol("theFunction");
|
||||||
Handle<JSFunction> function =
|
Handle<JSFunction> function =
|
||||||
FACTORY->NewFunction(name, FACTORY->undefined_value());
|
FACTORY->NewFunction(name, FACTORY->undefined_value());
|
||||||
Handle<Map> initial_map =
|
Handle<Map> initial_map =
|
||||||
FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
||||||
function->set_initial_map(*initial_map);
|
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);
|
Handle<JSObject> obj = FACTORY->NewJSObject(function);
|
||||||
|
|
||||||
// Set a propery
|
// Set a propery
|
||||||
@ -681,7 +681,7 @@ TEST(JSArray) {
|
|||||||
InitializeVM();
|
InitializeVM();
|
||||||
|
|
||||||
v8::HandleScope sc;
|
v8::HandleScope sc;
|
||||||
Handle<String> name = FACTORY->LookupAsciiSymbol("Array");
|
Handle<String> name = FACTORY->LookupUtf8Symbol("Array");
|
||||||
Object* raw_object = Isolate::Current()->context()->global_object()->
|
Object* raw_object = Isolate::Current()->context()->global_object()->
|
||||||
GetProperty(*name)->ToObjectChecked();
|
GetProperty(*name)->ToObjectChecked();
|
||||||
Handle<JSFunction> function = Handle<JSFunction>(
|
Handle<JSFunction> function = Handle<JSFunction>(
|
||||||
@ -734,8 +734,8 @@ TEST(JSObjectCopy) {
|
|||||||
JSFunction* object_function = JSFunction::cast(raw_object);
|
JSFunction* object_function = JSFunction::cast(raw_object);
|
||||||
Handle<JSFunction> constructor(object_function);
|
Handle<JSFunction> constructor(object_function);
|
||||||
Handle<JSObject> obj = FACTORY->NewJSObject(constructor);
|
Handle<JSObject> obj = FACTORY->NewJSObject(constructor);
|
||||||
Handle<String> first = FACTORY->LookupAsciiSymbol("first");
|
Handle<String> first = FACTORY->LookupUtf8Symbol("first");
|
||||||
Handle<String> second = FACTORY->LookupAsciiSymbol("second");
|
Handle<String> second = FACTORY->LookupUtf8Symbol("second");
|
||||||
|
|
||||||
obj->SetProperty(
|
obj->SetProperty(
|
||||||
*first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
*first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
||||||
@ -790,10 +790,10 @@ TEST(StringAllocation) {
|
|||||||
non_ascii[3 * i + 2] = chars[2];
|
non_ascii[3 * i + 2] = chars[2];
|
||||||
}
|
}
|
||||||
Handle<String> non_ascii_sym =
|
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());
|
CHECK_EQ(length, non_ascii_sym->length());
|
||||||
Handle<String> ascii_sym =
|
Handle<String> ascii_sym =
|
||||||
FACTORY->LookupSymbol(Vector<const char>(ascii, length));
|
FACTORY->LookupOneByteSymbol(Vector<const char>(ascii, length));
|
||||||
CHECK_EQ(length, ascii_sym->length());
|
CHECK_EQ(length, ascii_sym->length());
|
||||||
Handle<String> non_ascii_str =
|
Handle<String> non_ascii_str =
|
||||||
FACTORY->NewStringFromUtf8(Vector<const char>(non_ascii, 3 * length));
|
FACTORY->NewStringFromUtf8(Vector<const char>(non_ascii, 3 * length));
|
||||||
@ -970,7 +970,7 @@ TEST(TestCodeFlushing) {
|
|||||||
" var z = x + y;"
|
" var z = x + y;"
|
||||||
"};"
|
"};"
|
||||||
"foo()";
|
"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.
|
// This compile will add the code to the compilation cache.
|
||||||
{ v8::HandleScope scope;
|
{ v8::HandleScope scope;
|
||||||
@ -1017,7 +1017,7 @@ TEST(TestCodeFlushingIncremental) {
|
|||||||
" var z = x + y;"
|
" var z = x + y;"
|
||||||
"};"
|
"};"
|
||||||
"foo()";
|
"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.
|
// This compile will add the code to the compilation cache.
|
||||||
{ v8::HandleScope scope;
|
{ v8::HandleScope scope;
|
||||||
@ -1087,8 +1087,8 @@ TEST(TestCodeFlushingIncrementalScavenge) {
|
|||||||
" var x = 23;"
|
" var x = 23;"
|
||||||
"};"
|
"};"
|
||||||
"bar();";
|
"bar();";
|
||||||
Handle<String> foo_name = FACTORY->LookupAsciiSymbol("foo");
|
Handle<String> foo_name = FACTORY->LookupUtf8Symbol("foo");
|
||||||
Handle<String> bar_name = FACTORY->LookupAsciiSymbol("bar");
|
Handle<String> bar_name = FACTORY->LookupUtf8Symbol("bar");
|
||||||
|
|
||||||
// Perfrom one initial GC to enable code flushing.
|
// Perfrom one initial GC to enable code flushing.
|
||||||
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
||||||
@ -1149,7 +1149,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
|||||||
" var z = x + y;"
|
" var z = x + y;"
|
||||||
"};"
|
"};"
|
||||||
"foo()";
|
"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.
|
// This compile will add the code to the compilation cache.
|
||||||
{ v8::HandleScope scope;
|
{ v8::HandleScope scope;
|
||||||
@ -2493,7 +2493,7 @@ TEST(Regression144230) {
|
|||||||
// Fourth is the tricky part. Make sure the code containing the CallIC is
|
// 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 first without clearing the IC. The shared function info is then
|
||||||
// visited later, causing the CallIC to be cleared.
|
// 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());
|
Handle<GlobalObject> global(ISOLATE->context()->global_object());
|
||||||
MaybeObject* maybe_call = global->GetProperty(*name);
|
MaybeObject* maybe_call = global->GetProperty(*name);
|
||||||
JSFunction* call = JSFunction::cast(maybe_call->ToObjectChecked());
|
JSFunction* call = JSFunction::cast(maybe_call->ToObjectChecked());
|
||||||
|
@ -183,7 +183,7 @@ TEST(MarkCompactCollector) {
|
|||||||
|
|
||||||
// allocate a garbage
|
// allocate a garbage
|
||||||
String* func_name =
|
String* func_name =
|
||||||
String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked());
|
String::cast(HEAP->LookupUtf8Symbol("theFunction")->ToObjectChecked());
|
||||||
SharedFunctionInfo* function_share = SharedFunctionInfo::cast(
|
SharedFunctionInfo* function_share = SharedFunctionInfo::cast(
|
||||||
HEAP->AllocateSharedFunctionInfo(func_name)->ToObjectChecked());
|
HEAP->AllocateSharedFunctionInfo(func_name)->ToObjectChecked());
|
||||||
JSFunction* function = JSFunction::cast(
|
JSFunction* function = JSFunction::cast(
|
||||||
@ -202,7 +202,7 @@ TEST(MarkCompactCollector) {
|
|||||||
HEAP->CollectGarbage(OLD_POINTER_SPACE);
|
HEAP->CollectGarbage(OLD_POINTER_SPACE);
|
||||||
|
|
||||||
func_name =
|
func_name =
|
||||||
String::cast(HEAP->LookupAsciiSymbol("theFunction")->ToObjectChecked());
|
String::cast(HEAP->LookupUtf8Symbol("theFunction")->ToObjectChecked());
|
||||||
CHECK(Isolate::Current()->context()->global_object()->
|
CHECK(Isolate::Current()->context()->global_object()->
|
||||||
HasLocalProperty(func_name));
|
HasLocalProperty(func_name));
|
||||||
Object* func_value = Isolate::Current()->context()->global_object()->
|
Object* func_value = Isolate::Current()->context()->global_object()->
|
||||||
@ -212,11 +212,11 @@ TEST(MarkCompactCollector) {
|
|||||||
|
|
||||||
obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked());
|
obj = JSObject::cast(HEAP->AllocateJSObject(function)->ToObjectChecked());
|
||||||
String* obj_name =
|
String* obj_name =
|
||||||
String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked());
|
String::cast(HEAP->LookupUtf8Symbol("theObject")->ToObjectChecked());
|
||||||
Isolate::Current()->context()->global_object()->SetProperty(
|
Isolate::Current()->context()->global_object()->SetProperty(
|
||||||
obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked();
|
obj_name, obj, NONE, kNonStrictMode)->ToObjectChecked();
|
||||||
String* prop_name =
|
String* prop_name =
|
||||||
String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked());
|
String::cast(HEAP->LookupUtf8Symbol("theSlot")->ToObjectChecked());
|
||||||
obj->SetProperty(prop_name,
|
obj->SetProperty(prop_name,
|
||||||
Smi::FromInt(23),
|
Smi::FromInt(23),
|
||||||
NONE,
|
NONE,
|
||||||
@ -225,7 +225,7 @@ TEST(MarkCompactCollector) {
|
|||||||
HEAP->CollectGarbage(OLD_POINTER_SPACE);
|
HEAP->CollectGarbage(OLD_POINTER_SPACE);
|
||||||
|
|
||||||
obj_name =
|
obj_name =
|
||||||
String::cast(HEAP->LookupAsciiSymbol("theObject")->ToObjectChecked());
|
String::cast(HEAP->LookupUtf8Symbol("theObject")->ToObjectChecked());
|
||||||
CHECK(Isolate::Current()->context()->global_object()->
|
CHECK(Isolate::Current()->context()->global_object()->
|
||||||
HasLocalProperty(obj_name));
|
HasLocalProperty(obj_name));
|
||||||
CHECK(Isolate::Current()->context()->global_object()->
|
CHECK(Isolate::Current()->context()->global_object()->
|
||||||
@ -233,7 +233,7 @@ TEST(MarkCompactCollector) {
|
|||||||
obj = JSObject::cast(Isolate::Current()->context()->global_object()->
|
obj = JSObject::cast(Isolate::Current()->context()->global_object()->
|
||||||
GetProperty(obj_name)->ToObjectChecked());
|
GetProperty(obj_name)->ToObjectChecked());
|
||||||
prop_name =
|
prop_name =
|
||||||
String::cast(HEAP->LookupAsciiSymbol("theSlot")->ToObjectChecked());
|
String::cast(HEAP->LookupUtf8Symbol("theSlot")->ToObjectChecked());
|
||||||
CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23));
|
CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,8 @@ TEST(CrankshaftRandom) {
|
|||||||
|
|
||||||
CompileRun("function f() { return Math.random(); }");
|
CompileRun("function f() { return Math.random(); }");
|
||||||
|
|
||||||
Object* symbol = FACTORY->LookupAsciiSymbol("f")->ToObjectChecked();
|
Object* symbol = FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("f"))->
|
||||||
|
ToObjectChecked();
|
||||||
MaybeObject* fun_object =
|
MaybeObject* fun_object =
|
||||||
context->global_object()->GetProperty(String::cast(symbol));
|
context->global_object()->GetProperty(String::cast(symbol));
|
||||||
Handle<JSFunction> fun(JSFunction::cast(fun_object->ToObjectChecked()));
|
Handle<JSFunction> fun(JSFunction::cast(fun_object->ToObjectChecked()));
|
||||||
|
@ -291,7 +291,8 @@ static void SanityCheck() {
|
|||||||
CHECK(Isolate::Current()->global_object()->IsJSObject());
|
CHECK(Isolate::Current()->global_object()->IsJSObject());
|
||||||
CHECK(Isolate::Current()->native_context()->IsContext());
|
CHECK(Isolate::Current()->native_context()->IsContext());
|
||||||
CHECK(HEAP->symbol_table()->IsSymbolTable());
|
CHECK(HEAP->symbol_table()->IsSymbolTable());
|
||||||
CHECK(!FACTORY->LookupAsciiSymbol("Empty")->IsFailure());
|
CHECK(!FACTORY->LookupOneByteSymbol(
|
||||||
|
STATIC_ASCII_VECTOR("Empty"))->IsFailure());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user