diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-09-17 14:34:02 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-10-02 08:40:27 +0200 |
commit | 4f722915218862b108c90371503d26a3fe89f4c9 (patch) | |
tree | cd1577faff9acc20eb8e4a0e2d6ed1856bf308fd /deps/v8/src/codegen/assembler.cc | |
parent | 606bb521591a29df5401732bfbd19c1e31239ed9 (diff) | |
download | node-new-4f722915218862b108c90371503d26a3fe89f4c9.tar.gz |
deps: update V8 to 9.4.146.18
PR-URL: https://github.com/nodejs/node/pull/39945
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Diffstat (limited to 'deps/v8/src/codegen/assembler.cc')
-rw-r--r-- | deps/v8/src/codegen/assembler.cc | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/deps/v8/src/codegen/assembler.cc b/deps/v8/src/codegen/assembler.cc index 8eb5ae55e2..dfd406694a 100644 --- a/deps/v8/src/codegen/assembler.cc +++ b/deps/v8/src/codegen/assembler.cc @@ -57,7 +57,7 @@ AssemblerOptions AssemblerOptions::Default(Isolate* isolate) { const bool generating_embedded_builtin = isolate->IsGeneratingEmbeddedBuiltins(); options.record_reloc_info_for_serialization = serializer; - options.enable_root_array_delta_access = + options.enable_root_relative_access = !serializer && !generating_embedded_builtin; #ifdef USE_SIMULATOR // Even though the simulator is enabled, we may still need to generate code @@ -142,8 +142,9 @@ class ExternalAssemblerBufferImpl : public AssemblerBuffer { class OnHeapAssemblerBuffer : public AssemblerBuffer { public: - OnHeapAssemblerBuffer(Handle<Code> code, int size) - : code_(code), size_(size) {} + OnHeapAssemblerBuffer(Isolate* isolate, Handle<Code> code, int size, + int gc_count) + : isolate_(isolate), code_(code), size_(size), gc_count_(gc_count) {} byte* start() const override { return reinterpret_cast<byte*>(code_->raw_instruction_start()); @@ -153,20 +154,32 @@ class OnHeapAssemblerBuffer : public AssemblerBuffer { std::unique_ptr<AssemblerBuffer> Grow(int new_size) override { DCHECK_LT(size(), new_size); + Heap* heap = isolate_->heap(); + if (Code::SizeFor(new_size) < + heap->MaxRegularHeapObjectSize(AllocationType::kCode)) { + MaybeHandle<Code> code = + isolate_->factory()->NewEmptyCode(CodeKind::BASELINE, new_size); + if (!code.is_null()) { + return std::make_unique<OnHeapAssemblerBuffer>( + isolate_, code.ToHandleChecked(), new_size, heap->gc_count()); + } + } // We fall back to the slow path using the default assembler buffer and - // compile the code off the GC heap. Compiling directly on heap makes less - // sense now, since we will need to allocate a new Code object, copy the - // content generated so far and relocate. + // compile the code off the GC heap. return std::make_unique<DefaultAssemblerBuffer>(new_size); } bool IsOnHeap() const override { return true; } + int OnHeapGCCount() const override { return gc_count_; } + MaybeHandle<Code> code() const override { return code_; } private: + Isolate* isolate_; Handle<Code> code_; const int size_; + const int gc_count_; }; static thread_local std::aligned_storage_t<sizeof(ExternalAssemblerBufferImpl), @@ -211,7 +224,8 @@ std::unique_ptr<AssemblerBuffer> NewOnHeapAssemblerBuffer(Isolate* isolate, MaybeHandle<Code> code = isolate->factory()->NewEmptyCode(CodeKind::BASELINE, size); if (code.is_null()) return {}; - return std::make_unique<OnHeapAssemblerBuffer>(code.ToHandleChecked(), size); + return std::make_unique<OnHeapAssemblerBuffer>( + isolate, code.ToHandleChecked(), size, isolate->heap()->gc_count()); } // ----------------------------------------------------------------------------- @@ -281,13 +295,16 @@ HeapObjectRequest::HeapObjectRequest(const StringConstantBase* string, // Platform specific but identical code for all the platforms. -void Assembler::RecordDeoptReason(DeoptimizeReason reason, +void Assembler::RecordDeoptReason(DeoptimizeReason reason, uint32_t node_id, SourcePosition position, int id) { EnsureSpace ensure_space(this); RecordRelocInfo(RelocInfo::DEOPT_SCRIPT_OFFSET, position.ScriptOffset()); RecordRelocInfo(RelocInfo::DEOPT_INLINING_ID, position.InliningId()); RecordRelocInfo(RelocInfo::DEOPT_REASON, static_cast<int>(reason)); RecordRelocInfo(RelocInfo::DEOPT_ID, id); +#ifdef DEBUG + RecordRelocInfo(RelocInfo::DEOPT_NODE_ID, node_id); +#endif // DEBUG } void Assembler::DataAlign(int m) { |