Commit a6260ee4 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Unify JSEntryStub and JSConstructEntryStub, and some more code stub cleanups.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/545163002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23742 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dd877953
......@@ -1144,7 +1144,7 @@ void CEntryStub::Generate(MacroAssembler* masm) {
}
void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
void JSEntryStub::Generate(MacroAssembler* masm) {
// r0: code entry
// r1: function
// r2: receiver
......@@ -1183,7 +1183,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// r2: receiver
// r3: argc
// r4: argv
int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
int marker = type();
if (FLAG_enable_ool_constant_pool) {
__ mov(r8, Operand(isolate()->factory()->empty_constant_pool_array()));
}
......@@ -1264,7 +1264,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// r2: receiver
// r3: argc
// r4: argv
if (is_construct) {
if (type() == StackFrame::ENTRY_CONSTRUCT) {
ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline,
isolate());
__ mov(ip, Operand(construct_entry));
......
......@@ -71,8 +71,6 @@ class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
private:
void Generate(MacroAssembler* masm);
Register the_int() const {
return Register::from_code(IntRegisterBits::decode(minor_key_));
}
......@@ -90,7 +88,7 @@ class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
class ScratchRegisterBits: public BitField<int, 8, 4> {};
DEFINE_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(WriteInt32ToHeapNumber, PlatformCodeStub);
};
......@@ -245,7 +243,7 @@ class RecordWriteStub: public PlatformCodeStub {
virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; }
void Generate(MacroAssembler* masm);
virtual void Generate(MacroAssembler* masm) OVERRIDE;
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
......@@ -298,13 +296,12 @@ class RecordWriteStub: public PlatformCodeStub {
class DirectCEntryStub: public PlatformCodeStub {
public:
explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
void Generate(MacroAssembler* masm);
void GenerateCall(MacroAssembler* masm, Register target);
private:
bool NeedsImmovableCode() { return true; }
DEFINE_CODE_STUB(DirectCEntry, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(DirectCEntry, PlatformCodeStub);
};
......@@ -317,8 +314,6 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
minor_key_ = LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
static void GenerateNegativeLookup(MacroAssembler* masm,
Label* miss,
Label* done,
......@@ -353,7 +348,7 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
class LookupModeBits: public BitField<LookupMode, 0, 1> {};
DEFINE_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
};
} } // namespace v8::internal
......
......@@ -1256,7 +1256,7 @@ void CEntryStub::Generate(MacroAssembler* masm) {
// x4: argv.
// Output:
// x0: result.
void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
void JSEntryStub::Generate(MacroAssembler* masm) {
DCHECK(jssp.Is(__ StackPointer()));
Register code_entry = x0;
......@@ -1287,7 +1287,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
__ Fmov(fp_zero, 0.0);
// Build an entry frame (see layout below).
int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
int marker = type();
int64_t bad_frame_pointer = -1L; // Bad frame pointer to fail if it is used.
__ Mov(x13, bad_frame_pointer);
__ Mov(x12, Smi::FromInt(marker));
......@@ -1372,8 +1372,9 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// x2: receiver.
// x3: argc.
// x4: argv.
ExternalReference entry(is_construct ? Builtins::kJSConstructEntryTrampoline
: Builtins::kJSEntryTrampoline,
ExternalReference entry(type() == StackFrame::ENTRY_CONSTRUCT
? Builtins::kJSConstructEntryTrampoline
: Builtins::kJSEntryTrampoline,
isolate());
__ Mov(x10, entry);
......
......@@ -46,9 +46,7 @@ class StoreRegistersStateStub: public PlatformCodeStub {
static void GenerateAheadOfTime(Isolate* isolate);
private:
void Generate(MacroAssembler* masm);
DEFINE_CODE_STUB(StoreRegistersState, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(StoreRegistersState, PlatformCodeStub);
};
......@@ -60,9 +58,7 @@ class RestoreRegistersStateStub: public PlatformCodeStub {
static void GenerateAheadOfTime(Isolate* isolate);
private:
void Generate(MacroAssembler* masm);
DEFINE_CODE_STUB(RestoreRegistersState, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(RestoreRegistersState, PlatformCodeStub);
};
......@@ -278,7 +274,7 @@ class RecordWriteStub: public PlatformCodeStub {
virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; }
void Generate(MacroAssembler* masm);
virtual void Generate(MacroAssembler* masm) OVERRIDE;
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
......@@ -326,13 +322,12 @@ class RecordWriteStub: public PlatformCodeStub {
class DirectCEntryStub: public PlatformCodeStub {
public:
explicit DirectCEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
void Generate(MacroAssembler* masm);
void GenerateCall(MacroAssembler* masm, Register target);
private:
bool NeedsImmovableCode() { return true; }
DEFINE_CODE_STUB(DirectCEntry, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(DirectCEntry, PlatformCodeStub);
};
......@@ -345,8 +340,6 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
minor_key_ = LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
static void GenerateNegativeLookup(MacroAssembler* masm,
Label* miss,
Label* done,
......@@ -381,7 +374,7 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
class LookupModeBits: public BitField<LookupMode, 0, 1> {};
DEFINE_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
};
} } // namespace v8::internal
......
This diff is collapsed.
......@@ -2694,13 +2694,13 @@ void Heap::CreateApiObjects() {
void Heap::CreateJSEntryStub() {
JSEntryStub stub(isolate());
JSEntryStub stub(isolate(), StackFrame::ENTRY);
set_js_entry_code(*stub.GetCode());
}
void Heap::CreateJSConstructEntryStub() {
JSConstructEntryStub stub(isolate());
JSEntryStub stub(isolate(), StackFrame::ENTRY_CONSTRUCT);
set_js_construct_entry_code(*stub.GetCode());
}
......
......@@ -2398,7 +2398,7 @@ void CEntryStub::Generate(MacroAssembler* masm) {
}
void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
void JSEntryStub::Generate(MacroAssembler* masm) {
Label invoke, handler_entry, exit;
Label not_outermost_js, not_outermost_js_2;
......@@ -2409,7 +2409,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
__ mov(ebp, esp);
// Push marker in two places.
int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
int marker = type();
__ push(Immediate(Smi::FromInt(marker))); // context slot
__ push(Immediate(Smi::FromInt(marker))); // function slot
// Save callee-saved registers (C calling conventions).
......@@ -2460,7 +2460,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// pop the faked function when we return. Notice that we cannot store a
// reference to the trampoline code directly in this stub, because the
// builtin stubs may not have been generated yet.
if (is_construct) {
if (type() == StackFrame::ENTRY_CONSTRUCT) {
ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline,
isolate());
__ mov(edx, Immediate(construct_entry));
......
......@@ -66,8 +66,6 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
IndexBits::encode(index.code()) | LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
static void GenerateNegativeLookup(MacroAssembler* masm,
Label* miss,
Label* done,
......@@ -116,7 +114,7 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
class IndexBits: public BitField<int, 6, 3> {};
class LookupModeBits: public BitField<LookupMode, 9, 1> {};
DEFINE_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
};
......@@ -345,7 +343,7 @@ class RecordWriteStub: public PlatformCodeStub {
virtual inline Major MajorKey() const FINAL OVERRIDE { return RecordWrite; }
void Generate(MacroAssembler* masm);
virtual void Generate(MacroAssembler* masm) OVERRIDE;
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
......
......@@ -2308,7 +2308,7 @@ void CEntryStub::Generate(MacroAssembler* masm) {
}
void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
void JSEntryStub::Generate(MacroAssembler* masm) {
Label invoke, handler_entry, exit;
Label not_outermost_js, not_outermost_js_2;
......@@ -2321,7 +2321,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
__ movp(rbp, rsp);
// Push the stack frame type marker twice.
int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
int marker = type();
// Scratch register is neither callee-save, nor an argument register on any
// platform. It's free to use at this point.
// Cannot use smi-register for loading yet.
......@@ -2411,7 +2411,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// external reference instead of inlining the call target address directly
// in the code, because the builtin stubs may not have been generated yet
// at the time this code is generated.
if (is_construct) {
if (type() == StackFrame::ENTRY_CONSTRUCT) {
ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline,
isolate());
__ Load(rax, construct_entry);
......
......@@ -61,8 +61,6 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
IndexBits::encode(index.code()) | LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
static void GenerateNegativeLookup(MacroAssembler* masm,
Label* miss,
Label* done,
......@@ -111,7 +109,7 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
class IndexBits: public BitField<int, 8, 4> {};
class LookupModeBits: public BitField<LookupMode, 12, 1> {};
DEFINE_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
DEFINE_PLATFORM_CODE_STUB(NameDictionaryLookup, PlatformCodeStub);
};
......@@ -319,7 +317,7 @@ class RecordWriteStub: public PlatformCodeStub {
virtual Major MajorKey() const FINAL OVERRIDE { return RecordWrite; }
void Generate(MacroAssembler* masm);
virtual void Generate(MacroAssembler* masm) OVERRIDE;
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
......
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