Commit dabd1c0a authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[cctest] Record execution of parallel moves.

This patch is a first step towards target independent tests for the
CodeGenerator's AssembleMove and AssembleSwap methods.

The tests on top of which this builds would only make sure that no assertions
were triggered while generating moves, and that the hardware is happy executing
them. We want to do more and check that the generated code performs correctly.

In a nutshell, this introduces a facility that can do the following:

  - Setup an environment with registers and stack slots initialised with random
    values.
  - Perform a list of randomly generated moves and/or swaps on those.
  - Return the resulting environment.

This is a first step and therefore is lacking a few things which will be
implemented as follow-ups:

  - Support for kSimd128 moves and swaps.
  - Support large offsets for stack moves, as well as positive and negative.
  - Compare the resulting environment against the result of a reference
    simulation.

For more background information, see this design document:
https://docs.google.com/document/d/1KpioxCmtiB_9RaPaRidZPVtKlZ2BaNKGPYUjKFihhK0

Bug: v8:6848
Change-Id: Ie7dc837f4444df010ab58c64b722d40ee5d2af72
Reviewed-on: https://chromium-review.googlesource.com/677398Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#48459}
parent 00ba1dca
...@@ -1009,6 +1009,7 @@ class V8_EXPORT_PRIVATE CodeAssemblerState { ...@@ -1009,6 +1009,7 @@ class V8_EXPORT_PRIVATE CodeAssemblerState {
friend class CodeAssembler; friend class CodeAssembler;
friend class CodeAssemblerLabel; friend class CodeAssemblerLabel;
friend class CodeAssemblerVariable; friend class CodeAssemblerVariable;
friend class CodeAssemblerTester;
CodeAssemblerState(Isolate* isolate, Zone* zone, CodeAssemblerState(Isolate* isolate, Zone* zone,
CallDescriptor* call_descriptor, Code::Kind kind, CallDescriptor* call_descriptor, Code::Kind kind,
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define V8_TEST_CCTEST_COMPILER_CODE_ASSEMBLER_TESTER_H_ #define V8_TEST_CCTEST_COMPILER_CODE_ASSEMBLER_TESTER_H_
#include "src/compiler/code-assembler.h" #include "src/compiler/code-assembler.h"
#include "src/compiler/raw-machine-assembler.h"
#include "src/handles.h" #include "src/handles.h"
#include "src/interface-descriptors.h" #include "src/interface-descriptors.h"
#include "src/isolate.h" #include "src/isolate.h"
...@@ -30,15 +31,23 @@ class CodeAssemblerTester { ...@@ -30,15 +31,23 @@ class CodeAssemblerTester {
scope_(isolate), scope_(isolate),
state_(isolate, &zone_, parameter_count, kind, "test") {} state_(isolate, &zone_, parameter_count, kind, "test") {}
// This constructor is intended to be used for creating code objects with
// specific flags.
CodeAssemblerTester(Isolate* isolate, Code::Kind kind) CodeAssemblerTester(Isolate* isolate, Code::Kind kind)
: zone_(isolate->allocator(), ZONE_NAME), : zone_(isolate->allocator(), ZONE_NAME),
scope_(isolate), scope_(isolate),
state_(isolate, &zone_, 0, kind, "test") {} state_(isolate, &zone_, 0, kind, "test") {}
CodeAssemblerTester(Isolate* isolate, CallDescriptor* call_descriptor)
: zone_(isolate->allocator(), ZONE_NAME),
scope_(isolate),
state_(isolate, &zone_, call_descriptor, Code::STUB, "test") {}
CodeAssemblerState* state() { return &state_; } CodeAssemblerState* state() { return &state_; }
// Direct low-level access to the machine assembler, for testing only.
RawMachineAssembler* raw_assembler_for_testing() {
return state_.raw_assembler_.get();
}
Handle<Code> GenerateCode() { return CodeAssembler::GenerateCode(&state_); } Handle<Code> GenerateCode() { return CodeAssembler::GenerateCode(&state_); }
Handle<Code> GenerateCodeCloseAndEscape() { Handle<Code> GenerateCodeCloseAndEscape() {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment