Commit 7510bffc authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Submit code-stubs-mips.cc.

This submission required a small change to arch-indep code to declare
code stub DirectCEntry for mips.

It also required updates to macro-assembler-mips.cc & h and frames-mips.h.

I also made a small change to frames-mips.cc.

This code submission will compile, but is not testable until the majority
of the mips port is in place. It has been tested externally.

BUG=
TEST=

Review URL: http://codereview.chromium.org//7034008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7893 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 230a56ab
...@@ -84,7 +84,8 @@ namespace internal { ...@@ -84,7 +84,8 @@ namespace internal {
// List of code stubs only used on MIPS platforms. // List of code stubs only used on MIPS platforms.
#ifdef V8_TARGET_ARCH_MIPS #ifdef V8_TARGET_ARCH_MIPS
#define CODE_STUB_LIST_MIPS(V) \ #define CODE_STUB_LIST_MIPS(V) \
V(RegExpCEntry) V(RegExpCEntry) \
V(DirectCEntry)
#else #else
#define CODE_STUB_LIST_MIPS(V) #define CODE_STUB_LIST_MIPS(V)
#endif #endif
......
This diff is collapsed.
...@@ -456,6 +456,27 @@ class RegExpCEntryStub: public CodeStub { ...@@ -456,6 +456,27 @@ class RegExpCEntryStub: public CodeStub {
const char* GetName() { return "RegExpCEntryStub"; } const char* GetName() { return "RegExpCEntryStub"; }
}; };
// Trampoline stub to call into native code. To call safely into native code
// in the presence of compacting GC (which can move code objects) we need to
// keep the code which called into native pinned in the memory. Currently the
// simplest approach is to generate such stub early enough so it can never be
// moved by GC
class DirectCEntryStub: public CodeStub {
public:
DirectCEntryStub() {}
void Generate(MacroAssembler* masm);
void GenerateCall(MacroAssembler* masm,
ExternalReference function);
void GenerateCall(MacroAssembler* masm, Register target);
private:
Major MajorKey() { return DirectCEntry; }
int MinorKey() { return 0; }
bool NeedsImmovableCode() { return true; }
const char* GetName() { return "DirectCEntryStub"; }
};
class FloatingPointHelper : public AllStatic { class FloatingPointHelper : public AllStatic {
public: public:
...@@ -608,13 +629,14 @@ class StringDictionaryLookupStub: public CodeStub { ...@@ -608,13 +629,14 @@ class StringDictionaryLookupStub: public CodeStub {
void Generate(MacroAssembler* masm); void Generate(MacroAssembler* masm);
static void GenerateNegativeLookup(MacroAssembler* masm, MUST_USE_RESULT static MaybeObject* GenerateNegativeLookup(
Label* miss, MacroAssembler* masm,
Label* done, Label* miss,
Register receiver, Label* done,
Register properties, Register receiver,
String* name, Register properties,
Register scratch0) ; String* name,
Register scratch0);
static void GeneratePositiveLookup(MacroAssembler* masm, static void GeneratePositiveLookup(MacroAssembler* masm,
Label* miss, Label* miss,
......
...@@ -38,12 +38,7 @@ namespace internal { ...@@ -38,12 +38,7 @@ namespace internal {
Address ExitFrame::ComputeStackPointer(Address fp) { Address ExitFrame::ComputeStackPointer(Address fp) {
Address marker = Memory::Address_at(fp + ExitFrameConstants::kMarkerOffset); return Memory::Address_at(fp + ExitFrameConstants::kSPOffset);
Address sp = fp + ExitFrameConstants::kSPOffset;
if (marker == NULL) {
sp -= FPURegister::kNumRegisters * kDoubleSize + 2 * kPointerSize;
}
return sp;
} }
......
...@@ -101,22 +101,24 @@ class EntryFrameConstants : public AllStatic { ...@@ -101,22 +101,24 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public AllStatic { class ExitFrameConstants : public AllStatic {
public: public:
static const int kDebugMarkOffset = -1 * kPointerSize; // See some explanation in MacroAssembler::EnterExitFrame.
// Must be the same as kDebugMarkOffset. Alias introduced when upgrading. // This marks the top of the extra allocated stack space.
static const int kCodeOffset = -1 * kPointerSize; static const int kStackSpaceOffset = -3 * kPointerSize;
static const int kSPOffset = -1 * kPointerSize;
static const int kCodeOffset = -2 * kPointerSize;
// TODO(mips): Use a patched sp value on the stack instead. static const int kSPOffset = -1 * kPointerSize;
// A marker of 0 indicates that double registers are saved.
static const int kMarkerOffset = -2 * kPointerSize;
// The caller fields are below the frame pointer on the stack. // The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = +0 * kPointerSize; static const int kCallerFPOffset = +0 * kPointerSize;
// The calling JS function is between FP and PC. // The calling JS function is between FP and PC.
static const int kCallerPCOffset = +1 * kPointerSize; static const int kCallerPCOffset = +1 * kPointerSize;
// MIPS-specific: a pointer to the old sp to avoid unnecessary calculations.
static const int kCallerSPOffset = +2 * kPointerSize;
// FP-relative displacement of the caller's SP. // FP-relative displacement of the caller's SP.
static const int kCallerSPDisplacement = +3 * kPointerSize; static const int kCallerSPDisplacement = +2 * kPointerSize;
}; };
......
This diff is collapsed.
...@@ -581,23 +581,21 @@ DECLARE_NOTARGET_PROTOTYPE(Ret) ...@@ -581,23 +581,21 @@ DECLARE_NOTARGET_PROTOTYPE(Ret)
void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
// Enter exit frame. // Enter exit frame.
// Expects the number of arguments in register a0 and // argc - argument count to be dropped by LeaveExitFrame.
// the builtin function to call in register a1. // save_doubles - saves FPU registers on stack, currently disabled.
// On output hold_argc, hold_function, and hold_argv are setup. // stack_space - extra stack space.
void EnterExitFrame(Register hold_argc, void EnterExitFrame(bool save_doubles,
Register hold_argv, int stack_space = 0);
Register hold_function,
bool save_doubles);
// Leave the current exit frame. Expects the return value in v0. // Leave the current exit frame.
void LeaveExitFrame(bool save_doubles); void LeaveExitFrame(bool save_doubles, Register arg_count);
// Align the stack by optionally pushing a Smi zero.
void AlignStack(int offset); // TODO(mips) : remove this function.
// Get the actual activation frame alignment for target environment. // Get the actual activation frame alignment for target environment.
static int ActivationFrameAlignment(); static int ActivationFrameAlignment();
// Make sure the stack is aligned. Only emits code in debug mode.
void AssertStackIsAligned();
void LoadContext(Register dst, int context_chain_length); void LoadContext(Register dst, int context_chain_length);
void LoadGlobalFunction(int index, Register function); void LoadGlobalFunction(int index, Register function);
...@@ -669,6 +667,13 @@ DECLARE_NOTARGET_PROTOTYPE(Ret) ...@@ -669,6 +667,13 @@ DECLARE_NOTARGET_PROTOTYPE(Ret)
// Must preserve the result register. // Must preserve the result register.
void PopTryHandler(); void PopTryHandler();
// Passes thrown value (in v0) to the handler of top of the try handler chain.
void Throw(Register value);
// Propagates an uncatchable exception to the top of the current JS stack's
// handler chain.
void ThrowUncatchable(UncatchableExceptionType type, Register value);
// Copies a fixed number of fields of heap objects from src to dst. // Copies a fixed number of fields of heap objects from src to dst.
void CopyFields(Register dst, Register src, RegList temps, int field_count); void CopyFields(Register dst, Register src, RegList temps, int field_count);
...@@ -790,9 +795,27 @@ DECLARE_NOTARGET_PROTOTYPE(Ret) ...@@ -790,9 +795,27 @@ DECLARE_NOTARGET_PROTOTYPE(Ret)
void CallStub(CodeStub* stub, Condition cond = cc_always, void CallStub(CodeStub* stub, Condition cond = cc_always,
Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg)); Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg));
// Call a code stub and return the code object called. Try to generate
// the code if necessary. Do not perform a GC but instead return a retry
// after GC failure.
MUST_USE_RESULT MaybeObject* TryCallStub(CodeStub* stub,
Condition cond = cc_always,
Register r1 = zero_reg,
const Operand& r2 =
Operand(zero_reg));
// Tail call a code stub (jump). // Tail call a code stub (jump).
void TailCallStub(CodeStub* stub); void TailCallStub(CodeStub* stub);
// Tail call a code stub (jump) and return the code object called. Try to
// generate the code if necessary. Do not perform a GC but instead return
// a retry after GC failure.
MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub,
Condition cond = cc_always,
Register r1 = zero_reg,
const Operand& r2 =
Operand(zero_reg));
void CallJSExitStub(CodeStub* stub); void CallJSExitStub(CodeStub* stub);
// Call a runtime routine. // Call a runtime routine.
...@@ -813,6 +836,12 @@ DECLARE_NOTARGET_PROTOTYPE(Ret) ...@@ -813,6 +836,12 @@ DECLARE_NOTARGET_PROTOTYPE(Ret)
int num_arguments, int num_arguments,
int result_size); int result_size);
// Tail call of a runtime routine (jump). Try to generate the code if
// necessary. Do not perform a GC but instead return a retry after GC
// failure.
MUST_USE_RESULT MaybeObject* TryTailCallExternalReference(
const ExternalReference& ext, int num_arguments, int result_size);
// Convenience function: tail call a runtime routine (jump). // Convenience function: tail call a runtime routine (jump).
void TailCallRuntime(Runtime::FunctionId fid, void TailCallRuntime(Runtime::FunctionId fid,
int num_arguments, int num_arguments,
...@@ -840,12 +869,18 @@ DECLARE_NOTARGET_PROTOTYPE(Ret) ...@@ -840,12 +869,18 @@ DECLARE_NOTARGET_PROTOTYPE(Ret)
// function). // function).
void CallCFunction(ExternalReference function, int num_arguments); void CallCFunction(ExternalReference function, int num_arguments);
void CallCFunction(Register function, Register scratch, int num_arguments); void CallCFunction(Register function, Register scratch, int num_arguments);
void GetCFunctionDoubleResult(const DoubleRegister dst); void GetCFunctionDoubleResult(const DoubleRegister dst);
// Calls an API function. Allocates HandleScope, extracts returned value
// from handle and propagates exceptions. Restores context.
MaybeObject* TryCallApiFunctionAndReturn(ExternalReference function,
int stack_space);
// Jump to the builtin routine. // Jump to the builtin routine.
void JumpToExternalReference(const ExternalReference& builtin); void JumpToExternalReference(const ExternalReference& builtin);
MaybeObject* TryJumpToExternalReference(const ExternalReference& ext);
// Invoke specified builtin JavaScript function. Adds an entry to // Invoke specified builtin JavaScript function. Adds an entry to
// the unresolved list if the name does not resolve. // the unresolved list if the name does not resolve.
void InvokeBuiltin(Builtins::JavaScript id, void InvokeBuiltin(Builtins::JavaScript id,
......
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