diff options
Diffstat (limited to 'deps/v8/src/code-stubs.h')
-rw-r--r-- | deps/v8/src/code-stubs.h | 143 |
1 files changed, 23 insertions, 120 deletions
diff --git a/deps/v8/src/code-stubs.h b/deps/v8/src/code-stubs.h index 6e23fb9a9d..76057ffcc2 100644 --- a/deps/v8/src/code-stubs.h +++ b/deps/v8/src/code-stubs.h @@ -7,7 +7,6 @@ #include "src/allocation.h" #include "src/assembler.h" -#include "src/codegen.h" #include "src/factory.h" #include "src/globals.h" #include "src/interface-descriptors.h" @@ -38,11 +37,7 @@ class Node; V(JSEntry) \ V(MathPow) \ V(ProfileEntryHook) \ - V(RecordWrite) \ - V(StoreBufferOverflow) \ V(StoreSlowElement) \ - V(SubString) \ - V(NameDictionaryLookup) \ /* --- TurboFanCodeStubs --- */ \ V(ArrayNoArgumentConstructor) \ V(ArraySingleArgumentConstructor) \ @@ -54,7 +49,6 @@ class Node; V(KeyedStoreSloppyArguments) \ V(LoadScriptContextField) \ V(StoreScriptContextField) \ - V(NumberToString) \ V(StringAdd) \ V(GetProperty) \ V(StoreFastElement) \ @@ -81,35 +75,23 @@ class Node; // List of code stubs only used on PPC platforms. #ifdef V8_TARGET_ARCH_PPC -#define CODE_STUB_LIST_PPC(V) \ - V(DirectCEntry) \ - V(StoreRegistersState) \ - V(RestoreRegistersState) +#define CODE_STUB_LIST_PPC(V) V(DirectCEntry) #else #define CODE_STUB_LIST_PPC(V) #endif // List of code stubs only used on MIPS platforms. #if V8_TARGET_ARCH_MIPS -#define CODE_STUB_LIST_MIPS(V) \ - V(DirectCEntry) \ - V(RestoreRegistersState) \ - V(StoreRegistersState) +#define CODE_STUB_LIST_MIPS(V) V(DirectCEntry) #elif V8_TARGET_ARCH_MIPS64 -#define CODE_STUB_LIST_MIPS(V) \ - V(DirectCEntry) \ - V(RestoreRegistersState) \ - V(StoreRegistersState) +#define CODE_STUB_LIST_MIPS(V) V(DirectCEntry) #else #define CODE_STUB_LIST_MIPS(V) #endif // List of code stubs only used on S390 platforms. #ifdef V8_TARGET_ARCH_S390 -#define CODE_STUB_LIST_S390(V) \ - V(DirectCEntry) \ - V(StoreRegistersState) \ - V(RestoreRegistersState) +#define CODE_STUB_LIST_S390(V) V(DirectCEntry) #else #define CODE_STUB_LIST_S390(V) #endif @@ -211,7 +193,7 @@ class CodeStub : public ZoneObject { // Returns whether the code generated for this stub needs to be allocated as // a fixed (non-moveable) code object. - virtual bool NeedsImmovableCode() { return false; } + virtual Movability NeedsImmovableCode() { return kMovable; } virtual void PrintName(std::ostream& os) const; // NOLINT virtual void PrintBaseName(std::ostream& os) const; // NOLINT @@ -230,9 +212,6 @@ class CodeStub : public ZoneObject { // initially generated. void RecordCodeGeneration(Handle<Code> code); - // Finish the code object after it has been generated. - virtual void FinishCode(Handle<Code> code) { } - // Activate newly generated stub. Is called after // registering stub in the stub cache. virtual void Activate(Code* code) { } @@ -282,11 +261,6 @@ class CodeStub : public ZoneObject { void GenerateAssembly(compiler::CodeAssemblerState* state) const override; \ DEFINE_CODE_STUB(NAME, SUPER) -#define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ - public: \ - Handle<Code> GenerateCode() override; \ - DEFINE_CODE_STUB(NAME, SUPER) - #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ public: \ typedef NAME##Descriptor Descriptor; \ @@ -316,6 +290,9 @@ class PlatformCodeStub : public CodeStub { // Generates the assembler code for the stub. virtual void Generate(MacroAssembler* masm) = 0; + // Generates the exception handler table for the stub. + virtual Handle<HandlerTable> GenerateHandlerTable(); + DEFINE_CODE_STUB_BASE(PlatformCodeStub, CodeStub); }; @@ -329,11 +306,11 @@ class CodeStubDescriptor { CodeStubDescriptor(Isolate* isolate, uint32_t stub_key); - void Initialize(Address deoptimization_handler = NULL, + void Initialize(Address deoptimization_handler = nullptr, int hint_stack_parameter_count = -1, StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE); void Initialize(Register stack_parameter_count, - Address deoptimization_handler = NULL, + Address deoptimization_handler = nullptr, int hint_stack_parameter_count = -1, StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE); @@ -439,9 +416,7 @@ class TurboFanCodeStub : public CodeStub { } // namespace v8 #if V8_TARGET_ARCH_IA32 -#include "src/ia32/code-stubs-ia32.h" #elif V8_TARGET_ARCH_X64 -#include "src/x64/code-stubs-x64.h" #elif V8_TARGET_ARCH_ARM64 #include "src/arm64/code-stubs-arm64.h" #elif V8_TARGET_ARCH_ARM @@ -518,14 +493,6 @@ class GetPropertyStub : public TurboFanCodeStub { DEFINE_TURBOFAN_CODE_STUB(GetProperty, TurboFanCodeStub); }; -class NumberToStringStub final : public TurboFanCodeStub { - public: - explicit NumberToStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} - - DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); - DEFINE_TURBOFAN_CODE_STUB(NumberToString, TurboFanCodeStub); -}; - class GrowArrayElementsStub : public TurboFanCodeStub { public: GrowArrayElementsStub(Isolate* isolate, ElementsKind kind) @@ -638,30 +605,17 @@ class CallApiCallbackStub : public PlatformCodeStub { static const int kArgBits = 3; static const int kArgMax = (1 << kArgBits) - 1; - // CallApiCallbackStub for regular setters and getters. - CallApiCallbackStub(Isolate* isolate, bool is_store, bool is_lazy) - : CallApiCallbackStub(isolate, is_store ? 1 : 0, is_store, is_lazy) {} - - // CallApiCallbackStub for callback functions. - CallApiCallbackStub(Isolate* isolate, int argc, bool is_lazy) - : CallApiCallbackStub(isolate, argc, false, is_lazy) {} - - private: - CallApiCallbackStub(Isolate* isolate, int argc, bool is_store, bool is_lazy) + CallApiCallbackStub(Isolate* isolate, int argc) : PlatformCodeStub(isolate) { - CHECK(0 <= argc && argc <= kArgMax); - minor_key_ = IsStoreBits::encode(is_store) | - ArgumentBits::encode(argc) | - IsLazyAccessorBits::encode(is_lazy); + CHECK_LE(0, argc); + CHECK_LE(argc, kArgMax); + minor_key_ = ArgumentBits::encode(argc); } - bool is_store() const { return IsStoreBits::decode(minor_key_); } - bool is_lazy() const { return IsLazyAccessorBits::decode(minor_key_); } + private: int argc() const { return ArgumentBits::decode(minor_key_); } - class IsStoreBits: public BitField<bool, 0, 1> {}; - class IsLazyAccessorBits : public BitField<bool, 1, 1> {}; - class ArgumentBits : public BitField<int, 2, kArgBits> {}; + class ArgumentBits : public BitField<int, 0, kArgBits> {}; DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiCallback); DEFINE_PLATFORM_CODE_STUB(CallApiCallback, PlatformCodeStub); @@ -730,7 +684,7 @@ class CEntryStub : public PlatformCodeStub { bool is_builtin_exit() const { return FrameTypeBits::decode(minor_key_); } int result_size() const { return ResultSizeBits::decode(minor_key_); } - bool NeedsImmovableCode() override; + Movability NeedsImmovableCode() override; class SaveDoublesBits : public BitField<bool, 0, 1> {}; class ArgvMode : public BitField<bool, 1, 1> {}; @@ -741,7 +695,6 @@ class CEntryStub : public PlatformCodeStub { DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub); }; - class JSEntryStub : public PlatformCodeStub { public: JSEntryStub(Isolate* isolate, StackFrame::Type type) @@ -751,7 +704,7 @@ class JSEntryStub : public PlatformCodeStub { } private: - void FinishCode(Handle<Code> code) override; + Handle<HandlerTable> GenerateHandlerTable() override; void PrintName(std::ostream& os) const override { // NOLINT os << (type() == StackFrame::ENTRY ? "JSEntryStub" @@ -790,45 +743,24 @@ enum EmbedMode { class DoubleToIStub : public PlatformCodeStub { public: - DoubleToIStub(Isolate* isolate, Register source, Register destination, - int offset, bool is_truncating, bool skip_fastpath = false) + DoubleToIStub(Isolate* isolate, Register destination) : PlatformCodeStub(isolate) { - minor_key_ = SourceRegisterBits::encode(source.code()) | - DestinationRegisterBits::encode(destination.code()) | - OffsetBits::encode(offset) | - IsTruncatingBits::encode(is_truncating) | - SkipFastPathBits::encode(skip_fastpath) | + minor_key_ = DestinationRegisterBits::encode(destination.code()) | SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); } bool SometimesSetsUpAFrame() override { return false; } private: - Register source() const { - return Register::from_code(SourceRegisterBits::decode(minor_key_)); - } Register destination() const { return Register::from_code(DestinationRegisterBits::decode(minor_key_)); } - bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } - bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } - int offset() const { return OffsetBits::decode(minor_key_); } static const int kBitsPerRegisterNumber = 6; STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); - class SourceRegisterBits: - public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT - class DestinationRegisterBits: - public BitField<int, kBitsPerRegisterNumber, - kBitsPerRegisterNumber> {}; // NOLINT - class IsTruncatingBits: - public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT - class OffsetBits: - public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT - class SkipFastPathBits: - public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT - class SSE3Bits: - public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT + class DestinationRegisterBits + : public BitField<int, 0, kBitsPerRegisterNumber> {}; + class SSE3Bits : public BitField<int, kBitsPerRegisterNumber, 1> {}; DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); @@ -1095,37 +1027,8 @@ class ProfileEntryHookStub : public PlatformCodeStub { }; -class StoreBufferOverflowStub : public PlatformCodeStub { - public: - StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) - : PlatformCodeStub(isolate) { - minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs); - } - - static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); - bool SometimesSetsUpAFrame() override { return false; } - - private: - bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } - - class SaveDoublesBits : public BitField<bool, 0, 1> {}; - - DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); - DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); -}; - -class SubStringStub : public TurboFanCodeStub { - public: - explicit SubStringStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} - - DEFINE_CALL_INTERFACE_DESCRIPTOR(SubString); - DEFINE_TURBOFAN_CODE_STUB(SubString, TurboFanCodeStub); -}; - - #undef DEFINE_CALL_INTERFACE_DESCRIPTOR #undef DEFINE_PLATFORM_CODE_STUB -#undef DEFINE_HANDLER_CODE_STUB #undef DEFINE_CODE_STUB #undef DEFINE_CODE_STUB_BASE |