Commit a917b1cb authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[CSA] TNodify the rest of the member variables in interpreter assembler

TNodify related methods:
 * BytecodeArrayTaggedPointer
 * DispatchTablePointer (renamed from DispatchTableRawPointer)
 * GetAccumulatorUnchecked

SloppyTNodify SetAccumulator's argument.

Marking some tests as slow, due to TNodification.

Bug: v8:6949
Change-Id: I3a56c47247828ec1313ce69ce76064efedf57776
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1782162Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63573}
parent 26b36496
......@@ -1408,8 +1408,8 @@ Node* CodeAssembler::TailCallBytecodeDispatch(
// Instantiate TailCallBytecodeDispatch() for argument counts used by
// CSA-generated code
template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallBytecodeDispatch(
const CallInterfaceDescriptor& descriptor, Node* target, Node*, Node*,
Node*, Node*);
const CallInterfaceDescriptor& descriptor, Node* target, TNode<Object>,
Node*, TNode<BytecodeArray>, TNode<ExternalReference>);
TNode<Object> CodeAssembler::TailCallJSCode(TNode<Code> code,
TNode<Context> context,
......
......@@ -218,6 +218,10 @@ struct MachineRepresentationOf<
static const MachineRepresentation value =
MachineTypeOf<T>::value.representation();
};
template <>
struct MachineRepresentationOf<ExternalReference> {
static const MachineRepresentation value = RawPtrT::kMachineRepresentation;
};
template <class T>
struct is_valid_type_tag {
......
......@@ -32,19 +32,19 @@ InterpreterAssembler::InterpreterAssembler(CodeAssemblerState* state,
bytecode_(bytecode),
operand_scale_(operand_scale),
TVARIABLE_CONSTRUCTOR(interpreted_frame_pointer_),
VARIABLE_CONSTRUCTOR(
bytecode_array_, MachineRepresentation::kTagged,
Parameter(InterpreterDispatchDescriptor::kBytecodeArray)),
TVARIABLE_CONSTRUCTOR(
bytecode_array_,
CAST(Parameter(InterpreterDispatchDescriptor::kBytecodeArray))),
TVARIABLE_CONSTRUCTOR(
bytecode_offset_,
UncheckedCast<IntPtrT>(
Parameter(InterpreterDispatchDescriptor::kBytecodeOffset))),
VARIABLE_CONSTRUCTOR(
dispatch_table_, MachineType::PointerRepresentation(),
Parameter(InterpreterDispatchDescriptor::kDispatchTable)),
VARIABLE_CONSTRUCTOR(
accumulator_, MachineRepresentation::kTagged,
Parameter(InterpreterDispatchDescriptor::kAccumulator)),
TVARIABLE_CONSTRUCTOR(
dispatch_table_, UncheckedCast<ExternalReference>(Parameter(
InterpreterDispatchDescriptor::kDispatchTable))),
TVARIABLE_CONSTRUCTOR(
accumulator_,
CAST(Parameter(InterpreterDispatchDescriptor::kAccumulator))),
accumulator_use_(AccumulatorUse::kNone),
made_call_(false),
reloaded_frame_ptr_(false),
......@@ -129,27 +129,27 @@ void InterpreterAssembler::SaveBytecodeOffset() {
}
}
Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
TNode<BytecodeArray> InterpreterAssembler::BytecodeArrayTaggedPointer() {
// Force a re-load of the bytecode array after every call in case the debugger
// has been activated.
if (!bytecode_array_valid_) {
bytecode_array_.Bind(LoadRegister(Register::bytecode_array()));
bytecode_array_ = CAST(LoadRegister(Register::bytecode_array()));
bytecode_array_valid_ = true;
}
return bytecode_array_.value();
}
Node* InterpreterAssembler::DispatchTableRawPointer() {
TNode<ExternalReference> InterpreterAssembler::DispatchTablePointer() {
if (Bytecodes::MakesCallAlongCriticalPath(bytecode_) && made_call_ &&
(dispatch_table_.value() ==
Parameter(InterpreterDispatchDescriptor::kDispatchTable))) {
dispatch_table_.Bind(ExternalConstant(
ExternalReference::interpreter_dispatch_table_address(isolate())));
dispatch_table_ = ExternalConstant(
ExternalReference::interpreter_dispatch_table_address(isolate()));
}
return dispatch_table_.value();
}
Node* InterpreterAssembler::GetAccumulatorUnchecked() {
TNode<Object> InterpreterAssembler::GetAccumulatorUnchecked() {
return accumulator_.value();
}
......@@ -159,10 +159,11 @@ TNode<Object> InterpreterAssembler::GetAccumulator() {
return TaggedPoisonOnSpeculation(GetAccumulatorUnchecked());
}
void InterpreterAssembler::SetAccumulator(Node* value) {
// TODO(v8:6949): Remove sloppy-ness from SetAccumulator's value argument.
void InterpreterAssembler::SetAccumulator(SloppyTNode<Object> value) {
DCHECK(Bytecodes::WritesAccumulator(bytecode_));
accumulator_use_ = accumulator_use_ | AccumulatorUse::kWrite;
accumulator_.Bind(value);
accumulator_ = value;
}
TNode<Context> InterpreterAssembler::GetContext() {
......@@ -1436,9 +1437,8 @@ Node* InterpreterAssembler::DispatchToBytecode(Node* target_bytecode,
TraceBytecodeDispatch(target_bytecode);
}
Node* target_code_entry =
Load(MachineType::Pointer(), DispatchTableRawPointer(),
TimesSystemPointerSize(target_bytecode));
Node* target_code_entry = Load(MachineType::Pointer(), DispatchTablePointer(),
TimesSystemPointerSize(target_bytecode));
return DispatchToBytecodeHandlerEntry(target_code_entry, new_bytecode_offset,
target_bytecode);
......@@ -1462,7 +1462,7 @@ Node* InterpreterAssembler::DispatchToBytecodeHandlerEntry(
return TailCallBytecodeDispatch(
InterpreterDispatchDescriptor{}, poisoned_handler_entry,
GetAccumulatorUnchecked(), bytecode_offset, BytecodeArrayTaggedPointer(),
DispatchTableRawPointer());
DispatchTablePointer());
}
void InterpreterAssembler::DispatchWide(OperandScale operand_scale) {
......@@ -1493,9 +1493,8 @@ void InterpreterAssembler::DispatchWide(OperandScale operand_scale) {
UNREACHABLE();
}
TNode<WordT> target_index = IntPtrAdd(base_index, next_bytecode);
Node* target_code_entry =
Load(MachineType::Pointer(), DispatchTableRawPointer(),
TimesSystemPointerSize(target_index));
Node* target_code_entry = Load(MachineType::Pointer(), DispatchTablePointer(),
TimesSystemPointerSize(target_index));
DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset,
next_bytecode);
......
......@@ -68,7 +68,7 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
// Accumulator.
compiler::TNode<Object> GetAccumulator();
void SetAccumulator(compiler::Node* value);
void SetAccumulator(SloppyTNode<Object> value);
// Context.
compiler::TNode<Context> GetContext();
......@@ -277,16 +277,16 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
void ToNumberOrNumeric(Object::Conversion mode);
private:
// Returns a tagged pointer to the current function's BytecodeArray object.
compiler::Node* BytecodeArrayTaggedPointer();
// Returns a pointer to the current function's BytecodeArray object.
TNode<BytecodeArray> BytecodeArrayTaggedPointer();
// Returns a raw pointer to first entry in the interpreter dispatch table.
compiler::Node* DispatchTableRawPointer();
// Returns a pointer to first entry in the interpreter dispatch table.
TNode<ExternalReference> DispatchTablePointer();
// Returns the accumulator value without checking whether bytecode
// uses it. This is intended to be used only in dispatch and in
// tracing as these need to bypass accumulator use validity checks.
compiler::Node* GetAccumulatorUnchecked();
TNode<Object> GetAccumulatorUnchecked();
// Returns the frame pointer for the interpreted frame of the function being
// interpreted.
......@@ -424,11 +424,11 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
Bytecode bytecode_;
OperandScale operand_scale_;
TVariable<RawPtrT> interpreted_frame_pointer_;
CodeStubAssembler::Variable bytecode_array_;
TVariable<IntPtrT> bytecode_offset_;
CodeStubAssembler::Variable dispatch_table_;
CodeStubAssembler::Variable accumulator_;
CodeStubAssembler::TVariable<RawPtrT> interpreted_frame_pointer_;
CodeStubAssembler::TVariable<BytecodeArray> bytecode_array_;
CodeStubAssembler::TVariable<IntPtrT> bytecode_offset_;
CodeStubAssembler::TVariable<ExternalReference> dispatch_table_;
CodeStubAssembler::TVariable<Object> accumulator_;
AccumulatorUse accumulator_use_;
bool made_call_;
bool reloaded_frame_ptr_;
......
......@@ -151,6 +151,8 @@
# Pass but take too long with the simulator.
'test-api/ExternalArrays': [PASS, SLOW],
'test-api/Threading*': [SKIP],
'test-cpu-profiler/MultipleIsolates': [PASS, SLOW],
'test-debug/DebugBreakStackTrace': [PASS, SLOW],
}], # 'arch == arm64 and simulator_run'
##############################################################################
......@@ -259,6 +261,7 @@
['arch == arm and simulator_run', {
# Pass but take too long with the simulator.
'test-api/Threading*': [SKIP],
'test-cpu-profiler/MultipleIsolates': [PASS, SLOW],
}], # 'arch == arm and simulator_run'
##############################################################################
......
......@@ -470,11 +470,13 @@
'array-reduce': [PASS, SLOW],
'array-sort': [PASS, SLOW],
'array-splice': [PASS, SLOW],
'array-store-and-grow': [PASS, SLOW],
'bit-not': [PASS, SLOW],
'compiler/alloc-number': [PASS, SLOW],
'compiler/osr-with-args': [PASS, SLOW],
'generated-transition-stub': [PASS, SLOW],
'json2': [PASS, SLOW],
'large-object-literal-slow-elements': [PASS, SLOW],
'math-floor-of-div-nosudiv': [PASS, SLOW],
'math-floor-of-div': [PASS, SLOW],
'messages': [PASS, SLOW],
......@@ -486,6 +488,7 @@
'regress/regress-create-exception': [PASS, SLOW],
'regress/regress-json-stringify-gc': [PASS, SLOW],
'string-indexof-2': [PASS, SLOW],
'unbox-double-arrays': [PASS, SLOW],
'unicodelctest-no-optimization': [PASS, SLOW],
'unicodelctest': [PASS, SLOW],
'unicode-test': [PASS, SLOW],
......@@ -494,14 +497,27 @@
# BUG(v8:7247).
'regress/regress-779407': [PASS, SLOW, NO_VARIANTS],
# BUG(v8:9256). Slow with pointer compression.
'regress/regress-708247': [PASS, ['pointer_compression', SLOW]],
'es6/array-concat': [PASS, ['pointer_compression', SLOW]],
'non-extensible-array-reduce': [PASS, ['pointer_compression', SLOW]],
'regress/regress-454725': [PASS, ['pointer_compression', SLOW]],
}], # 'arch == arm64'
##############################################################################
['arch == arm64 and simulator_run', {
# Slow in simulator builds
'compiler/osr-follow': [PASS, SLOW],
'es6/array-concat': [PASS, SLOW],
'non-extensible-array-reduce': [PASS, SLOW],
'regress/regress-454725': [PASS, SLOW],
'regress/regress-708247': [PASS, SLOW],
'compiler/osr-big': [PASS, SLOW],
'frozen-array-reduce': [PASS, SLOW],
'json': [PASS, SLOW],
'sealed-array-reduce': [PASS, SLOW],
'try': [PASS, SLOW],
# Slow without pointer compression
'wasm/asm-wasm-u32': [PASS, ['not pointer_compression', SLOW]],
}], # 'arch == arm64 and simulator_run'
##############################################################################
['arch == arm64 and mode == debug and simulator_run', {
# Pass but take too long with the simulator in debug mode.
......
......@@ -1035,6 +1035,9 @@
#BUG(3152): Avoid C stack overflow.
'js1_5/extensions/regress-355497': [FAIL_OK, '--sim-stack-size=512'],
# Slow without pointer compression
'js1_5/Regress/regress-80981': [PASS, ['not pointer_compression', SLOW]],
}], # 'arch == arm64 and simulator_run'
['system == android', {
......
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