diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-12-04 08:20:37 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-12-06 15:23:33 +0100 |
commit | 9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3 (patch) | |
tree | 2b0c843168dafb939d8df8a15b2aa72b76dee51d /deps/v8/test/cctest/compiler/test-run-native-calls.cc | |
parent | b8fbe69db1292307adb2c2b2e0d5ef48c4ab2faf (diff) | |
download | android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.gz android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.bz2 android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.zip |
deps: update V8 to 7.1.302.28
PR-URL: https://github.com/nodejs/node/pull/23423
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/compiler/test-run-native-calls.cc')
-rw-r--r-- | deps/v8/test/cctest/compiler/test-run-native-calls.cc | 92 |
1 files changed, 41 insertions, 51 deletions
diff --git a/deps/v8/test/cctest/compiler/test-run-native-calls.cc b/deps/v8/test/cctest/compiler/test-run-native-calls.cc index b23bd500c6..2ddaa1bc07 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <vector> + #include "src/assembler.h" #include "src/codegen.h" #include "src/compiler/linkage.h" @@ -9,6 +11,7 @@ #include "src/machine-type.h" #include "src/objects-inl.h" #include "src/register-configuration.h" +#include "src/wasm/wasm-linkage.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/codegen-tester.h" @@ -20,8 +23,6 @@ namespace internal { namespace compiler { namespace test_run_native_calls { -const auto GetRegConfig = RegisterConfiguration::Default; - namespace { typedef float float32; typedef double float64; @@ -84,21 +85,12 @@ class RegisterPairs : public Pairs { GetRegConfig()->allocatable_general_codes()) {} }; - -// Pairs of double registers. +// Pairs of float registers. class Float32RegisterPairs : public Pairs { public: Float32RegisterPairs() - : Pairs( - 100, -#if V8_TARGET_ARCH_ARM - // TODO(bbudge) Modify wasm linkage to allow use of all float regs. - GetRegConfig()->num_allocatable_double_registers() / 2 - 2, -#else - GetRegConfig()->num_allocatable_double_registers(), -#endif - GetRegConfig()->allocatable_double_codes()) { - } + : Pairs(100, GetRegConfig()->num_allocatable_float_registers(), + GetRegConfig()->allocatable_float_codes()) {} }; @@ -112,48 +104,39 @@ class Float64RegisterPairs : public Pairs { // Helper for allocating either an GP or FP reg, or the next stack slot. -struct Allocator { - Allocator(int* gp, int gpc, int* fp, int fpc) - : gp_count(gpc), - gp_offset(0), - gp_regs(gp), - fp_count(fpc), - fp_offset(0), - fp_regs(fp), - stack_offset(0) {} - - int gp_count; - int gp_offset; - int* gp_regs; - - int fp_count; - int fp_offset; - int* fp_regs; - - int stack_offset; +class Allocator { + public: + Allocator(int* gp, int gpc, int* fp, int fpc) : stack_offset_(0) { + for (int i = 0; i < gpc; ++i) { + gp_.push_back(Register::from_code(gp[i])); + } + for (int i = 0; i < fpc; ++i) { + fp_.push_back(DoubleRegister::from_code(fp[i])); + } + Reset(); + } + + int stack_offset() const { return stack_offset_; } LinkageLocation Next(MachineType type) { if (IsFloatingPoint(type.representation())) { // Allocate a floating point register/stack location. - if (fp_offset < fp_count) { - int code = fp_regs[fp_offset++]; -#if V8_TARGET_ARCH_ARM - // TODO(bbudge) Modify wasm linkage to allow use of all float regs. - if (type.representation() == MachineRepresentation::kFloat32) code *= 2; -#endif + if (reg_allocator_->CanAllocateFP(type.representation())) { + int code = reg_allocator_->NextFpReg(type.representation()); return LinkageLocation::ForRegister(code, type); } else { - int offset = -1 - stack_offset; - stack_offset += StackWords(type); + int offset = -1 - stack_offset_; + stack_offset_ += StackWords(type); return LinkageLocation::ForCallerFrameSlot(offset, type); } } else { // Allocate a general purpose register/stack location. - if (gp_offset < gp_count) { - return LinkageLocation::ForRegister(gp_regs[gp_offset++], type); + if (reg_allocator_->CanAllocateGP()) { + int code = reg_allocator_->NextGpReg(); + return LinkageLocation::ForRegister(code, type); } else { - int offset = -1 - stack_offset; - stack_offset += StackWords(type); + int offset = -1 - stack_offset_; + stack_offset_ += StackWords(type); return LinkageLocation::ForCallerFrameSlot(offset, type); } } @@ -163,10 +146,17 @@ struct Allocator { return size <= kPointerSize ? 1 : size / kPointerSize; } void Reset() { - fp_offset = 0; - gp_offset = 0; - stack_offset = 0; + stack_offset_ = 0; + reg_allocator_.reset( + new wasm::LinkageAllocator(gp_.data(), static_cast<int>(gp_.size()), + fp_.data(), static_cast<int>(fp_.size()))); } + + private: + std::vector<Register> gp_; + std::vector<DoubleRegister> fp_; + std::unique_ptr<wasm::LinkageAllocator> reg_allocator_; + int stack_offset_; }; @@ -197,7 +187,7 @@ class RegisterConfig { MachineType target_type = MachineType::AnyTagged(); LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); - int stack_param_count = params.stack_offset; + int stack_param_count = params.stack_offset(); return new (zone) CallDescriptor( // -- CallDescriptor::kCallCodeObject, // kind target_type, // target MachineType @@ -868,7 +858,7 @@ TEST(Float32Select_registers) { return; } - int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableFloatCode(0)}; ArgsBuffer<float32>::Sig sig(2); Float32RegisterPairs pairs; @@ -912,7 +902,7 @@ TEST(Float64Select_registers) { TEST(Float32Select_stack_params_return_reg) { - int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; + int rarray[] = {GetRegConfig()->GetAllocatableFloatCode(0)}; Allocator params(nullptr, 0, nullptr, 0); Allocator rets(nullptr, 0, rarray, 1); RegisterConfig config(params, rets); |