summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/compiler')
-rw-r--r--deps/v8/test/cctest/compiler/code-assembler-tester.h4
-rw-r--r--deps/v8/test/cctest/compiler/function-tester.cc5
-rw-r--r--deps/v8/test/cctest/compiler/function-tester.h1
-rw-r--r--deps/v8/test/cctest/compiler/test-basic-block-profiler.cc5
-rw-r--r--deps/v8/test/cctest/compiler/test-code-generator.cc18
-rw-r--r--deps/v8/test/cctest/compiler/test-js-constant-cache.cc4
-rw-r--r--deps/v8/test/cctest/compiler/test-js-context-specialization.cc48
-rw-r--r--deps/v8/test/cctest/compiler/test-js-typed-lowering.cc7
-rw-r--r--deps/v8/test/cctest/compiler/test-linkage.cc7
-rw-r--r--deps/v8/test/cctest/compiler/test-multiple-return.cc166
-rw-r--r--deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc2
-rw-r--r--deps/v8/test/cctest/compiler/test-run-jscalls.cc1
-rw-r--r--deps/v8/test/cctest/compiler/test-run-machops.cc38
-rw-r--r--deps/v8/test/cctest/compiler/test-run-retpoline.cc1
-rw-r--r--deps/v8/test/cctest/compiler/test-run-stubs.cc3
-rw-r--r--deps/v8/test/cctest/compiler/test-run-tail-calls.cc1
-rw-r--r--deps/v8/test/cctest/compiler/test-run-variables.cc2
17 files changed, 188 insertions, 125 deletions
diff --git a/deps/v8/test/cctest/compiler/code-assembler-tester.h b/deps/v8/test/cctest/compiler/code-assembler-tester.h
index 1edb3fdf4b..7c88998f8a 100644
--- a/deps/v8/test/cctest/compiler/code-assembler-tester.h
+++ b/deps/v8/test/cctest/compiler/code-assembler-tester.h
@@ -60,6 +60,10 @@ class CodeAssemblerTester {
&state_, AssemblerOptions::Default(scope_.isolate()));
}
+ Handle<Code> GenerateCode(const AssemblerOptions& options) {
+ return CodeAssembler::GenerateCode(&state_, options);
+ }
+
Handle<Code> GenerateCodeCloseAndEscape() {
return scope_.CloseAndEscape(GenerateCode());
}
diff --git a/deps/v8/test/cctest/compiler/function-tester.cc b/deps/v8/test/cctest/compiler/function-tester.cc
index c3abcf7a15..86678606d4 100644
--- a/deps/v8/test/cctest/compiler/function-tester.cc
+++ b/deps/v8/test/cctest/compiler/function-tester.cc
@@ -4,7 +4,7 @@
#include "test/cctest/compiler/function-tester.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compiler.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
@@ -21,6 +21,7 @@ namespace compiler {
FunctionTester::FunctionTester(const char* source, uint32_t flags)
: isolate(main_isolate()),
+ canonical(isolate),
function((FLAG_allow_natives_syntax = true, NewFunction(source))),
flags_(flags) {
Compile(function);
@@ -30,6 +31,7 @@ FunctionTester::FunctionTester(const char* source, uint32_t flags)
FunctionTester::FunctionTester(Graph* graph, int param_count)
: isolate(main_isolate()),
+ canonical(isolate),
function(NewFunction(BuildFunction(param_count).c_str())),
flags_(0) {
CompileGraph(graph);
@@ -37,6 +39,7 @@ FunctionTester::FunctionTester(Graph* graph, int param_count)
FunctionTester::FunctionTester(Handle<Code> code, int param_count)
: isolate(main_isolate()),
+ canonical(isolate),
function((FLAG_allow_natives_syntax = true,
NewFunction(BuildFunction(param_count).c_str()))),
flags_(0) {
diff --git a/deps/v8/test/cctest/compiler/function-tester.h b/deps/v8/test/cctest/compiler/function-tester.h
index abcb924cec..6e0146958f 100644
--- a/deps/v8/test/cctest/compiler/function-tester.h
+++ b/deps/v8/test/cctest/compiler/function-tester.h
@@ -31,6 +31,7 @@ class FunctionTester : public InitializedHandleScope {
explicit FunctionTester(Handle<Code> code);
Isolate* isolate;
+ CanonicalHandleScope canonical;
Handle<JSFunction> function;
MaybeHandle<Object> Call() {
diff --git a/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc b/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc
index 663b66b74d..f961021913 100644
--- a/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc
+++ b/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc
@@ -18,12 +18,11 @@ class BasicBlockProfilerTest : public RawMachineAssemblerTester<int32_t> {
FLAG_turbo_profiling = true;
}
- void ResetCounts() { isolate()->basic_block_profiler()->ResetCounts(); }
+ void ResetCounts() { BasicBlockProfiler::Get()->ResetCounts(); }
void Expect(size_t size, uint32_t* expected) {
- CHECK(isolate()->basic_block_profiler());
const BasicBlockProfiler::DataList* l =
- isolate()->basic_block_profiler()->data_list();
+ BasicBlockProfiler::Get()->data_list();
CHECK_NE(0, static_cast<int>(l->size()));
const BasicBlockProfiler::Data* data = l->back();
CHECK_EQ(static_cast<int>(size), static_cast<int>(data->n_blocks()));
diff --git a/deps/v8/test/cctest/compiler/test-code-generator.cc b/deps/v8/test/cctest/compiler/test-code-generator.cc
index 9a7b590f5a..a3b80bc887 100644
--- a/deps/v8/test/cctest/compiler/test-code-generator.cc
+++ b/deps/v8/test/cctest/compiler/test-code-generator.cc
@@ -83,8 +83,8 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
// First allocate the FixedArray which will hold the final results. Here we
// should take care of all allocations, meaning we allocate HeapNumbers and
// FixedArrays representing Simd128 values.
- Node* state_out = __ AllocateFixedArray(PACKED_ELEMENTS,
- __ IntPtrConstant(parameters.size()));
+ TNode<FixedArray> state_out = __ Cast(__ AllocateFixedArray(
+ PACKED_ELEMENTS, __ IntPtrConstant(parameters.size())));
for (int i = 0; i < static_cast<int>(parameters.size()); i++) {
switch (parameters[i].representation()) {
case MachineRepresentation::kTagged:
@@ -94,8 +94,8 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
__ StoreFixedArrayElement(state_out, i, __ AllocateHeapNumber());
break;
case MachineRepresentation::kSimd128: {
- Node* vector =
- __ AllocateFixedArray(PACKED_SMI_ELEMENTS, __ IntPtrConstant(4));
+ TNode<FixedArray> vector = __ Cast(
+ __ AllocateFixedArray(PACKED_SMI_ELEMENTS, __ IntPtrConstant(4)));
for (int lane = 0; lane < 4; lane++) {
__ StoreFixedArrayElement(vector, lane, __ SmiConstant(0));
}
@@ -109,7 +109,7 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
}
params.push_back(state_out);
// Then take each element of the initial state and pass them as arguments.
- Node* state_in = __ Parameter(1);
+ TNode<FixedArray> state_in = __ Cast(__ Parameter(1));
for (int i = 0; i < static_cast<int>(parameters.size()); i++) {
Node* element = __ LoadFixedArrayElement(state_in, __ IntPtrConstant(i));
// Unbox all elements before passing them as arguments.
@@ -197,7 +197,7 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate,
std::vector<AllocatedOperand> parameters) {
CodeAssemblerTester tester(isolate, call_descriptor, "teardown");
CodeStubAssembler assembler(tester.state());
- Node* result_array = __ Parameter(1);
+ TNode<FixedArray> result_array = __ Cast(__ Parameter(1));
for (int i = 0; i < static_cast<int>(parameters.size()); i++) {
// The first argument is not used and the second is "result_array".
Node* param = __ Parameter(i + 2);
@@ -216,7 +216,8 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate,
param, MachineRepresentation::kFloat64);
break;
case MachineRepresentation::kSimd128: {
- Node* vector = __ LoadFixedArrayElement(result_array, i);
+ TNode<FixedArray> vector =
+ __ Cast(__ LoadFixedArrayElement(result_array, i));
for (int lane = 0; lane < 4; lane++) {
Node* lane_value =
__ SmiFromInt32(tester.raw_assembler_for_testing()->AddNode(
@@ -995,8 +996,7 @@ class CodeGeneratorTester {
generator_ = new CodeGenerator(
environment->main_zone(), &frame_, &linkage_, environment->code(),
&info_, environment->main_isolate(), base::Optional<OsrHelper>(),
- kNoSourcePosition, nullptr, nullptr,
- PoisoningMitigationLevel::kDontPoison,
+ kNoSourcePosition, nullptr, PoisoningMitigationLevel::kDontPoison,
AssemblerOptions::Default(environment->main_isolate()),
Builtins::kNoBuiltinId);
diff --git a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
index 5843c51698..a31700ede2 100644
--- a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
+++ b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
@@ -15,7 +15,7 @@ namespace compiler {
class JSCacheTesterHelper {
protected:
- JSCacheTesterHelper(Isolate* isolate, Zone* zone)
+ explicit JSCacheTesterHelper(Zone* zone)
: main_graph_(zone),
main_common_(zone),
main_javascript_(zone),
@@ -33,7 +33,7 @@ class JSConstantCacheTester : public HandleAndZoneScope,
public JSGraph {
public:
JSConstantCacheTester()
- : JSCacheTesterHelper(main_isolate(), main_zone()),
+ : JSCacheTesterHelper(main_zone()),
JSGraph(main_isolate(), &main_graph_, &main_common_, &main_javascript_,
nullptr, &main_machine_) {
main_graph_.SetStart(main_graph_.NewNode(common()->Start(0)));
diff --git a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc
index 6560bae096..7938c50069 100644
--- a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc
+++ b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc
@@ -22,7 +22,8 @@ namespace compiler {
class ContextSpecializationTester : public HandleAndZoneScope {
public:
explicit ContextSpecializationTester(Maybe<OuterContext> context)
- : graph_(new (main_zone()) Graph(main_zone())),
+ : canonical_(main_isolate()),
+ graph_(new (main_zone()) Graph(main_zone())),
common_(main_zone()),
javascript_(main_zone()),
machine_(main_zone()),
@@ -30,7 +31,7 @@ class ContextSpecializationTester : public HandleAndZoneScope {
jsgraph_(main_isolate(), graph(), common(), &javascript_, &simplified_,
&machine_),
reducer_(main_zone(), graph()),
- js_heap_broker_(main_isolate()),
+ js_heap_broker_(main_isolate(), main_zone()),
spec_(&reducer_, jsgraph(), &js_heap_broker_, context,
MaybeHandle<JSFunction>()) {}
@@ -50,6 +51,7 @@ class ContextSpecializationTester : public HandleAndZoneScope {
size_t expected_new_depth);
private:
+ CanonicalHandleScope canonical_;
Graph* graph_;
CommonOperatorBuilder common_;
JSOperatorBuilder javascript_;
@@ -106,6 +108,11 @@ void ContextSpecializationTester::CheckContextInputAndDepthChanges(
static const int slot_index = Context::NATIVE_CONTEXT_INDEX;
TEST(ReduceJSLoadContext0) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -170,6 +177,8 @@ TEST(ReduceJSLoadContext0) {
CHECK(match.HasValue());
CHECK_EQ(*expected, *match.Value());
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSLoadContext1) {
@@ -247,6 +256,11 @@ TEST(ReduceJSLoadContext2) {
// context2 <-- context1 <-- context0 (= HeapConstant(context_object1))
// context_object1 <~~ context_object0
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -317,6 +331,8 @@ TEST(ReduceJSLoadContext2) {
t.javascript()->LoadContext(3, slot_index, true), context2, start);
t.CheckChangesToValue(load, slot_value0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSLoadContext3) {
@@ -326,6 +342,11 @@ TEST(ReduceJSLoadContext3) {
// context_object2 from ReduceJSLoadContext2 for this, so almost all test
// expectations are the same as in ReduceJSLoadContext2.
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
HandleAndZoneScope handle_zone_scope;
auto factory = handle_zone_scope.main_isolate()->factory();
@@ -400,9 +421,16 @@ TEST(ReduceJSLoadContext3) {
t.javascript()->LoadContext(3, slot_index, true), context2, start);
t.CheckChangesToValue(load, slot_value0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSStoreContext0) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -462,6 +490,8 @@ TEST(ReduceJSStoreContext0) {
CHECK_EQ(0, static_cast<int>(access.depth()));
CHECK_EQ(false, access.immutable());
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSStoreContext1) {
@@ -509,6 +539,11 @@ TEST(ReduceJSStoreContext1) {
}
TEST(ReduceJSStoreContext2) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -559,9 +594,16 @@ TEST(ReduceJSStoreContext2) {
context2, context2, start, start);
t.CheckContextInputAndDepthChanges(store, context_object0, 0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSStoreContext3) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
HandleAndZoneScope handle_zone_scope;
auto factory = handle_zone_scope.main_isolate()->factory();
@@ -616,6 +658,8 @@ TEST(ReduceJSStoreContext3) {
context2, context2, start, start);
t.CheckContextInputAndDepthChanges(store, context_object0, 0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(SpecializeJSFunction_ToConstant1) {
diff --git a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc
index 3f969f8bfe..eec562cf36 100644
--- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc
+++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc
@@ -23,7 +23,8 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
public:
explicit JSTypedLoweringTester(int num_parameters = 0)
: isolate(main_isolate()),
- js_heap_broker(isolate),
+ canonical(isolate),
+ js_heap_broker(isolate, main_zone()),
binop(nullptr),
unop(nullptr),
javascript(main_zone()),
@@ -39,6 +40,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
}
Isolate* isolate;
+ CanonicalHandleScope canonical;
JSHeapBroker js_heap_broker;
const Operator* binop;
const Operator* unop;
@@ -605,7 +607,8 @@ static void CheckIsConvertedToNumber(Node* val, Node* converted) {
CHECK_EQ(val, converted);
} else {
if (converted->opcode() == IrOpcode::kNumberConstant) return;
- CHECK_EQ(IrOpcode::kJSToNumber, converted->opcode());
+ CHECK(IrOpcode::kJSToNumber == converted->opcode() ||
+ IrOpcode::kJSToNumberConvertBigInt == converted->opcode());
CHECK_EQ(val, converted->InputAt(0));
}
}
diff --git a/deps/v8/test/cctest/compiler/test-linkage.cc b/deps/v8/test/cctest/compiler/test-linkage.cc
index 39ef66c5eb..38c5d17b6b 100644
--- a/deps/v8/test/cctest/compiler/test-linkage.cc
+++ b/deps/v8/test/cctest/compiler/test-linkage.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/code-factory.h"
#include "src/code-stubs.h"
#include "src/compiler.h"
@@ -35,8 +35,9 @@ static Handle<JSFunction> Compile(const char* source) {
.ToHandleChecked();
Handle<SharedFunctionInfo> shared =
Compiler::GetSharedFunctionInfoForScript(
- source_code, Compiler::ScriptDetails(), v8::ScriptOriginOptions(),
- nullptr, nullptr, v8::ScriptCompiler::kNoCompileOptions,
+ isolate, source_code, Compiler::ScriptDetails(),
+ v8::ScriptOriginOptions(), nullptr, nullptr,
+ v8::ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
return isolate->factory()->NewFunctionFromSharedFunctionInfo(
diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc
index 13496ae829..b591d193e7 100644
--- a/deps/v8/test/cctest/compiler/test-multiple-return.cc
+++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc
@@ -130,92 +130,104 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate,
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
return isolate->wasm_engine()->code_manager()->NewNativeModule(
- isolate, code_size, false, std::move(module), env);
+ isolate, wasm::kAllWasmFeatures, code_size, false, std::move(module),
+ env);
}
void TestReturnMultipleValues(MachineType type) {
const int kMaxCount = 20;
- for (int count = 0; count < kMaxCount; ++count) {
- printf("\n==== type = %s, count = %d ====\n\n\n",
- MachineReprToString(type.representation()), count);
- v8::internal::AccountingAllocator allocator;
- Zone zone(&allocator, ZONE_NAME);
- CallDescriptor* desc = CreateCallDescriptor(&zone, count, 2, type);
- HandleAndZoneScope handles;
- RawMachineAssembler m(handles.main_isolate(),
- new (handles.main_zone()) Graph(handles.main_zone()),
- desc, MachineType::PointerRepresentation(),
- InstructionSelector::SupportedMachineOperatorFlags());
-
- // m.Parameter(0) is the WasmContext.
- Node* p0 = m.Parameter(1);
- Node* p1 = m.Parameter(2);
- typedef Node* Node_ptr;
- std::unique_ptr<Node_ptr[]> returns(new Node_ptr[count]);
- for (int i = 0; i < count; ++i) {
- if (i % 3 == 0) returns[i] = Add(m, type, p0, p1);
- if (i % 3 == 1) returns[i] = Sub(m, type, p0, p1);
- if (i % 3 == 2) returns[i] = Mul(m, type, p0, p1);
- }
- m.Return(count, returns.get());
-
- OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
- Code::WASM_FUNCTION);
- Handle<Code> code =
- Pipeline::GenerateCodeForTesting(
- &info, handles.main_isolate(), desc, m.graph(),
- AssemblerOptions::Default(handles.main_isolate()), m.Export())
- .ToHandleChecked();
+ const int kMaxParamCount = 9;
+ // Use 9 parameters as a regression test or https://crbug.com/838098.
+ for (int param_count : {2, kMaxParamCount}) {
+ for (int count = 0; count < kMaxCount; ++count) {
+ printf("\n==== type = %s, count = %d ====\n\n\n",
+ MachineReprToString(type.representation()), count);
+ v8::internal::AccountingAllocator allocator;
+ Zone zone(&allocator, ZONE_NAME);
+ CallDescriptor* desc =
+ CreateCallDescriptor(&zone, count, param_count, type);
+ HandleAndZoneScope handles;
+ RawMachineAssembler m(
+ handles.main_isolate(),
+ new (handles.main_zone()) Graph(handles.main_zone()), desc,
+ MachineType::PointerRepresentation(),
+ InstructionSelector::SupportedMachineOperatorFlags());
+
+ // m.Parameter(0) is the WasmContext.
+ Node* p0 = m.Parameter(1);
+ Node* p1 = m.Parameter(2);
+ typedef Node* Node_ptr;
+ std::unique_ptr<Node_ptr[]> returns(new Node_ptr[count]);
+ for (int i = 0; i < count; ++i) {
+ if (i % 3 == 0) returns[i] = Add(m, type, p0, p1);
+ if (i % 3 == 1) returns[i] = Sub(m, type, p0, p1);
+ if (i % 3 == 2) returns[i] = Mul(m, type, p0, p1);
+ }
+ m.Return(count, returns.get());
+
+ OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
+ Code::WASM_FUNCTION);
+ Handle<Code> code =
+ Pipeline::GenerateCodeForTesting(
+ &info, handles.main_isolate(), desc, m.graph(),
+ AssemblerOptions::Default(handles.main_isolate()), m.Export())
+ .ToHandleChecked();
#ifdef ENABLE_DISASSEMBLER
- if (FLAG_print_code) {
- StdoutStream os;
- code->Disassemble("multi_value", os);
- }
+ if (FLAG_print_code) {
+ StdoutStream os;
+ code->Disassemble("multi_value", os);
+ }
#endif
- const int a = 47, b = 12;
- int expect = 0;
- for (int i = 0, sign = +1; i < count; ++i) {
- if (i % 3 == 0) expect += sign * (a + b);
- if (i % 3 == 1) expect += sign * (a - b);
- if (i % 3 == 2) expect += sign * (a * b);
- if (i % 4 == 0) sign = -sign;
- }
-
- std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule(
- handles.main_isolate(), code->raw_instruction_size());
- byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0)
- ->instructions()
- .start();
-
- RawMachineAssemblerTester<int32_t> mt;
- Node* call_inputs[] = {mt.PointerConstant(code_start),
- // WasmContext dummy
- mt.PointerConstant(nullptr),
- // Inputs
- MakeConstant(mt, type, a),
- MakeConstant(mt, type, b)};
-
- Node* ret_multi = mt.AddNode(mt.common()->Call(desc),
- arraysize(call_inputs), call_inputs);
- Node* ret = MakeConstant(mt, type, 0);
- bool sign = false;
- for (int i = 0; i < count; ++i) {
- Node* x = (count == 1)
- ? ret_multi
- : mt.AddNode(mt.common()->Projection(i), ret_multi);
- ret = sign ? Sub(mt, type, ret, x) : Add(mt, type, ret, x);
- if (i % 4 == 0) sign = !sign;
- }
- mt.Return(ToInt32(mt, type, ret));
+ const int a = 47, b = 12;
+ int expect = 0;
+ for (int i = 0, sign = +1; i < count; ++i) {
+ if (i % 3 == 0) expect += sign * (a + b);
+ if (i % 3 == 1) expect += sign * (a - b);
+ if (i % 3 == 2) expect += sign * (a * b);
+ if (i % 4 == 0) sign = -sign;
+ }
+
+ std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule(
+ handles.main_isolate(), code->raw_instruction_size());
+ byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0)
+ ->instructions()
+ .start();
+
+ RawMachineAssemblerTester<int32_t> mt;
+ const int input_count = 2 + param_count;
+ Node* call_inputs[2 + kMaxParamCount];
+ call_inputs[0] = mt.PointerConstant(code_start);
+ // WasmContext dummy
+ call_inputs[1] = mt.PointerConstant(nullptr);
+ // Special inputs for the test.
+ call_inputs[2] = MakeConstant(mt, type, a);
+ call_inputs[3] = MakeConstant(mt, type, b);
+ for (int i = 2; i < param_count; i++) {
+ call_inputs[2 + i] = MakeConstant(mt, type, i);
+ }
+
+ Node* ret_multi = mt.AddNode(mt.common()->Call(desc),
+ input_count, call_inputs);
+ Node* ret = MakeConstant(mt, type, 0);
+ bool sign = false;
+ for (int i = 0; i < count; ++i) {
+ Node* x = (count == 1)
+ ? ret_multi
+ : mt.AddNode(mt.common()->Projection(i), ret_multi);
+ ret = sign ? Sub(mt, type, ret, x) : Add(mt, type, ret, x);
+ if (i % 4 == 0) sign = !sign;
+ }
+ mt.Return(ToInt32(mt, type, ret));
#ifdef ENABLE_DISASSEMBLER
- Handle<Code> code2 = mt.GetCode();
- if (FLAG_print_code) {
- StdoutStream os;
- code2->Disassemble("multi_value_call", os);
- }
+ Handle<Code> code2 = mt.GetCode();
+ if (FLAG_print_code) {
+ StdoutStream os;
+ code2->Disassemble("multi_value_call", os);
+ }
#endif
- CHECK_EQ(expect, mt.Call());
+ CHECK_EQ(expect, mt.Call());
+ }
}
}
diff --git a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
index 3e0e019fd2..c62ed69105 100644
--- a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -4,7 +4,7 @@
#include <utility>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compiler/pipeline.h"
#include "src/debug/debug-interface.h"
#include "src/execution.h"
diff --git a/deps/v8/test/cctest/compiler/test-run-jscalls.cc b/deps/v8/test/cctest/compiler/test-run-jscalls.cc
index 1b6d4fc49f..b1e9ddfce3 100644
--- a/deps/v8/test/cctest/compiler/test-run-jscalls.cc
+++ b/deps/v8/test/cctest/compiler/test-run-jscalls.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
#include "src/contexts.h"
#include "src/flags.h"
#include "src/objects-inl.h"
diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc
index 709c14e88e..71adbc738d 100644
--- a/deps/v8/test/cctest/compiler/test-run-machops.cc
+++ b/deps/v8/test/cctest/compiler/test-run-machops.cc
@@ -85,11 +85,7 @@ TEST(RunWord32ReverseBits) {
TEST(RunWord32ReverseBytes) {
BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- if (!m.machine()->Word32ReverseBytes().IsSupported()) {
- // We can only test the operator if it exists on the testing platform.
- return;
- }
- m.Return(m.AddNode(m.machine()->Word32ReverseBytes().op(), m.Parameter(0)));
+ m.Return(m.AddNode(m.machine()->Word32ReverseBytes(), m.Parameter(0)));
CHECK_EQ(uint32_t(0x00000000), m.Call(uint32_t(0x00000000)));
CHECK_EQ(uint32_t(0x12345678), m.Call(uint32_t(0x78563412)));
@@ -224,11 +220,7 @@ TEST(RunWord64ReverseBits) {
TEST(RunWord64ReverseBytes) {
BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Uint64());
- if (!m.machine()->Word64ReverseBytes().IsSupported()) {
- return;
- }
-
- m.Return(m.AddNode(m.machine()->Word64ReverseBytes().op(), m.Parameter(0)));
+ m.Return(m.AddNode(m.machine()->Word64ReverseBytes(), m.Parameter(0)));
CHECK_EQ(uint64_t(0x0000000000000000), m.Call(uint64_t(0x0000000000000000)));
CHECK_EQ(uint64_t(0x1234567890ABCDEF), m.Call(uint64_t(0xEFCDAB9078563412)));
@@ -2396,7 +2388,7 @@ TEST(RunWord32AndP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32And(bt.param0, m.Word32Not(bt.param1)));
+ bt.AddReturn(m.Word32And(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
int32_t expected = *i & ~(*j);
@@ -2407,7 +2399,7 @@ TEST(RunWord32AndP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32And(m.Word32Not(bt.param0), bt.param1));
+ bt.AddReturn(m.Word32And(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
int32_t expected = ~(*i) & *j;
@@ -2516,7 +2508,8 @@ TEST(RunWord32AndImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32And(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
+ m.Return(
+ m.Word32And(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i & ~(*j);
CHECK_EQ(expected, m.Call(*j));
@@ -2709,7 +2702,7 @@ TEST(RunWord32OrP) {
{
RawMachineAssemblerTester<int32_t> m;
Uint32BinopTester bt(&m);
- bt.AddReturn(m.Word32Or(bt.param0, m.Word32Not(bt.param1)));
+ bt.AddReturn(m.Word32Or(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | ~(*j);
@@ -2720,7 +2713,7 @@ TEST(RunWord32OrP) {
{
RawMachineAssemblerTester<int32_t> m;
Uint32BinopTester bt(&m);
- bt.AddReturn(m.Word32Or(m.Word32Not(bt.param0), bt.param1));
+ bt.AddReturn(m.Word32Or(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = ~(*i) | *j;
@@ -2745,7 +2738,8 @@ TEST(RunWord32OrImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Or(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
+ m.Return(
+ m.Word32Or(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | ~(*j);
CHECK_EQ(expected, m.Call(*j));
@@ -2947,7 +2941,7 @@ TEST(RunWord32XorP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32Xor(bt.param0, m.Word32Not(bt.param1)));
+ bt.AddReturn(m.Word32Xor(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected = *i ^ ~(*j);
@@ -2958,7 +2952,7 @@ TEST(RunWord32XorP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32Xor(m.Word32Not(bt.param0), bt.param1));
+ bt.AddReturn(m.Word32Xor(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected = ~(*i) ^ *j;
@@ -2969,7 +2963,8 @@ TEST(RunWord32XorP) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Xor(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
+ m.Return(
+ m.Word32Xor(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i ^ ~(*j);
CHECK_EQ(expected, m.Call(*j));
@@ -3454,10 +3449,9 @@ TEST(RunWord32RorInComparison) {
}
}
-
-TEST(RunWord32NotP) {
+TEST(RunWord32BitwiseNotP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- m.Return(m.Word32Not(m.Parameter(0)));
+ m.Return(m.Word32BitwiseNot(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
int expected = ~(*i);
CHECK_EQ(expected, m.Call(*i));
diff --git a/deps/v8/test/cctest/compiler/test-run-retpoline.cc b/deps/v8/test/cctest/compiler/test-run-retpoline.cc
index 4e5f99f413..3bbab4265f 100644
--- a/deps/v8/test/cctest/compiler/test-run-retpoline.cc
+++ b/deps/v8/test/cctest/compiler/test-run-retpoline.cc
@@ -128,6 +128,7 @@ CallDescriptor* CreateDescriptorForStackArguments(Zone* zone,
void TestHelper(int n, int m, bool tail) {
HandleAndZoneScope scope;
Isolate* isolate = scope.main_isolate();
+ CanonicalHandleScope canonical(isolate);
Zone* zone = scope.main_zone();
CallDescriptor* caller_descriptor =
CreateDescriptorForStackArguments(zone, n);
diff --git a/deps/v8/test/cctest/compiler/test-run-stubs.cc b/deps/v8/test/cctest/compiler/test-run-stubs.cc
index 1751ee0836..9c76f22b99 100644
--- a/deps/v8/test/cctest/compiler/test-run-stubs.cc
+++ b/deps/v8/test/cctest/compiler/test-run-stubs.cc
@@ -13,6 +13,7 @@
#include "src/compiler/machine-operator.h"
#include "src/compiler/pipeline.h"
#include "src/objects-inl.h"
+#include "src/objects/js-array-inl.h"
#include "src/optimized-compilation-info.h"
#include "test/cctest/compiler/function-tester.h"
@@ -22,7 +23,7 @@ namespace compiler {
class StubTester {
public:
- StubTester(Isolate* isolate, Zone* zone, CodeStub* stub)
+ StubTester(Zone* zone, CodeStub* stub)
: zone_(zone),
info_(ArrayVector("test"), zone, Code::STUB),
interface_descriptor_(stub->GetCallInterfaceDescriptor()),
diff --git a/deps/v8/test/cctest/compiler/test-run-tail-calls.cc b/deps/v8/test/cctest/compiler/test-run-tail-calls.cc
index 34d6212d73..b57b4fcbac 100644
--- a/deps/v8/test/cctest/compiler/test-run-tail-calls.cc
+++ b/deps/v8/test/cctest/compiler/test-run-tail-calls.cc
@@ -108,6 +108,7 @@ CallDescriptor* CreateDescriptorForStackArguments(Zone* zone,
void TestHelper(int n, int m) {
HandleAndZoneScope scope;
Isolate* isolate = scope.main_isolate();
+ CanonicalHandleScope canonical(isolate);
Zone* zone = scope.main_zone();
CallDescriptor* caller_descriptor =
CreateDescriptorForStackArguments(zone, n);
diff --git a/deps/v8/test/cctest/compiler/test-run-variables.cc b/deps/v8/test/cctest/compiler/test-run-variables.cc
index 728d60f491..e2539dc16c 100644
--- a/deps/v8/test/cctest/compiler/test-run-variables.cc
+++ b/deps/v8/test/cctest/compiler/test-run-variables.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "test/cctest/compiler/function-tester.h"