diff options
Diffstat (limited to 'deps/v8/src/codegen/turbo-assembler.h')
-rw-r--r-- | deps/v8/src/codegen/turbo-assembler.h | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/deps/v8/src/codegen/turbo-assembler.h b/deps/v8/src/codegen/turbo-assembler.h index e25ee2a629..2f2deadaac 100644 --- a/deps/v8/src/codegen/turbo-assembler.h +++ b/deps/v8/src/codegen/turbo-assembler.h @@ -15,12 +15,6 @@ namespace v8 { namespace internal { -enum class JumpMode { - kJump, // Does a direct jump to the given address - kPushAndReturn // Pushes the given address as the current return address and - // does a return -}; - // Common base class for platform-specific TurboAssemblers containing // platform-independent bits. // You will encounter two subclasses, TurboAssembler (derives from @@ -59,33 +53,19 @@ class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler { bool should_abort_hard() const { return hard_abort_; } void set_abort_hard(bool v) { hard_abort_ = v; } - void set_builtin_index(int i) { maybe_builtin_index_ = i; } + void set_builtin(Builtin builtin) { maybe_builtin_ = builtin; } void set_has_frame(bool v) { has_frame_ = v; } bool has_frame() const { return has_frame_; } - virtual void Jump(const ExternalReference& reference) = 0; - - // Calls the builtin given by the Smi in |builtin|. If builtins are embedded, - // the trampoline Code object on the heap is not used. - virtual void CallBuiltinByIndex(Register builtin_index) = 0; - - // Calls/jumps to the given Code object. If builtins are embedded, the - // trampoline Code object on the heap is not used. - virtual void CallCodeObject(Register code_object) = 0; - virtual void JumpCodeObject(Register code_object, - JumpMode jump_mode = JumpMode::kJump) = 0; - - // Loads the given Code object's entry point into the destination register. - virtual void LoadCodeObjectEntry(Register destination, - Register code_object) = 0; - // Loads the given constant or external reference without embedding its direct // pointer. The produced code is isolate-independent. void IndirectLoadConstant(Register destination, Handle<HeapObject> object); void IndirectLoadExternalReference(Register destination, ExternalReference reference); + Address BuiltinEntry(Builtin builtin); + virtual void LoadFromConstantsTable(Register destination, int constant_index) = 0; @@ -98,11 +78,8 @@ class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler { virtual void LoadRoot(Register destination, RootIndex index) = 0; - virtual void Trap() = 0; - virtual void DebugBreak() = 0; - static int32_t RootRegisterOffsetForRootIndex(RootIndex root_index); - static int32_t RootRegisterOffsetForBuiltinIndex(int builtin_index); + static int32_t RootRegisterOffsetForBuiltin(Builtin builtin); // Returns the root-relative offset to reference.address(). static intptr_t RootRegisterOffsetForExternalReference( @@ -124,13 +101,24 @@ class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler { static constexpr int kStackPageSize = 4 * KB; #endif - V8_INLINE void RecordCommentForOffHeapTrampoline(int builtin_index) { + V8_INLINE std::string CommentForOffHeapTrampoline(const char* prefix, + Builtin builtin) { + if (!FLAG_code_comments) return ""; + std::ostringstream str; + str << "Inlined Trampoline for " << prefix << " to " + << Builtins::name(builtin); + return str.str(); + } + + V8_INLINE void RecordCommentForOffHeapTrampoline(Builtin builtin) { if (!FLAG_code_comments) return; std::ostringstream str; - str << "[ Inlined Trampoline to " << Builtins::name(builtin_index); + str << "[ Inlined Trampoline to " << Builtins::name(builtin); RecordComment(str.str().c_str()); } + enum class RecordWriteCallMode { kDefault, kWasm }; + protected: Isolate* const isolate_ = nullptr; @@ -147,15 +135,17 @@ class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler { bool hard_abort_ = false; // May be set while generating builtins. - int maybe_builtin_index_ = Builtins::kNoBuiltinId; + Builtin maybe_builtin_ = Builtin::kNoBuiltinId; bool has_frame_ = false; + int comment_depth_ = 0; + DISALLOW_IMPLICIT_CONSTRUCTORS(TurboAssemblerBase); }; -// Avoids emitting calls to the {Builtins::kAbort} builtin when emitting debug -// code during the lifetime of this scope object. +// Avoids emitting calls to the {Builtin::kAbort} builtin when emitting +// debug code during the lifetime of this scope object. class V8_NODISCARD HardAbortScope { public: explicit HardAbortScope(TurboAssemblerBase* assembler) |