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

Unified Diff: src/ppc/code-stubs-ppc.h

Issue 422063005: Contribution of PowerPC port. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
Index: src/ppc/code-stubs-ppc.h
diff --git a/src/arm/code-stubs-arm.h b/src/ppc/code-stubs-ppc.h
similarity index 76%
copy from src/arm/code-stubs-arm.h
copy to src/ppc/code-stubs-ppc.h
index f7456ef8a77ea589ea6e8ce138161f2ca31d2b8d..d8a4a7aaa62dd1891da98e283fe8c179546c01a5 100644
--- a/src/arm/code-stubs-arm.h
+++ b/src/ppc/code-stubs-ppc.h
@@ -1,9 +1,12 @@
// Copyright 2012 the V8 project authors. All rights reserved.
+//
+// Copyright IBM Corp. 2012, 2013. All rights reserved.
+//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef V8_ARM_CODE_STUBS_ARM_H_
-#define V8_ARM_CODE_STUBS_ARM_H_
+#ifndef V8_PPC_CODE_STUBS_PPC_H_
+#define V8_PPC_CODE_STUBS_PPC_H_
#include "src/ic-inl.h"
@@ -49,14 +52,17 @@ class StringHelper : public AllStatic {
// Generate string hash.
static void GenerateHashInit(MacroAssembler* masm,
Register hash,
- Register character);
+ Register character,
+ Register scratch);
static void GenerateHashAddCharacter(MacroAssembler* masm,
Register hash,
- Register character);
+ Register character,
+ Register scratch);
static void GenerateHashGetHash(MacroAssembler* masm,
- Register hash);
+ Register hash,
+ Register scratch);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
@@ -86,8 +92,7 @@ class StringCompareStub: public PlatformCodeStub {
Register right,
Register scratch1,
Register scratch2,
- Register scratch3,
- Register scratch4);
+ Register scratch3);
// Compares two flat ASCII strings for equality and returns result
// in r0.
@@ -95,8 +100,7 @@ class StringCompareStub: public PlatformCodeStub {
Register left,
Register right,
Register scratch1,
- Register scratch2,
- Register scratch3);
+ Register scratch2);
private:
virtual Major MajorKey() const { return StringCompare; }
@@ -108,49 +112,10 @@ class StringCompareStub: public PlatformCodeStub {
Register right,
Register length,
Register scratch1,
- Register scratch2,
Label* chars_not_equal);
};
-// This stub can convert a signed int32 to a heap number (double). It does
-// not work for int32s that are in Smi range! No GC occurs during this stub
-// so you don't have to set up the frame.
-class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
- public:
- WriteInt32ToHeapNumberStub(Isolate* isolate,
- Register the_int,
- Register the_heap_number,
- Register scratch)
- : PlatformCodeStub(isolate),
- the_int_(the_int),
- the_heap_number_(the_heap_number),
- scratch_(scratch) { }
-
- static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
-
- private:
- Register the_int_;
- Register the_heap_number_;
- Register scratch_;
-
- // Minor key encoding in 16 bits.
- class IntRegisterBits: public BitField<int, 0, 4> {};
- class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
- class ScratchRegisterBits: public BitField<int, 8, 4> {};
-
- Major MajorKey() const { return WriteInt32ToHeapNumber; }
- int MinorKey() const {
- // Encode the parameters in a unique 16 bit value.
- return IntRegisterBits::encode(the_int_.code())
- | HeapNumberRegisterBits::encode(the_heap_number_.code())
- | ScratchRegisterBits::encode(scratch_.code());
- }
-
- void Generate(MacroAssembler* masm);
-};
-
-
class RecordWriteStub: public PlatformCodeStub {
public:
RecordWriteStub(Isolate* isolate,
@@ -179,31 +144,32 @@ class RecordWriteStub: public PlatformCodeStub {
virtual bool SometimesSetsUpAFrame() { return false; }
static void PatchBranchIntoNop(MacroAssembler* masm, int pos) {
- masm->instr_at_put(pos, (masm->instr_at(pos) & ~B27) | (B24 | B20));
- ASSERT(Assembler::IsTstImmediate(masm->instr_at(pos)));
+ masm->instr_at_put(pos, (masm->instr_at(pos) & ~kBOfieldMask) | BT);
+ // roohack ASSERT(Assembler::IsTstImmediate(masm->instr_at(pos)));
}
static void PatchNopIntoBranch(MacroAssembler* masm, int pos) {
- masm->instr_at_put(pos, (masm->instr_at(pos) & ~(B24 | B20)) | B27);
- ASSERT(Assembler::IsBranch(masm->instr_at(pos)));
+ masm->instr_at_put(pos, (masm->instr_at(pos) & ~kBOfieldMask) | BF);
+ // roohack ASSERT(Assembler::IsBranch(masm->instr_at(pos)));
}
static Mode GetMode(Code* stub) {
- Instr first_instruction = Assembler::instr_at(stub->instruction_start());
- Instr second_instruction = Assembler::instr_at(stub->instruction_start() +
+ Instr first_instruction = Assembler::instr_at(stub->instruction_start() +
Assembler::kInstrSize);
+ Instr second_instruction = Assembler::instr_at(stub->instruction_start() +
+ (Assembler::kInstrSize*2));
- if (Assembler::IsBranch(first_instruction)) {
+ if (BF == (first_instruction & kBOfieldMask)) {
return INCREMENTAL;
}
- ASSERT(Assembler::IsTstImmediate(first_instruction));
+ // roohack ASSERT(Assembler::IsTstImmediate(first_instruction));
- if (Assembler::IsBranch(second_instruction)) {
+ if (BF == (second_instruction & kBOfieldMask)) {
return INCREMENTAL_COMPACTION;
}
- ASSERT(Assembler::IsTstImmediate(second_instruction));
+ // roohack ASSERT(Assembler::IsTstImmediate(second_instruction));
return STORE_BUFFER_ONLY;
}
@@ -216,21 +182,22 @@ class RecordWriteStub: public PlatformCodeStub {
case STORE_BUFFER_ONLY:
ASSERT(GetMode(stub) == INCREMENTAL ||
GetMode(stub) == INCREMENTAL_COMPACTION);
- PatchBranchIntoNop(&masm, 0);
+
PatchBranchIntoNop(&masm, Assembler::kInstrSize);
+ PatchBranchIntoNop(&masm, Assembler::kInstrSize*2);
break;
case INCREMENTAL:
ASSERT(GetMode(stub) == STORE_BUFFER_ONLY);
- PatchNopIntoBranch(&masm, 0);
+ PatchNopIntoBranch(&masm, Assembler::kInstrSize);
break;
case INCREMENTAL_COMPACTION:
ASSERT(GetMode(stub) == STORE_BUFFER_ONLY);
- PatchNopIntoBranch(&masm, Assembler::kInstrSize);
+ PatchNopIntoBranch(&masm, Assembler::kInstrSize*2);
break;
}
ASSERT(GetMode(stub) == mode);
- CpuFeatures::FlushICache(stub->instruction_start(),
- 2 * Assembler::kInstrSize);
+ CpuFeatures::FlushICache(stub->instruction_start()+Assembler::kInstrSize,
+ 2 * Assembler::kInstrSize);
}
private:
@@ -264,18 +231,24 @@ class RecordWriteStub: public PlatformCodeStub {
// saved registers that were not already preserved. The scratch registers
// will be restored by other means so we don't bother pushing them here.
void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) {
- masm->stm(db_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit());
+ masm->mflr(r0);
+ masm->push(r0);
+ masm->MultiPush(kJSCallerSaved & ~scratch1_.bit());
if (mode == kSaveFPRegs) {
- masm->SaveFPRegs(sp, scratch0_);
+ // Save all volatile FP registers except d0.
+ masm->SaveFPRegs(sp, 1, DoubleRegister::kNumVolatileRegisters - 1);
}
}
inline void RestoreCallerSaveRegisters(MacroAssembler*masm,
SaveFPRegsMode mode) {
if (mode == kSaveFPRegs) {
- masm->RestoreFPRegs(sp, scratch0_);
+ // Restore all volatile FP registers except d0.
+ masm->RestoreFPRegs(sp, 1, DoubleRegister::kNumVolatileRegisters - 1);
}
- masm->ldm(ia_w, sp, (kCallerSaved | lr.bit()) & ~scratch1_.bit());
+ masm->MultiPop(kJSCallerSaved & ~scratch1_.bit());
+ masm->pop(r0);
+ masm->mtlr(r0);
}
inline Register object() { return object_; }
@@ -319,11 +292,11 @@ class RecordWriteStub: public PlatformCodeStub {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
- class ObjectBits: public BitField<int, 0, 4> {};
- class ValueBits: public BitField<int, 4, 4> {};
- class AddressBits: public BitField<int, 8, 4> {};
- class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {};
- class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {};
+ class ObjectBits: public BitField<int, 0, 5> {};
+ class ValueBits: public BitField<int, 5, 5> {};
+ class AddressBits: public BitField<int, 10, 5> {};
+ class RememberedSetActionBits: public BitField<RememberedSetAction, 15, 1> {};
+ class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 16, 1> {};
Register object_;
Register value_;
@@ -402,20 +375,6 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
LookupMode mode_;
};
-
-class PlatformInterfaceDescriptor {
- public:
- explicit PlatformInterfaceDescriptor(
- TargetAddressStorageMode storage_mode)
- : storage_mode_(storage_mode) { }
-
- TargetAddressStorageMode storage_mode() { return storage_mode_; }
-
- private:
- TargetAddressStorageMode storage_mode_;
-};
-
-
} } // namespace v8::internal
-#endif // V8_ARM_CODE_STUBS_ARM_H_
+#endif // V8_PPC_CODE_STUBS_PPC_H_
« src/objects-inl.h ('K') | « src/ppc/builtins-ppc.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698