Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: src/ic/ppc/ic-ppc.cc

Issue 2424433002: [ic] Delete old KeyedLoadIC code (Closed)
Patch Set: fix failing test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/ic/s390/ic-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ppc/ic-ppc.cc
diff --git a/src/ic/ppc/ic-ppc.cc b/src/ic/ppc/ic-ppc.cc
index 6dd788146bac3087e18529908b18fb445c947136..359a6a42dd10adcfdb5085ed143d4506b10efe0c 100644
--- a/src/ic/ppc/ic-ppc.cc
+++ b/src/ic/ppc/ic-ppc.cc
@@ -19,18 +19,6 @@ namespace internal {
#define __ ACCESS_MASM(masm)
-
-static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm, Register type,
- Label* global_object) {
- // Register usage:
- // type: holds the receiver instance type on entry.
- __ cmpi(type, Operand(JS_GLOBAL_OBJECT_TYPE));
- __ beq(global_object);
- __ cmpi(type, Operand(JS_GLOBAL_PROXY_TYPE));
- __ beq(global_object);
-}
-
-
// Helper function used from LoadIC GenerateNormal.
//
// elements: Property dictionary. It is not clobbered if a jump to the miss
@@ -131,143 +119,6 @@ static void GenerateDictionaryStore(MacroAssembler* masm, Label* miss,
kDontSaveFPRegs);
}
-
-// Checks the receiver for special cases (value type, slow case bits).
-// Falls through for regular JS object.
-static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm,
- Register receiver, Register map,
- Register scratch,
- int interceptor_bit, Label* slow) {
- // Check that the object isn't a smi.
- __ JumpIfSmi(receiver, slow);
- // Get the map of the receiver.
- __ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
- // Check bit field.
- __ lbz(scratch, FieldMemOperand(map, Map::kBitFieldOffset));
- DCHECK(((1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit)) < 0x8000);
- __ andi(r0, scratch,
- Operand((1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit)));
- __ bne(slow, cr0);
- // Check that the object is some kind of JS object EXCEPT JS Value type.
- // In the case that the object is a value-wrapper object,
- // we enter the runtime system to make sure that indexing into string
- // objects work as intended.
- DCHECK(JS_OBJECT_TYPE > JS_VALUE_TYPE);
- __ lbz(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset));
- __ cmpi(scratch, Operand(JS_OBJECT_TYPE));
- __ blt(slow);
-}
-
-
-// Loads an indexed element from a fast case array.
-static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver,
- Register key, Register elements,
- Register scratch1, Register scratch2,
- Register result, Label* slow) {
- // Register use:
- //
- // receiver - holds the receiver on entry.
- // Unchanged unless 'result' is the same register.
- //
- // key - holds the smi key on entry.
- // Unchanged unless 'result' is the same register.
- //
- // result - holds the result on exit if the load succeeded.
- // Allowed to be the the same as 'receiver' or 'key'.
- // Unchanged on bailout so 'receiver' and 'key' can be safely
- // used by further computation.
- //
- // Scratch registers:
- //
- // elements - holds the elements of the receiver and its protoypes.
- //
- // scratch1 - used to hold elements length, bit fields, base addresses.
- //
- // scratch2 - used to hold maps, prototypes, and the loaded value.
- Label check_prototypes, check_next_prototype;
- Label done, in_bounds, absent;
-
- __ LoadP(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
- __ AssertFastElements(elements);
-
- // Check that the key (index) is within bounds.
- __ LoadP(scratch1, FieldMemOperand(elements, FixedArray::kLengthOffset));
- __ cmpl(key, scratch1);
- __ blt(&in_bounds);
- // Out-of-bounds. Check the prototype chain to see if we can just return
- // 'undefined'.
- __ cmpi(key, Operand::Zero());
- __ blt(slow); // Negative keys can't take the fast OOB path.
- __ bind(&check_prototypes);
- __ LoadP(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset));
- __ bind(&check_next_prototype);
- __ LoadP(scratch2, FieldMemOperand(scratch2, Map::kPrototypeOffset));
- // scratch2: current prototype
- __ CompareRoot(scratch2, Heap::kNullValueRootIndex);
- __ beq(&absent);
- __ LoadP(elements, FieldMemOperand(scratch2, JSObject::kElementsOffset));
- __ LoadP(scratch2, FieldMemOperand(scratch2, HeapObject::kMapOffset));
- // elements: elements of current prototype
- // scratch2: map of current prototype
- __ CompareInstanceType(scratch2, scratch1, JS_OBJECT_TYPE);
- __ blt(slow);
- __ lbz(scratch1, FieldMemOperand(scratch2, Map::kBitFieldOffset));
- __ andi(r0, scratch1, Operand((1 << Map::kIsAccessCheckNeeded) |
- (1 << Map::kHasIndexedInterceptor)));
- __ bne(slow, cr0);
- __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex);
- __ bne(slow);
- __ jmp(&check_next_prototype);
-
- __ bind(&absent);
- __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
- __ jmp(&done);
-
- __ bind(&in_bounds);
- // Fast case: Do the load.
- __ addi(scratch1, elements,
- Operand(FixedArray::kHeaderSize - kHeapObjectTag));
- // The key is a smi.
- __ SmiToPtrArrayOffset(scratch2, key);
- __ LoadPX(scratch2, MemOperand(scratch2, scratch1));
- __ CompareRoot(scratch2, Heap::kTheHoleValueRootIndex);
- // In case the loaded value is the_hole we have to check the prototype chain.
- __ beq(&check_prototypes);
- __ mr(result, scratch2);
- __ bind(&done);
-}
-
-
-// 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_unique) {
- // The key is not a smi.
- Label unique;
- // Is it a name?
- __ CompareObjectType(key, map, hash, LAST_UNIQUE_NAME_TYPE);
- __ bgt(not_unique);
- STATIC_ASSERT(LAST_UNIQUE_NAME_TYPE == FIRST_NONSTRING_TYPE);
- __ beq(&unique);
-
- // Is the string an array index, with cached numeric value?
- __ lwz(hash, FieldMemOperand(key, Name::kHashFieldOffset));
- __ mov(r8, Operand(Name::kContainsCachedArrayIndexMask));
- __ and_(r0, hash, r8, SetRC);
- __ beq(index_string, cr0);
-
- // Is the string internalized? We know it's a string, so a single
- // bit test is enough.
- // map: key map
- __ lbz(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
- STATIC_ASSERT(kInternalizedTag == 0);
- __ andi(r0, hash, Operand(kIsNotInternalizedMask));
- __ bne(not_unique, cr0);
-
- __ bind(&unique);
-}
-
void LoadIC::GenerateNormal(MacroAssembler* masm) {
Register dictionary = r3;
DCHECK(!dictionary.is(LoadDescriptor::ReceiverRegister()));
@@ -349,107 +200,6 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kKeyedGetProperty);
}
-void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) {
- // The return address is in lr.
- Label slow, check_name, index_smi, index_name, property_array_property;
- Label probe_dictionary, check_number_dictionary;
-
- Register key = LoadDescriptor::NameRegister();
- Register receiver = LoadDescriptor::ReceiverRegister();
- DCHECK(key.is(r5));
- DCHECK(receiver.is(r4));
-
- Isolate* isolate = masm->isolate();
-
- // Check that the key is a smi.
- __ 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.
-
- GenerateKeyedLoadReceiverCheck(masm, receiver, r3, r6,
- Map::kHasIndexedInterceptor, &slow);
-
- // Check the receiver's map to see if it has fast elements.
- __ CheckFastElements(r3, r6, &check_number_dictionary);
-
- GenerateFastArrayLoad(masm, receiver, key, r3, r6, r7, r3, &slow);
- __ IncrementCounter(isolate->counters()->ic_keyed_load_generic_smi(), 1, r7,
- r6);
- __ Ret();
-
- __ bind(&check_number_dictionary);
- __ LoadP(r7, FieldMemOperand(receiver, JSObject::kElementsOffset));
- __ LoadP(r6, FieldMemOperand(r7, JSObject::kMapOffset));
-
- // Check whether the elements is a number dictionary.
- // r6: elements map
- // r7: elements
- __ LoadRoot(ip, Heap::kHashTableMapRootIndex);
- __ cmp(r6, ip);
- __ bne(&slow);
- __ SmiUntag(r3, key);
- __ LoadFromNumberDictionary(&slow, r7, key, r3, r3, r6, r8);
- __ Ret();
-
- // Slow case, key and receiver still in r3 and r4.
- __ bind(&slow);
- __ IncrementCounter(isolate->counters()->ic_keyed_load_generic_slow(), 1, r7,
- r6);
- GenerateRuntimeGetProperty(masm);
-
- __ bind(&check_name);
- GenerateKeyNameCheck(masm, key, r3, r6, &index_name, &slow);
-
- GenerateKeyedLoadReceiverCheck(masm, receiver, r3, r6,
- Map::kHasNamedInterceptor, &slow);
-
- // If the receiver is a fast-case object, check the stub cache. Otherwise
- // probe the dictionary.
- __ LoadP(r6, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
- __ LoadP(r7, FieldMemOperand(r6, HeapObject::kMapOffset));
- __ LoadRoot(ip, Heap::kHashTableMapRootIndex);
- __ cmp(r7, ip);
- __ beq(&probe_dictionary);
-
-
- // The handlers in the stub cache expect a vector and slot. Since we won't
- // change the IC from any downstream misses, a dummy vector can be used.
- Register vector = LoadWithVectorDescriptor::VectorRegister();
- Register slot = LoadWithVectorDescriptor::SlotRegister();
- DCHECK(!AreAliased(vector, slot, r7, r8, r9, r10));
- Handle<TypeFeedbackVector> dummy_vector =
- TypeFeedbackVector::DummyVector(masm->isolate());
- int slot_index = dummy_vector->GetIndex(
- FeedbackVectorSlot(TypeFeedbackVector::kDummyKeyedLoadICSlot));
- __ LoadRoot(vector, Heap::kDummyVectorRootIndex);
- __ LoadSmiLiteral(slot, Smi::FromInt(slot_index));
-
- masm->isolate()->load_stub_cache()->GenerateProbe(masm, receiver, key, r7, r8,
- r9, r10);
- // Cache miss.
- GenerateMiss(masm);
-
- // Do a quick inline probe of the receiver's dictionary, if it
- // exists.
- __ bind(&probe_dictionary);
- // r6: elements
- __ LoadP(r3, FieldMemOperand(receiver, HeapObject::kMapOffset));
- __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset));
- GenerateGlobalInstanceTypeCheck(masm, r3, &slow);
- // Load the property to r3.
- GenerateDictionaryLoad(masm, &slow, r6, key, r3, r8, r7);
- __ IncrementCounter(isolate->counters()->ic_keyed_load_generic_symbol(), 1,
- r7, r6);
- __ Ret();
-
- __ bind(&index_name);
- __ IndexFromHash(r6, key);
- // Now jump to the place where smi keys are handled.
- __ b(&index_smi);
-}
-
-
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreWithVectorDescriptor::ValueRegister(),
StoreWithVectorDescriptor::SlotRegister(),
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/ic/s390/ic-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698