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