Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index 626e14e08d4de951aa4bc837172b002b116aa3ba..eb858b0096569d4b1527a18ec51155193d93781c 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -180,10 +180,7 @@ class CodeStub BASE_EMBEDDED { |
// Lookup the code in the (possibly custom) cache. |
bool FindCodeInCache(Code** code_out); |
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() { |
- UNREACHABLE(); // Default returns an uninitialized descriptor. |
- return CallInterfaceDescriptor(); |
- } |
+ virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() = 0; |
virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {} |
@@ -314,6 +311,16 @@ class CodeStub BASE_EMBEDDED { |
return NAME##Descriptor(isolate()); \ |
} |
+// There are some code stubs we just can't describe right now with a |
+// CallInterfaceDescriptor. Isolate behavior for those cases with this macro. |
+// An attempt to retrieve a descriptor will fail. |
+#define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \ |
+ public: \ |
+ virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \ |
+ UNREACHABLE(); \ |
+ return CallInterfaceDescriptor(); \ |
+ } |
+ |
class PlatformCodeStub : public CodeStub { |
public: |
@@ -670,6 +677,13 @@ class InstanceofStub: public PlatformCodeStub { |
static Register left() { return InstanceofDescriptor::left(); } |
static Register right() { return InstanceofDescriptor::right(); } |
+ virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
+ if (HasArgsInRegisters()) { |
+ return InstanceofDescriptor(isolate()); |
+ } |
+ return ContextOnlyDescriptor(isolate()); |
+ } |
+ |
private: |
Flags flags() const { return FlagBits::decode(minor_key_); } |
@@ -687,7 +701,6 @@ class InstanceofStub: public PlatformCodeStub { |
class FlagBits : public BitField<Flags, 0, 3> {}; |
- DEFINE_CALL_INTERFACE_DESCRIPTOR(Instanceof); |
DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub); |
}; |
@@ -719,6 +732,7 @@ class ArrayConstructorStub: public PlatformCodeStub { |
class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); |
DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub); |
}; |
@@ -730,6 +744,7 @@ class InternalArrayConstructorStub: public PlatformCodeStub { |
private: |
void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor); |
DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub); |
}; |
@@ -743,6 +758,16 @@ class MathPowStub: public PlatformCodeStub { |
minor_key_ = ExponentTypeBits::encode(exponent_type); |
} |
+ virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
+ if (exponent_type() == TAGGED) { |
+ return MathPowTaggedDescriptor(isolate()); |
+ } else if (exponent_type() == INTEGER) { |
+ return MathPowIntegerDescriptor(isolate()); |
+ } |
+ // A CallInterfaceDescriptor doesn't specify double registers (yet). |
+ return ContextOnlyDescriptor(isolate()); |
+ } |
+ |
private: |
ExponentType exponent_type() const { |
return ExponentTypeBits::decode(minor_key_); |
@@ -789,6 +814,7 @@ class CallICStub: public PlatformCodeStub { |
private: |
virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); |
DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); |
}; |
@@ -817,6 +843,10 @@ class FunctionPrototypeStub : public PlatformCodeStub { |
virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
+ // TODO(mvstanton): only the receiver register is accessed. When this is |
+ // translated to a hydrogen code stub, a new CallInterfaceDescriptor |
+ // should be created that just uses that register for more efficient code. |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); |
}; |
@@ -1009,6 +1039,7 @@ class CallApiFunctionStub : public PlatformCodeStub { |
class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; |
STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction); |
DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); |
}; |
@@ -1017,6 +1048,7 @@ class CallApiGetterStub : public PlatformCodeStub { |
public: |
explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); |
DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); |
}; |
@@ -1108,6 +1140,7 @@ class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub { |
static void GenerateAheadOfTime(Isolate* isolate, |
const BinaryOpIC::State& state); |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); |
DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); |
}; |
@@ -1230,6 +1263,7 @@ class CompareICStub : public PlatformCodeStub { |
Handle<Map> known_map_; |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); |
}; |
@@ -1353,6 +1387,7 @@ class CEntryStub : public PlatformCodeStub { |
class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
class ResultSizeBits : public BitField<int, 1, 3> {}; |
+ DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub); |
}; |
@@ -1381,6 +1416,7 @@ class JSEntryStub : public PlatformCodeStub { |
int handler_offset_; |
+ DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); |
}; |
@@ -1398,6 +1434,13 @@ class ArgumentsAccessStub: public PlatformCodeStub { |
minor_key_ = TypeBits::encode(type); |
} |
+ virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
+ if (type() == READ_ELEMENT) { |
+ return ArgumentsAccessReadDescriptor(isolate()); |
+ } |
+ return ContextOnlyDescriptor(isolate()); |
+ } |
+ |
private: |
Type type() const { return TypeBits::decode(minor_key_); } |
@@ -1418,6 +1461,7 @@ class RegExpExecStub: public PlatformCodeStub { |
public: |
explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); |
DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); |
}; |
@@ -1716,6 +1760,7 @@ class LoadICTrampolineStub : public PlatformCodeStub { |
return LoadIC::State(static_cast<ExtraICState>(minor_key_)); |
} |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline); |
DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); |
}; |
@@ -1836,6 +1881,7 @@ class DoubleToIStub : public PlatformCodeStub { |
class SSE3Bits: |
public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT |
+ DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); |
}; |
@@ -2102,6 +2148,7 @@ class StoreElementStub : public PlatformCodeStub { |
class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); |
DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub); |
}; |
@@ -2252,6 +2299,7 @@ class StoreArrayLiteralElementStub : public PlatformCodeStub { |
explicit StoreArrayLiteralElementStub(Isolate* isolate) |
: PlatformCodeStub(isolate) { } |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreArrayLiteralElement); |
DEFINE_PLATFORM_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub); |
}; |
@@ -2272,6 +2320,7 @@ class StubFailureTrampolineStub : public PlatformCodeStub { |
class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; |
+ DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
DEFINE_PLATFORM_CODE_STUB(StubFailureTrampoline, PlatformCodeStub); |
}; |
@@ -2291,6 +2340,9 @@ class ProfileEntryHookStub : public PlatformCodeStub { |
intptr_t stack_pointer, |
Isolate* isolate); |
+ // ProfileEntryHookStub is called at the start of a function, so it has the |
+ // same register set. |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction) |
DEFINE_PLATFORM_CODE_STUB(ProfileEntryHook, PlatformCodeStub); |
}; |
@@ -2310,6 +2362,7 @@ class StoreBufferOverflowStub : public PlatformCodeStub { |
class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
+ DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); |
}; |
@@ -2318,6 +2371,7 @@ class SubStringStub : public PlatformCodeStub { |
public: |
explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); |
DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub); |
}; |
@@ -2326,6 +2380,7 @@ class StringCompareStub : public PlatformCodeStub { |
public: |
explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); |
DEFINE_PLATFORM_CODE_STUB(StringCompare, PlatformCodeStub); |
}; |