| Index: src/ic/s390/stub-cache-s390.cc
|
| diff --git a/src/ic/ppc/stub-cache-ppc.cc b/src/ic/s390/stub-cache-s390.cc
|
| similarity index 80%
|
| copy from src/ic/ppc/stub-cache-ppc.cc
|
| copy to src/ic/s390/stub-cache-s390.cc
|
| index 6030b2cbc8c48fc3c633e1f6ca24c1c239129eb2..054b946df849233cdbaa7487aa5c9408503c11c6 100644
|
| --- a/src/ic/ppc/stub-cache-ppc.cc
|
| +++ b/src/ic/s390/stub-cache-s390.cc
|
| @@ -1,12 +1,12 @@
|
| -// Copyright 2014 the V8 project authors. All rights reserved.
|
| +// Copyright 2015 the V8 project authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#if V8_TARGET_ARCH_PPC
|
| +#if V8_TARGET_ARCH_S390
|
|
|
| +#include "src/ic/stub-cache.h"
|
| #include "src/codegen.h"
|
| #include "src/ic/ic.h"
|
| -#include "src/ic/stub-cache.h"
|
| #include "src/interface-descriptors.h"
|
|
|
| namespace v8 {
|
| @@ -14,7 +14,6 @@ namespace internal {
|
|
|
| #define __ ACCESS_MASM(masm)
|
|
|
| -
|
| static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
|
| Code::Kind ic_kind, Code::Flags flags,
|
| StubCache::Table table, Register receiver, Register name,
|
| @@ -43,30 +42,28 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
|
| scratch = no_reg;
|
|
|
| // Multiply by 3 because there are 3 fields per entry (name, code, map).
|
| - __ ShiftLeftImm(offset_scratch, offset, Operand(1));
|
| - __ add(offset_scratch, offset, offset_scratch);
|
| + __ ShiftLeftP(offset_scratch, offset, Operand(1));
|
| + __ AddP(offset_scratch, offset, offset_scratch);
|
|
|
| // Calculate the base address of the entry.
|
| __ mov(base_addr, Operand(key_offset));
|
| -#if V8_TARGET_ARCH_PPC64
|
| +#if V8_TARGET_ARCH_S390X
|
| DCHECK(kPointerSizeLog2 > StubCache::kCacheIndexShift);
|
| - __ ShiftLeftImm(offset_scratch, offset_scratch,
|
| - Operand(kPointerSizeLog2 - StubCache::kCacheIndexShift));
|
| + __ ShiftLeftP(offset_scratch, offset_scratch,
|
| + Operand(kPointerSizeLog2 - StubCache::kCacheIndexShift));
|
| #else
|
| DCHECK(kPointerSizeLog2 == StubCache::kCacheIndexShift);
|
| #endif
|
| - __ add(base_addr, base_addr, offset_scratch);
|
| + __ AddP(base_addr, base_addr, offset_scratch);
|
|
|
| // Check that the key in the entry matches the name.
|
| - __ LoadP(ip, MemOperand(base_addr, 0));
|
| - __ cmp(name, ip);
|
| - __ bne(&miss);
|
| + __ CmpP(name, MemOperand(base_addr, 0));
|
| + __ bne(&miss, Label::kNear);
|
|
|
| // Check the map matches.
|
| __ LoadP(ip, MemOperand(base_addr, map_off_addr - key_off_addr));
|
| - __ LoadP(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| - __ cmp(ip, scratch2);
|
| - __ bne(&miss);
|
| + __ CmpP(ip, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| + __ bne(&miss, Label::kNear);
|
|
|
| // Get the code entry from the cache.
|
| Register code = scratch2;
|
| @@ -76,33 +73,30 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
|
| // Check that the flags match what we're looking for.
|
| Register flags_reg = base_addr;
|
| base_addr = no_reg;
|
| - __ lwz(flags_reg, FieldMemOperand(code, Code::kFlagsOffset));
|
| + __ LoadlW(flags_reg, FieldMemOperand(code, Code::kFlagsOffset));
|
|
|
| DCHECK(!r0.is(flags_reg));
|
| - __ li(r0, Operand(Code::kFlagsNotUsedInLookup));
|
| - __ andc(flags_reg, flags_reg, r0);
|
| - __ mov(r0, Operand(flags));
|
| - __ cmpl(flags_reg, r0);
|
| - __ bne(&miss);
|
| + __ AndP(flags_reg, flags_reg, Operand(~Code::kFlagsNotUsedInLookup));
|
| + __ CmpLogicalP(flags_reg, Operand(flags));
|
| + __ bne(&miss, Label::kNear);
|
|
|
| #ifdef DEBUG
|
| if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) {
|
| - __ b(&miss);
|
| + __ b(&miss, Label::kNear);
|
| } else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) {
|
| - __ b(&miss);
|
| + __ b(&miss, Label::kNear);
|
| }
|
| #endif
|
|
|
| // Jump to the first instruction in the code stub.
|
| - __ addi(r0, code, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| - __ mtctr(r0);
|
| - __ bctr();
|
| + // TODO(joransiu): Combine into indirect branch
|
| + __ la(code, MemOperand(code, Code::kHeaderSize - kHeapObjectTag));
|
| + __ b(code);
|
|
|
| // Miss: fall through.
|
| __ bind(&miss);
|
| }
|
|
|
| -
|
| void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
|
| Code::Flags flags, Register receiver,
|
| Register name, Register scratch, Register extra,
|
| @@ -110,7 +104,7 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
|
| Isolate* isolate = masm->isolate();
|
| Label miss;
|
|
|
| -#if V8_TARGET_ARCH_PPC64
|
| +#if V8_TARGET_ARCH_S390X
|
| // Make sure that code is valid. The multiplying code relies on the
|
| // entry size being 24.
|
| DCHECK(sizeof(Entry) == 24);
|
| @@ -157,12 +151,12 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
|
| __ JumpIfSmi(receiver, &miss);
|
|
|
| // Get the map of the receiver and compute the hash.
|
| - __ lwz(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
|
| + __ LoadlW(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
|
| __ LoadP(ip, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| - __ add(scratch, scratch, ip);
|
| - __ xori(scratch, scratch, Operand(flags));
|
| + __ AddP(scratch, scratch, ip);
|
| + __ XorP(scratch, scratch, Operand(flags));
|
| // The mask omits the last two bits because they are not part of the hash.
|
| - __ andi(scratch, scratch,
|
| + __ AndP(scratch, scratch,
|
| Operand((kPrimaryTableSize - 1) << kCacheIndexShift));
|
|
|
| // Probe the primary table.
|
| @@ -170,9 +164,9 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
|
| extra, extra2, extra3);
|
|
|
| // Primary miss: Compute hash for secondary probe.
|
| - __ sub(scratch, scratch, name);
|
| - __ addi(scratch, scratch, Operand(flags));
|
| - __ andi(scratch, scratch,
|
| + __ SubP(scratch, scratch, name);
|
| + __ AddP(scratch, scratch, Operand(flags));
|
| + __ AndP(scratch, scratch,
|
| Operand((kSecondaryTableSize - 1) << kCacheIndexShift));
|
|
|
| // Probe the secondary table.
|
| @@ -186,9 +180,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
|
| extra3);
|
| }
|
|
|
| -
|
| #undef __
|
| } // namespace internal
|
| } // namespace v8
|
|
|
| -#endif // V8_TARGET_ARCH_PPC
|
| +#endif // V8_TARGET_ARCH_S390
|
|
|