Commit dee0b9d6 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

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
parent 9f2f6f40
...@@ -81,7 +81,7 @@ CodeGenerator::CodeGenerator(MacroAssembler* masm) ...@@ -81,7 +81,7 @@ CodeGenerator::CodeGenerator(MacroAssembler* masm)
// a1: called JS function // a1: called JS function
// cp: callee's context // cp: callee's context
void CodeGenerator::Generate(CompilationInfo* info, Mode mode) { void CodeGenerator::Generate(CompilationInfo* infomode) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
...@@ -467,6 +467,34 @@ void CEntryStub::Generate(MacroAssembler* masm) { ...@@ -467,6 +467,34 @@ void CEntryStub::Generate(MacroAssembler* masm) {
void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
UNIMPLEMENTED_MIPS(); 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. // Load a result.
__ li(v0, Operand(0x1234)); __ li(v0, Operand(0x1234));
__ jr(ra); __ jr(ra);
......
...@@ -157,11 +157,10 @@ class CodeGenerator: public AstVisitor { ...@@ -157,11 +157,10 @@ class CodeGenerator: public AstVisitor {
private: private:
// Construction/Destruction. // Construction/Destruction.
explicit CodeGenerator(MacroAssembler* masm); explicit CodeGenerator(MacroAssembler* masm);
virtual ~CodeGenerator() { delete masm_; }
// Accessors. // Accessors.
inline bool is_eval(); inline bool is_eval();
Scope* scope() const { return scope_; } inline Scope* scope();
// Generating deferred code. // Generating deferred code.
void ProcessDeferred(); void ProcessDeferred();
...@@ -184,7 +183,7 @@ class CodeGenerator: public AstVisitor { ...@@ -184,7 +183,7 @@ class CodeGenerator: public AstVisitor {
#undef DEF_VISIT #undef DEF_VISIT
// Main code generation function // Main code generation function
void Generate(CompilationInfo* info, Mode mode); void Generate(CompilationInfo* info);
struct InlineRuntimeLUT { struct InlineRuntimeLUT {
void (CodeGenerator::*method)(ZoneList<Expression*>*); void (CodeGenerator::*method)(ZoneList<Expression*>*);
...@@ -307,6 +306,7 @@ class CodeGenerator: public AstVisitor { ...@@ -307,6 +306,7 @@ class CodeGenerator: public AstVisitor {
friend class JumpTarget; friend class JumpTarget;
friend class Reference; friend class Reference;
friend class FastCodeGenerator; friend class FastCodeGenerator;
friend class FullCodeGenerator;
friend class FullCodeGenSyntaxChecker; friend class FullCodeGenSyntaxChecker;
DISALLOW_COPY_AND_ASSIGN(CodeGenerator); DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
......
...@@ -35,6 +35,14 @@ namespace internal { ...@@ -35,6 +35,14 @@ namespace internal {
#define __ ACCESS_MASM(masm_) #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) { void FastCodeGenerator::Generate(CompilationInfo* info) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
...@@ -45,7 +53,17 @@ void FastCodeGenerator::EmitThisPropertyStore(Handle<String> name) { ...@@ -45,7 +53,17 @@ void FastCodeGenerator::EmitThisPropertyStore(Handle<String> name) {
} }
void FastCodeGenerator::EmitGlobalVariableLoad(Handle<String> name) { void FastCodeGenerator::EmitGlobalVariableLoad(Handle<Object> name) {
UNIMPLEMENTED_MIPS();
}
void FastCodeGenerator::EmitThisPropertyLoad(Handle<String> name) {
UNIMPLEMENTED_MIPS();
}
void FastCodeGenerator::EmitBitOr() {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
......
...@@ -146,6 +146,11 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { ...@@ -146,6 +146,11 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
} }
void FullCodeGenerator::VisitAssignment(Assignment* expr) {
UNIMPLEMENTED_MIPS();
}
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
......
...@@ -90,11 +90,6 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { ...@@ -90,11 +90,6 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
void LoadIC::GenerateMiss(MacroAssembler* masm) { void LoadIC::GenerateMiss(MacroAssembler* masm) {
Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
}
void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
...@@ -120,11 +115,6 @@ Object* KeyedLoadIC_Miss(Arguments args); ...@@ -120,11 +115,6 @@ Object* KeyedLoadIC_Miss(Arguments args);
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
}
void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
...@@ -145,24 +135,23 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, ...@@ -145,24 +135,23 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
} }
void KeyedStoreIC::Generate(MacroAssembler* masm, void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
const ExternalReference& f) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm,
ExternalArrayType array_type) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
ExternalArrayType array_type) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
...@@ -172,12 +161,12 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { ...@@ -172,12 +161,12 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
} }
void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { void StoreIC::GenerateMiss(MacroAssembler* masm) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
void StoreIC::GenerateMiss(MacroAssembler* masm) { void StoreIC::GenerateArrayLength(MacroAssembler* masm) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "codegen-inl.h" #include "codegen-inl.h"
#include "jump-target-inl.h" #include "jump-target-inl.h"
#include "register-allocator-inl.h" #include "register-allocator-inl.h"
#include "virtual-frame-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -422,7 +422,7 @@ void MacroAssembler::MultiPopReversed(RegList regs) { ...@@ -422,7 +422,7 @@ void MacroAssembler::MultiPopReversed(RegList regs) {
// Trashes the at register if no scratch register is provided. // Trashes the at register if no scratch register is provided.
void MacroAssembler::Branch(Condition cond, int16_t offset, Register rs, void MacroAssembler::Branch(Condition cond, int16_t offset, Register rs,
const Operand& rt, Register scratch) { const Operand& rt, Register scratch) {
Register r2; Register r2 = no_reg;
if (rt.is_reg()) { if (rt.is_reg()) {
// We don't want any other register but scratch clobbered. // We don't want any other register but scratch clobbered.
ASSERT(!scratch.is(rs) && !scratch.is(rt.rm_)); ASSERT(!scratch.is(rs) && !scratch.is(rt.rm_));
...@@ -489,7 +489,7 @@ void MacroAssembler::Branch(Condition cond, int16_t offset, Register rs, ...@@ -489,7 +489,7 @@ void MacroAssembler::Branch(Condition cond, int16_t offset, Register rs,
void MacroAssembler::Branch(Condition cond, Label* L, Register rs, void MacroAssembler::Branch(Condition cond, Label* L, Register rs,
const Operand& rt, Register scratch) { const Operand& rt, Register scratch) {
Register r2; Register r2 = no_reg;
if (rt.is_reg()) { if (rt.is_reg()) {
r2 = rt.rm_; r2 = rt.rm_;
} else if (cond != cc_always) { } else if (cond != cc_always) {
...@@ -559,7 +559,7 @@ void MacroAssembler::Branch(Condition cond, Label* L, Register rs, ...@@ -559,7 +559,7 @@ void MacroAssembler::Branch(Condition cond, Label* L, Register rs,
// cases, so we keep slt and add an intermediate third instruction. // cases, so we keep slt and add an intermediate third instruction.
void MacroAssembler::BranchAndLink(Condition cond, int16_t offset, Register rs, void MacroAssembler::BranchAndLink(Condition cond, int16_t offset, Register rs,
const Operand& rt, Register scratch) { const Operand& rt, Register scratch) {
Register r2; Register r2 = no_reg;
if (rt.is_reg()) { if (rt.is_reg()) {
r2 = rt.rm_; r2 = rt.rm_;
} else if (cond != cc_always) { } else if (cond != cc_always) {
...@@ -634,7 +634,7 @@ void MacroAssembler::BranchAndLink(Condition cond, int16_t offset, Register rs, ...@@ -634,7 +634,7 @@ void MacroAssembler::BranchAndLink(Condition cond, int16_t offset, Register rs,
void MacroAssembler::BranchAndLink(Condition cond, Label* L, Register rs, void MacroAssembler::BranchAndLink(Condition cond, Label* L, Register rs,
const Operand& rt, Register scratch) { const Operand& rt, Register scratch) {
Register r2; Register r2 = no_reg;
if (rt.is_reg()) { if (rt.is_reg()) {
r2 = rt.rm_; r2 = rt.rm_;
} else if (cond != cc_always) { } else if (cond != cc_always) {
...@@ -787,6 +787,16 @@ void MacroAssembler::Call(Label* target) { ...@@ -787,6 +787,16 @@ void MacroAssembler::Call(Label* target) {
} }
#ifdef ENABLE_DEBUGGER_SUPPORT
// ---------------------------------------------------------------------------
// Debugger Support
void MacroAssembler::DebugBreak() {
UNIMPLEMENTED_MIPS();
}
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Exception handling // Exception handling
......
...@@ -115,11 +115,7 @@ class MacroAssembler: public Assembler { ...@@ -115,11 +115,7 @@ class MacroAssembler: public Assembler {
Heap::RootListIndex index, Heap::RootListIndex index,
Condition cond, Register src1, const Operand& src2); Condition cond, Register src1, const Operand& src2);
// Sets the remembered set bit for [address+offset], where address is the // Sets the remembered set bit for [address+offset].
// 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.
void RecordWrite(Register object, Register offset, Register scratch); void RecordWrite(Register object, Register offset, Register scratch);
...@@ -182,19 +178,8 @@ class MacroAssembler: public Assembler { ...@@ -182,19 +178,8 @@ class MacroAssembler: public Assembler {
// Push multiple registers on the stack. // Push multiple registers on the stack.
// With MultiPush, lower registers are pushed first on the stack. // Registers are saved in numerical order, with higher numbered registers
// For example if you push t0, t1, s0, and ra you get: // saved in higher memory addresses
// | |
// |-----------------------|
// | t0 | +
// |-----------------------| |
// | t1 | |
// |-----------------------| |
// | s0 | v
// |-----------------------| -
// | ra |
// |-----------------------|
// | |
void MultiPush(RegList regs); void MultiPush(RegList regs);
void MultiPushReversed(RegList regs); void MultiPushReversed(RegList regs);
void Push(Register src) { void Push(Register src) {
...@@ -224,6 +209,20 @@ class MacroAssembler: public Assembler { ...@@ -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 // Exception handling
......
...@@ -72,20 +72,6 @@ void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm, ...@@ -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, void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
Register receiver, Register receiver,
Register scratch1, Register scratch1,
...@@ -99,7 +85,6 @@ void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, ...@@ -99,7 +85,6 @@ void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
// After executing generated code, the receiver_reg and name_reg // After executing generated code, the receiver_reg and name_reg
// may be clobbered. // may be clobbered.
void StubCompiler::GenerateStoreField(MacroAssembler* masm, void StubCompiler::GenerateStoreField(MacroAssembler* masm,
Builtins::Name storage_extend,
JSObject* object, JSObject* object,
int index, int index,
Map* transition, Map* transition,
...@@ -120,18 +105,6 @@ void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { ...@@ -120,18 +105,6 @@ void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) {
#define __ ACCESS_MASM(masm()) #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, void StubCompiler::GenerateLoadField(JSObject* object,
JSObject* holder, JSObject* holder,
Register receiver, Register receiver,
...@@ -192,7 +165,7 @@ Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { ...@@ -192,7 +165,7 @@ Object* StubCompiler::CompileLazyCompile(Code::Flags flags) {
} }
Object* CallStubCompiler::CompileCallField(Object* object, Object* CallStubCompiler::CompileCallField(JSObject* object,
JSObject* holder, JSObject* holder,
int index, int index,
String* name) { String* name) {
...@@ -211,7 +184,7 @@ Object* CallStubCompiler::CompileCallConstant(Object* object, ...@@ -211,7 +184,7 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
} }
Object* CallStubCompiler::CompileCallInterceptor(Object* object, Object* CallStubCompiler::CompileCallInterceptor(JSObject* object,
JSObject* holder, JSObject* holder,
String* name) { String* name) {
UNIMPLEMENTED_MIPS(); UNIMPLEMENTED_MIPS();
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "codegen-inl.h" #include "codegen-inl.h"
#include "register-allocator-inl.h" #include "register-allocator-inl.h"
#include "scopes.h" #include "scopes.h"
#include "virtual-frame-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -41,17 +42,6 @@ namespace internal { ...@@ -41,17 +42,6 @@ namespace internal {
#define __ ACCESS_MASM(masm()) #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) { void VirtualFrame::SyncElementBelowStackPointer(int index) {
UNREACHABLE(); UNREACHABLE();
} }
......
...@@ -61,16 +61,17 @@ class VirtualFrame : public ZoneObject { ...@@ -61,16 +61,17 @@ class VirtualFrame : public ZoneObject {
static const int kIllegalIndex = -1; static const int kIllegalIndex = -1;
// Construct an initial virtual frame on entry to a JS function. // 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. // 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(); } CodeGenerator* cgen() { return CodeGeneratorScope::Current(); }
MacroAssembler* masm() { return cgen()->masm(); } MacroAssembler* masm() { return cgen()->masm(); }
// Create a duplicate of an existing valid frame element. // 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. // The number of elements on the virtual frame.
int element_count() { return elements_.length(); } int element_count() { return elements_.length(); }
...@@ -366,9 +367,9 @@ class VirtualFrame : public ZoneObject { ...@@ -366,9 +367,9 @@ class VirtualFrame : public ZoneObject {
void EmitMultiPushReversed(RegList regs); // higher first void EmitMultiPushReversed(RegList regs); // higher first
// Push an element on the virtual frame. // Push an element on the virtual frame.
void Push(Register reg); inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown);
void Push(Handle<Object> value); inline void Push(Handle<Object> value);
void Push(Smi* value) { Push(Handle<Object>(value)); } inline void Push(Smi* value);
// Pushing a result invalidates it (its contents become owned by the frame). // Pushing a result invalidates it (its contents become owned by the frame).
void Push(Result* result) { void Push(Result* result) {
...@@ -384,7 +385,7 @@ class VirtualFrame : public ZoneObject { ...@@ -384,7 +385,7 @@ class VirtualFrame : public ZoneObject {
// Nip removes zero or more elements from immediately below the top // Nip removes zero or more elements from immediately below the top
// of the frame, leaving the previous top-of-frame value on top of // 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). // 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 // This pushes 4 arguments slots on the stack and saves asked 'a' registers
// 'a' registers are arguments register a0 to a3. // 'a' registers are arguments register a0 to a3.
...@@ -483,7 +484,7 @@ class VirtualFrame : public ZoneObject { ...@@ -483,7 +484,7 @@ class VirtualFrame : public ZoneObject {
// Push a copy of a frame slot (typically a local or parameter) on top of // Push a copy of a frame slot (typically a local or parameter) on top of
// the frame. // 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 // Push a the value of a frame slot (typically a local or parameter) on
// top of the frame and invalidate the slot. // top of the frame and invalidate the slot.
...@@ -534,7 +535,7 @@ class VirtualFrame : public ZoneObject { ...@@ -534,7 +535,7 @@ class VirtualFrame : public ZoneObject {
// (via PrepareForCall). // (via PrepareForCall).
void RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); void RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode);
bool Equals(VirtualFrame* other); inline bool Equals(VirtualFrame* other);
// Classes that need raw access to the elements_ array. // Classes that need raw access to the elements_ array.
friend class DeferredCode; friend class DeferredCode;
......
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