diff options
| author | Efraim Flashner <efraim@flashner.co.il> | 2025-03-12 19:57:30 +0200 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2025-03-13 14:34:59 +0200 |
| commit | babcff42cc5c796e0b16b5204d9bc9a3c0116608 (patch) | |
| tree | 90f70e57139d2b56b081ae65282392ba388d5107 | |
| parent | 368addcbf8de04e88ab1040e2c1c4de24a3fd40c (diff) | |
fixup node-12 riscv64 support
Change-Id: Ic376b07adaba7b4eccfe9879382b87b287ed1e6c
| -rw-r--r-- | gnu/packages/patches/node-12-riscv64-support.patch | 443 |
1 files changed, 211 insertions, 232 deletions
diff --git a/gnu/packages/patches/node-12-riscv64-support.patch b/gnu/packages/patches/node-12-riscv64-support.patch index 95310fb8d2e..ca3d3a11d06 100644 --- a/gnu/packages/patches/node-12-riscv64-support.patch +++ b/gnu/packages/patches/node-12-riscv64-support.patch | |||
| @@ -60,7 +60,7 @@ index e6485a7b383..a557a22de28 100755 | |||
| 60 | 60 | ||
| 61 | rtn = 'ia32' # default | 61 | rtn = 'ia32' # default |
| 62 | diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn | 62 | diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn |
| 63 | index 5c226f4b836..bf8916f5510 100644 | 63 | index 5c226f4b836..cd6eddb155f 100644 |
| 64 | --- a/deps/v8/BUILD.gn | 64 | --- a/deps/v8/BUILD.gn |
| 65 | +++ b/deps/v8/BUILD.gn | 65 | +++ b/deps/v8/BUILD.gn |
| 66 | @@ -627,6 +627,15 @@ config("toolchain") { | 66 | @@ -627,6 +627,15 @@ config("toolchain") { |
| @@ -100,7 +100,7 @@ index 5c226f4b836..bf8916f5510 100644 | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | if (!v8_enable_i18n_support) { | 102 | if (!v8_enable_i18n_support) { |
| 103 | @@ -3244,6 +3258,34 @@ v8_source_set("v8_base_without_compiler") { | 103 | @@ -3244,6 +3258,33 @@ v8_source_set("v8_base_without_compiler") { |
| 104 | "src/regexp/s390/regexp-macro-assembler-s390.h", | 104 | "src/regexp/s390/regexp-macro-assembler-s390.h", |
| 105 | "src/wasm/baseline/s390/liftoff-assembler-s390.h", | 105 | "src/wasm/baseline/s390/liftoff-assembler-s390.h", |
| 106 | ] | 106 | ] |
| @@ -123,7 +123,6 @@ index 5c226f4b836..bf8916f5510 100644 | |||
| 123 | + "src/debug/riscv64/debug-riscv64.cc", | 123 | + "src/debug/riscv64/debug-riscv64.cc", |
| 124 | + "src/deoptimizer/riscv64/deoptimizer-riscv64.cc", | 124 | + "src/deoptimizer/riscv64/deoptimizer-riscv64.cc", |
| 125 | + "src/diagnostics/riscv64/disasm-riscv64.cc", | 125 | + "src/diagnostics/riscv64/disasm-riscv64.cc", |
| 126 | + "src/diagnostics/riscv64/unwinder-riscv64.cc", | ||
| 127 | + "src/execution/riscv64/frame-constants-riscv64.cc", | 126 | + "src/execution/riscv64/frame-constants-riscv64.cc", |
| 128 | + "src/execution/riscv64/frame-constants-riscv64.h", | 127 | + "src/execution/riscv64/frame-constants-riscv64.h", |
| 129 | + "src/execution/riscv64/simulator-riscv64.cc", | 128 | + "src/execution/riscv64/simulator-riscv64.cc", |
| @@ -135,7 +134,7 @@ index 5c226f4b836..bf8916f5510 100644 | |||
| 135 | } | 134 | } |
| 136 | 135 | ||
| 137 | configs = [ ":internal_config" ] | 136 | configs = [ ":internal_config" ] |
| 138 | @@ -3321,7 +3363,8 @@ v8_source_set("v8_base_without_compiler") { | 137 | @@ -3321,7 +3362,8 @@ v8_source_set("v8_base_without_compiler") { |
| 139 | if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel" || | 138 | if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel" || |
| 140 | v8_current_cpu == "mips64" || v8_current_cpu == "mips64el" || | 139 | v8_current_cpu == "mips64" || v8_current_cpu == "mips64el" || |
| 141 | v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" || | 140 | v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" || |
| @@ -145,7 +144,7 @@ index 5c226f4b836..bf8916f5510 100644 | |||
| 145 | libs = [ "atomic" ] | 144 | libs = [ "atomic" ] |
| 146 | } | 145 | } |
| 147 | } | 146 | } |
| 148 | @@ -3639,6 +3682,10 @@ v8_component("v8_libbase") { | 147 | @@ -3639,6 +3681,10 @@ v8_component("v8_libbase") { |
| 149 | ] | 148 | ] |
| 150 | } | 149 | } |
| 151 | 150 | ||
| @@ -4577,10 +4576,10 @@ index 00000000000..b99262cb367 | |||
| 4577 | +#endif // V8_CODEGEN_RISCV64_ASSEMBLER_RISCV64_INL_H_ | 4576 | +#endif // V8_CODEGEN_RISCV64_ASSEMBLER_RISCV64_INL_H_ |
| 4578 | diff --git a/deps/v8/src/codegen/riscv64/assembler-riscv64.cc b/deps/v8/src/codegen/riscv64/assembler-riscv64.cc | 4577 | diff --git a/deps/v8/src/codegen/riscv64/assembler-riscv64.cc b/deps/v8/src/codegen/riscv64/assembler-riscv64.cc |
| 4579 | new file mode 100644 | 4578 | new file mode 100644 |
| 4580 | index 00000000000..c66081657b0 | 4579 | index 00000000000..a54f4ebe392 |
| 4581 | --- /dev/null | 4580 | --- /dev/null |
| 4582 | +++ b/deps/v8/src/codegen/riscv64/assembler-riscv64.cc | 4581 | +++ b/deps/v8/src/codegen/riscv64/assembler-riscv64.cc |
| 4583 | @@ -0,0 +1,3024 @@ | 4582 | @@ -0,0 +1,3026 @@ |
| 4584 | +// Copyright (c) 1994-2006 Sun Microsystems Inc. | 4583 | +// Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 4585 | +// All Rights Reserved. | 4584 | +// All Rights Reserved. |
| 4586 | +// | 4585 | +// |
| @@ -4771,8 +4770,10 @@ index 00000000000..c66081657b0 | |||
| 4771 | + Handle<HeapObject> object; | 4770 | + Handle<HeapObject> object; |
| 4772 | + switch (request.kind()) { | 4771 | + switch (request.kind()) { |
| 4773 | + case HeapObjectRequest::kHeapNumber: | 4772 | + case HeapObjectRequest::kHeapNumber: |
| 4774 | + object = isolate->factory()->NewHeapNumber<AllocationType::kOld>( | 4773 | + object = isolate->factory()->NewHeapNumber(request.heap_number(), |
| 4775 | + request.heap_number()); | 4774 | + AllocationType::kOld); |
| 4775 | + //object = isolate->factory()->NewHeapNumber<AllocationType::kOld>( | ||
| 4776 | + // request.heap_number()); | ||
| 4776 | + break; | 4777 | + break; |
| 4777 | + case HeapObjectRequest::kStringConstant: | 4778 | + case HeapObjectRequest::kStringConstant: |
| 4778 | + const StringConstantBase* str = request.string(); | 4779 | + const StringConstantBase* str = request.string(); |
| @@ -4821,7 +4822,7 @@ index 00000000000..c66081657b0 | |||
| 4821 | + // TODO(jgruber): Consider moving responsibility for proper alignment to | 4822 | + // TODO(jgruber): Consider moving responsibility for proper alignment to |
| 4822 | + // metadata table builders (safepoint, handler, constant pool, code | 4823 | + // metadata table builders (safepoint, handler, constant pool, code |
| 4823 | + // comments). | 4824 | + // comments). |
| 4824 | + DataAlign(Code::kMetadataAlignment); | 4825 | + //DataAlign(Code::kMetadataAlignment); |
| 4825 | + | 4826 | + |
| 4826 | + ForceConstantPoolEmissionWithoutJump(); | 4827 | + ForceConstantPoolEmissionWithoutJump(); |
| 4827 | + | 4828 | + |
| @@ -10301,10 +10302,10 @@ index 00000000000..aad09378f99 | |||
| 10301 | +#endif // V8_TARGET_ARCH_RISCV64 | 10302 | +#endif // V8_TARGET_ARCH_RISCV64 |
| 10302 | diff --git a/deps/v8/src/codegen/riscv64/interface-descriptors-riscv64.cc b/deps/v8/src/codegen/riscv64/interface-descriptors-riscv64.cc | 10303 | diff --git a/deps/v8/src/codegen/riscv64/interface-descriptors-riscv64.cc b/deps/v8/src/codegen/riscv64/interface-descriptors-riscv64.cc |
| 10303 | new file mode 100644 | 10304 | new file mode 100644 |
| 10304 | index 00000000000..b2717d9fa87 | 10305 | index 00000000000..75c855eaeb0 |
| 10305 | --- /dev/null | 10306 | --- /dev/null |
| 10306 | +++ b/deps/v8/src/codegen/riscv64/interface-descriptors-riscv64.cc | 10307 | +++ b/deps/v8/src/codegen/riscv64/interface-descriptors-riscv64.cc |
| 10307 | @@ -0,0 +1,323 @@ | 10308 | @@ -0,0 +1,329 @@ |
| 10308 | +// Copyright 2021 the V8 project authors. All rights reserved. | 10309 | +// Copyright 2021 the V8 project authors. All rights reserved. |
| 10309 | +// Use of this source code is governed by a BSD-style license that can be | 10310 | +// Use of this source code is governed by a BSD-style license that can be |
| 10310 | +// found in the LICENSE file. | 10311 | +// found in the LICENSE file. |
| @@ -10328,6 +10329,7 @@ index 00000000000..b2717d9fa87 | |||
| 10328 | + default_stub_registers); | 10329 | + default_stub_registers); |
| 10329 | +} | 10330 | +} |
| 10330 | + | 10331 | + |
| 10332 | +/* | ||
| 10331 | +void WasmI32AtomicWait32Descriptor::InitializePlatformSpecific( | 10333 | +void WasmI32AtomicWait32Descriptor::InitializePlatformSpecific( |
| 10332 | + CallInterfaceDescriptorData* data) { | 10334 | + CallInterfaceDescriptorData* data) { |
| 10333 | + const Register default_stub_registers[] = {a0, a1, a2, a3}; | 10335 | + const Register default_stub_registers[] = {a0, a1, a2, a3}; |
| @@ -10344,6 +10346,7 @@ index 00000000000..b2717d9fa87 | |||
| 10344 | + data->InitializePlatformSpecific(kParameterCount - kStackArgumentsCount, | 10346 | + data->InitializePlatformSpecific(kParameterCount - kStackArgumentsCount, |
| 10345 | + default_stub_registers); | 10347 | + default_stub_registers); |
| 10346 | +} | 10348 | +} |
| 10349 | +*/ | ||
| 10347 | + | 10350 | + |
| 10348 | +void RecordWriteDescriptor::InitializePlatformSpecific( | 10351 | +void RecordWriteDescriptor::InitializePlatformSpecific( |
| 10349 | + CallInterfaceDescriptorData* data) { | 10352 | + CallInterfaceDescriptorData* data) { |
| @@ -10374,6 +10377,7 @@ index 00000000000..b2717d9fa87 | |||
| 10374 | +} | 10377 | +} |
| 10375 | +const Register FastNewFunctionContextDescriptor::SlotsRegister() { return a0; } | 10378 | +const Register FastNewFunctionContextDescriptor::SlotsRegister() { return a0; } |
| 10376 | + | 10379 | + |
| 10380 | +/* | ||
| 10377 | +void DynamicCheckMapsDescriptor::InitializePlatformSpecific( | 10381 | +void DynamicCheckMapsDescriptor::InitializePlatformSpecific( |
| 10378 | + CallInterfaceDescriptorData* data) { | 10382 | + CallInterfaceDescriptorData* data) { |
| 10379 | + Register default_stub_registers[] = {kReturnRegister0, a1, a2, a3, cp}; | 10383 | + Register default_stub_registers[] = {kReturnRegister0, a1, a2, a3, cp}; |
| @@ -10385,6 +10389,7 @@ index 00000000000..b2717d9fa87 | |||
| 10385 | + arraysize(default_stub_registers)); | 10389 | + arraysize(default_stub_registers)); |
| 10386 | + data->InitializePlatformSpecific(kParameterCount, default_stub_registers); | 10390 | + data->InitializePlatformSpecific(kParameterCount, default_stub_registers); |
| 10387 | +} | 10391 | +} |
| 10392 | +*/ | ||
| 10388 | + | 10393 | + |
| 10389 | +const Register LoadDescriptor::ReceiverRegister() { return a1; } | 10394 | +const Register LoadDescriptor::ReceiverRegister() { return a1; } |
| 10390 | +const Register LoadDescriptor::NameRegister() { return a2; } | 10395 | +const Register LoadDescriptor::NameRegister() { return a2; } |
| @@ -10392,10 +10397,12 @@ index 00000000000..b2717d9fa87 | |||
| 10392 | + | 10397 | + |
| 10393 | +const Register LoadWithVectorDescriptor::VectorRegister() { return a3; } | 10398 | +const Register LoadWithVectorDescriptor::VectorRegister() { return a3; } |
| 10394 | + | 10399 | + |
| 10400 | +/* | ||
| 10395 | +const Register | 10401 | +const Register |
| 10396 | +LoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() { | 10402 | +LoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() { |
| 10397 | + return a4; | 10403 | + return a4; |
| 10398 | +} | 10404 | +} |
| 10405 | +*/ | ||
| 10399 | + | 10406 | + |
| 10400 | +const Register StoreDescriptor::ReceiverRegister() { return a1; } | 10407 | +const Register StoreDescriptor::ReceiverRegister() { return a1; } |
| 10401 | +const Register StoreDescriptor::NameRegister() { return a2; } | 10408 | +const Register StoreDescriptor::NameRegister() { return a2; } |
| @@ -10630,10 +10637,10 @@ index 00000000000..b2717d9fa87 | |||
| 10630 | +#endif // V8_TARGET_ARCH_RISCV64 | 10637 | +#endif // V8_TARGET_ARCH_RISCV64 |
| 10631 | diff --git a/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc | 10638 | diff --git a/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc |
| 10632 | new file mode 100644 | 10639 | new file mode 100644 |
| 10633 | index 00000000000..ade49800c6b | 10640 | index 00000000000..e9d03526c06 |
| 10634 | --- /dev/null | 10641 | --- /dev/null |
| 10635 | +++ b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc | 10642 | +++ b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc |
| 10636 | @@ -0,0 +1,4589 @@ | 10643 | @@ -0,0 +1,4591 @@ |
| 10637 | +// Copyright 2021 the V8 project authors. All rights reserved. | 10644 | +// Copyright 2021 the V8 project authors. All rights reserved. |
| 10638 | +// Use of this source code is governed by a BSD-style license that can be | 10645 | +// Use of this source code is governed by a BSD-style license that can be |
| 10639 | +// found in the LICENSE file. | 10646 | +// found in the LICENSE file. |
| @@ -10652,6 +10659,7 @@ index 00000000000..ade49800c6b | |||
| 10652 | +#include "src/codegen/register-configuration.h" | 10659 | +#include "src/codegen/register-configuration.h" |
| 10653 | +#include "src/debug/debug.h" | 10660 | +#include "src/debug/debug.h" |
| 10654 | +#include "src/execution/frames-inl.h" | 10661 | +#include "src/execution/frames-inl.h" |
| 10662 | +#include "src/heap/heap-inl.h" // For MemoryChunk. | ||
| 10655 | +#include "src/init/bootstrapper.h" | 10663 | +#include "src/init/bootstrapper.h" |
| 10656 | +#include "src/logging/counters.h" | 10664 | +#include "src/logging/counters.h" |
| 10657 | +#include "src/objects/heap-number.h" | 10665 | +#include "src/objects/heap-number.h" |
| @@ -14062,7 +14070,7 @@ index 00000000000..ade49800c6b | |||
| 14062 | + // If the expected parameter count is equal to the adaptor sentinel, no need | 14070 | + // If the expected parameter count is equal to the adaptor sentinel, no need |
| 14063 | + // to push undefined value as arguments. | 14071 | + // to push undefined value as arguments. |
| 14064 | + Branch(®ular_invoke, eq, expected_parameter_count, | 14072 | + Branch(®ular_invoke, eq, expected_parameter_count, |
| 14065 | + Operand(kDontAdaptArgumentsSentinel)); | 14073 | + Operand(static_cast<uint16_t>(-1))); |
| 14066 | + | 14074 | + |
| 14067 | + // If overapplication or if the actual argument count is equal to the | 14075 | + // If overapplication or if the actual argument count is equal to the |
| 14068 | + // formal parameter count, no need to push extra undefined values. | 14076 | + // formal parameter count, no need to push extra undefined values. |
| @@ -14346,8 +14354,8 @@ index 00000000000..ade49800c6b | |||
| 14346 | + // smarter. | 14354 | + // smarter. |
| 14347 | + PrepareCEntryArgs(f->nargs); | 14355 | + PrepareCEntryArgs(f->nargs); |
| 14348 | + PrepareCEntryFunction(ExternalReference::Create(f)); | 14356 | + PrepareCEntryFunction(ExternalReference::Create(f)); |
| 14349 | + DCHECK(!AreAliased(centry, a0, a1)); | 14357 | + //DCHECK(!AreAliased(centry, a0, a1)); |
| 14350 | + Daddu(centry, centry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 14358 | + //Daddu(centry, centry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 14351 | + Call(centry); | 14359 | + Call(centry); |
| 14352 | +} | 14360 | +} |
| 14353 | + | 14361 | + |
| @@ -14439,8 +14447,8 @@ index 00000000000..ade49800c6b | |||
| 14439 | +// ----------------------------------------------------------------------------- | 14447 | +// ----------------------------------------------------------------------------- |
| 14440 | +// Debugging. | 14448 | +// Debugging. |
| 14441 | + | 14449 | + |
| 14442 | +void TurboAssembler::Trap() { stop(); } | 14450 | +//void TurboAssembler::Trap() { stop(); } |
| 14443 | +void TurboAssembler::DebugBreak() { stop(); } | 14451 | +//void TurboAssembler::DebugBreak() { stop(); } |
| 14444 | + | 14452 | + |
| 14445 | +void TurboAssembler::Assert(Condition cc, AbortReason reason, Register rs, | 14453 | +void TurboAssembler::Assert(Condition cc, AbortReason reason, Register rs, |
| 14446 | + Operand rt) { | 14454 | + Operand rt) { |
| @@ -14514,7 +14522,7 @@ index 00000000000..ade49800c6b | |||
| 14514 | +void MacroAssembler::LoadNativeContextSlot(int index, Register dst) { | 14522 | +void MacroAssembler::LoadNativeContextSlot(int index, Register dst) { |
| 14515 | + LoadMap(dst, cp); | 14523 | + LoadMap(dst, cp); |
| 14516 | + Ld(dst, | 14524 | + Ld(dst, |
| 14517 | + FieldMemOperand(dst, Map::kConstructorOrBackPointerOrNativeContextOffset)); | 14525 | + FieldMemOperand(dst, Map::kConstructorOrBackPointerOffset)); |
| 14518 | + Ld(dst, MemOperand(dst, Context::SlotOffset(index))); | 14526 | + Ld(dst, MemOperand(dst, Context::SlotOffset(index))); |
| 14519 | +} | 14527 | +} |
| 14520 | + | 14528 | + |
| @@ -14776,27 +14784,25 @@ index 00000000000..ade49800c6b | |||
| 14776 | + | 14784 | + |
| 14777 | + LoadMap(kScratchReg, object); | 14785 | + LoadMap(kScratchReg, object); |
| 14778 | + Lbu(kScratchReg, FieldMemOperand(kScratchReg, Map::kBitFieldOffset)); | 14786 | + Lbu(kScratchReg, FieldMemOperand(kScratchReg, Map::kBitFieldOffset)); |
| 14779 | + And(kScratchReg, kScratchReg, Operand(Map::Bits1::IsConstructorBit::kMask)); | 14787 | + And(kScratchReg, kScratchReg, Operand(Map::IsConstructorBit::kMask)); |
| 14780 | + Check(ne, AbortReason::kOperandIsNotAConstructor, kScratchReg, | 14788 | + Check(ne, AbortReason::kOperandIsNotAConstructor, kScratchReg, |
| 14781 | + Operand(zero_reg)); | 14789 | + Operand(zero_reg)); |
| 14782 | + } | 14790 | + } |
| 14783 | +} | 14791 | +} |
| 14784 | + | 14792 | + |
| 14785 | +void MacroAssembler::AssertFunction(Register object) { | 14793 | +void MacroAssembler::AssertFunction(Register object) { |
| 14786 | + if (emit_debug_code()) { | 14794 | + //if (emit_debug_code()) { |
| 14787 | + BlockTrampolinePoolScope block_trampoline_pool(this); | 14795 | + // BlockTrampolinePoolScope block_trampoline_pool(this); |
| 14788 | + STATIC_ASSERT(kSmiTag == 0); | 14796 | + // STATIC_ASSERT(kSmiTag == 0); |
| 14789 | + DCHECK(object != kScratchReg); | 14797 | + // DCHECK(object != kScratchReg); |
| 14790 | + SmiTst(object, kScratchReg); | 14798 | + // SmiTst(object, kScratchReg); |
| 14791 | + Check(ne, AbortReason::kOperandIsASmiAndNotAFunction, kScratchReg, | 14799 | + // Check(ne, AbortReason::kOperandIsASmiAndNotAFunction, kScratchReg, |
| 14792 | + Operand(zero_reg)); | 14800 | + // Operand(zero_reg)); |
| 14793 | + push(object); | 14801 | + // push(object); |
| 14794 | + LoadMap(object, object); | 14802 | + // CompareObjectType(object, object, object, JS_FUNCTION_TYPE); |
| 14795 | + GetInstanceTypeRange(object, object, FIRST_JS_FUNCTION_TYPE, t5); | 14803 | + // pop(object); |
| 14796 | + Check(Uless_equal, AbortReason::kOperandIsNotAFunction, t5, | 14804 | + // Check(eq, AbortReason::kOperandIsNotAFunction); |
| 14797 | + Operand(LAST_JS_FUNCTION_TYPE - FIRST_JS_FUNCTION_TYPE)); | 14805 | + //} |
| 14798 | + pop(object); | ||
| 14799 | + } | ||
| 14800 | +} | 14806 | +} |
| 14801 | + | 14807 | + |
| 14802 | +void MacroAssembler::AssertBoundFunction(Register object) { | 14808 | +void MacroAssembler::AssertBoundFunction(Register object) { |
| @@ -15059,10 +15065,10 @@ index 00000000000..ade49800c6b | |||
| 15059 | + | 15065 | + |
| 15060 | + // See x64 code for reasoning about how to address the isolate data fields. | 15066 | + // See x64 code for reasoning about how to address the isolate data fields. |
| 15061 | + if (root_array_available()) { | 15067 | + if (root_array_available()) { |
| 15062 | + Sd(pc_scratch, MemOperand(kRootRegister, | 15068 | + //Sd(pc_scratch, MemOperand(kRootRegister, |
| 15063 | + IsolateData::fast_c_call_caller_pc_offset())); | 15069 | + // IsolateData::fast_c_call_caller_pc_offset())); |
| 15064 | + Sd(fp, MemOperand(kRootRegister, | 15070 | + //Sd(fp, MemOperand(kRootRegister, |
| 15065 | + IsolateData::fast_c_call_caller_fp_offset())); | 15071 | + // IsolateData::fast_c_call_caller_fp_offset())); |
| 15066 | + } else { | 15072 | + } else { |
| 15067 | + DCHECK_NOT_NULL(isolate()); | 15073 | + DCHECK_NOT_NULL(isolate()); |
| 15068 | + li(scratch, ExternalReference::fast_c_call_caller_pc_address(isolate())); | 15074 | + li(scratch, ExternalReference::fast_c_call_caller_pc_address(isolate())); |
| @@ -15096,7 +15102,7 @@ index 00000000000..ade49800c6b | |||
| 15096 | +void TurboAssembler::CheckPageFlag(Register object, Register scratch, int mask, | 15102 | +void TurboAssembler::CheckPageFlag(Register object, Register scratch, int mask, |
| 15097 | + Condition cc, Label* condition_met) { | 15103 | + Condition cc, Label* condition_met) { |
| 15098 | + And(scratch, object, Operand(~kPageAlignmentMask)); | 15104 | + And(scratch, object, Operand(~kPageAlignmentMask)); |
| 15099 | + Ld(scratch, MemOperand(scratch, BasicMemoryChunk::kFlagsOffset)); | 15105 | + Ld(scratch, MemOperand(scratch, MemoryChunk::kFlagsOffset)); |
| 15100 | + And(scratch, scratch, Operand(mask)); | 15106 | + And(scratch, scratch, Operand(mask)); |
| 15101 | + Branch(condition_met, cc, scratch, Operand(zero_reg)); | 15107 | + Branch(condition_met, cc, scratch, Operand(zero_reg)); |
| 15102 | +} | 15108 | +} |
| @@ -15144,12 +15150,15 @@ index 00000000000..ade49800c6b | |||
| 15144 | +//void TurboAssembler::CallForDeoptimization(Builtins::Name target, int, | 15150 | +//void TurboAssembler::CallForDeoptimization(Builtins::Name target, int, |
| 15145 | +// Label* exit, DeoptimizeKind kind, | 15151 | +// Label* exit, DeoptimizeKind kind, |
| 15146 | +// Label* ret, Label*) { | 15152 | +// Label* ret, Label*) { |
| 15147 | + UseScratchRegisterScope temps(this); | 15153 | + DCHECK_LE(deopt_id, 0xFFFF); |
| 15148 | + BlockTrampolinePoolScope block_trampoline_pool(this); | 15154 | + li(kRootRegister, deopt_id); |
| 15149 | + Register scratch = temps.Acquire(); | 15155 | + Call(target, RelocInfo::RUNTIME_ENTRY); |
| 15150 | + Ld(scratch, | 15156 | + //UseScratchRegisterScope temps(this); |
| 15151 | + MemOperand(kRootRegister, IsolateData::builtin_entry_slot_offset(target))); | 15157 | + //BlockTrampolinePoolScope block_trampoline_pool(this); |
| 15152 | + Call(scratch); | 15158 | + //Register scratch = temps.Acquire(); |
| 15159 | + //Ld(scratch, | ||
| 15160 | + // MemOperand(kRootRegister, IsolateData::builtin_entry_slot_offset(target))); | ||
| 15161 | + //Call(scratch); | ||
| 15153 | + //DCHECK_EQ(SizeOfCodeGeneratedSince(exit), | 15162 | + //DCHECK_EQ(SizeOfCodeGeneratedSince(exit), |
| 15154 | + // (kind == DeoptimizeKind::kLazy) | 15163 | + // (kind == DeoptimizeKind::kLazy) |
| 15155 | + // ? Deoptimizer::kLazyDeoptExitSize | 15164 | + // ? Deoptimizer::kLazyDeoptExitSize |
| @@ -15225,10 +15234,10 @@ index 00000000000..ade49800c6b | |||
| 15225 | +#endif // V8_TARGET_ARCH_RISCV64 | 15234 | +#endif // V8_TARGET_ARCH_RISCV64 |
| 15226 | diff --git a/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.h b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.h | 15235 | diff --git a/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.h b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.h |
| 15227 | new file mode 100644 | 15236 | new file mode 100644 |
| 15228 | index 00000000000..9f7d65ce6bd | 15237 | index 00000000000..eebccd931d9 |
| 15229 | --- /dev/null | 15238 | --- /dev/null |
| 15230 | +++ b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.h | 15239 | +++ b/deps/v8/src/codegen/riscv64/macro-assembler-riscv64.h |
| 15231 | @@ -0,0 +1,1217 @@ | 15240 | @@ -0,0 +1,1219 @@ |
| 15232 | +// Copyright 2021 the V8 project authors. All rights reserved. | 15241 | +// Copyright 2021 the V8 project authors. All rights reserved. |
| 15233 | +// Use of this source code is governed by a BSD-style license that can be | 15242 | +// Use of this source code is governed by a BSD-style license that can be |
| 15234 | +// found in the LICENSE file. | 15243 | +// found in the LICENSE file. |
| @@ -15386,6 +15395,8 @@ index 00000000000..9f7d65ce6bd | |||
| 15386 | +#undef COND_TYPED_ARGS | 15395 | +#undef COND_TYPED_ARGS |
| 15387 | +#undef COND_ARGS | 15396 | +#undef COND_ARGS |
| 15388 | + | 15397 | + |
| 15398 | + inline void NegateBool(Register rd, Register rs) { Xor(rd, rs, 1); } | ||
| 15399 | + | ||
| 15389 | + // Compare float, if any operand is NaN, result is false except for NE | 15400 | + // Compare float, if any operand is NaN, result is false except for NE |
| 15390 | + void CompareF32(Register rd, FPUCondition cc, FPURegister cmp1, | 15401 | + void CompareF32(Register rd, FPUCondition cc, FPURegister cmp1, |
| 15391 | + FPURegister cmp2); | 15402 | + FPURegister cmp2); |
| @@ -16849,10 +16860,10 @@ index d565a469639..837d192afb3 100644 | |||
| 16849 | #if !V8_TARGET_ARCH_ARM64 | 16860 | #if !V8_TARGET_ARCH_ARM64 |
| 16850 | diff --git a/deps/v8/src/compiler/backend/riscv64/code-generator-riscv64.cc b/deps/v8/src/compiler/backend/riscv64/code-generator-riscv64.cc | 16861 | diff --git a/deps/v8/src/compiler/backend/riscv64/code-generator-riscv64.cc b/deps/v8/src/compiler/backend/riscv64/code-generator-riscv64.cc |
| 16851 | new file mode 100644 | 16862 | new file mode 100644 |
| 16852 | index 00000000000..f626c36544c | 16863 | index 00000000000..522647a925f |
| 16853 | --- /dev/null | 16864 | --- /dev/null |
| 16854 | +++ b/deps/v8/src/compiler/backend/riscv64/code-generator-riscv64.cc | 16865 | +++ b/deps/v8/src/compiler/backend/riscv64/code-generator-riscv64.cc |
| 16855 | @@ -0,0 +1,2774 @@ | 16866 | @@ -0,0 +1,2779 @@ |
| 16856 | +// Copyright 2021 the V8 project authors. All rights reserved. | 16867 | +// Copyright 2021 the V8 project authors. All rights reserved. |
| 16857 | +// Use of this source code is governed by a BSD-style license that can be | 16868 | +// Use of this source code is governed by a BSD-style license that can be |
| 16858 | +// found in the LICENSE file. | 16869 | +// found in the LICENSE file. |
| @@ -16867,7 +16878,9 @@ index 00000000000..f626c36544c | |||
| 16867 | +#include "src/compiler/backend/gap-resolver.h" | 16878 | +#include "src/compiler/backend/gap-resolver.h" |
| 16868 | +#include "src/compiler/node-matchers.h" | 16879 | +#include "src/compiler/node-matchers.h" |
| 16869 | +#include "src/compiler/osr.h" | 16880 | +#include "src/compiler/osr.h" |
| 16881 | +#include "src/heap/heap-inl.h" // crbug.com/v8/8499 | ||
| 16870 | +#include "src/wasm/wasm-code-manager.h" | 16882 | +#include "src/wasm/wasm-code-manager.h" |
| 16883 | +#include "src/wasm/wasm-objects.h" | ||
| 16871 | + | 16884 | + |
| 16872 | +namespace v8 { | 16885 | +namespace v8 { |
| 16873 | +namespace internal { | 16886 | +namespace internal { |
| @@ -17034,7 +17047,7 @@ index 00000000000..f626c36544c | |||
| 17034 | + // Just encode the stub index. This will be patched when the code | 17047 | + // Just encode the stub index. This will be patched when the code |
| 17035 | + // is added to the native module and copied into wasm code space. | 17048 | + // is added to the native module and copied into wasm code space. |
| 17036 | + __ CallRecordWriteStub(object_, scratch1_, remembered_set_action, | 17049 | + __ CallRecordWriteStub(object_, scratch1_, remembered_set_action, |
| 17037 | + save_fp_mode, wasm::WasmCode::kRecordWrite); | 17050 | + save_fp_mode, wasm::WasmCode::kWasmRecordWrite); |
| 17038 | + } else { | 17051 | + } else { |
| 17039 | + __ CallRecordWriteStub(object_, scratch1_, remembered_set_action, | 17052 | + __ CallRecordWriteStub(object_, scratch1_, remembered_set_action, |
| 17040 | + save_fp_mode); | 17053 | + save_fp_mode); |
| @@ -17147,10 +17160,10 @@ index 00000000000..f626c36544c | |||
| 17147 | + InstructionCode opcode, Instruction* instr, | 17160 | + InstructionCode opcode, Instruction* instr, |
| 17148 | + RiscvOperandConverter const& i) { | 17161 | + RiscvOperandConverter const& i) { |
| 17149 | + const MemoryAccessMode access_mode = | 17162 | + const MemoryAccessMode access_mode = |
| 17150 | + static_cast<MemoryAccessMode>(MiscField::decode(opcode)); | 17163 | + static_cast<MemoryAccessMode>(MiscField::decode(instr->opcode())); |
| 17151 | + if (access_mode == kMemoryAccessPoisoned) { | 17164 | + if (access_mode == kMemoryAccessPoisoned) { |
| 17152 | + Register value = i.OutputRegister(); | 17165 | + Register value = i.OutputRegister(); |
| 17153 | + codegen->tasm()->And(value, value, kSpeculationPoisonRegister); | 17166 | + codegen->tasm()->AndP(value, kSpeculationPoisonRegister); |
| 17154 | + } | 17167 | + } |
| 17155 | +} | 17168 | +} |
| 17156 | + | 17169 | + |
| @@ -17574,9 +17587,9 @@ index 00000000000..f626c36544c | |||
| 17574 | + __ CallCFunction(func, num_parameters); | 17587 | + __ CallCFunction(func, num_parameters); |
| 17575 | + } | 17588 | + } |
| 17576 | + __ bind(&after_call); | 17589 | + __ bind(&after_call); |
| 17577 | + if (isWasmCapiFunction) { | 17590 | + //if (isWasmCapiFunction) { |
| 17578 | + RecordSafepoint(instr->reference_map()); | 17591 | + // RecordSafepoint(instr->reference_map()); |
| 17579 | + } | 17592 | + //} |
| 17580 | + | 17593 | + |
| 17581 | + frame_access_state()->SetFrameAccessToDefault(); | 17594 | + frame_access_state()->SetFrameAccessToDefault(); |
| 17582 | + // Ideally, we should decrement SP delta to match the change of stack | 17595 | + // Ideally, we should decrement SP delta to match the change of stack |
| @@ -17619,7 +17632,7 @@ index 00000000000..f626c36544c | |||
| 17619 | + __ stop(); | 17632 | + __ stop(); |
| 17620 | + break; | 17633 | + break; |
| 17621 | + case kArchDebugBreak: | 17634 | + case kArchDebugBreak: |
| 17622 | + __ DebugBreak(); | 17635 | + __ stop(); |
| 17623 | + break; | 17636 | + break; |
| 17624 | + case kArchComment: | 17637 | + case kArchComment: |
| 17625 | + __ RecordComment(reinterpret_cast<const char*>(i.InputInt64(0))); | 17638 | + __ RecordComment(reinterpret_cast<const char*>(i.InputInt64(0))); |
| @@ -17630,7 +17643,7 @@ index 00000000000..f626c36544c | |||
| 17630 | + break; | 17643 | + break; |
| 17631 | + case kArchDeoptimize: { | 17644 | + case kArchDeoptimize: { |
| 17632 | + DeoptimizationExit* exit = | 17645 | + DeoptimizationExit* exit = |
| 17633 | + BuildTranslation(instr, -1, 0, 0, OutputFrameStateCombine::Ignore()); | 17646 | + BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
| 17634 | + __ Branch(exit->label()); | 17647 | + __ Branch(exit->label()); |
| 17635 | + break; | 17648 | + break; |
| 17636 | + } | 17649 | + } |
| @@ -17640,9 +17653,9 @@ index 00000000000..f626c36544c | |||
| 17640 | + case kArchStackPointerGreaterThan: | 17653 | + case kArchStackPointerGreaterThan: |
| 17641 | + // Pseudo-instruction used for cmp/branch. No opcode emitted here. | 17654 | + // Pseudo-instruction used for cmp/branch. No opcode emitted here. |
| 17642 | + break; | 17655 | + break; |
| 17643 | + case kArchStackCheckOffset: | 17656 | + //case kArchStackCheckOffset: |
| 17644 | + __ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset())); | 17657 | + // __ Move(i.OutputRegister(), Smi::FromInt(GetStackCheckOffset())); |
| 17645 | + break; | 17658 | + // break; |
| 17646 | + case kArchFramePointer: | 17659 | + case kArchFramePointer: |
| 17647 | + __ Move(i.OutputRegister(), fp); | 17660 | + __ Move(i.OutputRegister(), fp); |
| 17648 | + break; | 17661 | + break; |
| @@ -17665,9 +17678,9 @@ index 00000000000..f626c36544c | |||
| 17665 | + Register value = i.InputRegister(2); | 17678 | + Register value = i.InputRegister(2); |
| 17666 | + Register scratch0 = i.TempRegister(0); | 17679 | + Register scratch0 = i.TempRegister(0); |
| 17667 | + Register scratch1 = i.TempRegister(1); | 17680 | + Register scratch1 = i.TempRegister(1); |
| 17668 | + auto ool = zone()->New<OutOfLineRecordWrite>(this, object, index, value, | 17681 | + auto ool = new (zone()) |
| 17669 | + scratch0, scratch1, mode, | 17682 | + OutOfLineRecordWrite(this, object, index, value, scratch0, scratch1, |
| 17670 | + DetermineStubCallMode()); | 17683 | + mode, DetermineStubCallMode()); |
| 17671 | + __ Add64(kScratchReg, object, index); | 17684 | + __ Add64(kScratchReg, object, index); |
| 17672 | + __ Sd(value, MemOperand(kScratchReg)); | 17685 | + __ Sd(value, MemOperand(kScratchReg)); |
| 17673 | + __ CheckPageFlag(object, scratch0, | 17686 | + __ CheckPageFlag(object, scratch0, |
| @@ -18758,12 +18771,12 @@ index 00000000000..f626c36544c | |||
| 18758 | + __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); | 18771 | + __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); |
| 18759 | + } else if (instr->arch_opcode() == kArchStackPointerGreaterThan) { | 18772 | + } else if (instr->arch_opcode() == kArchStackPointerGreaterThan) { |
| 18760 | + cc = FlagsConditionToConditionCmp(condition); | 18773 | + cc = FlagsConditionToConditionCmp(condition); |
| 18761 | + Register lhs_register = sp; | 18774 | + //Register lhs_register = sp; |
| 18762 | + uint32_t offset; | 18775 | + //uint32_t offset; |
| 18763 | + if (gen->ShouldApplyOffsetToStackCheck(instr, &offset)) { | 18776 | + //if (gen->ShouldApplyOffsetToStackCheck(instr, &offset)) { |
| 18764 | + lhs_register = i.TempRegister(0); | 18777 | + // lhs_register = i.TempRegister(0); |
| 18765 | + __ Sub64(lhs_register, sp, offset); | 18778 | + // __ Sub64(lhs_register, sp, offset); |
| 18766 | + } | 18779 | + //} |
| 18767 | + __ Branch(tlabel, cc, lhs_register, Operand(i.InputRegister(0))); | 18780 | + __ Branch(tlabel, cc, lhs_register, Operand(i.InputRegister(0))); |
| 18768 | + } else if (instr->arch_opcode() == kRiscvCmpS || | 18781 | + } else if (instr->arch_opcode() == kRiscvCmpS || |
| 18769 | + instr->arch_opcode() == kRiscvCmpD) { | 18782 | + instr->arch_opcode() == kRiscvCmpD) { |
| @@ -18926,7 +18939,7 @@ index 00000000000..f626c36544c | |||
| 18926 | + __ PrepareCallCFunction(0, 0, cp); | 18939 | + __ PrepareCallCFunction(0, 0, cp); |
| 18927 | + __ CallCFunction( | 18940 | + __ CallCFunction( |
| 18928 | + ExternalReference::wasm_call_trap_callback_for_testing(), 0); | 18941 | + ExternalReference::wasm_call_trap_callback_for_testing(), 0); |
| 18929 | + __ LeaveFrame(StackFrame::WASM); | 18942 | + __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 18930 | + auto call_descriptor = gen_->linkage()->GetIncomingDescriptor(); | 18943 | + auto call_descriptor = gen_->linkage()->GetIncomingDescriptor(); |
| 18931 | + int pop_count = | 18944 | + int pop_count = |
| 18932 | + static_cast<int>(call_descriptor->StackParameterCount()); | 18945 | + static_cast<int>(call_descriptor->StackParameterCount()); |
| @@ -18940,8 +18953,8 @@ index 00000000000..f626c36544c | |||
| 18940 | + // is added to the native module and copied into wasm code space. | 18953 | + // is added to the native module and copied into wasm code space. |
| 18941 | + __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); | 18954 | + __ Call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); |
| 18942 | + ReferenceMap* reference_map = | 18955 | + ReferenceMap* reference_map = |
| 18943 | + gen_->zone()->New<ReferenceMap>(gen_->zone()); | 18956 | + new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 18944 | + gen_->RecordSafepoint(reference_map); | 18957 | + gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); |
| 18945 | + if (FLAG_debug_code) { | 18958 | + if (FLAG_debug_code) { |
| 18946 | + __ stop(); | 18959 | + __ stop(); |
| 18947 | + } | 18960 | + } |
| @@ -18950,7 +18963,7 @@ index 00000000000..f626c36544c | |||
| 18950 | + Instruction* instr_; | 18963 | + Instruction* instr_; |
| 18951 | + CodeGenerator* gen_; | 18964 | + CodeGenerator* gen_; |
| 18952 | + }; | 18965 | + }; |
| 18953 | + auto ool = zone()->New<OutOfLineTrap>(this, instr); | 18966 | + auto ool = new (zone()) OutOfLineTrap(this, instr); |
| 18954 | + Label* tlabel = ool->entry(); | 18967 | + Label* tlabel = ool->entry(); |
| 18955 | + AssembleBranchToLabels(this, tasm(), instr, condition, tlabel, nullptr, true); | 18968 | + AssembleBranchToLabels(this, tasm(), instr, condition, tlabel, nullptr, true); |
| 18956 | +} | 18969 | +} |
| @@ -19235,8 +19248,8 @@ index 00000000000..f626c36544c | |||
| 19235 | + | 19248 | + |
| 19236 | + __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); | 19249 | + __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); |
| 19237 | + // We come from WebAssembly, there are no references for the GC. | 19250 | + // We come from WebAssembly, there are no references for the GC. |
| 19238 | + ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone()); | 19251 | + ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); |
| 19239 | + RecordSafepoint(reference_map); | 19252 | + RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); |
| 19240 | + if (FLAG_debug_code) { | 19253 | + if (FLAG_debug_code) { |
| 19241 | + __ stop(); | 19254 | + __ stop(); |
| 19242 | + } | 19255 | + } |
| @@ -19300,6 +19313,7 @@ index 00000000000..f626c36544c | |||
| 19300 | + | 19313 | + |
| 19301 | + // {aditional_pop_count} is only greater than zero if {parameter_count = 0}. | 19314 | + // {aditional_pop_count} is only greater than zero if {parameter_count = 0}. |
| 19302 | + // Check RawMachineAssembler::PopAndReturn. | 19315 | + // Check RawMachineAssembler::PopAndReturn. |
| 19316 | + /* | ||
| 19303 | + if (parameter_count != 0) { | 19317 | + if (parameter_count != 0) { |
| 19304 | + if (additional_pop_count->IsImmediate()) { | 19318 | + if (additional_pop_count->IsImmediate()) { |
| 19305 | + DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0); | 19319 | + DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0); |
| @@ -19309,6 +19323,7 @@ index 00000000000..f626c36544c | |||
| 19309 | + Operand(static_cast<int64_t>(0))); | 19323 | + Operand(static_cast<int64_t>(0))); |
| 19310 | + } | 19324 | + } |
| 19311 | + } | 19325 | + } |
| 19326 | + */ | ||
| 19312 | + | 19327 | + |
| 19313 | + // Functions with JS linkage have at least one parameter (the receiver). | 19328 | + // Functions with JS linkage have at least one parameter (the receiver). |
| 19314 | + // If {parameter_count} == 0, it means it is a builtin with | 19329 | + // If {parameter_count} == 0, it means it is a builtin with |
| @@ -19332,10 +19347,10 @@ index 00000000000..f626c36544c | |||
| 19332 | + __ bind(&return_label_); | 19347 | + __ bind(&return_label_); |
| 19333 | + } | 19348 | + } |
| 19334 | + } | 19349 | + } |
| 19335 | + if (drop_jsargs) { | 19350 | + //if (drop_jsargs) { |
| 19336 | + // Get the actual argument count | 19351 | + // // Get the actual argument count |
| 19337 | + __ Ld(t0, MemOperand(fp, StandardFrameConstants::kArgCOffset)); | 19352 | + // __ Ld(t0, MemOperand(fp, StandardFrameConstants::kArgCOffset)); |
| 19338 | + } | 19353 | + //} |
| 19339 | + AssembleDeconstructFrame(); | 19354 | + AssembleDeconstructFrame(); |
| 19340 | + } | 19355 | + } |
| 19341 | + if (drop_jsargs) { | 19356 | + if (drop_jsargs) { |
| @@ -19367,8 +19382,9 @@ index 00000000000..f626c36544c | |||
| 19367 | + | 19382 | + |
| 19368 | +void CodeGenerator::FinishCode() {} | 19383 | +void CodeGenerator::FinishCode() {} |
| 19369 | + | 19384 | + |
| 19370 | +void CodeGenerator::PrepareForDeoptimizationExits( | 19385 | +void CodeGenerator::PrepareForDeoptimizationExits(int deopt_count) {} |
| 19371 | + ZoneDeque<DeoptimizationExit*>* exits) {} | 19386 | +//void CodeGenerator::PrepareForDeoptimizationExits( |
| 19387 | +// ZoneDeque<DeoptimizationExit*>* exits) {} | ||
| 19372 | + | 19388 | + |
| 19373 | +void CodeGenerator::AssembleMove(InstructionOperand* source, | 19389 | +void CodeGenerator::AssembleMove(InstructionOperand* source, |
| 19374 | + InstructionOperand* destination) { | 19390 | + InstructionOperand* destination) { |
| @@ -21667,10 +21683,10 @@ index 00000000000..fdc13469026 | |||
| 21667 | +} // namespace v8 | 21683 | +} // namespace v8 |
| 21668 | diff --git a/deps/v8/src/compiler/backend/riscv64/instruction-selector-riscv64.cc b/deps/v8/src/compiler/backend/riscv64/instruction-selector-riscv64.cc | 21684 | diff --git a/deps/v8/src/compiler/backend/riscv64/instruction-selector-riscv64.cc b/deps/v8/src/compiler/backend/riscv64/instruction-selector-riscv64.cc |
| 21669 | new file mode 100644 | 21685 | new file mode 100644 |
| 21670 | index 00000000000..4d86fd02a32 | 21686 | index 00000000000..90376ff1b16 |
| 21671 | --- /dev/null | 21687 | --- /dev/null |
| 21672 | +++ b/deps/v8/src/compiler/backend/riscv64/instruction-selector-riscv64.cc | 21688 | +++ b/deps/v8/src/compiler/backend/riscv64/instruction-selector-riscv64.cc |
| 21673 | @@ -0,0 +1,3034 @@ | 21689 | @@ -0,0 +1,3011 @@ |
| 21674 | +// Copyright 2021 the V8 project authors. All rights reserved. | 21690 | +// Copyright 2021 the V8 project authors. All rights reserved. |
| 21675 | +// Use of this source code is governed by a BSD-style license that can be | 21691 | +// Use of this source code is governed by a BSD-style license that can be |
| 21676 | +// found in the LICENSE file. | 21692 | +// found in the LICENSE file. |
| @@ -22054,10 +22070,11 @@ index 00000000000..4d86fd02a32 | |||
| 22054 | + } | 22070 | + } |
| 22055 | +} | 22071 | +} |
| 22056 | + | 22072 | + |
| 22057 | +void InstructionSelector::VisitStoreLane(Node* node) { UNIMPLEMENTED(); } | 22073 | +//void InstructionSelector::VisitStoreLane(Node* node) { UNIMPLEMENTED(); } |
| 22058 | + | 22074 | + |
| 22059 | +void InstructionSelector::VisitLoadLane(Node* node) { UNIMPLEMENTED(); } | 22075 | +//void InstructionSelector::VisitLoadLane(Node* node) { UNIMPLEMENTED(); } |
| 22060 | + | 22076 | + |
| 22077 | +/* | ||
| 22061 | +void InstructionSelector::VisitLoadTransform(Node* node) { | 22078 | +void InstructionSelector::VisitLoadTransform(Node* node) { |
| 22062 | + LoadTransformParameters params = LoadTransformParametersOf(node->op()); | 22079 | + LoadTransformParameters params = LoadTransformParametersOf(node->op()); |
| 22063 | + | 22080 | + |
| @@ -22099,6 +22116,7 @@ index 00000000000..4d86fd02a32 | |||
| 22099 | + | 22116 | + |
| 22100 | + EmitLoad(this, node, opcode); | 22117 | + EmitLoad(this, node, opcode); |
| 22101 | +} | 22118 | +} |
| 22119 | +*/ | ||
| 22102 | + | 22120 | + |
| 22103 | +void InstructionSelector::VisitLoad(Node* node) { | 22121 | +void InstructionSelector::VisitLoad(Node* node) { |
| 22104 | + LoadRepresentation load_rep = LoadRepresentationOf(node->op()); | 22122 | + LoadRepresentation load_rep = LoadRepresentationOf(node->op()); |
| @@ -22238,8 +22256,8 @@ index 00000000000..4d86fd02a32 | |||
| 22238 | + RiscvOperandGenerator g(this); | 22256 | + RiscvOperandGenerator g(this); |
| 22239 | + Int64BinopMatcher m(node); | 22257 | + Int64BinopMatcher m(node); |
| 22240 | + if (m.left().IsWord64Shr() && CanCover(node, m.left().node()) && | 22258 | + if (m.left().IsWord64Shr() && CanCover(node, m.left().node()) && |
| 22241 | + m.right().HasResolvedValue()) { | 22259 | + m.right().HasValue()) { |
| 22242 | + uint64_t mask = m.right().ResolvedValue(); | 22260 | + uint64_t mask = m.right().Value(); |
| 22243 | + uint32_t mask_width = base::bits::CountPopulation(mask); | 22261 | + uint32_t mask_width = base::bits::CountPopulation(mask); |
| 22244 | + uint32_t mask_msb = base::bits::CountLeadingZeros64(mask); | 22262 | + uint32_t mask_msb = base::bits::CountLeadingZeros64(mask); |
| 22245 | + if ((mask_width != 0) && (mask_msb + mask_width == 64)) { | 22263 | + if ((mask_width != 0) && (mask_msb + mask_width == 64)) { |
| @@ -22249,10 +22267,10 @@ index 00000000000..4d86fd02a32 | |||
| 22249 | + // Select Dext for And(Shr(x, imm), mask) where the mask is in the least | 22267 | + // Select Dext for And(Shr(x, imm), mask) where the mask is in the least |
| 22250 | + // significant bits. | 22268 | + // significant bits. |
| 22251 | + Int64BinopMatcher mleft(m.left().node()); | 22269 | + Int64BinopMatcher mleft(m.left().node()); |
| 22252 | + if (mleft.right().HasResolvedValue()) { | 22270 | + if (mleft.right().HasValue()) { |
| 22253 | + // Any shift value can match; int64 shifts use `value % 64`. | 22271 | + // Any shift value can match; int64 shifts use `value % 64`. |
| 22254 | + uint32_t lsb = | 22272 | + uint32_t lsb = |
| 22255 | + static_cast<uint32_t>(mleft.right().ResolvedValue() & 0x3F); | 22273 | + static_cast<uint32_t>(mleft.right().Value() & 0x3F); |
| 22256 | + | 22274 | + |
| 22257 | + // Dext cannot extract bits past the register size, however since | 22275 | + // Dext cannot extract bits past the register size, however since |
| 22258 | + // shifting the original value would have introduced some zeros we can | 22276 | + // shifting the original value would have introduced some zeros we can |
| @@ -22284,7 +22302,7 @@ index 00000000000..4d86fd02a32 | |||
| 22284 | + if (m.left().IsWord32Or() && CanCover(node, m.left().node()) && | 22302 | + if (m.left().IsWord32Or() && CanCover(node, m.left().node()) && |
| 22285 | + m.right().Is(-1)) { | 22303 | + m.right().Is(-1)) { |
| 22286 | + Int32BinopMatcher mleft(m.left().node()); | 22304 | + Int32BinopMatcher mleft(m.left().node()); |
| 22287 | + if (!mleft.right().HasResolvedValue()) { | 22305 | + if (!mleft.right().HasValue()) { |
| 22288 | + RiscvOperandGenerator g(this); | 22306 | + RiscvOperandGenerator g(this); |
| 22289 | + Emit(kRiscvNor32, g.DefineAsRegister(node), | 22307 | + Emit(kRiscvNor32, g.DefineAsRegister(node), |
| 22290 | + g.UseRegister(mleft.left().node()), | 22308 | + g.UseRegister(mleft.left().node()), |
| @@ -22307,7 +22325,7 @@ index 00000000000..4d86fd02a32 | |||
| 22307 | + if (m.left().IsWord64Or() && CanCover(node, m.left().node()) && | 22325 | + if (m.left().IsWord64Or() && CanCover(node, m.left().node()) && |
| 22308 | + m.right().Is(-1)) { | 22326 | + m.right().Is(-1)) { |
| 22309 | + Int64BinopMatcher mleft(m.left().node()); | 22327 | + Int64BinopMatcher mleft(m.left().node()); |
| 22310 | + if (!mleft.right().HasResolvedValue()) { | 22328 | + if (!mleft.right().HasValue()) { |
| 22311 | + RiscvOperandGenerator g(this); | 22329 | + RiscvOperandGenerator g(this); |
| 22312 | + Emit(kRiscvNor, g.DefineAsRegister(node), | 22330 | + Emit(kRiscvNor, g.DefineAsRegister(node), |
| 22313 | + g.UseRegister(mleft.left().node()), | 22331 | + g.UseRegister(mleft.left().node()), |
| @@ -22333,12 +22351,12 @@ index 00000000000..4d86fd02a32 | |||
| 22333 | + Int32BinopMatcher mleft(m.left().node()); | 22351 | + Int32BinopMatcher mleft(m.left().node()); |
| 22334 | + // Match Word32Shl(Word32And(x, mask), imm) to Shl where the mask is | 22352 | + // Match Word32Shl(Word32And(x, mask), imm) to Shl where the mask is |
| 22335 | + // contiguous, and the shift immediate non-zero. | 22353 | + // contiguous, and the shift immediate non-zero. |
| 22336 | + if (mleft.right().HasResolvedValue()) { | 22354 | + if (mleft.right().HasValue()) { |
| 22337 | + uint32_t mask = mleft.right().ResolvedValue(); | 22355 | + uint32_t mask = mleft.right().Value(); |
| 22338 | + uint32_t mask_width = base::bits::CountPopulation(mask); | 22356 | + uint32_t mask_width = base::bits::CountPopulation(mask); |
| 22339 | + uint32_t mask_msb = base::bits::CountLeadingZeros32(mask); | 22357 | + uint32_t mask_msb = base::bits::CountLeadingZeros32(mask); |
| 22340 | + if ((mask_width != 0) && (mask_msb + mask_width == 32)) { | 22358 | + if ((mask_width != 0) && (mask_msb + mask_width == 32)) { |
| 22341 | + uint32_t shift = m.right().ResolvedValue(); | 22359 | + uint32_t shift = m.right().Value(); |
| 22342 | + DCHECK_EQ(0u, base::bits::CountTrailingZeros32(mask)); | 22360 | + DCHECK_EQ(0u, base::bits::CountTrailingZeros32(mask)); |
| 22343 | + DCHECK_NE(0u, shift); | 22361 | + DCHECK_NE(0u, shift); |
| 22344 | + if ((shift + mask_width) >= 32) { | 22362 | + if ((shift + mask_width) >= 32) { |
| @@ -22363,10 +22381,10 @@ index 00000000000..4d86fd02a32 | |||
| 22363 | + Int32BinopMatcher m(node); | 22381 | + Int32BinopMatcher m(node); |
| 22364 | + if (m.left().IsWord32Shl() && CanCover(node, m.left().node())) { | 22382 | + if (m.left().IsWord32Shl() && CanCover(node, m.left().node())) { |
| 22365 | + Int32BinopMatcher mleft(m.left().node()); | 22383 | + Int32BinopMatcher mleft(m.left().node()); |
| 22366 | + if (m.right().HasResolvedValue() && mleft.right().HasResolvedValue()) { | 22384 | + if (m.right().HasValue() && mleft.right().HasValue()) { |
| 22367 | + RiscvOperandGenerator g(this); | 22385 | + RiscvOperandGenerator g(this); |
| 22368 | + uint32_t sar = m.right().ResolvedValue(); | 22386 | + uint32_t sar = m.right().Value(); |
| 22369 | + uint32_t shl = mleft.right().ResolvedValue(); | 22387 | + uint32_t shl = mleft.right().Value(); |
| 22370 | + if ((sar == shl) && (sar == 16)) { | 22388 | + if ((sar == shl) && (sar == 16)) { |
| 22371 | + Emit(kRiscvSignExtendShort, g.DefineAsRegister(node), | 22389 | + Emit(kRiscvSignExtendShort, g.DefineAsRegister(node), |
| 22372 | + g.UseRegister(mleft.left().node())); | 22390 | + g.UseRegister(mleft.left().node())); |
| @@ -22402,12 +22420,12 @@ index 00000000000..4d86fd02a32 | |||
| 22402 | + // Match Word64Shl(Word64And(x, mask), imm) to Dshl where the mask is | 22420 | + // Match Word64Shl(Word64And(x, mask), imm) to Dshl where the mask is |
| 22403 | + // contiguous, and the shift immediate non-zero. | 22421 | + // contiguous, and the shift immediate non-zero. |
| 22404 | + Int64BinopMatcher mleft(m.left().node()); | 22422 | + Int64BinopMatcher mleft(m.left().node()); |
| 22405 | + if (mleft.right().HasResolvedValue()) { | 22423 | + if (mleft.right().HasValue()) { |
| 22406 | + uint64_t mask = mleft.right().ResolvedValue(); | 22424 | + uint64_t mask = mleft.right().Value(); |
| 22407 | + uint32_t mask_width = base::bits::CountPopulation(mask); | 22425 | + uint32_t mask_width = base::bits::CountPopulation(mask); |
| 22408 | + uint32_t mask_msb = base::bits::CountLeadingZeros64(mask); | 22426 | + uint32_t mask_msb = base::bits::CountLeadingZeros64(mask); |
| 22409 | + if ((mask_width != 0) && (mask_msb + mask_width == 64)) { | 22427 | + if ((mask_width != 0) && (mask_msb + mask_width == 64)) { |
| 22410 | + uint64_t shift = m.right().ResolvedValue(); | 22428 | + uint64_t shift = m.right().Value(); |
| 22411 | + DCHECK_EQ(0u, base::bits::CountTrailingZeros64(mask)); | 22429 | + DCHECK_EQ(0u, base::bits::CountTrailingZeros64(mask)); |
| 22412 | + DCHECK_NE(0u, shift); | 22430 | + DCHECK_NE(0u, shift); |
| 22413 | + | 22431 | + |
| @@ -22434,9 +22452,9 @@ index 00000000000..4d86fd02a32 | |||
| 22434 | + VisitRRO(this, kRiscvSar64, node); | 22452 | + VisitRRO(this, kRiscvSar64, node); |
| 22435 | +} | 22453 | +} |
| 22436 | + | 22454 | + |
| 22437 | +void InstructionSelector::VisitWord32Rol(Node* node) { UNREACHABLE(); } | 22455 | +//void InstructionSelector::VisitWord32Rol(Node* node) { UNREACHABLE(); } |
| 22438 | + | 22456 | + |
| 22439 | +void InstructionSelector::VisitWord64Rol(Node* node) { UNREACHABLE(); } | 22457 | +//void InstructionSelector::VisitWord64Rol(Node* node) { UNREACHABLE(); } |
| 22440 | + | 22458 | + |
| 22441 | +void InstructionSelector::VisitWord32Ror(Node* node) { | 22459 | +void InstructionSelector::VisitWord32Ror(Node* node) { |
| 22442 | + VisitRRO(this, kRiscvRor32, node); | 22460 | + VisitRRO(this, kRiscvRor32, node); |
| @@ -22462,9 +22480,11 @@ index 00000000000..4d86fd02a32 | |||
| 22462 | + g.UseRegister(node->InputAt(0))); | 22480 | + g.UseRegister(node->InputAt(0))); |
| 22463 | +} | 22481 | +} |
| 22464 | + | 22482 | + |
| 22483 | +/* | ||
| 22465 | +void InstructionSelector::VisitSimd128ReverseBytes(Node* node) { | 22484 | +void InstructionSelector::VisitSimd128ReverseBytes(Node* node) { |
| 22466 | + UNREACHABLE(); | 22485 | + UNREACHABLE(); |
| 22467 | +} | 22486 | +} |
| 22487 | +*/ | ||
| 22468 | + | 22488 | + |
| 22469 | +void InstructionSelector::VisitWord32Ctz(Node* node) { | 22489 | +void InstructionSelector::VisitWord32Ctz(Node* node) { |
| 22470 | + RiscvOperandGenerator g(this); | 22490 | + RiscvOperandGenerator g(this); |
| @@ -22515,19 +22535,19 @@ index 00000000000..4d86fd02a32 | |||
| 22515 | +void InstructionSelector::VisitInt32Mul(Node* node) { | 22535 | +void InstructionSelector::VisitInt32Mul(Node* node) { |
| 22516 | + RiscvOperandGenerator g(this); | 22536 | + RiscvOperandGenerator g(this); |
| 22517 | + Int32BinopMatcher m(node); | 22537 | + Int32BinopMatcher m(node); |
| 22518 | + if (m.right().HasResolvedValue() && m.right().ResolvedValue() > 0) { | 22538 | + if (m.right().HasValue() && m.right().Value() > 0) { |
| 22519 | + uint32_t value = static_cast<uint32_t>(m.right().ResolvedValue()); | 22539 | + uint32_t value = static_cast<uint32_t>(m.right().Value()); |
| 22520 | + if (base::bits::IsPowerOfTwo(value)) { | 22540 | + if (base::bits::IsPowerOfTwo(value)) { |
| 22521 | + Emit(kRiscvShl32 | AddressingModeField::encode(kMode_None), | 22541 | + Emit(kRiscvShl32 | AddressingModeField::encode(kMode_None), |
| 22522 | + g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 22542 | + g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
| 22523 | + g.TempImmediate(base::bits::WhichPowerOfTwo(value))); | 22543 | + g.TempImmediate(base::bits::IsPowerOfTwo(value))); |
| 22524 | + return; | 22544 | + return; |
| 22525 | + } | 22545 | + } |
| 22526 | + if (base::bits::IsPowerOfTwo(value + 1)) { | 22546 | + if (base::bits::IsPowerOfTwo(value + 1)) { |
| 22527 | + InstructionOperand temp = g.TempRegister(); | 22547 | + InstructionOperand temp = g.TempRegister(); |
| 22528 | + Emit(kRiscvShl32 | AddressingModeField::encode(kMode_None), temp, | 22548 | + Emit(kRiscvShl32 | AddressingModeField::encode(kMode_None), temp, |
| 22529 | + g.UseRegister(m.left().node()), | 22549 | + g.UseRegister(m.left().node()), |
| 22530 | + g.TempImmediate(base::bits::WhichPowerOfTwo(value + 1))); | 22550 | + g.TempImmediate(base::bits::IsPowerOfTwo(value + 1))); |
| 22531 | + Emit(kRiscvSub32 | AddressingModeField::encode(kMode_None), | 22551 | + Emit(kRiscvSub32 | AddressingModeField::encode(kMode_None), |
| 22532 | + g.DefineAsRegister(node), temp, g.UseRegister(m.left().node())); | 22552 | + g.DefineAsRegister(node), temp, g.UseRegister(m.left().node())); |
| 22533 | + return; | 22553 | + return; |
| @@ -22563,19 +22583,19 @@ index 00000000000..4d86fd02a32 | |||
| 22563 | + RiscvOperandGenerator g(this); | 22583 | + RiscvOperandGenerator g(this); |
| 22564 | + Int64BinopMatcher m(node); | 22584 | + Int64BinopMatcher m(node); |
| 22565 | + // TODO(dusmil): Add optimization for shifts larger than 32. | 22585 | + // TODO(dusmil): Add optimization for shifts larger than 32. |
| 22566 | + if (m.right().HasResolvedValue() && m.right().ResolvedValue() > 0) { | 22586 | + if (m.right().HasValue() && m.right().Value() > 0) { |
| 22567 | + uint32_t value = static_cast<uint32_t>(m.right().ResolvedValue()); | 22587 | + uint32_t value = static_cast<uint32_t>(m.right().Value()); |
| 22568 | + if (base::bits::IsPowerOfTwo(value)) { | 22588 | + if (base::bits::IsPowerOfTwo(value)) { |
| 22569 | + Emit(kRiscvShl64 | AddressingModeField::encode(kMode_None), | 22589 | + Emit(kRiscvShl64 | AddressingModeField::encode(kMode_None), |
| 22570 | + g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 22590 | + g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
| 22571 | + g.TempImmediate(base::bits::WhichPowerOfTwo(value))); | 22591 | + g.TempImmediate(base::bits::IsPowerOfTwo(value))); |
| 22572 | + return; | 22592 | + return; |
| 22573 | + } | 22593 | + } |
| 22574 | + if (base::bits::IsPowerOfTwo(value + 1)) { | 22594 | + if (base::bits::IsPowerOfTwo(value + 1)) { |
| 22575 | + InstructionOperand temp = g.TempRegister(); | 22595 | + InstructionOperand temp = g.TempRegister(); |
| 22576 | + Emit(kRiscvShl64 | AddressingModeField::encode(kMode_None), temp, | 22596 | + Emit(kRiscvShl64 | AddressingModeField::encode(kMode_None), temp, |
| 22577 | + g.UseRegister(m.left().node()), | 22597 | + g.UseRegister(m.left().node()), |
| 22578 | + g.TempImmediate(base::bits::WhichPowerOfTwo(value + 1))); | 22598 | + g.TempImmediate(base::bits::IsPowerOfTwo(value + 1))); |
| 22579 | + Emit(kRiscvSub64 | AddressingModeField::encode(kMode_None), | 22599 | + Emit(kRiscvSub64 | AddressingModeField::encode(kMode_None), |
| 22580 | + g.DefineAsRegister(node), temp, g.UseRegister(m.left().node())); | 22600 | + g.DefineAsRegister(node), temp, g.UseRegister(m.left().node())); |
| 22581 | + return; | 22601 | + return; |
| @@ -22696,23 +22716,25 @@ index 00000000000..4d86fd02a32 | |||
| 22696 | +} | 22716 | +} |
| 22697 | + | 22717 | + |
| 22698 | +void InstructionSelector::VisitTruncateFloat32ToInt32(Node* node) { | 22718 | +void InstructionSelector::VisitTruncateFloat32ToInt32(Node* node) { |
| 22699 | + RiscvOperandGenerator g(this); | 22719 | + VisitRR(this, kRiscvTruncWS, node); |
| 22700 | + InstructionCode opcode = kRiscvTruncWS; | 22720 | + //RiscvOperandGenerator g(this); |
| 22701 | + TruncateKind kind = OpParameter<TruncateKind>(node->op()); | 22721 | + //InstructionCode opcode = kRiscvTruncWS; |
| 22702 | + if (kind == TruncateKind::kSetOverflowToMin) { | 22722 | + //TruncateKind kind = OpParameter<TruncateKind>(node->op()); |
| 22703 | + opcode |= MiscField::encode(true); | 22723 | + //if (kind == TruncateKind::kSetOverflowToMin) { |
| 22704 | + } | 22724 | + // opcode |= MiscField::encode(true); |
| 22705 | + Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | 22725 | + //} |
| 22726 | + //Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | ||
| 22706 | +} | 22727 | +} |
| 22707 | + | 22728 | + |
| 22708 | +void InstructionSelector::VisitTruncateFloat32ToUint32(Node* node) { | 22729 | +void InstructionSelector::VisitTruncateFloat32ToUint32(Node* node) { |
| 22709 | + RiscvOperandGenerator g(this); | 22730 | + VisitRR(this, kRiscvTruncUwS, node); |
| 22710 | + InstructionCode opcode = kRiscvTruncUwS; | 22731 | + //RiscvOperandGenerator g(this); |
| 22711 | + TruncateKind kind = OpParameter<TruncateKind>(node->op()); | 22732 | + //InstructionCode opcode = kRiscvTruncUwS; |
| 22712 | + if (kind == TruncateKind::kSetOverflowToMin) { | 22733 | + //TruncateKind kind = OpParameter<TruncateKind>(node->op()); |
| 22713 | + opcode |= MiscField::encode(true); | 22734 | + //if (kind == TruncateKind::kSetOverflowToMin) { |
| 22714 | + } | 22735 | + // opcode |= MiscField::encode(true); |
| 22715 | + Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | 22736 | + //} |
| 22737 | + //Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | ||
| 22716 | +} | 22738 | +} |
| 22717 | + | 22739 | + |
| 22718 | +void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { | 22740 | +void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { |
| @@ -22795,28 +22817,30 @@ index 00000000000..4d86fd02a32 | |||
| 22795 | +} | 22817 | +} |
| 22796 | + | 22818 | + |
| 22797 | +void InstructionSelector::VisitTruncateFloat64ToInt64(Node* node) { | 22819 | +void InstructionSelector::VisitTruncateFloat64ToInt64(Node* node) { |
| 22798 | + RiscvOperandGenerator g(this); | 22820 | + VisitRR(this, kRiscvTruncLD, node); |
| 22799 | + InstructionCode opcode = kRiscvTruncLD; | 22821 | + //RiscvOperandGenerator g(this); |
| 22800 | + TruncateKind kind = OpParameter<TruncateKind>(node->op()); | 22822 | + //InstructionCode opcode = kRiscvTruncLD; |
| 22801 | + if (kind == TruncateKind::kSetOverflowToMin) { | 22823 | + //TruncateKind kind = OpParameter<TruncateKind>(node->op()); |
| 22802 | + opcode |= MiscField::encode(true); | 22824 | + //if (kind == TruncateKind::kSetOverflowToMin) { |
| 22803 | + } | 22825 | + // opcode |= MiscField::encode(true); |
| 22804 | + Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | 22826 | + //} |
| 22827 | + //Emit(opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | ||
| 22805 | +} | 22828 | +} |
| 22806 | + | 22829 | + |
| 22807 | +void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) { | 22830 | +void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) { |
| 22808 | + RiscvOperandGenerator g(this); | 22831 | + VisitRR(this, kRiscvTruncLS, node); |
| 22809 | + InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; | 22832 | + //RiscvOperandGenerator g(this); |
| 22810 | + InstructionOperand outputs[2]; | 22833 | + //InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; |
| 22811 | + size_t output_count = 0; | 22834 | + //InstructionOperand outputs[2]; |
| 22812 | + outputs[output_count++] = g.DefineAsRegister(node); | 22835 | + //size_t output_count = 0; |
| 22813 | + | 22836 | + //outputs[output_count++] = g.DefineAsRegister(node); |
| 22814 | + Node* success_output = NodeProperties::FindProjection(node, 1); | 22837 | + |
| 22815 | + if (success_output) { | 22838 | + //Node* success_output = NodeProperties::FindProjection(node, 1); |
| 22816 | + outputs[output_count++] = g.DefineAsRegister(success_output); | 22839 | + //if (success_output) { |
| 22817 | + } | 22840 | + // outputs[output_count++] = g.DefineAsRegister(success_output); |
| 22841 | + //} | ||
| 22818 | + | 22842 | + |
| 22819 | + this->Emit(kRiscvTruncLS, output_count, outputs, 1, inputs); | 22843 | + //this->Emit(kRiscvTruncLS, output_count, outputs, 1, inputs); |
| 22820 | +} | 22844 | +} |
| 22821 | + | 22845 | + |
| 22822 | +void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) { | 22846 | +void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) { |
| @@ -22865,9 +22889,9 @@ index 00000000000..4d86fd02a32 | |||
| 22865 | + Emit(kRiscvTruncUlD, output_count, outputs, 1, inputs); | 22889 | + Emit(kRiscvTruncUlD, output_count, outputs, 1, inputs); |
| 22866 | +} | 22890 | +} |
| 22867 | + | 22891 | + |
| 22868 | +void InstructionSelector::VisitBitcastWord32ToWord64(Node* node) { | 22892 | +//void InstructionSelector::VisitBitcastWord32ToWord64(Node* node) { |
| 22869 | + UNIMPLEMENTED(); | 22893 | +// UNIMPLEMENTED(); |
| 22870 | +} | 22894 | +//} |
| 22871 | + | 22895 | + |
| 22872 | +void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { | 22896 | +void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { |
| 22873 | + Node* value = node->InputAt(0); | 22897 | + Node* value = node->InputAt(0); |
| @@ -22897,6 +22921,7 @@ index 00000000000..4d86fd02a32 | |||
| 22897 | + } | 22921 | + } |
| 22898 | +} | 22922 | +} |
| 22899 | + | 22923 | + |
| 22924 | +/* | ||
| 22900 | +bool InstructionSelector::ZeroExtendsWord32ToWord64NoPhis(Node* node) { | 22925 | +bool InstructionSelector::ZeroExtendsWord32ToWord64NoPhis(Node* node) { |
| 22901 | + DCHECK_NE(node->opcode(), IrOpcode::kPhi); | 22926 | + DCHECK_NE(node->opcode(), IrOpcode::kPhi); |
| 22902 | + if (node->opcode() == IrOpcode::kLoad) { | 22927 | + if (node->opcode() == IrOpcode::kLoad) { |
| @@ -22916,14 +22941,15 @@ index 00000000000..4d86fd02a32 | |||
| 22916 | + // All other 32-bit operations sign-extend to the upper 32 bits | 22941 | + // All other 32-bit operations sign-extend to the upper 32 bits |
| 22917 | + return false; | 22942 | + return false; |
| 22918 | +} | 22943 | +} |
| 22944 | +*/ | ||
| 22919 | + | 22945 | + |
| 22920 | +void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { | 22946 | +void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
| 22921 | + RiscvOperandGenerator g(this); | 22947 | + RiscvOperandGenerator g(this); |
| 22922 | + Node* value = node->InputAt(0); | 22948 | + Node* value = node->InputAt(0); |
| 22923 | + if (ZeroExtendsWord32ToWord64(value)) { | 22949 | + //if (ZeroExtendsWord32ToWord64(value)) { |
| 22924 | + Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value)); | 22950 | + // Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value)); |
| 22925 | + return; | 22951 | + // return; |
| 22926 | + } | 22952 | + //} |
| 22927 | + Emit(kRiscvZeroExtendWord, g.DefineAsRegister(node), | 22953 | + Emit(kRiscvZeroExtendWord, g.DefineAsRegister(node), |
| 22928 | + g.UseRegister(node->InputAt(0))); | 22954 | + g.UseRegister(node->InputAt(0))); |
| 22929 | +} | 22955 | +} |
| @@ -23656,12 +23682,16 @@ index 00000000000..4d86fd02a32 | |||
| 23656 | + | 23682 | + |
| 23657 | +void InstructionSelector::VisitStackPointerGreaterThan( | 23683 | +void InstructionSelector::VisitStackPointerGreaterThan( |
| 23658 | + Node* node, FlagsContinuation* cont) { | 23684 | + Node* node, FlagsContinuation* cont) { |
| 23659 | + StackCheckKind kind = StackCheckKindOf(node->op()); | 23685 | + //StackCheckKind kind = StackCheckKindOf(node->op()); |
| 23660 | + InstructionCode opcode = | 23686 | + //InstructionCode opcode = |
| 23661 | + kArchStackPointerGreaterThan | MiscField::encode(static_cast<int>(kind)); | 23687 | + // kArchStackPointerGreaterThan | MiscField::encode(static_cast<int>(kind)); |
| 23688 | + Node* const value = node->InputAt(0); | ||
| 23689 | + InstructionCode opcode = kArchStackPointerGreaterThan; | ||
| 23662 | + | 23690 | + |
| 23663 | + RiscvOperandGenerator g(this); | 23691 | + RiscvOperandGenerator g(this); |
| 23692 | + EmitWithContinuation(opcode, g.UseRegister(value), cont); | ||
| 23664 | + | 23693 | + |
| 23694 | + /* | ||
| 23665 | + // No outputs. | 23695 | + // No outputs. |
| 23666 | + InstructionOperand* const outputs = nullptr; | 23696 | + InstructionOperand* const outputs = nullptr; |
| 23667 | + const int output_count = 0; | 23697 | + const int output_count = 0; |
| @@ -23681,6 +23711,7 @@ index 00000000000..4d86fd02a32 | |||
| 23681 | + | 23711 | + |
| 23682 | + EmitWithContinuation(opcode, output_count, outputs, input_count, inputs, | 23712 | + EmitWithContinuation(opcode, output_count, outputs, input_count, inputs, |
| 23683 | + temp_count, temps, cont); | 23713 | + temp_count, temps, cont); |
| 23714 | + */ | ||
| 23684 | +} | 23715 | +} |
| 23685 | + | 23716 | + |
| 23686 | +// Shared routine for word comparisons against zero. | 23717 | +// Shared routine for word comparisons against zero. |
| @@ -24253,33 +24284,14 @@ index 00000000000..4d86fd02a32 | |||
| 24253 | +#define SIMD_UNOP_LIST(V) \ | 24284 | +#define SIMD_UNOP_LIST(V) \ |
| 24254 | + V(F64x2Abs, kRiscvF64x2Abs) \ | 24285 | + V(F64x2Abs, kRiscvF64x2Abs) \ |
| 24255 | + V(F64x2Neg, kRiscvF64x2Neg) \ | 24286 | + V(F64x2Neg, kRiscvF64x2Neg) \ |
| 24256 | + V(F64x2Sqrt, kRiscvF64x2Sqrt) \ | ||
| 24257 | + V(F64x2ConvertLowI32x4S, kRiscvF64x2ConvertLowI32x4S) \ | ||
| 24258 | + V(F64x2ConvertLowI32x4U, kRiscvF64x2ConvertLowI32x4U) \ | ||
| 24259 | + V(F64x2PromoteLowF32x4, kRiscvF64x2PromoteLowF32x4) \ | ||
| 24260 | + V(F64x2Ceil, kRiscvF64x2Ceil) \ | ||
| 24261 | + V(F64x2Floor, kRiscvF64x2Floor) \ | ||
| 24262 | + V(F64x2Trunc, kRiscvF64x2Trunc) \ | ||
| 24263 | + V(F64x2NearestInt, kRiscvF64x2NearestInt) \ | ||
| 24264 | + V(I64x2Neg, kRiscvI64x2Neg) \ | 24287 | + V(I64x2Neg, kRiscvI64x2Neg) \ |
| 24265 | + V(I64x2BitMask, kRiscvI64x2BitMask) \ | ||
| 24266 | + V(I64x2Eq, kRiscvI64x2Eq) \ | 24288 | + V(I64x2Eq, kRiscvI64x2Eq) \ |
| 24267 | + V(F32x4SConvertI32x4, kRiscvF32x4SConvertI32x4) \ | 24289 | + V(F32x4SConvertI32x4, kRiscvF32x4SConvertI32x4) \ |
| 24268 | + V(F32x4UConvertI32x4, kRiscvF32x4UConvertI32x4) \ | 24290 | + V(F32x4UConvertI32x4, kRiscvF32x4UConvertI32x4) \ |
| 24269 | + V(F32x4Abs, kRiscvF32x4Abs) \ | 24291 | + V(F32x4Abs, kRiscvF32x4Abs) \ |
| 24270 | + V(F32x4Neg, kRiscvF32x4Neg) \ | 24292 | + V(F32x4Neg, kRiscvF32x4Neg) \ |
| 24271 | + V(F32x4Sqrt, kRiscvF32x4Sqrt) \ | ||
| 24272 | + V(F32x4RecipApprox, kRiscvF32x4RecipApprox) \ | 24293 | + V(F32x4RecipApprox, kRiscvF32x4RecipApprox) \ |
| 24273 | + V(F32x4RecipSqrtApprox, kRiscvF32x4RecipSqrtApprox) \ | 24294 | + V(F32x4RecipSqrtApprox, kRiscvF32x4RecipSqrtApprox) \ |
| 24274 | + V(F32x4DemoteF64x2Zero, kRiscvF32x4DemoteF64x2Zero) \ | ||
| 24275 | + V(F32x4Ceil, kRiscvF32x4Ceil) \ | ||
| 24276 | + V(F32x4Floor, kRiscvF32x4Floor) \ | ||
| 24277 | + V(F32x4Trunc, kRiscvF32x4Trunc) \ | ||
| 24278 | + V(F32x4NearestInt, kRiscvF32x4NearestInt) \ | ||
| 24279 | + V(I64x2SConvertI32x4Low, kRiscvI64x2SConvertI32x4Low) \ | ||
| 24280 | + V(I64x2SConvertI32x4High, kRiscvI64x2SConvertI32x4High) \ | ||
| 24281 | + V(I64x2UConvertI32x4Low, kRiscvI64x2UConvertI32x4Low) \ | ||
| 24282 | + V(I64x2UConvertI32x4High, kRiscvI64x2UConvertI32x4High) \ | ||
| 24283 | + V(I32x4SConvertF32x4, kRiscvI32x4SConvertF32x4) \ | 24295 | + V(I32x4SConvertF32x4, kRiscvI32x4SConvertF32x4) \ |
| 24284 | + V(I32x4UConvertF32x4, kRiscvI32x4UConvertF32x4) \ | 24296 | + V(I32x4UConvertF32x4, kRiscvI32x4UConvertF32x4) \ |
| 24285 | + V(I32x4Neg, kRiscvI32x4Neg) \ | 24297 | + V(I32x4Neg, kRiscvI32x4Neg) \ |
| @@ -24287,26 +24299,14 @@ index 00000000000..4d86fd02a32 | |||
| 24287 | + V(I32x4SConvertI16x8High, kRiscvI32x4SConvertI16x8High) \ | 24299 | + V(I32x4SConvertI16x8High, kRiscvI32x4SConvertI16x8High) \ |
| 24288 | + V(I32x4UConvertI16x8Low, kRiscvI32x4UConvertI16x8Low) \ | 24300 | + V(I32x4UConvertI16x8Low, kRiscvI32x4UConvertI16x8Low) \ |
| 24289 | + V(I32x4UConvertI16x8High, kRiscvI32x4UConvertI16x8High) \ | 24301 | + V(I32x4UConvertI16x8High, kRiscvI32x4UConvertI16x8High) \ |
| 24290 | + V(I32x4Abs, kRiscvI32x4Abs) \ | ||
| 24291 | + V(I32x4BitMask, kRiscvI32x4BitMask) \ | ||
| 24292 | + V(I32x4TruncSatF64x2SZero, kRiscvI32x4TruncSatF64x2SZero) \ | ||
| 24293 | + V(I32x4TruncSatF64x2UZero, kRiscvI32x4TruncSatF64x2UZero) \ | ||
| 24294 | + V(I16x8Neg, kRiscvI16x8Neg) \ | 24302 | + V(I16x8Neg, kRiscvI16x8Neg) \ |
| 24295 | + V(I16x8SConvertI8x16Low, kRiscvI16x8SConvertI8x16Low) \ | 24303 | + V(I16x8SConvertI8x16Low, kRiscvI16x8SConvertI8x16Low) \ |
| 24296 | + V(I16x8SConvertI8x16High, kRiscvI16x8SConvertI8x16High) \ | 24304 | + V(I16x8SConvertI8x16High, kRiscvI16x8SConvertI8x16High) \ |
| 24297 | + V(I16x8UConvertI8x16Low, kRiscvI16x8UConvertI8x16Low) \ | 24305 | + V(I16x8UConvertI8x16Low, kRiscvI16x8UConvertI8x16Low) \ |
| 24298 | + V(I16x8UConvertI8x16High, kRiscvI16x8UConvertI8x16High) \ | 24306 | + V(I16x8UConvertI8x16High, kRiscvI16x8UConvertI8x16High) \ |
| 24299 | + V(I16x8Abs, kRiscvI16x8Abs) \ | 24307 | + V(I16x8Abs, kRiscvI16x8Abs) \ |
| 24300 | + V(I16x8BitMask, kRiscvI16x8BitMask) \ | ||
| 24301 | + V(I8x16Neg, kRiscvI8x16Neg) \ | 24308 | + V(I8x16Neg, kRiscvI8x16Neg) \ |
| 24302 | + V(I8x16Abs, kRiscvI8x16Abs) \ | 24309 | + V(S128Not, kRiscvS128Not) |
| 24303 | + V(I8x16BitMask, kRiscvI8x16BitMask) \ | ||
| 24304 | + V(I8x16Popcnt, kRiscvI8x16Popcnt) \ | ||
| 24305 | + V(S128Not, kRiscvS128Not) \ | ||
| 24306 | + V(V128AnyTrue, kRiscvV128AnyTrue) \ | ||
| 24307 | + V(V32x4AllTrue, kRiscvV32x4AllTrue) \ | ||
| 24308 | + V(V16x8AllTrue, kRiscvV16x8AllTrue) \ | ||
| 24309 | + V(V8x16AllTrue, kRiscvV8x16AllTrue) | ||
| 24310 | + | 24310 | + |
| 24311 | +#define SIMD_SHIFT_OP_LIST(V) \ | 24311 | +#define SIMD_SHIFT_OP_LIST(V) \ |
| 24312 | + V(I64x2Shl) \ | 24312 | + V(I64x2Shl) \ |
| @@ -24361,14 +24361,9 @@ index 00000000000..4d86fd02a32 | |||
| 24361 | + V(I32x4GeS, kRiscvI32x4GeS) \ | 24361 | + V(I32x4GeS, kRiscvI32x4GeS) \ |
| 24362 | + V(I32x4GtU, kRiscvI32x4GtU) \ | 24362 | + V(I32x4GtU, kRiscvI32x4GtU) \ |
| 24363 | + V(I32x4GeU, kRiscvI32x4GeU) \ | 24363 | + V(I32x4GeU, kRiscvI32x4GeU) \ |
| 24364 | + V(I32x4DotI16x8S, kRiscvI32x4DotI16x8S) \ | ||
| 24365 | + V(I16x8Add, kRiscvI16x8Add) \ | 24364 | + V(I16x8Add, kRiscvI16x8Add) \ |
| 24366 | + V(I16x8AddSatS, kRiscvI16x8AddSatS) \ | ||
| 24367 | + V(I16x8AddSatU, kRiscvI16x8AddSatU) \ | ||
| 24368 | + V(I16x8AddHoriz, kRiscvI16x8AddHoriz) \ | 24365 | + V(I16x8AddHoriz, kRiscvI16x8AddHoriz) \ |
| 24369 | + V(I16x8Sub, kRiscvI16x8Sub) \ | 24366 | + V(I16x8Sub, kRiscvI16x8Sub) \ |
| 24370 | + V(I16x8SubSatS, kRiscvI16x8SubSatS) \ | ||
| 24371 | + V(I16x8SubSatU, kRiscvI16x8SubSatU) \ | ||
| 24372 | + V(I16x8Mul, kRiscvI16x8Mul) \ | 24367 | + V(I16x8Mul, kRiscvI16x8Mul) \ |
| 24373 | + V(I16x8MaxS, kRiscvI16x8MaxS) \ | 24368 | + V(I16x8MaxS, kRiscvI16x8MaxS) \ |
| 24374 | + V(I16x8MinS, kRiscvI16x8MinS) \ | 24369 | + V(I16x8MinS, kRiscvI16x8MinS) \ |
| @@ -24380,16 +24375,10 @@ index 00000000000..4d86fd02a32 | |||
| 24380 | + V(I16x8GeS, kRiscvI16x8GeS) \ | 24375 | + V(I16x8GeS, kRiscvI16x8GeS) \ |
| 24381 | + V(I16x8GtU, kRiscvI16x8GtU) \ | 24376 | + V(I16x8GtU, kRiscvI16x8GtU) \ |
| 24382 | + V(I16x8GeU, kRiscvI16x8GeU) \ | 24377 | + V(I16x8GeU, kRiscvI16x8GeU) \ |
| 24383 | + V(I16x8RoundingAverageU, kRiscvI16x8RoundingAverageU) \ | ||
| 24384 | + V(I16x8Q15MulRSatS, kRiscvI16x8Q15MulRSatS) \ | ||
| 24385 | + V(I16x8SConvertI32x4, kRiscvI16x8SConvertI32x4) \ | 24378 | + V(I16x8SConvertI32x4, kRiscvI16x8SConvertI32x4) \ |
| 24386 | + V(I16x8UConvertI32x4, kRiscvI16x8UConvertI32x4) \ | 24379 | + V(I16x8UConvertI32x4, kRiscvI16x8UConvertI32x4) \ |
| 24387 | + V(I8x16Add, kRiscvI8x16Add) \ | 24380 | + V(I8x16Add, kRiscvI8x16Add) \ |
| 24388 | + V(I8x16AddSatS, kRiscvI8x16AddSatS) \ | ||
| 24389 | + V(I8x16AddSatU, kRiscvI8x16AddSatU) \ | ||
| 24390 | + V(I8x16Sub, kRiscvI8x16Sub) \ | 24381 | + V(I8x16Sub, kRiscvI8x16Sub) \ |
| 24391 | + V(I8x16SubSatS, kRiscvI8x16SubSatS) \ | ||
| 24392 | + V(I8x16SubSatU, kRiscvI8x16SubSatU) \ | ||
| 24393 | + V(I8x16Mul, kRiscvI8x16Mul) \ | 24382 | + V(I8x16Mul, kRiscvI8x16Mul) \ |
| 24394 | + V(I8x16MaxS, kRiscvI8x16MaxS) \ | 24383 | + V(I8x16MaxS, kRiscvI8x16MaxS) \ |
| 24395 | + V(I8x16MinS, kRiscvI8x16MinS) \ | 24384 | + V(I8x16MinS, kRiscvI8x16MinS) \ |
| @@ -24401,15 +24390,14 @@ index 00000000000..4d86fd02a32 | |||
| 24401 | + V(I8x16GeS, kRiscvI8x16GeS) \ | 24390 | + V(I8x16GeS, kRiscvI8x16GeS) \ |
| 24402 | + V(I8x16GtU, kRiscvI8x16GtU) \ | 24391 | + V(I8x16GtU, kRiscvI8x16GtU) \ |
| 24403 | + V(I8x16GeU, kRiscvI8x16GeU) \ | 24392 | + V(I8x16GeU, kRiscvI8x16GeU) \ |
| 24404 | + V(I8x16RoundingAverageU, kRiscvI8x16RoundingAverageU) \ | ||
| 24405 | + V(I8x16SConvertI16x8, kRiscvI8x16SConvertI16x8) \ | 24393 | + V(I8x16SConvertI16x8, kRiscvI8x16SConvertI16x8) \ |
| 24406 | + V(I8x16UConvertI16x8, kRiscvI8x16UConvertI16x8) \ | 24394 | + V(I8x16UConvertI16x8, kRiscvI8x16UConvertI16x8) \ |
| 24407 | + V(S128And, kRiscvS128And) \ | 24395 | + V(S128And, kRiscvS128And) \ |
| 24408 | + V(S128Or, kRiscvS128Or) \ | 24396 | + V(S128Or, kRiscvS128Or) \ |
| 24409 | + V(S128Xor, kRiscvS128Xor) \ | 24397 | + V(S128Xor, kRiscvS128Xor) |
| 24410 | + V(S128AndNot, kRiscvS128AndNot) | ||
| 24411 | + | 24398 | + |
| 24412 | +void InstructionSelector::VisitS128Const(Node* node) { | 24399 | +/* |
| 24400 | + void InstructionSelector::VisitS128Const(Node* node) { | ||
| 24413 | + RiscvOperandGenerator g(this); | 24401 | + RiscvOperandGenerator g(this); |
| 24414 | + static const int kUint32Immediates = kSimd128Size / sizeof(uint32_t); | 24402 | + static const int kUint32Immediates = kSimd128Size / sizeof(uint32_t); |
| 24415 | + uint32_t val[kUint32Immediates]; | 24403 | + uint32_t val[kUint32Immediates]; |
| @@ -24428,6 +24416,7 @@ index 00000000000..4d86fd02a32 | |||
| 24428 | + g.UseImmediate(val[2]), g.UseImmediate(val[3])); | 24416 | + g.UseImmediate(val[2]), g.UseImmediate(val[3])); |
| 24429 | + } | 24417 | + } |
| 24430 | +} | 24418 | +} |
| 24419 | +*/ | ||
| 24431 | + | 24420 | + |
| 24432 | +void InstructionSelector::VisitS128Zero(Node* node) { | 24421 | +void InstructionSelector::VisitS128Zero(Node* node) { |
| 24433 | + RiscvOperandGenerator g(this); | 24422 | + RiscvOperandGenerator g(this); |
| @@ -24449,10 +24438,10 @@ index 00000000000..4d86fd02a32 | |||
| 24449 | +SIMD_VISIT_EXTRACT_LANE(F64x2, ) | 24438 | +SIMD_VISIT_EXTRACT_LANE(F64x2, ) |
| 24450 | +SIMD_VISIT_EXTRACT_LANE(F32x4, ) | 24439 | +SIMD_VISIT_EXTRACT_LANE(F32x4, ) |
| 24451 | +SIMD_VISIT_EXTRACT_LANE(I32x4, ) | 24440 | +SIMD_VISIT_EXTRACT_LANE(I32x4, ) |
| 24452 | +SIMD_VISIT_EXTRACT_LANE(I16x8, U) | 24441 | +//SIMD_VISIT_EXTRACT_LANE(I16x8, U) |
| 24453 | +SIMD_VISIT_EXTRACT_LANE(I16x8, S) | 24442 | +//SIMD_VISIT_EXTRACT_LANE(I16x8, S) |
| 24454 | +SIMD_VISIT_EXTRACT_LANE(I8x16, U) | 24443 | +//SIMD_VISIT_EXTRACT_LANE(I8x16, U) |
| 24455 | +SIMD_VISIT_EXTRACT_LANE(I8x16, S) | 24444 | +//SIMD_VISIT_EXTRACT_LANE(I8x16, S) |
| 24456 | +#undef SIMD_VISIT_EXTRACT_LANE | 24445 | +#undef SIMD_VISIT_EXTRACT_LANE |
| 24457 | + | 24446 | + |
| 24458 | +#define SIMD_VISIT_REPLACE_LANE(Type) \ | 24447 | +#define SIMD_VISIT_REPLACE_LANE(Type) \ |
| @@ -24565,6 +24554,7 @@ index 00000000000..4d86fd02a32 | |||
| 24565 | + | 24554 | + |
| 24566 | +} // namespace | 24555 | +} // namespace |
| 24567 | + | 24556 | + |
| 24557 | +/* | ||
| 24568 | +void InstructionSelector::VisitI8x16Shuffle(Node* node) { | 24558 | +void InstructionSelector::VisitI8x16Shuffle(Node* node) { |
| 24569 | + uint8_t shuffle[kSimd128Size]; | 24559 | + uint8_t shuffle[kSimd128Size]; |
| 24570 | + bool is_swizzle; | 24560 | + bool is_swizzle; |
| @@ -24608,6 +24598,7 @@ index 00000000000..4d86fd02a32 | |||
| 24608 | + g.UseUniqueRegister(node->InputAt(0)), | 24598 | + g.UseUniqueRegister(node->InputAt(0)), |
| 24609 | + g.UseUniqueRegister(node->InputAt(1)), arraysize(temps), temps); | 24599 | + g.UseUniqueRegister(node->InputAt(1)), arraysize(temps), temps); |
| 24610 | +} | 24600 | +} |
| 24601 | +*/ | ||
| 24611 | + | 24602 | + |
| 24612 | +void InstructionSelector::VisitSignExtendWord8ToInt32(Node* node) { | 24603 | +void InstructionSelector::VisitSignExtendWord8ToInt32(Node* node) { |
| 24613 | + RiscvOperandGenerator g(this); | 24604 | + RiscvOperandGenerator g(this); |
| @@ -24639,6 +24630,7 @@ index 00000000000..4d86fd02a32 | |||
| 24639 | + g.TempImmediate(0)); | 24630 | + g.TempImmediate(0)); |
| 24640 | +} | 24631 | +} |
| 24641 | + | 24632 | + |
| 24633 | +/* | ||
| 24642 | +void InstructionSelector::VisitF32x4Pmin(Node* node) { | 24634 | +void InstructionSelector::VisitF32x4Pmin(Node* node) { |
| 24643 | + VisitUniqueRRR(this, kRiscvF32x4Pmin, node); | 24635 | + VisitUniqueRRR(this, kRiscvF32x4Pmin, node); |
| 24644 | +} | 24636 | +} |
| @@ -24670,6 +24662,7 @@ index 00000000000..4d86fd02a32 | |||
| 24670 | +VISIT_EXT_MUL(I16x8, I8x16S) | 24662 | +VISIT_EXT_MUL(I16x8, I8x16S) |
| 24671 | +VISIT_EXT_MUL(I16x8, I8x16U) | 24663 | +VISIT_EXT_MUL(I16x8, I8x16U) |
| 24672 | +#undef VISIT_EXT_MUL | 24664 | +#undef VISIT_EXT_MUL |
| 24665 | +*/ | ||
| 24673 | + | 24666 | + |
| 24674 | +// static | 24667 | +// static |
| 24675 | +MachineOperatorBuilder::Flags | 24668 | +MachineOperatorBuilder::Flags |
| @@ -24807,10 +24800,10 @@ index 00000000000..b2923001509 | |||
| 24807 | +#endif // V8_TARGET_ARCH_RISCV64 | 24800 | +#endif // V8_TARGET_ARCH_RISCV64 |
| 24808 | diff --git a/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc b/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc | 24801 | diff --git a/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc b/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc |
| 24809 | new file mode 100644 | 24802 | new file mode 100644 |
| 24810 | index 00000000000..1cbe85ba5df | 24803 | index 00000000000..16cf733e808 |
| 24811 | --- /dev/null | 24804 | --- /dev/null |
| 24812 | +++ b/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc | 24805 | +++ b/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc |
| 24813 | @@ -0,0 +1,41 @@ | 24806 | @@ -0,0 +1,43 @@ |
| 24814 | +// Copyright 2021 the V8 project authors. All rights reserved. | 24807 | +// Copyright 2021 the V8 project authors. All rights reserved. |
| 24815 | +// Use of this source code is governed by a BSD-style license that can be | 24808 | +// Use of this source code is governed by a BSD-style license that can be |
| 24816 | +// found in the LICENSE file. | 24809 | +// found in the LICENSE file. |
| @@ -24820,7 +24813,8 @@ index 00000000000..1cbe85ba5df | |||
| 24820 | +namespace v8 { | 24813 | +namespace v8 { |
| 24821 | +namespace internal { | 24814 | +namespace internal { |
| 24822 | + | 24815 | + |
| 24823 | +const bool Deoptimizer::kSupportsFixedDeoptExitSizes = true; | 24816 | +const bool Deoptimizer::kSupportsFixedDeoptExitSize = true; |
| 24817 | +/* | ||
| 24824 | +const int Deoptimizer::kNonLazyDeoptExitSize = 5 * kInstrSize; | 24818 | +const int Deoptimizer::kNonLazyDeoptExitSize = 5 * kInstrSize; |
| 24825 | +const int Deoptimizer::kLazyDeoptExitSize = 5 * kInstrSize; | 24819 | +const int Deoptimizer::kLazyDeoptExitSize = 5 * kInstrSize; |
| 24826 | +const int Deoptimizer::kEagerWithResumeBeforeArgsSize = 6 * kInstrSize; | 24820 | +const int Deoptimizer::kEagerWithResumeBeforeArgsSize = 6 * kInstrSize; |
| @@ -24829,6 +24823,7 @@ index 00000000000..1cbe85ba5df | |||
| 24829 | +const int Deoptimizer::kEagerWithResumeImmedArgs1PcOffset = kInstrSize; | 24823 | +const int Deoptimizer::kEagerWithResumeImmedArgs1PcOffset = kInstrSize; |
| 24830 | +const int Deoptimizer::kEagerWithResumeImmedArgs2PcOffset = | 24824 | +const int Deoptimizer::kEagerWithResumeImmedArgs2PcOffset = |
| 24831 | + kInstrSize + kSystemPointerSize; | 24825 | + kInstrSize + kSystemPointerSize; |
| 24826 | +*/ | ||
| 24832 | + | 24827 | + |
| 24833 | +Float32 RegisterValues::GetFloatRegister(unsigned n) const { | 24828 | +Float32 RegisterValues::GetFloatRegister(unsigned n) const { |
| 24834 | + return Float32::FromBits( | 24829 | + return Float32::FromBits( |
| @@ -24848,7 +24843,7 @@ index 00000000000..1cbe85ba5df | |||
| 24848 | + UNREACHABLE(); | 24843 | + UNREACHABLE(); |
| 24849 | +} | 24844 | +} |
| 24850 | + | 24845 | + |
| 24851 | +void FrameDescription::SetPc(intptr_t pc) { pc_ = pc; } | 24846 | +// void FrameDescription::SetPc(intptr_t pc) { pc_ = pc; } |
| 24852 | + | 24847 | + |
| 24853 | +} // namespace internal | 24848 | +} // namespace internal |
| 24854 | +} // namespace v8 | 24849 | +} // namespace v8 |
| @@ -24875,10 +24870,10 @@ index 36ab8441100..e3a28ce65b9 100644 | |||
| 24875 | return 0; | 24870 | return 0; |
| 24876 | diff --git a/deps/v8/src/diagnostics/riscv64/disasm-riscv64.cc b/deps/v8/src/diagnostics/riscv64/disasm-riscv64.cc | 24871 | diff --git a/deps/v8/src/diagnostics/riscv64/disasm-riscv64.cc b/deps/v8/src/diagnostics/riscv64/disasm-riscv64.cc |
| 24877 | new file mode 100644 | 24872 | new file mode 100644 |
| 24878 | index 00000000000..a39261555d1 | 24873 | index 00000000000..480fa78c3eb |
| 24879 | --- /dev/null | 24874 | --- /dev/null |
| 24880 | +++ b/deps/v8/src/diagnostics/riscv64/disasm-riscv64.cc | 24875 | +++ b/deps/v8/src/diagnostics/riscv64/disasm-riscv64.cc |
| 24881 | @@ -0,0 +1,1862 @@ | 24876 | @@ -0,0 +1,1864 @@ |
| 24882 | +// Copyright 2021 the V8 project authors. All rights reserved. | 24877 | +// Copyright 2021 the V8 project authors. All rights reserved. |
| 24883 | +// Use of this source code is governed by a BSD-style license that can be | 24878 | +// Use of this source code is governed by a BSD-style license that can be |
| 24884 | +// found in the LICENSE file. | 24879 | +// found in the LICENSE file. |
| @@ -25731,7 +25726,8 @@ index 00000000000..a39261555d1 | |||
| 25731 | + // Special handling for A extension instructions because it uses func5 | 25726 | + // Special handling for A extension instructions because it uses func5 |
| 25732 | + // For all A extension instruction, V8 simulator is pure sequential. No | 25727 | + // For all A extension instruction, V8 simulator is pure sequential. No |
| 25733 | + // Memory address lock or other synchronizaiton behaviors. | 25728 | + // Memory address lock or other synchronizaiton behaviors. |
| 25734 | + switch (instr->InstructionBits() & kRATypeMask) { | 25729 | + uint32_t opcode = (instr->InstructionBits() & kRATypeMask); |
| 25730 | + switch (opcode) { | ||
| 25735 | + case RO_LR_W: | 25731 | + case RO_LR_W: |
| 25736 | + Format(instr, "lr.w'a 'rd, ('rs1)"); | 25732 | + Format(instr, "lr.w'a 'rd, ('rs1)"); |
| 25737 | + break; | 25733 | + break; |
| @@ -25811,7 +25807,8 @@ index 00000000000..a39261555d1 | |||
| 25811 | + // OP_FP instructions (F/D) uses func7 first. Some further uses fun3 and rs2() | 25807 | + // OP_FP instructions (F/D) uses func7 first. Some further uses fun3 and rs2() |
| 25812 | + | 25808 | + |
| 25813 | + // kRATypeMask is only for func7 | 25809 | + // kRATypeMask is only for func7 |
| 25814 | + switch (instr->InstructionBits() & kRFPTypeMask) { | 25810 | + uint32_t opcode = (instr->InstructionBits() & kRFPTypeMask); |
| 25811 | + switch (opcode) { | ||
| 25815 | + // TODO(riscv): Add macro for RISCV F extension | 25812 | + // TODO(riscv): Add macro for RISCV F extension |
| 25816 | + case RO_FADD_S: | 25813 | + case RO_FADD_S: |
| 25817 | + Format(instr, "fadd.s 'fd, 'fs1, 'fs2"); | 25814 | + Format(instr, "fadd.s 'fd, 'fs1, 'fs2"); |
| @@ -26741,24 +26738,6 @@ index 00000000000..a39261555d1 | |||
| 26741 | +} // namespace disasm | 26738 | +} // namespace disasm |
| 26742 | + | 26739 | + |
| 26743 | +#endif // V8_TARGET_ARCH_RISCV64 | 26740 | +#endif // V8_TARGET_ARCH_RISCV64 |
| 26744 | diff --git a/deps/v8/src/diagnostics/riscv64/unwinder-riscv64.cc b/deps/v8/src/diagnostics/riscv64/unwinder-riscv64.cc | ||
| 26745 | new file mode 100644 | ||
| 26746 | index 00000000000..ccfb9268ea2 | ||
| 26747 | --- /dev/null | ||
| 26748 | +++ b/deps/v8/src/diagnostics/riscv64/unwinder-riscv64.cc | ||
| 26749 | @@ -0,0 +1,12 @@ | ||
| 26750 | +// Copyright 2021 the V8 project authors. All rights reserved. | ||
| 26751 | +// Use of this source code is governed by a BSD-style license that can be | ||
| 26752 | +// found in the LICENSE file. | ||
| 26753 | + | ||
| 26754 | +#include "src/diagnostics/unwinder.h" | ||
| 26755 | + | ||
| 26756 | +namespace v8 { | ||
| 26757 | + | ||
| 26758 | +void GetCalleeSavedRegistersFromEntryFrame(void* fp, | ||
| 26759 | + RegisterState* register_state) {} | ||
| 26760 | + | ||
| 26761 | +} // namespace v8 | ||
| 26762 | diff --git a/deps/v8/src/execution/frame-constants.h b/deps/v8/src/execution/frame-constants.h | 26741 | diff --git a/deps/v8/src/execution/frame-constants.h b/deps/v8/src/execution/frame-constants.h |
| 26763 | index a6e5c9522cc..f3cdbc92c50 100644 | 26742 | index a6e5c9522cc..f3cdbc92c50 100644 |
| 26764 | --- a/deps/v8/src/execution/frame-constants.h | 26743 | --- a/deps/v8/src/execution/frame-constants.h |
| @@ -26774,7 +26753,7 @@ index a6e5c9522cc..f3cdbc92c50 100644 | |||
| 26774 | #endif | 26753 | #endif |
| 26775 | diff --git a/deps/v8/src/execution/riscv64/frame-constants-riscv64.cc b/deps/v8/src/execution/riscv64/frame-constants-riscv64.cc | 26754 | diff --git a/deps/v8/src/execution/riscv64/frame-constants-riscv64.cc b/deps/v8/src/execution/riscv64/frame-constants-riscv64.cc |
| 26776 | new file mode 100644 | 26755 | new file mode 100644 |
| 26777 | index 00000000000..13e91639c98 | 26756 | index 00000000000..43be3bde508 |
| 26778 | --- /dev/null | 26757 | --- /dev/null |
| 26779 | +++ b/deps/v8/src/execution/riscv64/frame-constants-riscv64.cc | 26758 | +++ b/deps/v8/src/execution/riscv64/frame-constants-riscv64.cc |
| 26780 | @@ -0,0 +1,32 @@ | 26759 | @@ -0,0 +1,32 @@ |
| @@ -26797,7 +26776,7 @@ index 00000000000..13e91639c98 | |||
| 26797 | +Register JavaScriptFrame::context_register() { return cp; } | 26776 | +Register JavaScriptFrame::context_register() { return cp; } |
| 26798 | +Register JavaScriptFrame::constant_pool_pointer_register() { UNREACHABLE(); } | 26777 | +Register JavaScriptFrame::constant_pool_pointer_register() { UNREACHABLE(); } |
| 26799 | + | 26778 | + |
| 26800 | +int UnoptimizedFrameConstants::RegisterStackSlotCount(int register_count) { | 26779 | +int InterpreterFrameConstants::RegisterStackSlotCount(int register_count) { |
| 26801 | + return register_count; | 26780 | + return register_count; |
| 26802 | +} | 26781 | +} |
| 26803 | + | 26782 | + |
