From dee0b9d636f5f3eef51f63315c4faa10c8d4dd80 Mon Sep 17 00:00:00 2001 From: "sgjesse@chromium.org" Date: Mon, 1 Mar 2010 08:32:54 +0000 Subject: [PATCH] Update MIPS port to support recent changes This lands http://codereview.chromium.org/660244. Patch by Alexandre Rames from Sigma Designs Inc. Review URL: http://codereview.chromium.org/661268 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3982 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/codegen-mips.cc | 30 ++++++++++++++++++++++++++- src/mips/codegen-mips.h | 6 +++--- src/mips/fast-codegen-mips.cc | 20 +++++++++++++++++- src/mips/full-codegen-mips.cc | 5 +++++ src/mips/ic-mips.cc | 25 +++++++---------------- src/mips/jump-target-mips.cc | 1 + src/mips/macro-assembler-mips.cc | 18 ++++++++++++---- src/mips/macro-assembler-mips.h | 35 ++++++++++++++++---------------- src/mips/stub-cache-mips.cc | 31 ++-------------------------- src/mips/virtual-frame-mips.cc | 12 +---------- src/mips/virtual-frame-mips.h | 19 +++++++++-------- 11 files changed, 108 insertions(+), 94 deletions(-) diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc index 01b5816f8..2d5cc9790 100644 --- a/src/mips/codegen-mips.cc +++ b/src/mips/codegen-mips.cc @@ -81,7 +81,7 @@ CodeGenerator::CodeGenerator(MacroAssembler* masm) // a1: called JS function // cp: callee's context -void CodeGenerator::Generate(CompilationInfo* info, Mode mode) { +void CodeGenerator::Generate(CompilationInfo* infomode) { UNIMPLEMENTED_MIPS(); } @@ -467,6 +467,34 @@ void CEntryStub::Generate(MacroAssembler* masm) { void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { UNIMPLEMENTED_MIPS(); + + // Save callee saved registers on the stack. + __ MultiPush(kCalleeSaved | ra.bit()); + + // ********** State ********** + // + // * Registers: + // a0: entry_address + // a1: function + // a2: reveiver_pointer + // a3: argc + // + // * Stack: + // --------------------------- + // args + // --------------------------- + // 4 args slots + // --------------------------- + // callee saved registers + ra + // --------------------------- + // + // *************************** + + __ break_(0x1234); + + // Restore callee saved registers from the stack. + __ MultiPop(kCalleeSaved | ra.bit()); + // Load a result. __ li(v0, Operand(0x1234)); __ jr(ra); diff --git a/src/mips/codegen-mips.h b/src/mips/codegen-mips.h index 1d7c27452..25ce47a0c 100644 --- a/src/mips/codegen-mips.h +++ b/src/mips/codegen-mips.h @@ -157,11 +157,10 @@ class CodeGenerator: public AstVisitor { private: // Construction/Destruction. explicit CodeGenerator(MacroAssembler* masm); - virtual ~CodeGenerator() { delete masm_; } // Accessors. inline bool is_eval(); - Scope* scope() const { return scope_; } + inline Scope* scope(); // Generating deferred code. void ProcessDeferred(); @@ -184,7 +183,7 @@ class CodeGenerator: public AstVisitor { #undef DEF_VISIT // Main code generation function - void Generate(CompilationInfo* info, Mode mode); + void Generate(CompilationInfo* info); struct InlineRuntimeLUT { void (CodeGenerator::*method)(ZoneList*); @@ -307,6 +306,7 @@ class CodeGenerator: public AstVisitor { friend class JumpTarget; friend class Reference; friend class FastCodeGenerator; + friend class FullCodeGenerator; friend class FullCodeGenSyntaxChecker; DISALLOW_COPY_AND_ASSIGN(CodeGenerator); diff --git a/src/mips/fast-codegen-mips.cc b/src/mips/fast-codegen-mips.cc index c47f6326d..48a0ce6c7 100644 --- a/src/mips/fast-codegen-mips.cc +++ b/src/mips/fast-codegen-mips.cc @@ -35,6 +35,14 @@ namespace internal { #define __ ACCESS_MASM(masm_) +Register FastCodeGenerator::accumulator0() { return no_reg; } +Register FastCodeGenerator::accumulator1() { return no_reg; } +Register FastCodeGenerator::scratch0() { return no_reg; } +Register FastCodeGenerator::scratch1() { return no_reg; } +Register FastCodeGenerator::receiver_reg() { return no_reg; } +Register FastCodeGenerator::context_reg() { return no_reg; } + + void FastCodeGenerator::Generate(CompilationInfo* info) { UNIMPLEMENTED_MIPS(); } @@ -45,7 +53,17 @@ void FastCodeGenerator::EmitThisPropertyStore(Handle name) { } -void FastCodeGenerator::EmitGlobalVariableLoad(Handle name) { +void FastCodeGenerator::EmitGlobalVariableLoad(Handle name) { + UNIMPLEMENTED_MIPS(); +} + + +void FastCodeGenerator::EmitThisPropertyLoad(Handle name) { + UNIMPLEMENTED_MIPS(); +} + + +void FastCodeGenerator::EmitBitOr() { UNIMPLEMENTED_MIPS(); } diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 920329eea..3c29e99be 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -146,6 +146,11 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { } +void FullCodeGenerator::VisitAssignment(Assignment* expr) { + UNIMPLEMENTED_MIPS(); +} + + void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { UNIMPLEMENTED_MIPS(); } diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc index 5598cdfcd..605616626 100644 --- a/src/mips/ic-mips.cc +++ b/src/mips/ic-mips.cc @@ -90,11 +90,6 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { void LoadIC::GenerateMiss(MacroAssembler* masm) { - Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); -} - - -void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { UNIMPLEMENTED_MIPS(); } @@ -120,11 +115,6 @@ Object* KeyedLoadIC_Miss(Arguments args); void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { - Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); -} - - -void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { UNIMPLEMENTED_MIPS(); } @@ -145,24 +135,23 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, } -void KeyedStoreIC::Generate(MacroAssembler* masm, - const ExternalReference& f) { +void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { UNIMPLEMENTED_MIPS(); } -void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { +void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, + ExternalArrayType array_type) { UNIMPLEMENTED_MIPS(); } -void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, - ExternalArrayType array_type) { +void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { UNIMPLEMENTED_MIPS(); } -void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { +void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { UNIMPLEMENTED_MIPS(); } @@ -172,12 +161,12 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { } -void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { +void StoreIC::GenerateMiss(MacroAssembler* masm) { UNIMPLEMENTED_MIPS(); } -void StoreIC::GenerateMiss(MacroAssembler* masm) { +void StoreIC::GenerateArrayLength(MacroAssembler* masm) { UNIMPLEMENTED_MIPS(); } diff --git a/src/mips/jump-target-mips.cc b/src/mips/jump-target-mips.cc index 3301d1991..e8398a849 100644 --- a/src/mips/jump-target-mips.cc +++ b/src/mips/jump-target-mips.cc @@ -31,6 +31,7 @@ #include "codegen-inl.h" #include "jump-target-inl.h" #include "register-allocator-inl.h" +#include "virtual-frame-inl.h" namespace v8 { namespace internal { diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index f50a09047..e49858b1d 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -422,7 +422,7 @@ void MacroAssembler::MultiPopReversed(RegList regs) { // Trashes the at register if no scratch register is provided. void MacroAssembler::Branch(Condition cond, int16_t offset, Register rs, const Operand& rt, Register scratch) { - Register r2; + Register r2 = no_reg; if (rt.is_reg()) { // We don't want any other register but scratch clobbered. ASSERT(!scratch.is(rs) && !scratch.is(rt.rm_)); @@ -489,7 +489,7 @@ void MacroAssembler::Branch(Condition cond, int16_t offset, Register rs, void MacroAssembler::Branch(Condition cond, Label* L, Register rs, const Operand& rt, Register scratch) { - Register r2; + Register r2 = no_reg; if (rt.is_reg()) { r2 = rt.rm_; } else if (cond != cc_always) { @@ -559,7 +559,7 @@ void MacroAssembler::Branch(Condition cond, Label* L, Register rs, // cases, so we keep slt and add an intermediate third instruction. void MacroAssembler::BranchAndLink(Condition cond, int16_t offset, Register rs, const Operand& rt, Register scratch) { - Register r2; + Register r2 = no_reg; if (rt.is_reg()) { r2 = rt.rm_; } else if (cond != cc_always) { @@ -634,7 +634,7 @@ void MacroAssembler::BranchAndLink(Condition cond, int16_t offset, Register rs, void MacroAssembler::BranchAndLink(Condition cond, Label* L, Register rs, const Operand& rt, Register scratch) { - Register r2; + Register r2 = no_reg; if (rt.is_reg()) { r2 = rt.rm_; } else if (cond != cc_always) { @@ -787,6 +787,16 @@ void MacroAssembler::Call(Label* target) { } +#ifdef ENABLE_DEBUGGER_SUPPORT + // --------------------------------------------------------------------------- + // Debugger Support + + void MacroAssembler::DebugBreak() { + UNIMPLEMENTED_MIPS(); + } +#endif + + // --------------------------------------------------------------------------- // Exception handling diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h index 99ab88705..b34488cef 100644 --- a/src/mips/macro-assembler-mips.h +++ b/src/mips/macro-assembler-mips.h @@ -115,11 +115,7 @@ class MacroAssembler: public Assembler { Heap::RootListIndex index, Condition cond, Register src1, const Operand& src2); - // Sets the remembered set bit for [address+offset], where address is the - // address of the heap object 'object'. The address must be in the first 8K - // of an allocated page. The 'scratch' register is used in the - // implementation and all 3 registers are clobbered by the operation, as - // well as the ip register. + // Sets the remembered set bit for [address+offset]. void RecordWrite(Register object, Register offset, Register scratch); @@ -182,19 +178,8 @@ class MacroAssembler: public Assembler { // Push multiple registers on the stack. - // With MultiPush, lower registers are pushed first on the stack. - // For example if you push t0, t1, s0, and ra you get: - // | | - // |-----------------------| - // | t0 | + - // |-----------------------| | - // | t1 | | - // |-----------------------| | - // | s0 | v - // |-----------------------| - - // | ra | - // |-----------------------| - // | | + // Registers are saved in numerical order, with higher numbered registers + // saved in higher memory addresses void MultiPush(RegList regs); void MultiPushReversed(RegList regs); void Push(Register src) { @@ -224,6 +209,20 @@ class MacroAssembler: public Assembler { } +#ifdef ENABLE_DEBUGGER_SUPPORT + // --------------------------------------------------------------------------- + // Debugger Support + + void SaveRegistersToMemory(RegList regs); + void RestoreRegistersFromMemory(RegList regs); + void CopyRegistersFromMemoryToStack(Register base, RegList regs); + void CopyRegistersFromStackToMemory(Register base, + Register scratch, + RegList regs); + void DebugBreak(); +#endif + + // --------------------------------------------------------------------------- // Exception handling diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc index a87a49b73..669fdaa3c 100644 --- a/src/mips/stub-cache-mips.cc +++ b/src/mips/stub-cache-mips.cc @@ -72,20 +72,6 @@ void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm, } -// Generate code to load the length from a string object and return the length. -// If the receiver object is not a string or a wrapped string object the -// execution continues at the miss label. The register containing the -// receiver is potentially clobbered. -void StubCompiler::GenerateLoadStringLength2(MacroAssembler* masm, - Register receiver, - Register scratch1, - Register scratch2, - Label* miss) { - UNIMPLEMENTED_MIPS(); - __ break_(0x249); -} - - void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, Register receiver, Register scratch1, @@ -99,7 +85,6 @@ void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, // After executing generated code, the receiver_reg and name_reg // may be clobbered. void StubCompiler::GenerateStoreField(MacroAssembler* masm, - Builtins::Name storage_extend, JSObject* object, int index, Map* transition, @@ -120,18 +105,6 @@ void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { #define __ ACCESS_MASM(masm()) -Register StubCompiler::CheckPrototypes(JSObject* object, - Register object_reg, - JSObject* holder, - Register holder_reg, - Register scratch, - String* name, - Label* miss) { - UNIMPLEMENTED_MIPS(); - return at; // UNIMPLEMENTED RETURN -} - - void StubCompiler::GenerateLoadField(JSObject* object, JSObject* holder, Register receiver, @@ -192,7 +165,7 @@ Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { } -Object* CallStubCompiler::CompileCallField(Object* object, +Object* CallStubCompiler::CompileCallField(JSObject* object, JSObject* holder, int index, String* name) { @@ -211,7 +184,7 @@ Object* CallStubCompiler::CompileCallConstant(Object* object, } -Object* CallStubCompiler::CompileCallInterceptor(Object* object, +Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, JSObject* holder, String* name) { UNIMPLEMENTED_MIPS(); diff --git a/src/mips/virtual-frame-mips.cc b/src/mips/virtual-frame-mips.cc index fad7ec4c7..e89882f2a 100644 --- a/src/mips/virtual-frame-mips.cc +++ b/src/mips/virtual-frame-mips.cc @@ -32,6 +32,7 @@ #include "codegen-inl.h" #include "register-allocator-inl.h" #include "scopes.h" +#include "virtual-frame-inl.h" namespace v8 { namespace internal { @@ -41,17 +42,6 @@ namespace internal { #define __ ACCESS_MASM(masm()) - -// On entry to a function, the virtual frame already contains the -// receiver and the parameters. All initial frame elements are in -// memory. -VirtualFrame::VirtualFrame() - : elements_(parameter_count() + local_count() + kPreallocatedElements), - stack_pointer_(parameter_count()) { // 0-based index of TOS. - UNIMPLEMENTED_MIPS(); -} - - void VirtualFrame::SyncElementBelowStackPointer(int index) { UNREACHABLE(); } diff --git a/src/mips/virtual-frame-mips.h b/src/mips/virtual-frame-mips.h index 79f973fb6..e5bc93fa2 100644 --- a/src/mips/virtual-frame-mips.h +++ b/src/mips/virtual-frame-mips.h @@ -61,16 +61,17 @@ class VirtualFrame : public ZoneObject { static const int kIllegalIndex = -1; // Construct an initial virtual frame on entry to a JS function. - VirtualFrame(); + inline VirtualFrame(); // Construct a virtual frame as a clone of an existing one. - explicit VirtualFrame(VirtualFrame* original); + explicit inline VirtualFrame(VirtualFrame* original); CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } MacroAssembler* masm() { return cgen()->masm(); } // Create a duplicate of an existing valid frame element. - FrameElement CopyElementAt(int index); + FrameElement CopyElementAt(int index, + NumberInfo::Type info = NumberInfo::kUnknown); // The number of elements on the virtual frame. int element_count() { return elements_.length(); } @@ -366,9 +367,9 @@ class VirtualFrame : public ZoneObject { void EmitMultiPushReversed(RegList regs); // higher first // Push an element on the virtual frame. - void Push(Register reg); - void Push(Handle value); - void Push(Smi* value) { Push(Handle(value)); } + inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); + inline void Push(Handle value); + inline void Push(Smi* value); // Pushing a result invalidates it (its contents become owned by the frame). void Push(Result* result) { @@ -384,7 +385,7 @@ class VirtualFrame : public ZoneObject { // Nip removes zero or more elements from immediately below the top // of the frame, leaving the previous top-of-frame value on top of // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). - void Nip(int num_dropped); + inline void Nip(int num_dropped); // This pushes 4 arguments slots on the stack and saves asked 'a' registers // 'a' registers are arguments register a0 to a3. @@ -483,7 +484,7 @@ class VirtualFrame : public ZoneObject { // Push a copy of a frame slot (typically a local or parameter) on top of // the frame. - void PushFrameSlotAt(int index); + inline void PushFrameSlotAt(int index); // Push a the value of a frame slot (typically a local or parameter) on // top of the frame and invalidate the slot. @@ -534,7 +535,7 @@ class VirtualFrame : public ZoneObject { // (via PrepareForCall). void RawCallCodeObject(Handle code, RelocInfo::Mode rmode); - bool Equals(VirtualFrame* other); + inline bool Equals(VirtualFrame* other); // Classes that need raw access to the elements_ array. friend class DeferredCode; -- 2.34.1