Purge unused internalized string accessors.

R=marja@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23141 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-08-18 07:54:19 +00:00
parent d32fa64d33
commit 84edfa3d0c
22 changed files with 37 additions and 58 deletions

View File

@ -5616,7 +5616,7 @@ class Internals {
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
static const int kEmptyStringRootIndex = 164;
static const int kEmptyStringRootIndex = 161;
// The external allocation limit should be below 256 MB on all architectures
// to avoid that resource-constrained embedders run low on memory.

View File

@ -3304,7 +3304,8 @@ Local<String> v8::Object::ObjectProtoToString() {
return v8::String::NewFromUtf8(isolate, "[object ]");
} else {
i::Handle<i::String> class_name = i::Handle<i::String>::cast(name);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Arguments"))) {
if (i::String::Equals(class_name,
i_isolate->factory()->Arguments_string())) {
return v8::String::NewFromUtf8(isolate, "[object Object]");
} else {
const char* prefix = "[object ";

View File

@ -3318,7 +3318,7 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ bind(&function);
__ LoadRoot(r0, Heap::kfunction_class_stringRootIndex);
__ LoadRoot(r0, Heap::kFunction_stringRootIndex);
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.

View File

@ -2689,7 +2689,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
__ JumpIfSmi(input, is_false);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) {
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
// Assuming the following assertions, we can use the same compares to test
// for both being a function type and being in the object type range.
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);

View File

@ -3015,7 +3015,7 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ Bind(&function);
__ LoadRoot(x0, Heap::kfunction_class_stringRootIndex);
__ LoadRoot(x0, Heap::kFunction_stringRootIndex);
__ B(&done);
// Objects with a non-function constructor have class 'Object'.

View File

@ -2358,7 +2358,7 @@ void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
__ JumpIfSmi(input, false_label);
Register map = scratch2;
if (class_name->IsUtf8EqualTo(CStrVector("Function"))) {
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
// Assuming the following assertions, we can use the same compares to test
// for both being a function type and being in the object type range.
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
@ -2383,7 +2383,7 @@ void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) {
__ Ldr(scratch1, FieldMemOperand(map, Map::kConstructorOffset));
// Objects with a non-function constructor have class 'Object'.
if (class_name->IsUtf8EqualTo(CStrVector("Object"))) {
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
__ JumpIfNotObjectType(
scratch1, scratch2, scratch2, JS_FUNCTION_TYPE, true_label);
} else {

View File

@ -821,8 +821,7 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
factory()->GlobalProxyType);
}
Handle<String> global_name = factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("global"));
Handle<String> global_name = factory()->global_string();
global_proxy_function->shared()->set_instance_class_name(*global_name);
global_proxy_function->initial_map()->set_is_access_check_needed(true);
@ -861,11 +860,8 @@ void Genesis::HookUpGlobalObject(Handle<GlobalObject> global_object) {
native_context()->set_security_token(*global_object);
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
Runtime::DefineObjectProperty(builtins_global,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("global")),
global_object,
attributes).Assert();
Runtime::DefineObjectProperty(builtins_global, factory()->global_string(),
global_object, attributes).Assert();
// Set up the reference from the global object to the builtins object.
JSGlobalObject::cast(*global_object)->set_builtins(*builtins_global);
TransferNamedProperties(global_object_from_snapshot, global_object);
@ -1187,8 +1183,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
// Make sure we can recognize argument objects at runtime.
// This is done by introducing an anonymous function with
// class_name equals 'Arguments'.
Handle<String> arguments_string = factory->InternalizeOneByteString(
STATIC_ASCII_VECTOR("Arguments"));
Handle<String> arguments_string = factory->Arguments_string();
Handle<Code> code(isolate->builtins()->builtin(Builtins::kIllegal));
Handle<JSFunction> function = factory->NewFunctionWithoutPrototype(
arguments_string, code);
@ -1947,7 +1942,8 @@ bool Genesis::InstallNatives() {
HeapObject::cast(string_function->initial_map()->prototype())->map());
// Install Function.prototype.call and apply.
{ Handle<String> key = factory()->function_class_string();
{
Handle<String> key = factory()->Function_string();
Handle<JSFunction> function =
Handle<JSFunction>::cast(Object::GetProperty(
handle(native_context()->global_object()), key).ToHandleChecked());

View File

@ -256,13 +256,10 @@ namespace internal {
V(neander_map)
#define INTERNALIZED_STRING_LIST(V) \
V(Array_string, "Array") \
V(Object_string, "Object") \
V(proto_string, "__proto__") \
V(arguments_string, "arguments") \
V(Arguments_string, "Arguments") \
V(call_string, "call") \
V(apply_string, "apply") \
V(caller_string, "caller") \
V(boolean_string, "boolean") \
V(Boolean_string, "Boolean") \
@ -273,13 +270,13 @@ namespace internal {
V(eval_string, "eval") \
V(empty_string, "") \
V(function_string, "function") \
V(Function_string, "Function") \
V(length_string, "length") \
V(name_string, "name") \
V(null_string, "null") \
V(number_string, "number") \
V(Number_string, "Number") \
V(nan_string, "NaN") \
V(RegExp_string, "RegExp") \
V(source_string, "source") \
V(source_url_string, "source_url") \
V(source_mapping_url_string, "source_mapping_url") \
@ -290,7 +287,6 @@ namespace internal {
V(index_string, "index") \
V(last_index_string, "lastIndex") \
V(object_string, "object") \
V(literals_string, "literals") \
V(prototype_string, "prototype") \
V(string_string, "string") \
V(String_string, "String") \
@ -298,34 +294,20 @@ namespace internal {
V(Symbol_string, "Symbol") \
V(for_string, "for") \
V(for_api_string, "for_api") \
V(for_intern_string, "for_intern") \
V(private_api_string, "private_api") \
V(private_intern_string, "private_intern") \
V(Date_string, "Date") \
V(to_string_string, "toString") \
V(char_at_string, "CharAt") \
V(undefined_string, "undefined") \
V(value_of_string, "valueOf") \
V(stack_string, "stack") \
V(toJSON_string, "toJSON") \
V(InitializeVarGlobal_string, "InitializeVarGlobal") \
V(InitializeConstGlobal_string, "InitializeConstGlobal") \
V(KeyedLoadMonomorphic_string, "KeyedLoadMonomorphic") \
V(KeyedStoreMonomorphic_string, "KeyedStoreMonomorphic") \
V(stack_overflow_string, "kStackOverflowBoilerplate") \
V(illegal_access_string, "illegal access") \
V(get_string, "get") \
V(set_string, "set") \
V(map_field_string, "%map") \
V(elements_field_string, "%elements") \
V(length_field_string, "%length") \
V(cell_value_string, "%cell_value") \
V(function_class_string, "Function") \
V(illegal_argument_string, "illegal argument") \
V(space_string, " ") \
V(exec_string, "exec") \
V(zero_string, "0") \
V(global_eval_string, "GlobalEval") \
V(identity_hash_string, "v8::IdentityHash") \
V(closure_string, "(closure)") \
V(dot_string, ".") \
@ -341,7 +323,6 @@ namespace internal {
V(next_string, "next") \
V(byte_length_string, "byteLength") \
V(byte_offset_string, "byteOffset") \
V(buffer_string, "buffer") \
V(intl_initialized_marker_string, "v8::intl_initialized_marker") \
V(intl_impl_object_string, "v8::intl_object")

View File

@ -4675,9 +4675,8 @@ HObjectAccess HObjectAccess::ForField(Handle<Map> map,
HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) {
return HObjectAccess(
kInobject, Cell::kValueOffset, Representation::Tagged(),
Handle<String>(isolate->heap()->cell_value_string()));
return HObjectAccess(kInobject, Cell::kValueOffset, Representation::Tagged(),
isolate->factory()->cell_value_string());
}

View File

@ -7201,7 +7201,9 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) {
HInstruction* result = NULL;
if (expr->key()->IsPropertyName()) {
Handle<String> name = expr->key()->AsLiteral()->AsPropertyName();
if (!name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("length"))) return false;
if (!String::Equals(name, isolate()->factory()->length_string())) {
return false;
}
if (function_state()->outer() == NULL) {
HInstruction* elements = Add<HArgumentsElements>(false);

View File

@ -3247,7 +3247,7 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ bind(&function);
__ mov(eax, isolate()->factory()->function_class_string());
__ mov(eax, isolate()->factory()->Function_string());
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.

View File

@ -2536,7 +2536,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
DCHECK(!temp.is(temp2));
__ JumpIfSmi(input, is_false);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) {
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
// Assuming the following assertions, we can use the same compares to test
// for both being a function type and being in the object type range.
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
@ -2566,7 +2566,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
__ mov(temp, FieldOperand(temp, Map::kConstructorOffset));
// Objects with a non-function constructor have class 'Object'.
__ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) {
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
__ j(not_equal, is_true);
} else {
__ j(not_equal, is_false);

View File

@ -3315,7 +3315,7 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ bind(&function);
__ LoadRoot(v0, Heap::kfunction_class_stringRootIndex);
__ LoadRoot(v0, Heap::kFunction_stringRootIndex);
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.

View File

@ -2598,7 +2598,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
__ JumpIfSmi(input, is_false);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) {
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
// Assuming the following assertions, we can use the same compares to test
// for both being a function type and being in the object type range.
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
@ -2627,7 +2627,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
// Objects with a non-function constructor have class 'Object'.
__ GetObjectType(temp, temp2, temp2);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) {
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
__ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE));
} else {
__ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE));

View File

@ -3314,7 +3314,7 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ bind(&function);
__ LoadRoot(v0, Heap::kfunction_class_stringRootIndex);
__ LoadRoot(v0, Heap::kFunction_stringRootIndex);
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.

View File

@ -2577,7 +2577,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
__ JumpIfSmi(input, is_false);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) {
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
// Assuming the following assertions, we can use the same compares to test
// for both being a function type and being in the object type range.
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
@ -2606,7 +2606,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
// Objects with a non-function constructor have class 'Object'.
__ GetObjectType(temp, temp2, temp2);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) {
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
__ Branch(is_true, ne, temp2, Operand(JS_FUNCTION_TYPE));
} else {
__ Branch(is_false, ne, temp2, Operand(JS_FUNCTION_TYPE));

View File

@ -1739,7 +1739,7 @@ void HeapNumber::HeapNumberPrint(OStream& os) { // NOLINT
String* JSReceiver::class_name() {
if (IsJSFunction() || IsJSFunctionProxy()) {
return GetHeap()->function_class_string();
return GetHeap()->Function_string();
}
if (map()->constructor()->IsJSFunction()) {
JSFunction* constructor = JSFunction::cast(map()->constructor());

View File

@ -14463,7 +14463,7 @@ RUNTIME_FUNCTION(Runtime_BreakIteratorBreakType) {
if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) {
return *isolate->factory()->NewStringFromStaticAscii("none");
} else if (status >= UBRK_WORD_NUMBER && status < UBRK_WORD_NUMBER_LIMIT) {
return *isolate->factory()->NewStringFromStaticAscii("number");
return *isolate->factory()->number_string();
} else if (status >= UBRK_WORD_LETTER && status < UBRK_WORD_LETTER_LIMIT) {
return *isolate->factory()->NewStringFromStaticAscii("letter");
} else if (status >= UBRK_WORD_KANA && status < UBRK_WORD_KANA_LIMIT) {

View File

@ -3231,7 +3231,7 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ bind(&function);
__ Move(rax, isolate()->factory()->function_class_string());
__ Move(rax, isolate()->factory()->Function_string());
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.

View File

@ -2578,7 +2578,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
__ JumpIfSmi(input, is_false);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) {
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
// Assuming the following assertions, we can use the same compares to test
// for both being a function type and being in the object type range.
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
@ -2609,7 +2609,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
// Objects with a non-function constructor have class 'Object'.
__ CmpObjectType(temp, JS_FUNCTION_TYPE, kScratchRegister);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) {
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
__ j(not_equal, is_true);
} else {
__ j(not_equal, is_false);

View File

@ -3241,7 +3241,7 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ bind(&function);
__ mov(eax, isolate()->factory()->function_class_string());
__ mov(eax, isolate()->factory()->Function_string());
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.

View File

@ -2671,7 +2671,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
DCHECK(!temp.is(temp2));
__ JumpIfSmi(input, is_false);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Function"))) {
if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
// Assuming the following assertions, we can use the same compares to test
// for both being a function type and being in the object type range.
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
@ -2701,7 +2701,7 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
__ mov(temp, FieldOperand(temp, Map::kConstructorOffset));
// Objects with a non-function constructor have class 'Object'.
__ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Object"))) {
if (String::Equals(class_name, isolate()->factory()->Object_string())) {
__ j(not_equal, is_true);
} else {
__ j(not_equal, is_false);