diff --git a/include/v8.h b/include/v8.h index e7f73d1bd6..7fdcb05084 100644 --- a/include/v8.h +++ b/include/v8.h @@ -4221,7 +4221,7 @@ class Internals { static const int kNullValueRootIndex = 7; static const int kTrueValueRootIndex = 8; static const int kFalseValueRootIndex = 9; - static const int kEmptySymbolRootIndex = 119; + static const int kEmptyStringRootIndex = 118; static const int kNodeClassIdOffset = 1 * kApiPointerSize; static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; @@ -4671,7 +4671,7 @@ Local String::Empty(Isolate* isolate) { typedef internal::Object* S; typedef internal::Internals I; if (!I::IsInitialized(isolate)) return Empty(); - S* slot = I::GetRoot(isolate, I::kEmptySymbolRootIndex); + S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); return Local(reinterpret_cast(slot)); } diff --git a/src/accessors.cc b/src/accessors.cc index 3dcf422ccb..57062be41c 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -103,7 +103,7 @@ MaybeObject* Accessors::ArraySetLength(JSObject* object, Object* value, void*) { // causes an infinite loop. if (!object->IsJSArray()) { return object->SetLocalPropertyIgnoreAttributes( - isolate->heap()->length_symbol(), value, NONE); + isolate->heap()->length_string(), value, NONE); } value = FlattenNumber(value); @@ -475,7 +475,7 @@ MaybeObject* Accessors::FunctionSetPrototype(JSObject* object, if (function_raw == NULL) return heap->undefined_value(); if (!function_raw->should_have_prototype()) { // Since we hit this accessor, object will have no prototype property. - return object->SetLocalPropertyIgnoreAttributes(heap->prototype_symbol(), + return object->SetLocalPropertyIgnoreAttributes(heap->prototype_string(), value_raw, NONE); } @@ -503,7 +503,7 @@ MaybeObject* Accessors::FunctionSetPrototype(JSObject* object, if (is_observed && !old_value->SameValue(*value)) { JSObject::EnqueueChangeRecord( - function, "updated", isolate->factory()->prototype_symbol(), old_value); + function, "updated", isolate->factory()->prototype_string(), old_value); } return *function; @@ -630,7 +630,7 @@ MaybeObject* Accessors::FunctionGetArguments(Object* object, void*) { // If there is an arguments variable in the stack, we return that. Handle scope_info(function->shared()->scope_info()); int index = scope_info->StackSlotIndex( - isolate->heap()->arguments_symbol()); + isolate->heap()->arguments_string()); if (index >= 0) { Handle arguments(frame->GetExpression(index), isolate); if (!arguments->IsArgumentsMarker()) return *arguments; @@ -826,7 +826,7 @@ MaybeObject* Accessors::ObjectSetPrototype(JSObject* receiver_raw, isolate); if (!new_value->SameValue(*old_value)) { JSObject::EnqueueChangeRecord(receiver, "prototype", - isolate->factory()->Proto_symbol(), + isolate->factory()->proto_string(), old_value); } return *hresult; diff --git a/src/api.cc b/src/api.cc index 96a3c82ef7..e5135a2d29 100644 --- a/src/api.cc +++ b/src/api.cc @@ -1785,7 +1785,7 @@ v8::Local v8::TryCatch::StackTrace() const { if (!raw_obj->IsJSObject()) return v8::Local(); i::HandleScope scope(isolate_); i::Handle obj(i::JSObject::cast(raw_obj), isolate_); - i::Handle name = isolate_->factory()->stack_symbol(); + i::Handle name = isolate_->factory()->stack_string(); if (!obj->HasProperty(*name)) return v8::Local(); i::Handle value = i::GetProperty(isolate_, obj, name); if (value.is_null()) return v8::Local(); @@ -1899,7 +1899,8 @@ static i::Handle CallV8HeapFunction(const char* name, i::Handle argv[], bool* has_pending_exception) { i::Isolate* isolate = i::Isolate::Current(); - i::Handle fmt_str = isolate->factory()->LookupUtf8Symbol(name); + i::Handle fmt_str = + isolate->factory()->InternalizeUtf8String(name); i::Object* object_fun = isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str); i::Handle fun = @@ -2292,7 +2293,7 @@ bool Value::IsDate() const { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::Value::IsDate()")) return false; i::Handle obj = Utils::OpenHandle(this); - return obj->HasSpecificClassOf(isolate->heap()->Date_symbol()); + return obj->HasSpecificClassOf(isolate->heap()->Date_string()); } @@ -2300,7 +2301,7 @@ bool Value::IsStringObject() const { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::Value::IsStringObject()")) return false; i::Handle obj = Utils::OpenHandle(this); - return obj->HasSpecificClassOf(isolate->heap()->String_symbol()); + return obj->HasSpecificClassOf(isolate->heap()->String_string()); } @@ -2308,16 +2309,16 @@ bool Value::IsNumberObject() const { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::Value::IsNumberObject()")) return false; i::Handle obj = Utils::OpenHandle(this); - return obj->HasSpecificClassOf(isolate->heap()->Number_symbol()); + return obj->HasSpecificClassOf(isolate->heap()->Number_string()); } static i::Object* LookupBuiltin(i::Isolate* isolate, const char* builtin_name) { - i::Handle symbol = - isolate->factory()->LookupUtf8Symbol(builtin_name); + i::Handle string = + isolate->factory()->InternalizeUtf8String(builtin_name); i::Handle builtins = isolate->js_builtins_object(); - return builtins->GetPropertyNoExceptionThrown(*symbol); + return builtins->GetPropertyNoExceptionThrown(*string); } @@ -2355,7 +2356,7 @@ bool Value::IsBooleanObject() const { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::Value::IsBooleanObject()")) return false; i::Handle obj = Utils::OpenHandle(this); - return obj->HasSpecificClassOf(isolate->heap()->Boolean_symbol()); + return obj->HasSpecificClassOf(isolate->heap()->Boolean_string()); } @@ -2547,7 +2548,7 @@ void v8::Date::CheckCast(v8::Value* that) { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::Date::Cast()")) return; i::Handle obj = Utils::OpenHandle(that); - ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Date_symbol()), + ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Date_string()), "v8::Date::Cast()", "Could not convert to date"); } @@ -2557,7 +2558,7 @@ void v8::StringObject::CheckCast(v8::Value* that) { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::StringObject::Cast()")) return; i::Handle obj = Utils::OpenHandle(that); - ApiCheck(obj->HasSpecificClassOf(isolate->heap()->String_symbol()), + ApiCheck(obj->HasSpecificClassOf(isolate->heap()->String_string()), "v8::StringObject::Cast()", "Could not convert to StringObject"); } @@ -2567,7 +2568,7 @@ void v8::NumberObject::CheckCast(v8::Value* that) { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::NumberObject::Cast()")) return; i::Handle obj = Utils::OpenHandle(that); - ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Number_symbol()), + ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Number_string()), "v8::NumberObject::Cast()", "Could not convert to NumberObject"); } @@ -2577,7 +2578,7 @@ void v8::BooleanObject::CheckCast(v8::Value* that) { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::BooleanObject::Cast()")) return; i::Handle obj = Utils::OpenHandle(that); - ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Boolean_symbol()), + ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Boolean_string()), "v8::BooleanObject::Cast()", "Could not convert to BooleanObject"); } @@ -3367,10 +3368,11 @@ bool v8::Object::SetHiddenValue(v8::Handle key, i::HandleScope scope(isolate); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); - i::Handle key_symbol = isolate->factory()->LookupSymbol(key_obj); + i::Handle key_string = + isolate->factory()->InternalizeString(key_obj); i::Handle value_obj = Utils::OpenHandle(*value); i::Handle result = - i::JSObject::SetHiddenProperty(self, key_symbol, value_obj); + i::JSObject::SetHiddenProperty(self, key_string, value_obj); return *result == *self; } @@ -3382,8 +3384,8 @@ v8::Local v8::Object::GetHiddenValue(v8::Handle key) { ENTER_V8(isolate); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); - i::Handle key_symbol = FACTORY->LookupSymbol(key_obj); - i::Handle result(self->GetHiddenProperty(*key_symbol), isolate); + i::Handle key_string = FACTORY->InternalizeString(key_obj); + i::Handle result(self->GetHiddenProperty(*key_string), isolate); if (result->IsUndefined()) return v8::Local(); return Utils::ToLocal(result); } @@ -3396,8 +3398,8 @@ bool v8::Object::DeleteHiddenValue(v8::Handle key) { i::HandleScope scope(isolate); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); - i::Handle key_symbol = FACTORY->LookupSymbol(key_obj); - self->DeleteHiddenProperty(*key_symbol); + i::Handle key_string = FACTORY->InternalizeString(key_obj); + self->DeleteHiddenProperty(*key_string); return true; } @@ -4827,7 +4829,7 @@ Local v8::String::Empty() { return v8::Local(); } LOG_API(isolate, "String::Empty()"); - return Utils::ToLocal(isolate->factory()->empty_symbol()); + return Utils::ToLocal(isolate->factory()->empty_string()); } @@ -4952,7 +4954,7 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) { } CHECK(resource && resource->data()); bool result = obj->MakeExternal(resource); - if (result && !obj->IsSymbol()) { + if (result && !obj->IsInternalizedString()) { isolate->heap()->external_string_table()->AddString(*obj); } return result; @@ -4989,7 +4991,7 @@ bool v8::String::MakeExternal( } CHECK(resource && resource->data()); bool result = obj->MakeExternal(resource); - if (result && !obj->IsSymbol()) { + if (result && !obj->IsInternalizedString()) { isolate->heap()->external_string_table()->AddString(*obj); } return result; @@ -5127,8 +5129,9 @@ void v8::Date::DateTimeConfigurationChangeNotification() { i::HandleScope scope(isolate); // Get the function ResetDateCache (defined in date.js). - i::Handle func_name_str = isolate->factory()->LookupOneByteSymbol( - STATIC_ASCII_VECTOR("ResetDateCache")); + i::Handle func_name_str = + isolate->factory()->InternalizeOneByteString( + STATIC_ASCII_VECTOR("ResetDateCache")); i::MaybeObject* result = isolate->js_builtins_object()->GetProperty(*func_name_str); i::Object* object_func; @@ -5158,7 +5161,7 @@ static i::Handle RegExpFlagsToString(RegExp::Flags flags) { if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; ASSERT(num_flags <= static_cast(ARRAY_SIZE(flags_buf))); - return FACTORY->LookupOneByteSymbol( + return FACTORY->InternalizeOneByteString( i::Vector(flags_buf, num_flags)); } @@ -5263,7 +5266,7 @@ Local v8::String::NewSymbol(const char* data, int length) { LOG_API(isolate, "String::NewSymbol(char)"); ENTER_V8(isolate); if (length == -1) length = i::StrLength(data); - i::Handle result = isolate->factory()->LookupUtf8Symbol( + i::Handle result = isolate->factory()->InternalizeUtf8String( i::Vector(data, length)); return Utils::ToLocal(result); } @@ -5975,7 +5978,7 @@ Local Debug::GetMirror(v8::Handle obj) { i::Debug* isolate_debug = isolate->debug(); isolate_debug->Load(); i::Handle debug(isolate_debug->debug_context()->global_object()); - i::Handle name = isolate->factory()->LookupOneByteSymbol( + i::Handle name = isolate->factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("MakeMirror")); i::Handle fun_obj = i::GetProperty(isolate, debug, name); i::Handle fun = i::Handle::cast(fun_obj); @@ -6038,11 +6041,11 @@ Handle CpuProfileNode::GetFunctionName() const { const i::CodeEntry* entry = node->entry(); if (!entry->has_name_prefix()) { return Handle(ToApi( - isolate->factory()->LookupUtf8Symbol(entry->name()))); + isolate->factory()->InternalizeUtf8String(entry->name()))); } else { return Handle(ToApi(isolate->factory()->NewConsString( - isolate->factory()->LookupUtf8Symbol(entry->name_prefix()), - isolate->factory()->LookupUtf8Symbol(entry->name())))); + isolate->factory()->InternalizeUtf8String(entry->name_prefix()), + isolate->factory()->InternalizeUtf8String(entry->name())))); } } @@ -6051,7 +6054,7 @@ Handle CpuProfileNode::GetScriptResourceName() const { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); const i::ProfileNode* node = reinterpret_cast(this); - return Handle(ToApi(isolate->factory()->LookupUtf8Symbol( + return Handle(ToApi(isolate->factory()->InternalizeUtf8String( node->entry()->resource_name()))); } @@ -6137,7 +6140,7 @@ Handle CpuProfile::GetTitle() const { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); const i::CpuProfile* profile = reinterpret_cast(this); - return Handle(ToApi(isolate->factory()->LookupUtf8Symbol( + return Handle(ToApi(isolate->factory()->InternalizeUtf8String( profile->title()))); } @@ -6234,12 +6237,12 @@ Handle HeapGraphEdge::GetName() const { case i::HeapGraphEdge::kInternal: case i::HeapGraphEdge::kProperty: case i::HeapGraphEdge::kShortcut: - return Handle(ToApi(isolate->factory()->LookupUtf8Symbol( - edge->name()))); + return Handle(ToApi( + isolate->factory()->InternalizeUtf8String(edge->name()))); case i::HeapGraphEdge::kElement: case i::HeapGraphEdge::kHidden: - return Handle(ToApi(isolate->factory()->NewNumberFromInt( - edge->index()))); + return Handle(ToApi( + isolate->factory()->NewNumberFromInt(edge->index()))); default: UNREACHABLE(); } return v8::Undefined(); @@ -6278,7 +6281,7 @@ HeapGraphNode::Type HeapGraphNode::GetType() const { Handle HeapGraphNode::GetName() const { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapGraphNode::GetName"); - return Handle(ToApi(isolate->factory()->LookupUtf8Symbol( + return Handle(ToApi(isolate->factory()->InternalizeUtf8String( ToInternal(this)->name()))); } @@ -6357,7 +6360,7 @@ unsigned HeapSnapshot::GetUid() const { Handle HeapSnapshot::GetTitle() const { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle"); - return Handle(ToApi(isolate->factory()->LookupUtf8Symbol( + return Handle(ToApi(isolate->factory()->InternalizeUtf8String( ToInternal(this)->title()))); } diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc index 00bc36797a..d17f393aaa 100644 --- a/src/arm/builtins-arm.cc +++ b/src/arm/builtins-arm.cc @@ -682,7 +682,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { // Load the empty string into r2, remove the receiver from the // stack, and jump back to the case where the argument is a string. __ bind(&no_arguments); - __ LoadRoot(argument, Heap::kEmptyStringRootIndex); + __ LoadRoot(argument, Heap::kempty_stringRootIndex); __ Drop(1); __ b(&argument_is_string); diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 32759b4845..6c87a43d3f 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -1505,12 +1505,13 @@ static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, __ cmp(r3, Operand(ODDBALL_TYPE)); __ b(eq, &return_not_equal); - // Now that we have the types we might as well check for symbol-symbol. - // Ensure that no non-strings have the symbol bit set. - STATIC_ASSERT(LAST_TYPE < kNotStringTag + kIsSymbolMask); - STATIC_ASSERT(kSymbolTag != 0); + // Now that we have the types we might as well check for + // internalized-internalized. + // Ensure that no non-strings have the internalized bit set. + STATIC_ASSERT(LAST_TYPE < kNotStringTag + kIsInternalizedMask); + STATIC_ASSERT(kInternalizedTag != 0); __ and_(r2, r2, Operand(r3)); - __ tst(r2, Operand(kIsSymbolMask)); + __ tst(r2, Operand(kIsInternalizedMask)); __ b(ne, &return_not_equal); } @@ -1547,29 +1548,29 @@ static void EmitCheckForTwoHeapNumbers(MacroAssembler* masm, } -// Fast negative check for symbol-to-symbol equality. -static void EmitCheckForSymbolsOrObjects(MacroAssembler* masm, - Register lhs, - Register rhs, - Label* possible_strings, - Label* not_both_strings) { +// Fast negative check for internalized-to-internalized equality. +static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, + Register lhs, + Register rhs, + Label* possible_strings, + Label* not_both_strings) { ASSERT((lhs.is(r0) && rhs.is(r1)) || (lhs.is(r1) && rhs.is(r0))); // r2 is object type of rhs. - // Ensure that no non-strings have the symbol bit set. + // Ensure that no non-strings have the internalized bit set. Label object_test; - STATIC_ASSERT(kSymbolTag != 0); + STATIC_ASSERT(kInternalizedTag != 0); __ tst(r2, Operand(kIsNotStringMask)); __ b(ne, &object_test); - __ tst(r2, Operand(kIsSymbolMask)); + __ tst(r2, Operand(kIsInternalizedMask)); __ b(eq, possible_strings); __ CompareObjectType(lhs, r3, r3, FIRST_NONSTRING_TYPE); __ b(ge, not_both_strings); - __ tst(r3, Operand(kIsSymbolMask)); + __ tst(r3, Operand(kIsInternalizedMask)); __ b(eq, possible_strings); - // Both are symbols. We already checked they weren't the same pointer + // Both are internalized. We already checked they weren't the same pointer // so they are not equal. __ mov(r0, Operand(NOT_EQUAL)); __ Ret(); @@ -1716,7 +1717,7 @@ static void ICCompareStub_CheckInputType(MacroAssembler* masm, __ CheckMap(input, scratch, Heap::kHeapNumberMapRootIndex, fail, DONT_DO_SMI_CHECK); } - // We could be strict about symbol/string here, but as long as + // We could be strict about internalized/non-internalized here, but as long as // hydrogen doesn't care, the stub doesn't have to care either. __ bind(&ok); } @@ -1814,27 +1815,29 @@ void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { EmitStrictTwoHeapObjectCompare(masm, lhs, rhs); } - Label check_for_symbols; + Label check_for_internalized_strings; Label flat_string_check; // Check for heap-number-heap-number comparison. Can jump to slow case, // or load both doubles into r0, r1, r2, r3 and jump to the code that handles - // that case. If the inputs are not doubles then jumps to check_for_symbols. + // that case. If the inputs are not doubles then jumps to + // check_for_internalized_strings. // In this case r2 will contain the type of rhs_. Never falls through. EmitCheckForTwoHeapNumbers(masm, lhs, rhs, &both_loaded_as_doubles, - &check_for_symbols, + &check_for_internalized_strings, &flat_string_check); - __ bind(&check_for_symbols); + __ bind(&check_for_internalized_strings); // In the strict case the EmitStrictTwoHeapObjectCompare already took care of - // symbols. + // internalized strings. if (cc == eq && !strict()) { - // Returns an answer for two symbols or two detectable objects. + // Returns an answer for two internalized strings or two detectable objects. // Otherwise jumps to string case or not both strings case. // Assumes that r2 is the type of rhs_ on entry. - EmitCheckForSymbolsOrObjects(masm, lhs, rhs, &flat_string_check, &slow); + EmitCheckForInternalizedStringsOrObjects( + masm, lhs, rhs, &flat_string_check, &slow); } // Check for both being sequential ASCII strings, and inline if that is the @@ -4501,7 +4504,7 @@ void ArrayLengthStub::Generate(MacroAssembler* masm) { // -- r0 : key // -- r1 : receiver // ----------------------------------- - __ cmp(r0, Operand(masm->isolate()->factory()->length_symbol())); + __ cmp(r0, Operand(masm->isolate()->factory()->length_string())); __ b(ne, &miss); receiver = r1; } else { @@ -4530,7 +4533,7 @@ void FunctionPrototypeStub::Generate(MacroAssembler* masm) { // -- r0 : key // -- r1 : receiver // ----------------------------------- - __ cmp(r0, Operand(masm->isolate()->factory()->prototype_symbol())); + __ cmp(r0, Operand(masm->isolate()->factory()->prototype_string())); __ b(ne, &miss); receiver = r1; } else { @@ -4559,7 +4562,7 @@ void StringLengthStub::Generate(MacroAssembler* masm) { // -- r0 : key // -- r1 : receiver // ----------------------------------- - __ cmp(r0, Operand(masm->isolate()->factory()->length_symbol())); + __ cmp(r0, Operand(masm->isolate()->factory()->length_string())); __ b(ne, &miss); receiver = r1; } else { @@ -4597,7 +4600,7 @@ void StoreArrayLengthStub::Generate(MacroAssembler* masm) { // -- r1 : key // -- r2 : receiver // ----------------------------------- - __ cmp(r1, Operand(masm->isolate()->factory()->length_symbol())); + __ cmp(r1, Operand(masm->isolate()->factory()->length_string())); __ b(ne, &miss); receiver = r2; value = r0; @@ -5159,7 +5162,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { // (3) Cons string. Check that it's flat. // Replace subject with first string and reload instance type. __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); - __ CompareRoot(r0, Heap::kEmptyStringRootIndex); + __ CompareRoot(r0, Heap::kempty_stringRootIndex); __ b(ne, &runtime); __ ldr(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); @@ -6029,7 +6032,7 @@ void StringHelper::GenerateCopyCharactersLong(MacroAssembler* masm, } -void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, +void StringHelper::GenerateTwoCharacterStringTableProbe(MacroAssembler* masm, Register c1, Register c2, Register scratch1, @@ -6042,7 +6045,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, Register scratch = scratch3; // Make sure that both characters are not digits as such strings has a - // different hash algorithm. Don't try to look for these in the symbol table. + // different hash algorithm. Don't try to look for these in the string table. Label not_array_index; __ sub(scratch, c1, Operand(static_cast('0'))); __ cmp(scratch, Operand(static_cast('9' - '0'))); @@ -6070,43 +6073,43 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, // chars: two character string, char 1 in byte 0 and char 2 in byte 1. // hash: hash of two character string. - // Load symbol table - // Load address of first element of the symbol table. - Register symbol_table = c2; - __ LoadRoot(symbol_table, Heap::kSymbolTableRootIndex); + // Load string table + // Load address of first element of the string table. + Register string_table = c2; + __ LoadRoot(string_table, Heap::kStringTableRootIndex); Register undefined = scratch4; __ LoadRoot(undefined, Heap::kUndefinedValueRootIndex); - // Calculate capacity mask from the symbol table capacity. + // Calculate capacity mask from the string table capacity. Register mask = scratch2; - __ ldr(mask, FieldMemOperand(symbol_table, SymbolTable::kCapacityOffset)); + __ ldr(mask, FieldMemOperand(string_table, StringTable::kCapacityOffset)); __ mov(mask, Operand(mask, ASR, 1)); __ sub(mask, mask, Operand(1)); - // Calculate untagged address of the first element of the symbol table. - Register first_symbol_table_element = symbol_table; - __ add(first_symbol_table_element, symbol_table, - Operand(SymbolTable::kElementsStartOffset - kHeapObjectTag)); + // Calculate untagged address of the first element of the string table. + Register first_string_table_element = string_table; + __ add(first_string_table_element, string_table, + Operand(StringTable::kElementsStartOffset - kHeapObjectTag)); // Registers // chars: two character string, char 1 in byte 0 and char 2 in byte 1. // hash: hash of two character string // mask: capacity mask - // first_symbol_table_element: address of the first element of - // the symbol table + // first_string_table_element: address of the first element of + // the string table // undefined: the undefined object // scratch: - - // Perform a number of probes in the symbol table. + // Perform a number of probes in the string table. const int kProbes = 4; - Label found_in_symbol_table; + Label found_in_string_table; Label next_probe[kProbes]; Register candidate = scratch5; // Scratch register contains candidate. for (int i = 0; i < kProbes; i++) { - // Calculate entry in symbol table. + // Calculate entry in string table. if (i > 0) { - __ add(candidate, hash, Operand(SymbolTable::GetProbeOffset(i))); + __ add(candidate, hash, Operand(StringTable::GetProbeOffset(i))); } else { __ mov(candidate, hash); } @@ -6114,9 +6117,9 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, __ and_(candidate, candidate, Operand(mask)); // Load the entry from the symble table. - STATIC_ASSERT(SymbolTable::kEntrySize == 1); + STATIC_ASSERT(StringTable::kEntrySize == 1); __ ldr(candidate, - MemOperand(first_symbol_table_element, + MemOperand(first_string_table_element, candidate, LSL, kPointerSizeLog2)); @@ -6132,7 +6135,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, if (FLAG_debug_code) { __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); __ cmp(ip, candidate); - __ Assert(eq, "oddball in symbol table is not undefined or the hole"); + __ Assert(eq, "oddball in string table is not undefined or the hole"); } __ jmp(&next_probe[i]); @@ -6152,7 +6155,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, // Assumes that word load is little endian. __ ldrh(scratch, FieldMemOperand(candidate, SeqOneByteString::kHeaderSize)); __ cmp(chars, scratch); - __ b(eq, &found_in_symbol_table); + __ b(eq, &found_in_string_table); __ bind(&next_probe[i]); } @@ -6161,7 +6164,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, // Scratch register contains result when we fall through to here. Register result = candidate; - __ bind(&found_in_symbol_table); + __ bind(&found_in_string_table); __ Move(r0, result); } @@ -6290,7 +6293,7 @@ void SubStringStub::Generate(MacroAssembler* masm) { __ b(ne, &sliced_string); // Cons string. Check whether it is flat, then fetch first part. __ ldr(r5, FieldMemOperand(r0, ConsString::kSecondOffset)); - __ CompareRoot(r5, Heap::kEmptyStringRootIndex); + __ CompareRoot(r5, Heap::kempty_stringRootIndex); __ b(ne, &runtime); __ ldr(r5, FieldMemOperand(r0, ConsString::kFirstOffset)); // Update instance type. @@ -6663,8 +6666,8 @@ void StringAddStub::Generate(MacroAssembler* masm) { // Adding two lengths can't overflow. STATIC_ASSERT(String::kMaxLength < String::kMaxLength * 2); __ add(r6, r2, Operand(r3)); - // Use the symbol table when adding two one character strings, as it - // helps later optimizations to return a symbol here. + // Use the string table when adding two one character strings, as it + // helps later optimizations to return a string here. __ cmp(r6, Operand(2)); __ b(ne, &longer_than_two); @@ -6682,10 +6685,10 @@ void StringAddStub::Generate(MacroAssembler* masm) { __ ldrb(r2, FieldMemOperand(r0, SeqOneByteString::kHeaderSize)); __ ldrb(r3, FieldMemOperand(r1, SeqOneByteString::kHeaderSize)); - // Try to lookup two character string in symbol table. If it is not found + // Try to lookup two character string in string table. If it is not found // just allocate a new one. Label make_two_character_string; - StringHelper::GenerateTwoCharacterSymbolTableProbe( + StringHelper::GenerateTwoCharacterStringTableProbe( masm, r2, r3, r6, r7, r4, r5, r9, &make_two_character_string); __ IncrementCounter(counters->string_add_native(), 1, r2, r3); __ add(sp, sp, Operand(2 * kPointerSize)); @@ -7026,8 +7029,8 @@ void ICCompareStub::GenerateNumbers(MacroAssembler* masm) { } -void ICCompareStub::GenerateSymbols(MacroAssembler* masm) { - ASSERT(state_ == CompareIC::SYMBOL); +void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) { + ASSERT(state_ == CompareIC::INTERNALIZED_STRING); Label miss; // Registers containing left and right operands respectively. @@ -7039,17 +7042,17 @@ void ICCompareStub::GenerateSymbols(MacroAssembler* masm) { // Check that both operands are heap objects. __ JumpIfEitherSmi(left, right, &miss); - // Check that both operands are symbols. + // Check that both operands are internalized strings. __ ldr(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); __ ldr(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); __ ldrb(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); __ ldrb(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); - STATIC_ASSERT(kSymbolTag != 0); + STATIC_ASSERT(kInternalizedTag != 0); __ and_(tmp1, tmp1, Operand(tmp2)); - __ tst(tmp1, Operand(kIsSymbolMask)); + __ tst(tmp1, Operand(kIsInternalizedMask)); __ b(eq, &miss); - // Symbols are compared by identity. + // Internalized strings are compared by identity. __ cmp(left, right); // Make sure r0 is non-zero. At this point input operands are // guaranteed to be non-zero. @@ -7101,13 +7104,13 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) { // Handle not identical strings. - // Check that both strings are symbols. If they are, we're done + // Check that both strings are internalized strings. If they are, we're done // because we already know they are not identical. if (equality) { ASSERT(GetCondition() == eq); - STATIC_ASSERT(kSymbolTag != 0); + STATIC_ASSERT(kInternalizedTag != 0); __ and_(tmp3, tmp1, Operand(tmp2)); - __ tst(tmp3, Operand(kIsSymbolMask)); + __ tst(tmp3, Operand(kIsInternalizedMask)); // Make sure r0 is non-zero. At this point input operands are // guaranteed to be non-zero. ASSERT(right.is(r0)); @@ -7290,11 +7293,11 @@ void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, __ cmp(entity_name, tmp); __ b(eq, &the_hole); - // Check if the entry name is not a symbol. + // Check if the entry name is not an internalized string. __ ldr(entity_name, FieldMemOperand(entity_name, HeapObject::kMapOffset)); __ ldrb(entity_name, FieldMemOperand(entity_name, Map::kInstanceTypeOffset)); - __ tst(entity_name, Operand(kIsSymbolMask)); + __ tst(entity_name, Operand(kIsInternalizedMask)); __ b(eq, miss); __ bind(&the_hole); @@ -7463,11 +7466,11 @@ void StringDictionaryLookupStub::Generate(MacroAssembler* masm) { __ b(eq, &in_dictionary); if (i != kTotalProbes - 1 && mode_ == NEGATIVE_LOOKUP) { - // Check if the entry name is not a symbol. + // Check if the entry name is not an internalized string. __ ldr(entry_key, FieldMemOperand(entry_key, HeapObject::kMapOffset)); __ ldrb(entry_key, FieldMemOperand(entry_key, Map::kInstanceTypeOffset)); - __ tst(entry_key, Operand(kIsSymbolMask)); + __ tst(entry_key, Operand(kIsInternalizedMask)); __ b(eq, &maybe_in_dictionary); } } diff --git a/src/arm/code-stubs-arm.h b/src/arm/code-stubs-arm.h index 8b7b5ceb48..f952756a82 100644 --- a/src/arm/code-stubs-arm.h +++ b/src/arm/code-stubs-arm.h @@ -172,14 +172,14 @@ class StringHelper : public AllStatic { int flags); - // Probe the symbol table for a two character string. If the string is + // Probe the string table for a two character string. If the string is // not found by probing a jump to the label not_found is performed. This jump - // does not guarantee that the string is not in the symbol table. If the + // does not guarantee that the string is not in the string table. If the // string is found the code falls through with the string in register r0. // Contents of both c1 and c2 registers are modified. At the exit c1 is // guaranteed to contain halfword with low and high bytes equal to // initial contents of c1 and c2 respectively. - static void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, + static void GenerateTwoCharacterStringTableProbe(MacroAssembler* masm, Register c1, Register c2, Register scratch1, diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc index 69a2c9c750..6e3c635fb0 100644 --- a/src/arm/codegen-arm.cc +++ b/src/arm/codegen-arm.cc @@ -468,7 +468,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, // the string. __ bind(&cons_string); __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); - __ CompareRoot(result, Heap::kEmptyStringRootIndex); + __ CompareRoot(result, Heap::kempty_stringRootIndex); __ b(ne, call_runtime); // Get the first of the two strings and load its instance type. __ ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index f5f26e7bad..7037ba9594 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -1631,7 +1631,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); // Fall through. case ObjectLiteral::Property::COMPUTED: - if (key->handle()->IsSymbol()) { + if (key->handle()->IsInternalizedString()) { if (property->emit_store()) { VisitForAccumulatorValue(value); __ mov(r2, Operand(key->handle())); @@ -2691,7 +2691,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( __ cmp(r2, ip); __ b(eq, if_false); - // Look for valueOf symbol in the descriptor array, and indicate false if + // Look for valueOf name in the descriptor array, and indicate false if // found. Since we omit an enumeration index check, if it is added via a // transition that shares its descriptor array, this is a false positive. Label entry, loop, done; @@ -2716,10 +2716,10 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( __ add(r2, r2, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize)); // Loop through all the keys in the descriptor array. If one of these is the - // symbol valueOf the result is false. - // The use of ip to store the valueOf symbol asumes that it is not otherwise + // string "valueOf" the result is false. + // The use of ip to store the valueOf string assumes that it is not otherwise // used in the loop below. - __ mov(ip, Operand(FACTORY->value_of_symbol())); + __ mov(ip, Operand(FACTORY->value_of_string())); __ jmp(&entry); __ bind(&loop); __ ldr(r3, MemOperand(r4, 0)); @@ -2954,12 +2954,12 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { // Functions have class 'Function'. __ bind(&function); - __ LoadRoot(r0, Heap::kfunction_class_symbolRootIndex); + __ LoadRoot(r0, Heap::kfunction_class_stringRootIndex); __ jmp(&done); // Objects with a non-function constructor have class 'Object'. __ bind(&non_function_constructor); - __ LoadRoot(r0, Heap::kObject_symbolRootIndex); + __ LoadRoot(r0, Heap::kObject_stringRootIndex); __ jmp(&done); // Non-JS objects have class null. @@ -3324,7 +3324,7 @@ void FullCodeGenerator::EmitStringCharAt(CallRuntime* expr) { __ bind(&index_out_of_range); // When the index is out of range, the spec requires us to return // the empty string. - __ LoadRoot(result, Heap::kEmptyStringRootIndex); + __ LoadRoot(result, Heap::kempty_stringRootIndex); __ jmp(&done); __ bind(&need_conversion); @@ -3633,7 +3633,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) { __ ldr(array_length, FieldMemOperand(array, JSArray::kLengthOffset)); __ SmiUntag(array_length, SetCC); __ b(ne, &non_trivial_array); - __ LoadRoot(r0, Heap::kEmptyStringRootIndex); + __ LoadRoot(r0, Heap::kempty_stringRootIndex); __ b(&done); __ bind(&non_trivial_array); @@ -4246,13 +4246,13 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, } PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); - if (check->Equals(isolate()->heap()->number_symbol())) { + if (check->Equals(isolate()->heap()->number_string())) { __ JumpIfSmi(r0, if_true); __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); __ cmp(r0, ip); Split(eq, if_true, if_false, fall_through); - } else if (check->Equals(isolate()->heap()->string_symbol())) { + } else if (check->Equals(isolate()->heap()->string_string())) { __ JumpIfSmi(r0, if_false); // Check for undetectable objects => false. __ CompareObjectType(r0, r0, r1, FIRST_NONSTRING_TYPE); @@ -4260,16 +4260,16 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); __ tst(r1, Operand(1 << Map::kIsUndetectable)); Split(eq, if_true, if_false, fall_through); - } else if (check->Equals(isolate()->heap()->boolean_symbol())) { + } else if (check->Equals(isolate()->heap()->boolean_string())) { __ CompareRoot(r0, Heap::kTrueValueRootIndex); __ b(eq, if_true); __ CompareRoot(r0, Heap::kFalseValueRootIndex); Split(eq, if_true, if_false, fall_through); } else if (FLAG_harmony_typeof && - check->Equals(isolate()->heap()->null_symbol())) { + check->Equals(isolate()->heap()->null_string())) { __ CompareRoot(r0, Heap::kNullValueRootIndex); Split(eq, if_true, if_false, fall_through); - } else if (check->Equals(isolate()->heap()->undefined_symbol())) { + } else if (check->Equals(isolate()->heap()->undefined_string())) { __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); __ b(eq, if_true); __ JumpIfSmi(r0, if_false); @@ -4279,14 +4279,14 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, __ tst(r1, Operand(1 << Map::kIsUndetectable)); Split(ne, if_true, if_false, fall_through); - } else if (check->Equals(isolate()->heap()->function_symbol())) { + } else if (check->Equals(isolate()->heap()->function_string())) { __ JumpIfSmi(r0, if_false); STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); __ CompareObjectType(r0, r0, r1, JS_FUNCTION_TYPE); __ b(eq, if_true); __ cmp(r1, Operand(JS_FUNCTION_PROXY_TYPE)); Split(eq, if_true, if_false, fall_through); - } else if (check->Equals(isolate()->heap()->object_symbol())) { + } else if (check->Equals(isolate()->heap()->object_string())) { __ JumpIfSmi(r0, if_false); if (!FLAG_harmony_typeof) { __ CompareRoot(r0, Heap::kNullValueRootIndex); diff --git a/src/arm/ic-arm.cc b/src/arm/ic-arm.cc index 4a5d9204d4..9c41e734ab 100644 --- a/src/arm/ic-arm.cc +++ b/src/arm/ic-arm.cc @@ -303,30 +303,30 @@ static void GenerateFastArrayLoad(MacroAssembler* masm, } -// Checks whether a key is an array index string or a symbol string. -// Falls through if a key is a symbol. +// Checks whether a key is an array index string or an internalized string. +// Falls through if a key is an internalized string. static void GenerateKeyStringCheck(MacroAssembler* masm, Register key, Register map, Register hash, Label* index_string, - Label* not_symbol) { + Label* not_internalized) { // The key is not a smi. // Is it a string? __ CompareObjectType(key, map, hash, FIRST_NONSTRING_TYPE); - __ b(ge, not_symbol); + __ b(ge, not_internalized); // Is the string an array index, with cached numeric value? __ ldr(hash, FieldMemOperand(key, String::kHashFieldOffset)); __ tst(hash, Operand(String::kContainsCachedArrayIndexMask)); __ b(eq, index_string); - // Is the string a symbol? + // Is the string internalized? // map: key map __ ldrb(hash, FieldMemOperand(map, Map::kInstanceTypeOffset)); - STATIC_ASSERT(kSymbolTag != 0); - __ tst(hash, Operand(kIsSymbolMask)); - __ b(eq, not_symbol); + STATIC_ASSERT(kInternalizedTag != 0); + __ tst(hash, Operand(kIsInternalizedMask)); + __ b(eq, not_internalized); } @@ -585,7 +585,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { __ bind(&check_string); GenerateKeyStringCheck(masm, r2, r0, r3, &index_string, &slow_call); - // The key is known to be a symbol. + // The key is known to be internalized. // If the receiver is a regular JS object with slow properties then do // a quick inline probe of the receiver's dictionary. // Otherwise do the monomorphic cache probe. @@ -613,7 +613,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { __ bind(&slow_call); // This branch is taken if: // - the receiver requires boxing or access check, - // - the key is neither smi nor symbol, + // - the key is neither smi nor an internalized string, // - the value loaded is not a function, // - there is hope that the runtime will create a monomorphic call stub // that will get fetched next time. @@ -987,7 +987,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; __ And(r3, r3, Operand(mask)); - // Load the key (consisting of map and symbol) from the cache and + // Load the key (consisting of map and internalized string) from the cache and // check for match. Label load_in_object_property; static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket; @@ -1004,13 +1004,13 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { __ ldr(r5, MemOperand(r4, kPointerSize * 2, PostIndex)); __ cmp(r2, r5); __ b(ne, &try_next_entry); - __ ldr(r5, MemOperand(r4, -kPointerSize)); // Load symbol + __ ldr(r5, MemOperand(r4, -kPointerSize)); // Load string __ cmp(r0, r5); __ b(eq, &hit_on_nth_entry[i]); __ bind(&try_next_entry); } - // Last entry: Load map and move r4 to symbol. + // Last entry: Load map and move r4 to string. __ ldr(r5, MemOperand(r4, kPointerSize, PostIndex)); __ cmp(r2, r5); __ b(ne, &slow); @@ -1072,8 +1072,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { GenerateGlobalInstanceTypeCheck(masm, r2, &slow); // Load the property to r0. GenerateDictionaryLoad(masm, &slow, r3, r0, r0, r2, r4); - __ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(), - 1, r2, r3); + __ IncrementCounter( + isolate->counters()->keyed_load_generic_symbol(), 1, r2, r3); __ Ret(); __ bind(&index_string); diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 5bbaae8966..45dc6ff896 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -2680,12 +2680,12 @@ void LCodeGen::EmitClassOfTest(Label* is_true, __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); __ ldr(temp, FieldMemOperand(temp, SharedFunctionInfo::kInstanceClassNameOffset)); - // The class name we are testing against is a symbol because it's a literal. - // The name in the constructor is a symbol because of the way the context is - // booted. This routine isn't expected to work for random API-created + // The class name we are testing against is internalized since it's a literal. + // The name in the constructor is internalized because of the way the context + // is booted. This routine isn't expected to work for random API-created // classes and it doesn't have to because you can't access it with natives - // syntax. Since both sides are symbols it is sufficient to use an identity - // comparison. + // syntax. Since both sides are internalized it is sufficient to use an + // identity comparison. __ cmp(temp, Operand(class_name)); // End with the answer in flags. } @@ -6042,14 +6042,14 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, Handle type_name) { Condition final_branch_condition = kNoCondition; Register scratch = scratch0(); - if (type_name->Equals(heap()->number_symbol())) { + if (type_name->Equals(heap()->number_string())) { __ JumpIfSmi(input, true_label); __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); __ cmp(input, Operand(ip)); final_branch_condition = eq; - } else if (type_name->Equals(heap()->string_symbol())) { + } else if (type_name->Equals(heap()->string_string())) { __ JumpIfSmi(input, false_label); __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); __ b(ge, false_label); @@ -6057,17 +6057,17 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, __ tst(ip, Operand(1 << Map::kIsUndetectable)); final_branch_condition = eq; - } else if (type_name->Equals(heap()->boolean_symbol())) { + } else if (type_name->Equals(heap()->boolean_string())) { __ CompareRoot(input, Heap::kTrueValueRootIndex); __ b(eq, true_label); __ CompareRoot(input, Heap::kFalseValueRootIndex); final_branch_condition = eq; - } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_symbol())) { + } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { __ CompareRoot(input, Heap::kNullValueRootIndex); final_branch_condition = eq; - } else if (type_name->Equals(heap()->undefined_symbol())) { + } else if (type_name->Equals(heap()->undefined_string())) { __ CompareRoot(input, Heap::kUndefinedValueRootIndex); __ b(eq, true_label); __ JumpIfSmi(input, false_label); @@ -6077,7 +6077,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, __ tst(ip, Operand(1 << Map::kIsUndetectable)); final_branch_condition = ne; - } else if (type_name->Equals(heap()->function_symbol())) { + } else if (type_name->Equals(heap()->function_string())) { STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); __ JumpIfSmi(input, false_label); __ CompareObjectType(input, scratch, input, JS_FUNCTION_TYPE); @@ -6085,7 +6085,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE)); final_branch_condition = eq; - } else if (type_name->Equals(heap()->object_symbol())) { + } else if (type_name->Equals(heap()->object_string())) { __ JumpIfSmi(input, false_label); if (!FLAG_harmony_typeof) { __ CompareRoot(input, Heap::kNullValueRootIndex); diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index 354956d8ab..ea7604ae40 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -130,14 +130,14 @@ static void ProbeTable(Isolate* isolate, // the property. This function may return false negatives, so miss_label // must always call a backup property check that is complete. // This function is safe to call if the receiver has fast properties. -// Name must be a symbol and receiver must be a heap object. +// Name must be internalized and receiver must be a heap object. static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, Label* miss_label, Register receiver, Handle name, Register scratch0, Register scratch1) { - ASSERT(name->IsSymbol()); + ASSERT(name->IsInternalizedString()); Counters* counters = masm->isolate()->counters(); __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); @@ -1102,8 +1102,8 @@ Register StubCompiler::CheckPrototypes(Handle object, if (!current->HasFastProperties() && !current->IsJSGlobalObject() && !current->IsJSGlobalProxy()) { - if (!name->IsSymbol()) { - name = factory()->LookupSymbol(name); + if (!name->IsInternalizedString()) { + name = factory()->InternalizeString(name); } ASSERT(current->property_dictionary()->FindEntry(*name) == StringDictionary::kNotFound); @@ -1995,7 +1995,7 @@ Handle CallStubCompiler::CompileStringCharAtCall( if (index_out_of_range.is_linked()) { __ bind(&index_out_of_range); - __ LoadRoot(r0, Heap::kEmptyStringRootIndex); + __ LoadRoot(r0, Heap::kempty_stringRootIndex); __ Drop(argc + 1); __ Ret(); } @@ -2422,7 +2422,7 @@ void CallStubCompiler::CompileHandlerFrontend(Handle object, break; case STRING_CHECK: - // Check that the object is a two-byte string or a symbol. + // Check that the object is a string. __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE); __ b(ge, &miss); // Check that the maps starting from the prototype haven't changed. diff --git a/src/ast.cc b/src/ast.cc index 627e65a039..d220f5560c 100644 --- a/src/ast.cc +++ b/src/ast.cc @@ -97,7 +97,7 @@ VariableProxy::VariableProxy(Isolate* isolate, position_(position), interface_(interface) { // Names must be canonicalized for fast equality checks. - ASSERT(name->IsSymbol()); + ASSERT(name->IsInternalizedString()); } @@ -182,8 +182,8 @@ ObjectLiteral::Property::Property(Literal* key, key_ = key; value_ = value; Object* k = *key->handle(); - if (k->IsSymbol() && - isolate->heap()->Proto_symbol()->Equals(String::cast(k))) { + if (k->IsInternalizedString() && + isolate->heap()->proto_string()->Equals(String::cast(k))) { kind_ = PROTOTYPE; } else if (value_->AsMaterializedLiteral() != NULL) { kind_ = MATERIALIZED_LITERAL; @@ -483,9 +483,9 @@ void CaseClause::RecordTypeFeedback(TypeFeedbackOracle* oracle) { if (info.IsUninitialized()) info = TypeInfo::Unknown(); if (info.IsSmi()) { compare_type_ = SMI_ONLY; - } else if (info.IsSymbol()) { - compare_type_ = SYMBOL_ONLY; - } else if (info.IsNonSymbol()) { + } else if (info.IsInternalizedString()) { + compare_type_ = NAME_ONLY; + } else if (info.IsNonInternalizedString()) { compare_type_ = STRING_ONLY; } else if (info.IsNonPrimitive()) { compare_type_ = OBJECT_ONLY; diff --git a/src/ast.h b/src/ast.h index a0a7a73206..740aa44293 100644 --- a/src/ast.h +++ b/src/ast.h @@ -968,7 +968,7 @@ class CaseClause: public ZoneObject { TypeFeedbackId CompareId() { return compare_id_; } void RecordTypeFeedback(TypeFeedbackOracle* oracle); bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } - bool IsSymbolCompare() { return compare_type_ == SYMBOL_ONLY; } + bool IsNameCompare() { return compare_type_ == NAME_ONLY; } bool IsStringCompare() { return compare_type_ == STRING_ONLY; } bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } @@ -980,7 +980,7 @@ class CaseClause: public ZoneObject { enum CompareTypeFeedback { NONE, SMI_ONLY, - SYMBOL_ONLY, + NAME_ONLY, STRING_ONLY, OBJECT_ONLY }; @@ -1171,7 +1171,7 @@ class Literal: public Expression { DECLARE_NODE_TYPE(Literal) virtual bool IsPropertyName() { - if (handle_->IsSymbol()) { + if (handle_->IsInternalizedString()) { uint32_t ignored; return !String::cast(*handle_)->AsArrayIndex(&ignored); } diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index b2c8c778c0..e2622c54f6 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -360,11 +360,11 @@ static Handle InstallFunction(Handle target, bool is_ecma_native) { Isolate* isolate = target->GetIsolate(); Factory* factory = isolate->factory(); - Handle symbol = factory->LookupUtf8Symbol(name); + Handle internalized_name = factory->InternalizeUtf8String(name); Handle call_code = Handle(isolate->builtins()->builtin(call)); Handle function = prototype.is_null() ? - factory->NewFunctionWithoutPrototype(symbol, call_code) : - factory->NewFunctionWithPrototype(symbol, + factory->NewFunctionWithoutPrototype(internalized_name, call_code) : + factory->NewFunctionWithPrototype(internalized_name, type, instance_size, prototype, @@ -379,9 +379,9 @@ static Handle InstallFunction(Handle target, } CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( - target, symbol, function, attributes)); + target, internalized_name, function, attributes)); if (is_ecma_native) { - function->shared()->set_instance_class_name(*symbol); + function->shared()->set_instance_class_name(*internalized_name); } function->shared()->set_native(true); return function; @@ -407,19 +407,19 @@ void Genesis::SetFunctionInstanceDescriptor( map->set_instance_descriptors(*descriptors); { // Add length. - CallbacksDescriptor d(*factory()->length_symbol(), *length, attribs); + CallbacksDescriptor d(*factory()->length_string(), *length, attribs); map->AppendDescriptor(&d, witness); } { // Add name. - CallbacksDescriptor d(*factory()->name_symbol(), *name, attribs); + CallbacksDescriptor d(*factory()->name_string(), *name, attribs); map->AppendDescriptor(&d, witness); } { // Add arguments. - CallbacksDescriptor d(*factory()->arguments_symbol(), *args, attribs); + CallbacksDescriptor d(*factory()->arguments_string(), *args, attribs); map->AppendDescriptor(&d, witness); } { // Add caller. - CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attribs); + CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs); map->AppendDescriptor(&d, witness); } if (prototypeMode != DONT_ADD_PROTOTYPE) { @@ -427,7 +427,7 @@ void Genesis::SetFunctionInstanceDescriptor( if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { attribs = static_cast(attribs & ~READ_ONLY); } - CallbacksDescriptor d(*factory()->prototype_symbol(), *prototype, attribs); + CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); map->AppendDescriptor(&d, witness); } } @@ -472,7 +472,7 @@ Handle Genesis::CreateEmptyFunction(Isolate* isolate) { Factory* factory = isolate->factory(); Heap* heap = isolate->heap(); - Handle object_name = Handle(heap->Object_symbol()); + Handle object_name = Handle(heap->Object_string()); { // --- O b j e c t --- Handle object_fun = @@ -498,7 +498,7 @@ Handle Genesis::CreateEmptyFunction(Isolate* isolate) { object_prototype_map->set_instance_descriptors(*prototype_descriptors); { // Add __proto__. - CallbacksDescriptor d(heap->Proto_symbol(), *object_prototype, attribs); + CallbacksDescriptor d(heap->proto_string(), *object_prototype, attribs); object_prototype_map->AppendDescriptor(&d, witness); } @@ -511,10 +511,10 @@ Handle Genesis::CreateEmptyFunction(Isolate* isolate) { // Allocate the empty function as the prototype for function ECMAScript // 262 15.3.4. - Handle symbol = - factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("Empty")); + Handle empty_string = + factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty")); Handle empty_function = - factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE); + factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE); // --- E m p t y --- Handle code = @@ -566,19 +566,19 @@ void Genesis::SetStrictFunctionInstanceDescriptor( map->set_instance_descriptors(*descriptors); { // Add length. - CallbacksDescriptor d(*factory()->length_symbol(), *length, attribs); + CallbacksDescriptor d(*factory()->length_string(), *length, attribs); map->AppendDescriptor(&d, witness); } { // Add name. - CallbacksDescriptor d(*factory()->name_symbol(), *name, attribs); + CallbacksDescriptor d(*factory()->name_string(), *name, attribs); map->AppendDescriptor(&d, witness); } { // Add arguments. - CallbacksDescriptor d(*factory()->arguments_symbol(), *arguments, attribs); + CallbacksDescriptor d(*factory()->arguments_string(), *arguments, attribs); map->AppendDescriptor(&d, witness); } { // Add caller. - CallbacksDescriptor d(*factory()->caller_symbol(), *caller, attribs); + CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs); map->AppendDescriptor(&d, witness); } if (prototypeMode != DONT_ADD_PROTOTYPE) { @@ -586,7 +586,7 @@ void Genesis::SetStrictFunctionInstanceDescriptor( if (prototypeMode != ADD_WRITEABLE_PROTOTYPE) { attribs = static_cast(attribs | READ_ONLY); } - CallbacksDescriptor d(*factory()->prototype_symbol(), *prototype, attribs); + CallbacksDescriptor d(*factory()->prototype_string(), *prototype, attribs); map->AppendDescriptor(&d, witness); } } @@ -595,7 +595,7 @@ void Genesis::SetStrictFunctionInstanceDescriptor( // ECMAScript 5th Edition, 13.2.3 Handle Genesis::GetThrowTypeErrorFunction() { if (throw_type_error_function.is_null()) { - Handle name = factory()->LookupOneByteSymbol( + Handle name = factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("ThrowTypeError")); throw_type_error_function = factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE); @@ -671,8 +671,8 @@ static void SetAccessors(Handle map, void Genesis::PoisonArgumentsAndCaller(Handle map) { - SetAccessors(map, factory()->arguments_symbol(), GetThrowTypeErrorFunction()); - SetAccessors(map, factory()->caller_symbol(), GetThrowTypeErrorFunction()); + SetAccessors(map, factory()->arguments_string(), GetThrowTypeErrorFunction()); + SetAccessors(map, factory()->caller_string(), GetThrowTypeErrorFunction()); } @@ -748,7 +748,7 @@ Handle Genesis::CreateNewGlobals( } if (js_global_template.is_null()) { - Handle name = Handle(heap()->empty_symbol()); + Handle name = Handle(heap()->empty_string()); Handle code = Handle(isolate()->builtins()->builtin( Builtins::kIllegal)); js_global_function = @@ -761,7 +761,7 @@ Handle Genesis::CreateNewGlobals( JSObject::cast(js_global_function->instance_prototype())); CHECK_NOT_EMPTY_HANDLE(isolate(), JSObject::SetLocalPropertyIgnoreAttributes( - prototype, factory()->constructor_symbol(), + prototype, factory()->constructor_string(), isolate()->object_function(), NONE)); } else { Handle js_global_constructor( @@ -782,7 +782,7 @@ Handle Genesis::CreateNewGlobals( // Step 2: create or re-initialize the global proxy object. Handle global_proxy_function; if (global_template.IsEmpty()) { - Handle name = Handle(heap()->empty_symbol()); + Handle name = Handle(heap()->empty_string()); Handle code = Handle(isolate()->builtins()->builtin( Builtins::kIllegal)); global_proxy_function = @@ -798,7 +798,7 @@ Handle Genesis::CreateNewGlobals( factory()->OuterGlobalObject); } - Handle global_name = factory()->LookupOneByteSymbol( + Handle global_name = factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("global")); global_proxy_function->shared()->set_instance_class_name(*global_name); global_proxy_function->initial_map()->set_is_access_check_needed(true); @@ -839,7 +839,7 @@ void Genesis::HookUpInnerGlobal(Handle inner_global) { static const PropertyAttributes attributes = static_cast(READ_ONLY | DONT_DELETE); ForceSetProperty(builtins_global, - factory()->LookupOneByteSymbol( + factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("global")), inner_global, attributes); @@ -871,7 +871,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, Factory* factory = isolate->factory(); Heap* heap = isolate->heap(); - Handle object_name = Handle(heap->Object_symbol()); + Handle object_name = Handle(heap->Object_string()); CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( inner_global, object_name, @@ -907,7 +907,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, initial_map->set_instance_descriptors(*array_descriptors); { // Add length. - CallbacksDescriptor d(*factory->length_symbol(), *array_length, attribs); + CallbacksDescriptor d(*factory->length_string(), *array_length, attribs); array_function->initial_map()->AppendDescriptor(&d, witness); } @@ -956,7 +956,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, string_map->set_instance_descriptors(*string_descriptors); { // Add length. - CallbacksDescriptor d(*factory->length_symbol(), *string_length, attribs); + CallbacksDescriptor d(*factory->length_string(), *string_length, attribs); string_map->AppendDescriptor(&d, witness); } } @@ -993,28 +993,28 @@ bool Genesis::InitializeGlobal(Handle inner_global, { // ECMA-262, section 15.10.7.1. - FieldDescriptor field(heap->source_symbol(), + FieldDescriptor field(heap->source_string(), JSRegExp::kSourceFieldIndex, final); initial_map->AppendDescriptor(&field, witness); } { // ECMA-262, section 15.10.7.2. - FieldDescriptor field(heap->global_symbol(), + FieldDescriptor field(heap->global_string(), JSRegExp::kGlobalFieldIndex, final); initial_map->AppendDescriptor(&field, witness); } { // ECMA-262, section 15.10.7.3. - FieldDescriptor field(heap->ignore_case_symbol(), + FieldDescriptor field(heap->ignore_case_string(), JSRegExp::kIgnoreCaseFieldIndex, final); initial_map->AppendDescriptor(&field, witness); } { // ECMA-262, section 15.10.7.4. - FieldDescriptor field(heap->multiline_symbol(), + FieldDescriptor field(heap->multiline_string(), JSRegExp::kMultilineFieldIndex, final); initial_map->AppendDescriptor(&field, witness); @@ -1023,7 +1023,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, // ECMA-262, section 15.10.7.5. PropertyAttributes writable = static_cast(DONT_ENUM | DONT_DELETE); - FieldDescriptor field(heap->last_index_symbol(), + FieldDescriptor field(heap->last_index_string(), JSRegExp::kLastIndexFieldIndex, writable); initial_map->AppendDescriptor(&field, witness); @@ -1041,7 +1041,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, proto_map->set_prototype(native_context()->initial_object_prototype()); Handle proto = factory->NewJSObjectFromMap(proto_map); proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, - heap->query_colon_symbol()); + heap->query_colon_string()); proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, heap->false_value()); proto->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, @@ -1078,7 +1078,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, // Make sure we can recognize argument objects at runtime. // This is done by introducing an anonymous function with // class_name equals 'Arguments'. - Handle symbol = factory->LookupOneByteSymbol( + Handle arguments_string = factory->InternalizeOneByteString( STATIC_ASCII_VECTOR("Arguments")); Handle code = Handle( isolate->builtins()->builtin(Builtins::kIllegal)); @@ -1087,14 +1087,14 @@ bool Genesis::InitializeGlobal(Handle inner_global, JSObject::cast(native_context()->object_function()->prototype())); Handle function = - factory->NewFunctionWithPrototype(symbol, + factory->NewFunctionWithPrototype(arguments_string, JS_OBJECT_TYPE, JSObject::kHeaderSize, prototype, code, false); ASSERT(!function->has_initial_map()); - function->shared()->set_instance_class_name(*symbol); + function->shared()->set_instance_class_name(*arguments_string); function->shared()->set_expected_nof_properties(2); Handle result = factory->NewJSObject(function); @@ -1103,20 +1103,20 @@ bool Genesis::InitializeGlobal(Handle inner_global, // callee must be added as the second property. CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( - result, factory->length_symbol(), + result, factory->length_string(), factory->undefined_value(), DONT_ENUM)); CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( - result, factory->callee_symbol(), + result, factory->callee_string(), factory->undefined_value(), DONT_ENUM)); #ifdef DEBUG LookupResult lookup(isolate); - result->LocalLookup(heap->callee_symbol(), &lookup); + result->LocalLookup(heap->callee_string(), &lookup); ASSERT(lookup.IsField()); ASSERT(lookup.GetFieldIndex().field_index() == Heap::kArgumentsCalleeIndex); - result->LocalLookup(heap->length_symbol(), &lookup); + result->LocalLookup(heap->length_string(), &lookup); ASSERT(lookup.IsField()); ASSERT(lookup.GetFieldIndex().field_index() == Heap::kArgumentsLengthIndex); @@ -1177,17 +1177,17 @@ bool Genesis::InitializeGlobal(Handle inner_global, map->set_instance_descriptors(*descriptors); { // length - FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM); + FieldDescriptor d(*factory->length_string(), 0, DONT_ENUM); map->AppendDescriptor(&d, witness); } { // callee - CallbacksDescriptor d(*factory->callee_symbol(), + CallbacksDescriptor d(*factory->callee_string(), *callee, attributes); map->AppendDescriptor(&d, witness); } { // caller - CallbacksDescriptor d(*factory->caller_symbol(), + CallbacksDescriptor d(*factory->caller_string(), *caller, attributes); map->AppendDescriptor(&d, witness); @@ -1209,12 +1209,12 @@ bool Genesis::InitializeGlobal(Handle inner_global, // Add length property only for strict mode boilerplate. CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( - result, factory->length_symbol(), + result, factory->length_string(), factory->undefined_value(), DONT_ENUM)); #ifdef DEBUG LookupResult lookup(isolate); - result->LocalLookup(heap->length_symbol(), &lookup); + result->LocalLookup(heap->length_string(), &lookup); ASSERT(lookup.IsField()); ASSERT(lookup.GetFieldIndex().field_index() == Heap::kArgumentsLengthIndex); @@ -1231,14 +1231,14 @@ bool Genesis::InitializeGlobal(Handle inner_global, Handle code = Handle( isolate->builtins()->builtin(Builtins::kIllegal)); Handle context_extension_fun = - factory->NewFunction(factory->empty_symbol(), + factory->NewFunction(factory->empty_string(), JS_CONTEXT_EXTENSION_OBJECT_TYPE, JSObject::kHeaderSize, code, true); - Handle name = - factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("context_extension")); + Handle name = factory->InternalizeOneByteString( + STATIC_ASCII_VECTOR("context_extension")); context_extension_fun->shared()->set_instance_class_name(*name); native_context()->set_context_extension_function(*context_extension_fun); } @@ -1250,7 +1250,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, Handle(isolate->builtins()->builtin( Builtins::kHandleApiCallAsFunction)); Handle delegate = - factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE, + factory->NewFunction(factory->empty_string(), JS_OBJECT_TYPE, JSObject::kHeaderSize, code, true); native_context()->set_call_as_function_delegate(*delegate); delegate->shared()->DontAdaptArguments(); @@ -1262,7 +1262,7 @@ bool Genesis::InitializeGlobal(Handle inner_global, Handle(isolate->builtins()->builtin( Builtins::kHandleApiCallAsConstructor)); Handle delegate = - factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE, + factory->NewFunction(factory->empty_string(), JS_OBJECT_TYPE, JSObject::kHeaderSize, code, true); native_context()->set_call_as_constructor_delegate(*delegate); delegate->shared()->DontAdaptArguments(); @@ -1418,7 +1418,7 @@ bool Genesis::CompileScriptCached(Isolate* isolate, #define INSTALL_NATIVE(Type, name, var) \ Handle var##_name = \ - factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR(name)); \ + factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ Object* var##_native = \ native_context()->builtins()->GetPropertyNoExceptionThrown( \ *var##_name); \ @@ -1508,7 +1508,7 @@ Handle Genesis::InstallInternalArray( { // Add length. CallbacksDescriptor d( - *factory()->length_symbol(), *array_length, attribs); + *factory()->length_string(), *array_length, attribs); array_function->initial_map()->AppendDescriptor(&d, witness); } @@ -1525,12 +1525,12 @@ bool Genesis::InstallNatives() { Handle code = Handle( isolate()->builtins()->builtin(Builtins::kIllegal)); Handle builtins_fun = - factory()->NewFunction(factory()->empty_symbol(), + factory()->NewFunction(factory()->empty_string(), JS_BUILTINS_OBJECT_TYPE, JSBuiltinsObject::kSize, code, true); Handle name = - factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("builtins")); + factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("builtins")); builtins_fun->shared()->set_instance_class_name(*name); builtins_fun->initial_map()->set_dictionary_map(true); builtins_fun->initial_map()->set_prototype(heap()->null_value()); @@ -1549,12 +1549,12 @@ bool Genesis::InstallNatives() { // global object. static const PropertyAttributes attributes = static_cast(READ_ONLY | DONT_DELETE); - Handle global_symbol = - factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("global")); + Handle global_string = + factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("global")); Handle global_obj(native_context()->global_object(), isolate()); CHECK_NOT_EMPTY_HANDLE(isolate(), JSObject::SetLocalPropertyIgnoreAttributes( - builtins, global_symbol, global_obj, attributes)); + builtins, global_string, global_obj, attributes)); // Set up the reference from the global object to the builtins object. JSGlobalObject::cast(native_context()->global_object())-> @@ -1562,7 +1562,7 @@ bool Genesis::InstallNatives() { // Create a bridge function that has context in the native context. Handle bridge = - factory()->NewFunction(factory()->empty_symbol(), + factory()->NewFunction(factory()->empty_string(), factory()->undefined_value()); ASSERT(bridge->context() == *isolate()->native_context()); @@ -1593,48 +1593,51 @@ bool Genesis::InstallNatives() { Handle script_source( factory()->NewForeign(&Accessors::ScriptSource)); Handle script_name(factory()->NewForeign(&Accessors::ScriptName)); - Handle id_symbol(factory()->LookupOneByteSymbol( + Handle id_string(factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("id"))); Handle script_id(factory()->NewForeign(&Accessors::ScriptId)); - Handle line_offset_symbol( - factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("line_offset"))); + Handle line_offset_string( + factory()->InternalizeOneByteString( + STATIC_ASCII_VECTOR("line_offset"))); Handle script_line_offset( factory()->NewForeign(&Accessors::ScriptLineOffset)); - Handle column_offset_symbol( - factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("column_offset"))); + Handle column_offset_string( + factory()->InternalizeOneByteString( + STATIC_ASCII_VECTOR("column_offset"))); Handle script_column_offset( factory()->NewForeign(&Accessors::ScriptColumnOffset)); - Handle data_symbol(factory()->LookupOneByteSymbol( + Handle data_string(factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("data"))); Handle script_data(factory()->NewForeign(&Accessors::ScriptData)); - Handle type_symbol(factory()->LookupOneByteSymbol( + Handle type_string(factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("type"))); Handle script_type(factory()->NewForeign(&Accessors::ScriptType)); - Handle compilation_type_symbol( - factory()->LookupOneByteSymbol( + Handle compilation_type_string( + factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("compilation_type"))); Handle script_compilation_type( factory()->NewForeign(&Accessors::ScriptCompilationType)); - Handle line_ends_symbol(factory()->LookupOneByteSymbol( + Handle line_ends_string(factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("line_ends"))); Handle script_line_ends( factory()->NewForeign(&Accessors::ScriptLineEnds)); - Handle context_data_symbol( - factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("context_data"))); + Handle context_data_string( + factory()->InternalizeOneByteString( + STATIC_ASCII_VECTOR("context_data"))); Handle script_context_data( factory()->NewForeign(&Accessors::ScriptContextData)); - Handle eval_from_script_symbol( - factory()->LookupOneByteSymbol( + Handle eval_from_script_string( + factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("eval_from_script"))); Handle script_eval_from_script( factory()->NewForeign(&Accessors::ScriptEvalFromScript)); - Handle eval_from_script_position_symbol( - factory()->LookupOneByteSymbol( + Handle eval_from_script_position_string( + factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("eval_from_script_position"))); Handle script_eval_from_script_position( factory()->NewForeign(&Accessors::ScriptEvalFromScriptPosition)); - Handle eval_from_function_name_symbol( - factory()->LookupOneByteSymbol( + Handle eval_from_function_name_string( + factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("eval_from_function_name"))); Handle script_eval_from_function_name( factory()->NewForeign(&Accessors::ScriptEvalFromFunctionName)); @@ -1644,67 +1647,67 @@ bool Genesis::InstallNatives() { { CallbacksDescriptor d( - *factory()->source_symbol(), *script_source, attribs); + *factory()->source_string(), *script_source, attribs); script_map->AppendDescriptor(&d, witness); } { - CallbacksDescriptor d(*factory()->name_symbol(), *script_name, attribs); + CallbacksDescriptor d(*factory()->name_string(), *script_name, attribs); script_map->AppendDescriptor(&d, witness); } { - CallbacksDescriptor d(*id_symbol, *script_id, attribs); + CallbacksDescriptor d(*id_string, *script_id, attribs); script_map->AppendDescriptor(&d, witness); } { - CallbacksDescriptor d(*line_offset_symbol, *script_line_offset, attribs); + CallbacksDescriptor d(*line_offset_string, *script_line_offset, attribs); script_map->AppendDescriptor(&d, witness); } { CallbacksDescriptor d( - *column_offset_symbol, *script_column_offset, attribs); + *column_offset_string, *script_column_offset, attribs); script_map->AppendDescriptor(&d, witness); } { - CallbacksDescriptor d(*data_symbol, *script_data, attribs); + CallbacksDescriptor d(*data_string, *script_data, attribs); script_map->AppendDescriptor(&d, witness); } { - CallbacksDescriptor d(*type_symbol, *script_type, attribs); + CallbacksDescriptor d(*type_string, *script_type, attribs); script_map->AppendDescriptor(&d, witness); } { CallbacksDescriptor d( - *compilation_type_symbol, *script_compilation_type, attribs); + *compilation_type_string, *script_compilation_type, attribs); script_map->AppendDescriptor(&d, witness); } { - CallbacksDescriptor d(*line_ends_symbol, *script_line_ends, attribs); + CallbacksDescriptor d(*line_ends_string, *script_line_ends, attribs); script_map->AppendDescriptor(&d, witness); } { CallbacksDescriptor d( - *context_data_symbol, *script_context_data, attribs); + *context_data_string, *script_context_data, attribs); script_map->AppendDescriptor(&d, witness); } { CallbacksDescriptor d( - *eval_from_script_symbol, *script_eval_from_script, attribs); + *eval_from_script_string, *script_eval_from_script, attribs); script_map->AppendDescriptor(&d, witness); } { CallbacksDescriptor d( - *eval_from_script_position_symbol, + *eval_from_script_position_string, *script_eval_from_script_position, attribs); script_map->AppendDescriptor(&d, witness); @@ -1712,7 +1715,7 @@ bool Genesis::InstallNatives() { { CallbacksDescriptor d( - *eval_from_function_name_symbol, + *eval_from_function_name_string, *script_eval_from_function_name, attribs); script_map->AppendDescriptor(&d, witness); @@ -1784,7 +1787,7 @@ bool Genesis::InstallNatives() { HeapObject::cast(string_function->initial_map()->prototype())->map()); // Install Function.prototype.call and apply. - { Handle key = factory()->function_class_symbol(); + { Handle key = factory()->function_class_string(); Handle function = Handle::cast( GetProperty(isolate(), isolate()->global_object(), key)); @@ -1848,7 +1851,7 @@ bool Genesis::InstallNatives() { JSFunction* array_function = native_context()->array_function(); Handle array_descriptors( array_function->initial_map()->instance_descriptors()); - String* length = heap()->length_symbol(); + String* length = heap()->length_string(); int old = array_descriptors->SearchWithCache( length, array_function->initial_map()); ASSERT(old != DescriptorArray::kNotFound); @@ -1858,14 +1861,14 @@ bool Genesis::InstallNatives() { initial_map->AppendDescriptor(&desc, witness); } { - FieldDescriptor index_field(heap()->index_symbol(), + FieldDescriptor index_field(heap()->index_string(), JSRegExpResult::kIndexIndex, NONE); initial_map->AppendDescriptor(&index_field, witness); } { - FieldDescriptor input_field(heap()->input_symbol(), + FieldDescriptor input_field(heap()->input_string(), JSRegExpResult::kInputIndex, NONE); initial_map->AppendDescriptor(&input_field, witness); @@ -1921,14 +1924,14 @@ static Handle ResolveBuiltinIdHolder( Handle global(native_context->global_object()); const char* period_pos = strchr(holder_expr, '.'); if (period_pos == NULL) { - return Handle::cast( - GetProperty(isolate, global, factory->LookupUtf8Symbol(holder_expr))); + return Handle::cast(GetProperty( + isolate, global, factory->InternalizeUtf8String(holder_expr))); } ASSERT_EQ(".prototype", period_pos); Vector property(holder_expr, static_cast(period_pos - holder_expr)); Handle function = Handle::cast( - GetProperty(isolate, global, factory->LookupUtf8Symbol(property))); + GetProperty(isolate, global, factory->InternalizeUtf8String(property))); return Handle(JSObject::cast(function->prototype())); } @@ -1937,7 +1940,7 @@ static void InstallBuiltinFunctionId(Handle holder, const char* function_name, BuiltinFunctionId id) { Factory* factory = holder->GetIsolate()->factory(); - Handle name = factory->LookupUtf8Symbol(function_name); + Handle name = factory->InternalizeUtf8String(function_name); Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked(); Handle function(JSFunction::cast(function_object)); function->shared()->set_function_data(Smi::FromInt(id)); @@ -2027,7 +2030,8 @@ void Genesis::InstallSpecialObjects(Handle native_context) { native_context->global_object())); // Expose the natives in global if a name for it is specified. if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) { - Handle natives = factory->LookupUtf8Symbol(FLAG_expose_natives_as); + Handle natives = + factory->InternalizeUtf8String(FLAG_expose_natives_as); CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( global, natives, @@ -2037,10 +2041,10 @@ void Genesis::InstallSpecialObjects(Handle native_context) { Handle Error = GetProperty(global, "Error"); if (Error->IsJSObject()) { - Handle name = - factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stackTraceLimit")); - Handle stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), - isolate); + Handle name = factory->InternalizeOneByteString( + STATIC_ASCII_VECTOR("stackTraceLimit")); + Handle stack_trace_limit( + Smi::FromInt(FLAG_stack_trace_limit), isolate); CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( Handle::cast(Error), name, @@ -2061,9 +2065,9 @@ void Genesis::InstallSpecialObjects(Handle native_context) { native_context->security_token()); Handle debug_string = - factory->LookupUtf8Symbol(FLAG_expose_debug_as); - Handle global_proxy(debug->debug_context()->global_proxy(), - isolate); + factory->InternalizeUtf8String(FLAG_expose_debug_as); + Handle global_proxy( + debug->debug_context()->global_proxy(), isolate); CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( global, debug_string, global_proxy, DONT_ENUM)); @@ -2205,7 +2209,8 @@ bool Genesis::InstallJSBuiltins(Handle builtins) { HandleScope scope(isolate()); for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { Builtins::JavaScript id = static_cast(i); - Handle name = factory()->LookupUtf8Symbol(Builtins::GetName(id)); + Handle name = + factory()->InternalizeUtf8String(Builtins::GetName(id)); Object* function_object = builtins->GetPropertyNoExceptionThrown(*name); Handle function = Handle(JSFunction::cast(function_object)); diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index d02715f7f1..20abec4fa5 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -171,7 +171,7 @@ void CodeStubGraphBuilder::BuildCodeStub() { HInstruction* value = AddInstruction(new(zone) HLoadNamedField(boilerplate, true, i)); AddInstruction(new(zone) HStoreNamedField(object, - factory->empty_symbol(), + factory->empty_string(), value, true, i)); AddSimulate(BailoutId::StubEntry()); @@ -290,14 +290,14 @@ void CodeStubGraphBuilder::BuildCodeStub() { to_kind, array_length); AddInstruction(new(zone) HStoreNamedField(js_array, - factory->elements_field_symbol(), + factory->elements_field_string(), new_elements, true, JSArray::kElementsOffset)); AddSimulate(BailoutId::StubEntry()); if_builder.End(); - AddInstruction(new(zone) HStoreNamedField(js_array, factory->length_symbol(), + AddInstruction(new(zone) HStoreNamedField(js_array, factory->length_string(), map, true, JSArray::kMapOffset)); AddSimulate(BailoutId::StubEntry()); diff --git a/src/code-stubs.cc b/src/code-stubs.cc index dacd5256dc..1320ef8f29 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -295,8 +295,8 @@ void ICCompareStub::AddToSpecialCache(Handle new_object) { Factory* factory = isolate->factory(); return Map::UpdateCodeCache(known_map_, strict() ? - factory->strict_compare_ic_symbol() : - factory->compare_ic_symbol(), + factory->strict_compare_ic_string() : + factory->compare_ic_string(), new_object); } @@ -307,10 +307,13 @@ bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) { static_cast(GetCodeKind()), UNINITIALIZED); ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT); - String* symbol = strict() ? - *factory->strict_compare_ic_symbol() : - *factory->compare_ic_symbol(); - Handle probe(known_map_->FindInCodeCache(symbol, flags), isolate); + Handle probe( + known_map_->FindInCodeCache( + strict() ? + *factory->strict_compare_ic_string() : + *factory->compare_ic_string(), + flags), + isolate); if (probe->IsCode()) { *code_out = Code::cast(*probe); #ifdef DEBUG @@ -370,8 +373,8 @@ void ICCompareStub::Generate(MacroAssembler* masm) { case CompareIC::STRING: GenerateStrings(masm); break; - case CompareIC::SYMBOL: - GenerateSymbols(masm); + case CompareIC::INTERNALIZED_STRING: + GenerateInternalizedStrings(masm); break; case CompareIC::OBJECT: GenerateObjects(masm); diff --git a/src/code-stubs.h b/src/code-stubs.h index 06e28368a2..af1a426001 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -809,7 +809,7 @@ class ICCompareStub: public PlatformCodeStub { void GenerateSmis(MacroAssembler* masm); void GenerateNumbers(MacroAssembler* masm); - void GenerateSymbols(MacroAssembler* masm); + void GenerateInternalizedStrings(MacroAssembler* masm); void GenerateStrings(MacroAssembler* masm); void GenerateObjects(MacroAssembler* masm); void GenerateMiss(MacroAssembler* masm); diff --git a/src/conversions-inl.h b/src/conversions-inl.h index 1b53912696..7edaf22407 100644 --- a/src/conversions-inl.h +++ b/src/conversions-inl.h @@ -481,9 +481,9 @@ double InternalStringToDouble(UnicodeCache* unicode_cache, sign = NEGATIVE; } - static const char kInfinitySymbol[] = "Infinity"; - if (*current == kInfinitySymbol[0]) { - if (!SubStringEquals(¤t, end, kInfinitySymbol)) { + static const char kInfinityString[] = "Infinity"; + if (*current == kInfinityString[0]) { + if (!SubStringEquals(¤t, end, kInfinityString)) { return JunkStringValue(); } diff --git a/src/debug.cc b/src/debug.cc index 8940edd15a..282157810c 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -842,7 +842,7 @@ bool Debug::Load() { isolate_->set_context(*context); // Expose the builtins object in the debugger context. - Handle key = isolate_->factory()->LookupOneByteSymbol( + Handle key = isolate_->factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("builtins")); Handle global = Handle(context->global_object()); RETURN_IF_EMPTY_HANDLE_VALUE( @@ -1109,13 +1109,13 @@ bool Debug::CheckBreakPoint(Handle break_point_object) { if (!break_point_object->IsJSObject()) return true; // Get the function IsBreakPointTriggered (defined in debug-debugger.js). - Handle is_break_point_triggered_symbol = - factory->LookupOneByteSymbol( + Handle is_break_point_triggered_string = + factory->InternalizeOneByteString( STATIC_ASCII_VECTOR("IsBreakPointTriggered")); Handle check_break_point = Handle(JSFunction::cast( debug_context()->global_object()->GetPropertyNoExceptionThrown( - *is_break_point_triggered_symbol))); + *is_break_point_triggered_string))); // Get the break id as an object. Handle break_id = factory->NewNumberFromInt(Debug::break_id()); @@ -2441,7 +2441,7 @@ void Debug::ClearMirrorCache() { ASSERT(isolate_->context() == *Debug::debug_context()); // Clear the mirror cache. - Handle function_name = isolate_->factory()->LookupOneByteSymbol( + Handle function_name = isolate_->factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("ClearMirrorCache")); Handle fun( isolate_->global_object()->GetPropertyNoExceptionThrown(*function_name), @@ -2570,7 +2570,7 @@ Handle Debugger::MakeJSObject(Vector constructor_name, // Create the execution state object. Handle constructor_str = - isolate_->factory()->LookupUtf8Symbol(constructor_name); + isolate_->factory()->InternalizeUtf8String(constructor_name); Handle constructor( isolate_->global_object()->GetPropertyNoExceptionThrown(*constructor_str), isolate_); @@ -2800,13 +2800,13 @@ void Debugger::OnAfterCompile(Handle