Commit ffcc4de0 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: ES6 symbols: Allow symbols as property names

Port r13811 (0e64f280)

Original commit message:
Since symbols and strings share a common representation, most of this change is about consistently replacing 'String' with 'Name' in all places where property names are expected. In particular, no new logic at all is necessary for maps, property dictionaries, or transitions. :) The only places where an actual case distinction is needed have to do with generated type checks, and with conversions of names to strings (especially in logger and profiler).

Left in some TODOs wrt to the API: interceptors and native getters don't accept symbols as property names yet, because that would require extending the external v8.h.

(Baseline CL: https://codereview.chromium.org/12296026/)

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13874 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8312b895
......@@ -7519,13 +7519,14 @@ void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
}
void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
Label* miss,
Label* done,
Register receiver,
Register properties,
Handle<String> name,
Handle<Name> name,
Register scratch0) {
ASSERT(name->IsUniqueName());
// If names of slots in range from 1 to kProbes - 1 for the hash value are
// not equal to the name and kProbes-th slot is not used (its name is the
// undefined value), it guarantees the hash table doesn't contain the
......@@ -7539,10 +7540,10 @@ void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
__ lw(index, FieldMemOperand(properties, kCapacityOffset));
__ Subu(index, index, Operand(1));
__ And(index, index, Operand(
Smi::FromInt(name->Hash() + StringDictionary::GetProbeOffset(i))));
Smi::FromInt(name->Hash() + NameDictionary::GetProbeOffset(i))));
// Scale the index by multiplying by the entry size.
ASSERT(StringDictionary::kEntrySize == 3);
ASSERT(NameDictionary::kEntrySize == 3);
__ sll(at, index, 1);
__ Addu(index, index, at);
......@@ -7563,19 +7564,20 @@ void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
__ LoadRoot(tmp, Heap::kTheHoleValueRootIndex);
// Stop if found the property.
__ Branch(miss, eq, entity_name, Operand(Handle<String>(name)));
__ Branch(miss, eq, entity_name, Operand(Handle<Name>(name)));
Label the_hole;
__ Branch(&the_hole, eq, entity_name, Operand(tmp));
Label good;
__ Branch(&good, eq, entity_name, Operand(tmp));
// Check if the entry name is not a internalized string.
// Check if the entry name is not a unique name.
__ lw(entity_name, FieldMemOperand(entity_name, HeapObject::kMapOffset));
__ lbu(entity_name,
FieldMemOperand(entity_name, Map::kInstanceTypeOffset));
__ And(scratch0, entity_name, Operand(kIsInternalizedMask));
__ Branch(miss, eq, scratch0, Operand(zero_reg));
__ Branch(&good, ne, scratch0, Operand(zero_reg));
__ Branch(miss, ne, entity_name, Operand(SYMBOL_TYPE));
__ bind(&the_hole);
__ bind(&good);
// Restore the properties.
__ lw(properties,
......@@ -7589,8 +7591,8 @@ void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
__ MultiPush(spill_mask);
__ lw(a0, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
__ li(a1, Operand(Handle<String>(name)));
StringDictionaryLookupStub stub(NEGATIVE_LOOKUP);
__ li(a1, Operand(Handle<Name>(name)));
NameDictionaryLookupStub stub(NEGATIVE_LOOKUP);
__ CallStub(&stub);
__ mov(at, v0);
__ MultiPop(spill_mask);
......@@ -7600,11 +7602,11 @@ void StringDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm,
}
// Probe the string dictionary in the |elements| register. Jump to the
// Probe the name dictionary in the |elements| register. Jump to the
// |done| label if a property with the given name is found. Jump to
// the |miss| label otherwise.
// If lookup was successful |scratch2| will be equal to elements + 4 * index.
void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
Label* miss,
Label* done,
Register elements,
......@@ -7616,7 +7618,7 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
ASSERT(!name.is(scratch1));
ASSERT(!name.is(scratch2));
__ AssertString(name);
__ AssertName(name);
// Compute the capacity mask.
__ lw(scratch1, FieldMemOperand(elements, kCapacityOffset));
......@@ -7628,21 +7630,21 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
// cover ~93% of loads from dictionaries.
for (int i = 0; i < kInlinedProbes; i++) {
// Compute the masked index: (hash + i + i * i) & mask.
__ lw(scratch2, FieldMemOperand(name, String::kHashFieldOffset));
__ lw(scratch2, FieldMemOperand(name, Name::kHashFieldOffset));
if (i > 0) {
// Add the probe offset (i + i * i) left shifted to avoid right shifting
// the hash in a separate instruction. The value hash + i + i * i is right
// shifted in the following and instruction.
ASSERT(StringDictionary::GetProbeOffset(i) <
1 << (32 - String::kHashFieldOffset));
ASSERT(NameDictionary::GetProbeOffset(i) <
1 << (32 - Name::kHashFieldOffset));
__ Addu(scratch2, scratch2, Operand(
StringDictionary::GetProbeOffset(i) << String::kHashShift));
NameDictionary::GetProbeOffset(i) << Name::kHashShift));
}
__ srl(scratch2, scratch2, String::kHashShift);
__ srl(scratch2, scratch2, Name::kHashShift);
__ And(scratch2, scratch1, scratch2);
// Scale the index by multiplying by the element size.
ASSERT(StringDictionary::kEntrySize == 3);
ASSERT(NameDictionary::kEntrySize == 3);
// scratch2 = scratch2 * 3.
__ sll(at, scratch2, 1);
......@@ -7669,7 +7671,7 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
__ Move(a0, elements);
__ Move(a1, name);
}
StringDictionaryLookupStub stub(POSITIVE_LOOKUP);
NameDictionaryLookupStub stub(POSITIVE_LOOKUP);
__ CallStub(&stub);
__ mov(scratch2, a2);
__ mov(at, v0);
......@@ -7680,14 +7682,14 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
}
void StringDictionaryLookupStub::Generate(MacroAssembler* masm) {
void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
// This stub overrides SometimesSetsUpAFrame() to return false. That means
// we cannot call anything that could cause a GC from this stub.
// Registers:
// result: StringDictionary to probe
// result: NameDictionary to probe
// a1: key
// : StringDictionary to probe.
// index_: will hold an index of entry if lookup is successful.
// dictionary: NameDictionary to probe.
// index: will hold an index of entry if lookup is successful.
// might alias with result_.
// Returns:
// result_ is zero if lookup failed, non zero otherwise.
......@@ -7707,7 +7709,7 @@ void StringDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ sra(mask, mask, kSmiTagSize);
__ Subu(mask, mask, Operand(1));
__ lw(hash, FieldMemOperand(key, String::kHashFieldOffset));
__ lw(hash, FieldMemOperand(key, Name::kHashFieldOffset));
__ LoadRoot(undefined, Heap::kUndefinedValueRootIndex);
......@@ -7718,18 +7720,18 @@ void StringDictionaryLookupStub::Generate(MacroAssembler* masm) {
// Add the probe offset (i + i * i) left shifted to avoid right shifting
// the hash in a separate instruction. The value hash + i + i * i is right
// shifted in the following and instruction.
ASSERT(StringDictionary::GetProbeOffset(i) <
1 << (32 - String::kHashFieldOffset));
ASSERT(NameDictionary::GetProbeOffset(i) <
1 << (32 - Name::kHashFieldOffset));
__ Addu(index, hash, Operand(
StringDictionary::GetProbeOffset(i) << String::kHashShift));
NameDictionary::GetProbeOffset(i) << Name::kHashShift));
} else {
__ mov(index, hash);
}
__ srl(index, index, String::kHashShift);
__ srl(index, index, Name::kHashShift);
__ And(index, mask, index);
// Scale the index by multiplying by the entry size.
ASSERT(StringDictionary::kEntrySize == 3);
ASSERT(NameDictionary::kEntrySize == 3);
// index *= 3.
__ mov(at, index);
__ sll(index, index, 1);
......@@ -7748,12 +7750,15 @@ void StringDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ Branch(&in_dictionary, eq, entry_key, Operand(key));
if (i != kTotalProbes - 1 && mode_ == NEGATIVE_LOOKUP) {
// Check if the entry name is not a internalized string.
// Check if the entry name is not a unique name.
Label cont;
__ lw(entry_key, FieldMemOperand(entry_key, HeapObject::kMapOffset));
__ lbu(entry_key,
FieldMemOperand(entry_key, Map::kInstanceTypeOffset));
__ And(result, entry_key, Operand(kIsInternalizedMask));
__ Branch(&maybe_in_dictionary, eq, result, Operand(zero_reg));
__ Branch(&cont, ne, result, Operand(zero_reg));
__ Branch(&maybe_in_dictionary, ne, entry_key, Operand(SYMBOL_TYPE));
__ bind(&cont);
}
}
......
......@@ -739,11 +739,11 @@ class FloatingPointHelper : public AllStatic {
};
class StringDictionaryLookupStub: public PlatformCodeStub {
class NameDictionaryLookupStub: public PlatformCodeStub {
public:
enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
explicit StringDictionaryLookupStub(LookupMode mode) : mode_(mode) { }
explicit NameDictionaryLookupStub(LookupMode mode) : mode_(mode) { }
void Generate(MacroAssembler* masm);
......@@ -752,7 +752,7 @@ class StringDictionaryLookupStub: public PlatformCodeStub {
Label* done,
Register receiver,
Register properties,
Handle<String> name,
Handle<Name> name,
Register scratch0);
static void GeneratePositiveLookup(MacroAssembler* masm,
......@@ -770,14 +770,14 @@ class StringDictionaryLookupStub: public PlatformCodeStub {
static const int kTotalProbes = 20;
static const int kCapacityOffset =
StringDictionary::kHeaderSize +
StringDictionary::kCapacityIndex * kPointerSize;
NameDictionary::kHeaderSize +
NameDictionary::kCapacityIndex * kPointerSize;
static const int kElementsStartOffset =
StringDictionary::kHeaderSize +
StringDictionary::kElementsStartIndex * kPointerSize;
NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
Major MajorKey() { return StringDictionaryLookup; }
Major MajorKey() { return NameDictionaryLookup; }
int MinorKey() {
return LookupModeBits::encode(mode_);
......
......@@ -61,7 +61,7 @@ static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm,
// Generated code falls through if the receiver is a regular non-global
// JS object with slow properties and no interceptors.
static void GenerateStringDictionaryReceiverCheck(MacroAssembler* masm,
static void GenerateNameDictionaryReceiverCheck(MacroAssembler* masm,
Register receiver,
Register elements,
Register scratch0,
......@@ -129,7 +129,7 @@ static void GenerateDictionaryLoad(MacroAssembler* masm,
Label done;
// Probe the dictionary.
StringDictionaryLookupStub::GeneratePositiveLookup(masm,
NameDictionaryLookupStub::GeneratePositiveLookup(masm,
miss,
&done,
elements,
......@@ -140,8 +140,8 @@ static void GenerateDictionaryLoad(MacroAssembler* masm,
// If probing finds an entry check that the value is a normal
// property.
__ bind(&done); // scratch2 == elements + 4 * index.
const int kElementsStartOffset = StringDictionary::kHeaderSize +
StringDictionary::kElementsStartIndex * kPointerSize;
const int kElementsStartOffset = NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
__ lw(scratch1, FieldMemOperand(scratch2, kDetailsOffset));
__ And(at,
......@@ -182,7 +182,7 @@ static void GenerateDictionaryStore(MacroAssembler* masm,
Label done;
// Probe the dictionary.
StringDictionaryLookupStub::GeneratePositiveLookup(masm,
NameDictionaryLookupStub::GeneratePositiveLookup(masm,
miss,
&done,
elements,
......@@ -193,8 +193,8 @@ static void GenerateDictionaryStore(MacroAssembler* masm,
// If probing finds an entry in the dictionary check that the value
// is a normal property that is not read only.
__ bind(&done); // scratch2 == elements + 4 * index.
const int kElementsStartOffset = StringDictionary::kHeaderSize +
StringDictionary::kElementsStartIndex * kPointerSize;
const int kElementsStartOffset = NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
const int kTypeAndReadOnlyMask =
(PropertyDetails::TypeField::kMask |
......@@ -305,22 +305,25 @@ static void GenerateFastArrayLoad(MacroAssembler* masm,
}
// 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,
// Checks whether a key is an array index string or a unique name.
// Falls through if a key is a unique name.
static void GenerateKeyNameCheck(MacroAssembler* masm,
Register key,
Register map,
Register hash,
Label* index_string,
Label* not_internalized) {
Label* not_unique) {
// The key is not a smi.
// Is it a string?
Label unique;
// Is it a name?
__ GetObjectType(key, map, hash);
__ Branch(not_internalized, ge, hash, Operand(FIRST_NONSTRING_TYPE));
__ Branch(not_unique, hi, hash, Operand(LAST_UNIQUE_NAME_TYPE));
STATIC_ASSERT(LAST_UNIQUE_NAME_TYPE == FIRST_NONSTRING_TYPE);
__ Branch(&unique, eq, hash, Operand(LAST_UNIQUE_NAME_TYPE));
// Is the string an array index, with cached numeric value?
__ lw(hash, FieldMemOperand(key, String::kHashFieldOffset));
__ And(at, hash, Operand(String::kContainsCachedArrayIndexMask));
__ lw(hash, FieldMemOperand(key, Name::kHashFieldOffset));
__ And(at, hash, Operand(Name::kContainsCachedArrayIndexMask));
__ Branch(index_string, eq, at, Operand(zero_reg));
// Is the string internalized?
......@@ -328,7 +331,9 @@ static void GenerateKeyStringCheck(MacroAssembler* masm,
__ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
STATIC_ASSERT(kInternalizedTag != 0);
__ And(at, hash, Operand(kIsInternalizedMask));
__ Branch(not_internalized, eq, at, Operand(zero_reg));
__ Branch(not_unique, eq, at, Operand(zero_reg));
__ bind(&unique);
}
......@@ -426,7 +431,7 @@ void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) {
// Get the receiver of the function from the stack into a1.
__ lw(a1, MemOperand(sp, argc * kPointerSize));
GenerateStringDictionaryReceiverCheck(masm, a1, a0, a3, t0, &miss);
GenerateNameDictionaryReceiverCheck(masm, a1, a0, a3, t0, &miss);
// a0: elements
// Search the dictionary - put result in register a1.
......@@ -529,11 +534,11 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ lw(a1, MemOperand(sp, argc * kPointerSize));
Label do_call, slow_call, slow_load, slow_reload_receiver;
Label check_number_dictionary, check_string, lookup_monomorphic_cache;
Label index_smi, index_string;
Label check_number_dictionary, check_name, lookup_monomorphic_cache;
Label index_smi, index_name;
// Check that the key is a smi.
__ JumpIfNotSmi(a2, &check_string);
__ JumpIfNotSmi(a2, &check_name);
__ bind(&index_smi);
// Now the key is known to be a smi. This place is also jumped to from below
// where a numeric string is converted to a smi.
......@@ -580,10 +585,10 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ mov(a1, v0);
__ jmp(&do_call);
__ bind(&check_string);
GenerateKeyStringCheck(masm, a2, a0, a3, &index_string, &slow_call);
__ bind(&check_name);
GenerateKeyNameCheck(masm, a2, a0, a3, &index_name, &slow_call);
// The key is known to be internalized.
// The key is known to be a unique name.
// 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,14 +615,14 @@ 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 an internalized string,
// - the key is neither smi nor a unique name,
// - 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.
__ IncrementCounter(counters->keyed_call_generic_slow(), 1, a0, a3);
GenerateMiss(masm, argc);
__ bind(&index_string);
__ bind(&index_name);
__ IndexFromHash(a3, a2);
// Now jump to the place where smi keys are handled.
__ jmp(&index_smi);
......@@ -630,10 +635,10 @@ void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) {
// -- ra : return address
// -----------------------------------
// Check if the name is a string.
// Check if the name is really a name.
Label miss;
__ JumpIfSmi(a2, &miss);
__ IsObjectJSStringType(a2, a0, &miss);
__ IsObjectNameType(a2, a0, &miss);
CallICBase::GenerateNormal(masm, argc);
__ bind(&miss);
......@@ -672,7 +677,7 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
// -----------------------------------
Label miss;
GenerateStringDictionaryReceiverCheck(masm, a0, a1, a3, t0, &miss);
GenerateNameDictionaryReceiverCheck(masm, a0, a1, a3, t0, &miss);
// a1: elements
GenerateDictionaryLoad(masm, &miss, a1, a2, v0, a3, t0);
......@@ -920,7 +925,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// -- a0 : key
// -- a1 : receiver
// -----------------------------------
Label slow, check_string, index_smi, index_string, property_array_property;
Label slow, check_name, index_smi, index_name, property_array_property;
Label probe_dictionary, check_number_dictionary;
Register key = a0;
......@@ -929,7 +934,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
Isolate* isolate = masm->isolate();
// Check that the key is a smi.
__ JumpIfNotSmi(key, &check_string);
__ JumpIfNotSmi(key, &check_name);
__ bind(&index_smi);
// Now the key is known to be a smi. This place is also jumped to from below
// where a numeric string is converted to a smi.
......@@ -968,8 +973,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
a3);
GenerateRuntimeGetProperty(masm);
__ bind(&check_string);
GenerateKeyStringCheck(masm, key, a2, a3, &index_string, &slow);
__ bind(&check_name);
GenerateKeyNameCheck(masm, key, a2, a3, &index_name, &slow);
GenerateKeyedLoadReceiverCheck(
masm, receiver, a2, a3, Map::kHasIndexedInterceptor, &slow);
......@@ -983,16 +988,16 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ Branch(&probe_dictionary, eq, t0, Operand(at));
// Load the map of the receiver, compute the keyed lookup cache hash
// based on 32 bits of the map pointer and the string hash.
// based on 32 bits of the map pointer and the name hash.
__ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset));
__ sra(a3, a2, KeyedLookupCache::kMapHashShift);
__ lw(t0, FieldMemOperand(a0, String::kHashFieldOffset));
__ sra(at, t0, String::kHashShift);
__ lw(t0, FieldMemOperand(a0, Name::kHashFieldOffset));
__ sra(at, t0, Name::kHashShift);
__ xor_(a3, a3, at);
int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask;
__ And(a3, a3, Operand(mask));
// Load the key (consisting of map and internalized string) from the cache and
// Load the key (consisting of map and unique name) from the cache and
// check for match.
Label load_in_object_property;
static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket;
......@@ -1085,7 +1090,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
a3);
__ Ret();
__ bind(&index_string);
__ bind(&index_name);
__ IndexFromHash(a3, key);
// Now jump to the place where smi keys are handled.
__ Branch(&index_smi);
......@@ -1545,7 +1550,7 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
// -----------------------------------
Label miss;
GenerateStringDictionaryReceiverCheck(masm, a1, a3, t0, t1, &miss);
GenerateNameDictionaryReceiverCheck(masm, a1, a3, t0, t1, &miss);
GenerateDictionaryStore(masm, &miss, a3, a2, a0, t0, t1);
Counters* counters = masm->isolate()->counters();
......
......@@ -3866,6 +3866,15 @@ void MacroAssembler::IsObjectJSStringType(Register object,
}
void MacroAssembler::IsObjectNameType(Register object,
Register scratch,
Label* fail) {
lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
Branch(fail, hi, scratch, Operand(LAST_NAME_TYPE));
}
// ---------------------------------------------------------------------------
// Support functions.
......@@ -4897,6 +4906,20 @@ void MacroAssembler::AssertString(Register object) {
}
void MacroAssembler::AssertName(Register object) {
if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0);
And(t0, object, Operand(kSmiTagMask));
Check(ne, "Operand is a smi and not a name", t0, Operand(zero_reg));
push(object);
lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
pop(object);
Check(le, "Operand is not a name", object, Operand(LAST_NAME_TYPE));
}
}
void MacroAssembler::AssertRootValue(Register src,
Heap::RootListIndex root_value_index,
const char* message) {
......
......@@ -900,6 +900,10 @@ class MacroAssembler: public Assembler {
Register scratch,
Label* fail);
void IsObjectNameType(Register object,
Register scratch,
Label* fail);
#ifdef ENABLE_DEBUGGER_SUPPORT
// -------------------------------------------------------------------------
// Debugger Support.
......@@ -1357,6 +1361,9 @@ class MacroAssembler: public Assembler {
// Abort execution if argument is not a string, enabled via --debug-code.
void AssertString(Register object);
// Abort execution if argument is not a name, enabled via --debug-code.
void AssertName(Register object);
// Abort execution if argument is not the root value with the given index,
// enabled via --debug-code.
void AssertRootValue(Register src,
......
......@@ -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 internalized and receiver must be a heap object.
// Name must be unique and receiver must be a heap object.
static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
Label* miss_label,
Register receiver,
Handle<String> name,
Handle<Name> name,
Register scratch0,
Register scratch1) {
ASSERT(name->IsInternalizedString());
ASSERT(name->IsUniqueName());
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
__ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
......@@ -162,7 +162,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
__ lw(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
StringDictionaryLookupStub::GenerateNegativeLookup(masm,
NameDictionaryLookupStub::GenerateNegativeLookup(masm,
miss_label,
&done,
receiver,
......@@ -217,7 +217,7 @@ void StubCache::GenerateProbe(MacroAssembler* masm,
__ JumpIfSmi(receiver, &miss);
// Get the map of the receiver and compute the hash.
__ lw(scratch, FieldMemOperand(name, String::kHashFieldOffset));
__ lw(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
__ lw(at, FieldMemOperand(receiver, HeapObject::kMapOffset));
__ Addu(scratch, scratch, at);
uint32_t mask = kPrimaryTableSize - 1;
......@@ -430,7 +430,7 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
Handle<JSObject> object,
int index,
Handle<Map> transition,
Handle<String> name,
Handle<Name> name,
Register receiver_reg,
Register name_reg,
Register scratch1,
......@@ -766,7 +766,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
void Compile(MacroAssembler* masm,
Handle<JSObject> object,
Handle<JSObject> holder,
Handle<String> name,
Handle<Name> name,
LookupResult* lookup,
Register receiver,
Register scratch1,
......@@ -797,7 +797,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
Register scratch3,
Handle<JSObject> interceptor_holder,
LookupResult* lookup,
Handle<String> name,
Handle<Name> name,
const CallOptimization& optimization,
Label* miss_label) {
ASSERT(optimization.is_constant_call());
......@@ -952,7 +952,7 @@ class CallInterceptorCompiler BASE_EMBEDDED {
// property.
static void GenerateCheckPropertyCell(MacroAssembler* masm,
Handle<GlobalObject> global,
Handle<String> name,
Handle<Name> name,
Register scratch,
Label* miss) {
Handle<JSGlobalPropertyCell> cell =
......@@ -971,7 +971,7 @@ static void GenerateCheckPropertyCell(MacroAssembler* masm,
static void GenerateCheckPropertyCells(MacroAssembler* masm,
Handle<JSObject> object,
Handle<JSObject> holder,
Handle<String> name,
Handle<Name> name,
Register scratch,
Label* miss) {
Handle<JSObject> current = object;
......@@ -1079,7 +1079,7 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
Register holder_reg,
Register scratch1,
Register scratch2,
Handle<String> name,
Handle<Name> name,
int save_at_depth,
Label* miss,
PrototypeCheckType check) {
......@@ -1111,11 +1111,12 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
if (!current->HasFastProperties() &&
!current->IsJSGlobalObject() &&
!current->IsJSGlobalProxy()) {
if (!name->IsInternalizedString()) {
name = factory()->InternalizeString(name);
if (!name->IsUniqueName()) {
ASSERT(name->IsString());
name = factory()->InternalizeString(Handle<String>::cast(name));
}
ASSERT(current->property_dictionary()->FindEntry(*name) ==
StringDictionary::kNotFound);
NameDictionary::kNotFound);
GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
scratch1, scratch2);
......@@ -1198,7 +1199,7 @@ Register BaseLoadStubCompiler::CallbackHandlerFrontend(
Handle<JSObject> object,
Register object_reg,
Handle<JSObject> holder,
Handle<String> name,
Handle<Name> name,
Label* success,
Handle<ExecutableAccessorInfo> callback) {
Label miss;
......@@ -1216,7 +1217,7 @@ Register BaseLoadStubCompiler::CallbackHandlerFrontend(
// Probe the dictionary.
Label probe_done;
StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&miss,
&probe_done,
dictionary,
......@@ -1228,8 +1229,8 @@ Register BaseLoadStubCompiler::CallbackHandlerFrontend(
// If probing finds an entry in the dictionary, scratch3 contains the
// pointer into the dictionary. Check that the value is the callback.
Register pointer = scratch3();
const int kElementsStartOffset = StringDictionary::kHeaderSize +
StringDictionary::kElementsStartIndex * kPointerSize;
const int kElementsStartOffset = NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ lw(scratch2(), FieldMemOperand(pointer, kValueOffset));
__ Branch(&miss, ne, scratch2(), Operand(callback));
......@@ -1243,7 +1244,7 @@ Register BaseLoadStubCompiler::CallbackHandlerFrontend(
void BaseLoadStubCompiler::NonexistentHandlerFrontend(
Handle<JSObject> object,
Handle<JSObject> last,
Handle<String> name,
Handle<Name> name,
Label* success,
Handle<GlobalObject> global) {
Label miss;
......@@ -1305,7 +1306,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback(
__ sw(name(), MemOperand(sp, 0 * kPointerSize));
__ mov(a2, scratch2()); // Saved in case scratch2 == a1.
__ mov(a1, sp); // a1 (first argument - see note below) = Handle<String>
__ mov(a1, sp); // a1 (first argument - see note below) = Handle<Name>
// NOTE: the O32 abi requires a0 to hold a special pointer when returning a
// struct from the function (which is currently the case). This means we pass
......@@ -1338,7 +1339,7 @@ void BaseLoadStubCompiler::GenerateLoadInterceptor(
Handle<JSObject> object,
Handle<JSObject> interceptor_holder,
LookupResult* lookup,
Handle<String> name) {
Handle<Name> name) {
ASSERT(interceptor_holder->HasNamedInterceptor());
ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
......@@ -1419,7 +1420,7 @@ void BaseLoadStubCompiler::GenerateLoadInterceptor(
}
void CallStubCompiler::GenerateNameCheck(Handle<String> name, Label* miss) {
void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) {
if (kind_ == Code::KEYED_CALL_IC) {
__ Branch(miss, ne, a2, Operand(name));
}
......@@ -1428,7 +1429,7 @@ void CallStubCompiler::GenerateNameCheck(Handle<String> name, Label* miss) {
void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object,
Handle<JSObject> holder,
Handle<String> name,
Handle<Name> name,
Label* miss) {
ASSERT(holder->IsGlobalObject());
......@@ -1485,7 +1486,7 @@ void CallStubCompiler::GenerateMissBranch() {
Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
Handle<JSObject> holder,
PropertyIndex index,
Handle<String> name) {
Handle<Name> name) {
// ----------- S t a t e -------------
// -- a2 : name
// -- ra : return address
......@@ -2395,7 +2396,7 @@ Handle<Code> CallStubCompiler::CompileFastApiCall(
void CallStubCompiler::CompileHandlerFrontend(Handle<Object> object,
Handle<JSObject> holder,
Handle<String> name,
Handle<Name> name,
CheckType check,
Label* success) {
// ----------- S t a t e -------------
......@@ -2506,13 +2507,13 @@ void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) {
Handle<Code> CallStubCompiler::CompileCallConstant(
Handle<Object> object,
Handle<JSObject> holder,
Handle<String> name,
Handle<Name> name,
CheckType check,
Handle<JSFunction> function) {
if (HasCustomCallGenerator(function)) {
Handle<Code> code = CompileCustomCall(object, holder,
Handle<JSGlobalPropertyCell>::null(),
function, name);
function, Handle<String>::cast(name));
// A null handle means bail out to the regular compiler code below.
if (!code.is_null()) return code;
}
......@@ -2530,7 +2531,7 @@ Handle<Code> CallStubCompiler::CompileCallConstant(
Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object,
Handle<JSObject> holder,
Handle<String> name) {
Handle<Name> name) {
// ----------- S t a t e -------------
// -- a2 : name
// -- ra : return address
......@@ -2573,14 +2574,15 @@ Handle<Code> CallStubCompiler::CompileCallGlobal(
Handle<GlobalObject> holder,
Handle<JSGlobalPropertyCell> cell,
Handle<JSFunction> function,
Handle<String> name) {
Handle<Name> name) {
// ----------- S t a t e -------------
// -- a2 : name
// -- ra : return address
// -----------------------------------
if (HasCustomCallGenerator(function)) {
Handle<Code> code = CompileCustomCall(object, holder, cell, function, name);
Handle<Code> code = CompileCustomCall(
object, holder, cell, function, Handle<String>::cast(name));
// A null handle means bail out to the regular compiler code below.
if (!code.is_null()) return code;
}
......@@ -2630,7 +2632,7 @@ Handle<Code> CallStubCompiler::CompileCallGlobal(
Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object,
int index,
Handle<Map> transition,
Handle<String> name) {
Handle<Name> name) {
// ----------- S t a t e -------------
// -- a0 : value
// -- a1 : receiver
......@@ -2660,7 +2662,7 @@ Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object,
Handle<Code> StoreStubCompiler::CompileStoreCallback(
Handle<String> name,
Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
Handle<ExecutableAccessorInfo> callback) {
......@@ -2746,7 +2748,7 @@ void StoreStubCompiler::GenerateStoreViaSetter(
Handle<Code> StoreStubCompiler::CompileStoreViaSetter(
Handle<String> name,
Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
Handle<JSFunction> setter) {
......@@ -2775,7 +2777,7 @@ Handle<Code> StoreStubCompiler::CompileStoreViaSetter(
Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
Handle<JSObject> receiver,
Handle<String> name) {
Handle<Name> name) {
// ----------- S t a t e -------------
// -- a0 : value
// -- a1 : receiver
......@@ -2821,7 +2823,7 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
Handle<Code> StoreStubCompiler::CompileStoreGlobal(
Handle<GlobalObject> object,
Handle<JSGlobalPropertyCell> cell,
Handle<String> name) {
Handle<Name> name) {
// ----------- S t a t e -------------
// -- a0 : value
// -- a1 : receiver
......@@ -2866,7 +2868,7 @@ Handle<Code> StoreStubCompiler::CompileStoreGlobal(
Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
Handle<JSObject> object,
Handle<JSObject> last,
Handle<String> name,
Handle<Name> name,
Handle<GlobalObject> global) {
Label success;
......@@ -2896,7 +2898,7 @@ Register* KeyedLoadStubCompiler::registers() {
}
void KeyedLoadStubCompiler::GenerateNameCheck(Handle<String> name,
void KeyedLoadStubCompiler::GenerateNameCheck(Handle<Name> name,
Register name_reg,
Label* miss) {
__ Branch(miss, ne, name_reg, Operand(name));
......@@ -2944,7 +2946,7 @@ Handle<Code> LoadStubCompiler::CompileLoadGlobal(
Handle<JSObject> object,
Handle<GlobalObject> global,
Handle<JSGlobalPropertyCell> cell,
Handle<String> name,
Handle<Name> name,
bool is_dont_delete) {
Label success, miss;
......@@ -3007,7 +3009,7 @@ Handle<Code> KeyedLoadStubCompiler::CompileLoadElement(
Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC(
MapHandleList* receiver_maps,
CodeHandleList* handlers,
Handle<String> name,
Handle<Name> name,
Code::StubType type,
IcCheckType check) {
Label miss;
......@@ -3039,7 +3041,7 @@ Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC(
Handle<Code> KeyedStoreStubCompiler::CompileStoreField(Handle<JSObject> object,
int index,
Handle<Map> transition,
Handle<String> name) {
Handle<Name> name) {
// ----------- S t a t e -------------
// -- a0 : value
// -- a1 : key
......
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