Commit 4292356b authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Renamed "symbols" to "internalized strings" throughout the code base, in...

MIPS: Renamed "symbols" to "internalized strings" throughout the code base, in preparation of the introduction of ES6 'symbols' (aka private/unique names).

Port r13781 (59f39a06)

Original commit message:
The SymbolTable became the StringTable. I also made sure to adapt all comments. The only remaining use of the term "symbol" (other than unrelated uses in the parser and such) is now 'NewSymbol' in the API and the 'V8.KeyedLoadGenericSymbol' counter, changing which might break embedders.

The one functional change in this CL is that I removed the former 'empty_string' constant, since it is redundant given the 'empty_symbol' constant that we also had (and both were used inconsistently).

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13807 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 42a9a868
......@@ -698,7 +698,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
// Load the empty string into a2, 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);
__ Branch(&argument_is_string);
......
This diff is collapsed.
......@@ -173,9 +173,9 @@ 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
......
......@@ -475,7 +475,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
// the string.
__ bind(&cons_string);
__ lw(result, FieldMemOperand(string, ConsString::kSecondOffset));
__ LoadRoot(at, Heap::kEmptyStringRootIndex);
__ LoadRoot(at, Heap::kempty_stringRootIndex);
__ Branch(call_runtime, ne, result, Operand(at));
// Get the first of the two strings and load its instance type.
__ lw(string, FieldMemOperand(string, ConsString::kFirstOffset));
......
......@@ -1638,7 +1638,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(a0, result_register());
......@@ -2711,7 +2711,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ LoadRoot(t0, Heap::kHashTableMapRootIndex);
__ Branch(if_false, eq, a2, Operand(t0));
// 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;
......@@ -2736,10 +2736,10 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ Addu(a2, a2, t1);
// Loop through all the keys in the descriptor array. If one of these is the
// symbol valueOf the result is false.
// The use of t2 to store the valueOf symbol asumes that it is not otherwise
// string "valueOf" the result is false.
// The use of t2 to store the valueOf string assumes that it is not otherwise
// used in the loop below.
__ LoadRoot(t2, Heap::kvalue_of_symbolRootIndex);
__ li(t2, Operand(FACTORY->value_of_string()));
__ jmp(&entry);
__ bind(&loop);
__ lw(a3, MemOperand(t0, 0));
......@@ -2970,12 +2970,12 @@ void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
// Functions have class 'Function'.
__ bind(&function);
__ LoadRoot(v0, Heap::kfunction_class_symbolRootIndex);
__ LoadRoot(v0, Heap::kfunction_class_stringRootIndex);
__ jmp(&done);
// Objects with a non-function constructor have class 'Object'.
__ bind(&non_function_constructor);
__ LoadRoot(v0, Heap::kObject_symbolRootIndex);
__ LoadRoot(v0, Heap::kObject_stringRootIndex);
__ jmp(&done);
// Non-JS objects have class null.
......@@ -3345,7 +3345,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);
......@@ -3660,7 +3660,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(CallRuntime* expr) {
__ lw(array_length, FieldMemOperand(array, JSArray::kLengthOffset));
__ SmiUntag(array_length);
__ Branch(&non_trivial_array, ne, array_length, Operand(zero_reg));
__ LoadRoot(v0, Heap::kEmptyStringRootIndex);
__ LoadRoot(v0, Heap::kempty_stringRootIndex);
__ Branch(&done);
__ bind(&non_trivial_array);
......@@ -4275,12 +4275,12 @@ 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(v0, if_true);
__ lw(v0, FieldMemOperand(v0, HeapObject::kMapOffset));
__ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
Split(eq, v0, Operand(at), if_true, if_false, fall_through);
} else if (check->Equals(isolate()->heap()->string_symbol())) {
} else if (check->Equals(isolate()->heap()->string_string())) {
__ JumpIfSmi(v0, if_false);
// Check for undetectable objects => false.
__ GetObjectType(v0, v0, a1);
......@@ -4289,16 +4289,16 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ And(a1, a1, Operand(1 << Map::kIsUndetectable));
Split(eq, a1, Operand(zero_reg),
if_true, if_false, fall_through);
} else if (check->Equals(isolate()->heap()->boolean_symbol())) {
} else if (check->Equals(isolate()->heap()->boolean_string())) {
__ LoadRoot(at, Heap::kTrueValueRootIndex);
__ Branch(if_true, eq, v0, Operand(at));
__ LoadRoot(at, Heap::kFalseValueRootIndex);
Split(eq, v0, Operand(at), if_true, if_false, fall_through);
} else if (FLAG_harmony_typeof &&
check->Equals(isolate()->heap()->null_symbol())) {
check->Equals(isolate()->heap()->null_string())) {
__ LoadRoot(at, Heap::kNullValueRootIndex);
Split(eq, v0, Operand(at), if_true, if_false, fall_through);
} else if (check->Equals(isolate()->heap()->undefined_symbol())) {
} else if (check->Equals(isolate()->heap()->undefined_string())) {
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
__ Branch(if_true, eq, v0, Operand(at));
__ JumpIfSmi(v0, if_false);
......@@ -4307,14 +4307,14 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
__ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset));
__ And(a1, a1, Operand(1 << Map::kIsUndetectable));
Split(ne, a1, Operand(zero_reg), if_true, if_false, fall_through);
} else if (check->Equals(isolate()->heap()->function_symbol())) {
} else if (check->Equals(isolate()->heap()->function_string())) {
__ JumpIfSmi(v0, if_false);
STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
__ GetObjectType(v0, v0, a1);
__ Branch(if_true, eq, a1, Operand(JS_FUNCTION_TYPE));
Split(eq, a1, Operand(JS_FUNCTION_PROXY_TYPE),
if_true, if_false, fall_through);
} else if (check->Equals(isolate()->heap()->object_symbol())) {
} else if (check->Equals(isolate()->heap()->object_string())) {
__ JumpIfSmi(v0, if_false);
if (!FLAG_harmony_typeof) {
__ LoadRoot(at, Heap::kNullValueRootIndex);
......
......@@ -305,30 +305,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?
__ GetObjectType(key, map, hash);
__ Branch(not_symbol, ge, hash, Operand(FIRST_NONSTRING_TYPE));
__ Branch(not_internalized, ge, hash, Operand(FIRST_NONSTRING_TYPE));
// Is the string an array index, with cached numeric value?
__ lw(hash, FieldMemOperand(key, String::kHashFieldOffset));
__ And(at, hash, Operand(String::kContainsCachedArrayIndexMask));
__ Branch(index_string, eq, at, Operand(zero_reg));
// Is the string a symbol?
// Is the string internalized?
// map: key map
__ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
STATIC_ASSERT(kSymbolTag != 0);
__ And(at, hash, Operand(kIsSymbolMask));
__ Branch(not_symbol, eq, at, Operand(zero_reg));
STATIC_ASSERT(kInternalizedTag != 0);
__ And(at, hash, Operand(kIsInternalizedMask));
__ Branch(not_internalized, eq, at, Operand(zero_reg));
}
......@@ -583,7 +583,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ bind(&check_string);
GenerateKeyStringCheck(masm, a2, a0, a3, &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.
......@@ -610,7 +610,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.
......@@ -991,7 +991,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask;
__ And(a3, a3, 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;
......
......@@ -2327,12 +2327,12 @@ void LCodeGen::EmitClassOfTest(Label* is_true,
__ lw(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset));
__ lw(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.
// End with the address of this class_name instance in temp register.
// On MIPS, the caller must do the comparison with Handle<String>class_name.
......@@ -5720,7 +5720,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
// register.
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);
__ lw(input, FieldMemOperand(input, HeapObject::kMapOffset));
__ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
......@@ -5728,7 +5728,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
cmp2 = Operand(at);
final_branch_condition = eq;
} else if (type_name->Equals(heap()->string_symbol())) {
} else if (type_name->Equals(heap()->string_string())) {
__ JumpIfSmi(input, false_label);
__ GetObjectType(input, input, scratch);
__ Branch(USE_DELAY_SLOT, false_label,
......@@ -5741,7 +5741,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
cmp2 = Operand(zero_reg);
final_branch_condition = eq;
} else if (type_name->Equals(heap()->boolean_symbol())) {
} else if (type_name->Equals(heap()->boolean_string())) {
__ LoadRoot(at, Heap::kTrueValueRootIndex);
__ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input));
__ LoadRoot(at, Heap::kFalseValueRootIndex);
......@@ -5749,13 +5749,13 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
cmp2 = Operand(input);
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())) {
__ LoadRoot(at, Heap::kNullValueRootIndex);
cmp1 = at;
cmp2 = Operand(input);
final_branch_condition = eq;
} else if (type_name->Equals(heap()->undefined_symbol())) {
} else if (type_name->Equals(heap()->undefined_string())) {
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
__ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input));
// The first instruction of JumpIfSmi is an And - it is safe in the delay
......@@ -5769,7 +5769,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
cmp2 = Operand(zero_reg);
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);
__ GetObjectType(input, scratch, input);
......@@ -5778,7 +5778,7 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
cmp2 = 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) {
__ LoadRoot(at, Heap::kNullValueRootIndex);
......
......@@ -121,14 +121,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<String> 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);
......@@ -1103,7 +1103,7 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
if (!current->HasFastProperties() &&
!current->IsJSGlobalObject() &&
!current->IsJSGlobalProxy()) {
if (!name->IsSymbol()) {
if (!name->IsInternalizedString()) {
name = factory()->InternalizeString(name);
}
ASSERT(current->property_dictionary()->FindEntry(*name) ==
......@@ -2001,7 +2001,7 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall(
if (index_out_of_range.is_linked()) {
__ bind(&index_out_of_range);
__ LoadRoot(v0, Heap::kEmptyStringRootIndex);
__ LoadRoot(v0, Heap::kempty_stringRootIndex);
__ Drop(argc + 1);
__ Ret();
}
......@@ -2420,7 +2420,7 @@ void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object,
break;
case STRING_CHECK:
// Check that the object is a two-byte string or a symbol.
// Check that the object is a string.
__ GetObjectType(a1, a3, a3);
__ Branch(&miss, Ugreater_equal, a3, Operand(FIRST_NONSTRING_TYPE));
// Check that the maps starting from the prototype haven't changed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment