diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-04-17 17:28:46 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-04-30 13:54:06 +0300 |
commit | d221cdc97ce465f95866af8ef8ea00c6105b45ed (patch) | |
tree | bbb9bbdee527dbf1e5e0aa7c79b73236da518a12 /deps | |
parent | 26cc1605652844c78c210f91e07ddfa22ffcea66 (diff) |
deps: V8: cherry-pick d2283ba066ba
Original commit message:
[macro-assembler] Avoid using the isolate in CallRecordWriteStub
CallRecordWriteStub is used in a background compile thread for
JS-to-Wasm wrapper compilation, so it should avoid accessing the
isolate.
Call the builtin using CallBuiltin which does not require a Handle<Code>
object and instead gets the call target directly from the embedded data.
R=clemensb@chromium.org
(cherry picked from commit 6b3994e8507b32dfb956329395dbe33a2a8fee14)
No-Try: true
No-Presubmit: true
No-Tree-Checks: true
Bug: chromium:1146813
Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#71785}
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2731535
Commit-Queue: Victor-Gabriel Savu <vsavu@google.com>
Reviewed-by: Jana Grill <janagrill@chromium.org>
Cr-Commit-Position: refs/branch-heads/8.6@{#66}
Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1}
Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472}
Refs: https://github.com/v8/v8/commit/d2283ba066ba28ecb25a1462d9194ff20690bb8b
PR-URL: https://github.com/nodejs/node/pull/38275
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r-- | deps/v8/src/codegen/arm/macro-assembler-arm.cc | 19 | ||||
-rw-r--r-- | deps/v8/src/codegen/arm/macro-assembler-arm.h | 2 | ||||
-rw-r--r-- | deps/v8/src/codegen/arm64/macro-assembler-arm64.cc | 19 | ||||
-rw-r--r-- | deps/v8/src/codegen/arm64/macro-assembler-arm64.h | 2 | ||||
-rw-r--r-- | deps/v8/src/codegen/ia32/macro-assembler-ia32.cc | 19 | ||||
-rw-r--r-- | deps/v8/src/codegen/ia32/macro-assembler-ia32.h | 2 | ||||
-rw-r--r-- | deps/v8/src/codegen/x64/macro-assembler-x64.cc | 19 | ||||
-rw-r--r-- | deps/v8/src/codegen/x64/macro-assembler-x64.h | 2 |
8 files changed, 48 insertions, 36 deletions
diff --git a/deps/v8/src/codegen/arm/macro-assembler-arm.cc b/deps/v8/src/codegen/arm/macro-assembler-arm.cc index 7e5fa8cef1c..fa9aba33876 100644 --- a/deps/v8/src/codegen/arm/macro-assembler-arm.cc +++ b/deps/v8/src/codegen/arm/macro-assembler-arm.cc @@ -722,23 +722,22 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Operand offset, void TurboAssembler::CallRecordWriteStub( Register object, Operand offset, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) { - CallRecordWriteStub( - object, offset, remembered_set_action, fp_mode, - isolate()->builtins()->builtin_handle(Builtins::kRecordWrite), - kNullAddress); + CallRecordWriteStub(object, offset, remembered_set_action, fp_mode, + Builtins::kRecordWrite, kNullAddress); } void TurboAssembler::CallRecordWriteStub( Register object, Operand offset, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, Address wasm_target) { CallRecordWriteStub(object, offset, remembered_set_action, fp_mode, - Handle<Code>::null(), wasm_target); + Builtins::kNoBuiltinId, wasm_target); } void TurboAssembler::CallRecordWriteStub( Register object, Operand offset, RememberedSetAction remembered_set_action, - SaveFPRegsMode fp_mode, Handle<Code> code_target, Address wasm_target) { - DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress); + SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target) { + DCHECK_NE(builtin_index == Builtins::kNoBuiltinId, + wasm_target == kNullAddress); // TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode, // i.e. always emit remember set and save FP registers in RecordWriteStub. If // large performance regression is observed, we should use these values to @@ -762,9 +761,13 @@ void TurboAssembler::CallRecordWriteStub( Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action)); Move(fp_mode_parameter, Smi::FromEnum(fp_mode)); - if (code_target.is_null()) { + if (builtin_index == Builtins::kNoBuiltinId) { Call(wasm_target, RelocInfo::WASM_STUB_CALL); + } else if (options().inline_offheap_trampolines) { + CallBuiltin(builtin_index); } else { + Handle<Code> code_target = + isolate()->builtins()->builtin_handle(Builtins::kRecordWrite); Call(code_target, RelocInfo::CODE_TARGET); } diff --git a/deps/v8/src/codegen/arm/macro-assembler-arm.h b/deps/v8/src/codegen/arm/macro-assembler-arm.h index a7dc5498b8b..4821eb79c94 100644 --- a/deps/v8/src/codegen/arm/macro-assembler-arm.h +++ b/deps/v8/src/codegen/arm/macro-assembler-arm.h @@ -588,7 +588,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { void CallRecordWriteStub(Register object, Operand offset, RememberedSetAction remembered_set_action, - SaveFPRegsMode fp_mode, Handle<Code> code_target, + SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target); }; diff --git a/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc b/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc index c157df29966..c93f5797257 100644 --- a/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc +++ b/deps/v8/src/codegen/arm64/macro-assembler-arm64.cc @@ -2738,23 +2738,22 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Operand offset, void TurboAssembler::CallRecordWriteStub( Register object, Operand offset, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) { - CallRecordWriteStub( - object, offset, remembered_set_action, fp_mode, - isolate()->builtins()->builtin_handle(Builtins::kRecordWrite), - kNullAddress); + CallRecordWriteStub(object, offset, remembered_set_action, fp_mode, + Builtins::kRecordWrite, kNullAddress); } void TurboAssembler::CallRecordWriteStub( Register object, Operand offset, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, Address wasm_target) { CallRecordWriteStub(object, offset, remembered_set_action, fp_mode, - Handle<Code>::null(), wasm_target); + Builtins::kNoBuiltinId, wasm_target); } void TurboAssembler::CallRecordWriteStub( Register object, Operand offset, RememberedSetAction remembered_set_action, - SaveFPRegsMode fp_mode, Handle<Code> code_target, Address wasm_target) { - DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress); + SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target) { + DCHECK_NE(builtin_index == Builtins::kNoBuiltinId, + wasm_target == kNullAddress); // TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode, // i.e. always emit remember set and save FP registers in RecordWriteStub. If // large performance regression is observed, we should use these values to @@ -2778,9 +2777,13 @@ void TurboAssembler::CallRecordWriteStub( Mov(remembered_set_parameter, Smi::FromEnum(remembered_set_action)); Mov(fp_mode_parameter, Smi::FromEnum(fp_mode)); - if (code_target.is_null()) { + if (builtin_index == Builtins::kNoBuiltinId) { Call(wasm_target, RelocInfo::WASM_STUB_CALL); + } else if (options().inline_offheap_trampolines) { + CallBuiltin(builtin_index); } else { + Handle<Code> code_target = + isolate()->builtins()->builtin_handle(Builtins::kRecordWrite); Call(code_target, RelocInfo::CODE_TARGET); } diff --git a/deps/v8/src/codegen/arm64/macro-assembler-arm64.h b/deps/v8/src/codegen/arm64/macro-assembler-arm64.h index 109e73c3c22..e701a5b12a3 100644 --- a/deps/v8/src/codegen/arm64/macro-assembler-arm64.h +++ b/deps/v8/src/codegen/arm64/macro-assembler-arm64.h @@ -1419,7 +1419,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { void CallRecordWriteStub(Register object, Operand offset, RememberedSetAction remembered_set_action, - SaveFPRegsMode fp_mode, Handle<Code> code_target, + SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target); }; diff --git a/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc b/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc index b73050a680d..4b31481acdd 100644 --- a/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc +++ b/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc @@ -415,10 +415,8 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address, void TurboAssembler::CallRecordWriteStub( Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) { - CallRecordWriteStub( - object, address, remembered_set_action, fp_mode, - isolate()->builtins()->builtin_handle(Builtins::kRecordWrite), - kNullAddress); + CallRecordWriteStub(object, address, remembered_set_action, fp_mode, + Builtins::kRecordWrite, kNullAddress); } void TurboAssembler::CallRecordWriteStub( @@ -426,14 +424,15 @@ void TurboAssembler::CallRecordWriteStub( RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, Address wasm_target) { CallRecordWriteStub(object, address, remembered_set_action, fp_mode, - Handle<Code>::null(), wasm_target); + Builtins::kNoBuiltinId, wasm_target); } void TurboAssembler::CallRecordWriteStub( Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, - Handle<Code> code_target, Address wasm_target) { - DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress); + int builtin_index, Address wasm_target) { + DCHECK_NE(builtin_index == Builtins::kNoBuiltinId, + wasm_target == kNullAddress); // TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode, // i.e. always emit remember set and save FP registers in RecordWriteStub. If // large performance regression is observed, we should use these values to @@ -461,10 +460,14 @@ void TurboAssembler::CallRecordWriteStub( Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action)); Move(fp_mode_parameter, Smi::FromEnum(fp_mode)); - if (code_target.is_null()) { + if (builtin_index == Builtins::kNoBuiltinId) { // Use {wasm_call} for direct Wasm call within a module. wasm_call(wasm_target, RelocInfo::WASM_STUB_CALL); + } else if (options().inline_offheap_trampolines) { + CallBuiltin(builtin_index); } else { + Handle<Code> code_target = + isolate()->builtins()->builtin_handle(Builtins::kRecordWrite); Call(code_target, RelocInfo::CODE_TARGET); } diff --git a/deps/v8/src/codegen/ia32/macro-assembler-ia32.h b/deps/v8/src/codegen/ia32/macro-assembler-ia32.h index 9909d732cf9..0847599295a 100644 --- a/deps/v8/src/codegen/ia32/macro-assembler-ia32.h +++ b/deps/v8/src/codegen/ia32/macro-assembler-ia32.h @@ -567,7 +567,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { void CallRecordWriteStub(Register object, Register address, RememberedSetAction remembered_set_action, - SaveFPRegsMode fp_mode, Handle<Code> code_target, + SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target); }; diff --git a/deps/v8/src/codegen/x64/macro-assembler-x64.cc b/deps/v8/src/codegen/x64/macro-assembler-x64.cc index 7d6fdc5eb3d..44e590843eb 100644 --- a/deps/v8/src/codegen/x64/macro-assembler-x64.cc +++ b/deps/v8/src/codegen/x64/macro-assembler-x64.cc @@ -385,10 +385,8 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address, void TurboAssembler::CallRecordWriteStub( Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) { - CallRecordWriteStub( - object, address, remembered_set_action, fp_mode, - isolate()->builtins()->builtin_handle(Builtins::kRecordWrite), - kNullAddress); + CallRecordWriteStub(object, address, remembered_set_action, fp_mode, + Builtins::kRecordWrite, kNullAddress); } void TurboAssembler::CallRecordWriteStub( @@ -396,14 +394,15 @@ void TurboAssembler::CallRecordWriteStub( RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, Address wasm_target) { CallRecordWriteStub(object, address, remembered_set_action, fp_mode, - Handle<Code>::null(), wasm_target); + Builtins::kNoBuiltinId, wasm_target); } void TurboAssembler::CallRecordWriteStub( Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, - Handle<Code> code_target, Address wasm_target) { - DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress); + int builtin_index, Address wasm_target) { + DCHECK_NE(builtin_index == Builtins::kNoBuiltinId, + wasm_target == kNullAddress); RecordWriteDescriptor descriptor; RegList registers = descriptor.allocatable_registers(); @@ -432,10 +431,14 @@ void TurboAssembler::CallRecordWriteStub( } else { movq(fp_mode_parameter, remembered_set_parameter); } - if (code_target.is_null()) { + if (builtin_index == Builtins::kNoBuiltinId) { // Use {near_call} for direct Wasm call within a module. near_call(wasm_target, RelocInfo::WASM_STUB_CALL); + } else if (options().inline_offheap_trampolines) { + CallBuiltin(builtin_index); } else { + Handle<Code> code_target = + isolate()->builtins()->builtin_handle(Builtins::kRecordWrite); Call(code_target, RelocInfo::CODE_TARGET); } diff --git a/deps/v8/src/codegen/x64/macro-assembler-x64.h b/deps/v8/src/codegen/x64/macro-assembler-x64.h index 8382bf5a287..ea87002b08e 100644 --- a/deps/v8/src/codegen/x64/macro-assembler-x64.h +++ b/deps/v8/src/codegen/x64/macro-assembler-x64.h @@ -693,7 +693,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { void CallRecordWriteStub(Register object, Register address, RememberedSetAction remembered_set_action, - SaveFPRegsMode fp_mode, Handle<Code> code_target, + SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target); }; |