[cleanup][interpreter] Fix kPointerSize usages in src/interpreter/

Bug: v8:8477, v8:8562
Change-Id: Id97f5b53fe6e6a696d8955acc1ab1bc5ac2f4052
Reviewed-on: https://chromium-review.googlesource.com/c/1388527
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58474}
This commit is contained in:
Igor Sheludko 2018-12-27 05:22:35 +01:00 committed by Commit Bot
parent 4a44cf83b0
commit 2a6b9fe2da
5 changed files with 20 additions and 32 deletions

View File

@ -1890,18 +1890,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Variable* var_numeric, Variable* var_numeric,
Variable* var_feedback); Variable* var_feedback);
// TODO(ishell): drop this version once all usages are fixed.
TNode<WordT> TimesPointerSize(SloppyTNode<WordT> value) {
STATIC_ASSERT(kTaggedSize == kSystemPointerSize);
return TimesSystemPointerSize(value);
}
TNode<IntPtrT> TimesPointerSize(TNode<IntPtrT> value) {
return Signed(TimesPointerSize(implicit_cast<TNode<WordT>>(value)));
}
TNode<UintPtrT> TimesPointerSize(TNode<UintPtrT> value) {
return Unsigned(TimesPointerSize(implicit_cast<TNode<WordT>>(value)));
}
TNode<WordT> TimesSystemPointerSize(SloppyTNode<WordT> value); TNode<WordT> TimesSystemPointerSize(SloppyTNode<WordT> value);
TNode<IntPtrT> TimesSystemPointerSize(TNode<IntPtrT> value) { TNode<IntPtrT> TimesSystemPointerSize(TNode<IntPtrT> value) {
return Signed(TimesSystemPointerSize(implicit_cast<TNode<WordT>>(value))); return Signed(TimesSystemPointerSize(implicit_cast<TNode<WordT>>(value)));

View File

@ -42,7 +42,7 @@ Handle<BytecodeArray> BytecodeArrayWriter::ToBytecodeArray(
DCHECK_EQ(0, unbound_jumps_); DCHECK_EQ(0, unbound_jumps_);
int bytecode_size = static_cast<int>(bytecodes()->size()); int bytecode_size = static_cast<int>(bytecodes()->size());
int frame_size = register_count * kPointerSize; int frame_size = register_count * kSystemPointerSize;
Handle<FixedArray> constant_pool = Handle<FixedArray> constant_pool =
constant_array_builder()->ToFixedArray(isolate); constant_array_builder()->ToFixedArray(isolate);
Handle<ByteArray> source_position_table = Handle<ByteArray> source_position_table =

View File

@ -11,27 +11,27 @@ namespace interpreter {
static const int kLastParamRegisterIndex = static const int kLastParamRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp - (InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kLastParamFromFp) / InterpreterFrameConstants::kLastParamFromFp) /
kPointerSize; kSystemPointerSize;
static const int kFunctionClosureRegisterIndex = static const int kFunctionClosureRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp - (InterpreterFrameConstants::kRegisterFileFromFp -
StandardFrameConstants::kFunctionOffset) / StandardFrameConstants::kFunctionOffset) /
kPointerSize; kSystemPointerSize;
static const int kCurrentContextRegisterIndex = static const int kCurrentContextRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp - (InterpreterFrameConstants::kRegisterFileFromFp -
StandardFrameConstants::kContextOffset) / StandardFrameConstants::kContextOffset) /
kPointerSize; kSystemPointerSize;
static const int kBytecodeArrayRegisterIndex = static const int kBytecodeArrayRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp - (InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kBytecodeArrayFromFp) / InterpreterFrameConstants::kBytecodeArrayFromFp) /
kPointerSize; kSystemPointerSize;
static const int kBytecodeOffsetRegisterIndex = static const int kBytecodeOffsetRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp - (InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kBytecodeOffsetFromFp) / InterpreterFrameConstants::kBytecodeOffsetFromFp) /
kPointerSize; kSystemPointerSize;
static const int kCallerPCOffsetRegisterIndex = static const int kCallerPCOffsetRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp - (InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kCallerPCOffsetFromFp) / InterpreterFrameConstants::kCallerPCOffsetFromFp) /
kPointerSize; kSystemPointerSize;
Register Register::FromParameterIndex(int index, int parameter_count) { Register Register::FromParameterIndex(int index, int parameter_count) {
DCHECK_GE(index, 0); DCHECK_GE(index, 0);

View File

@ -91,7 +91,7 @@ class V8_EXPORT_PRIVATE Register final {
static const int kInvalidIndex = kMaxInt; static const int kInvalidIndex = kMaxInt;
static const int kRegisterFileStartOffset = static const int kRegisterFileStartOffset =
InterpreterFrameConstants::kRegisterFileFromFp / kPointerSize; InterpreterFrameConstants::kRegisterFileFromFp / kSystemPointerSize;
int index_; int index_;
}; };

View File

@ -232,7 +232,7 @@ Node* InterpreterAssembler::RegisterLocation(Register reg) {
} }
Node* InterpreterAssembler::RegisterFrameOffset(Node* index) { Node* InterpreterAssembler::RegisterFrameOffset(Node* index) {
return TimesPointerSize(index); return TimesSystemPointerSize(index);
} }
Node* InterpreterAssembler::LoadRegister(Node* reg_index) { Node* InterpreterAssembler::LoadRegister(Node* reg_index) {
@ -242,12 +242,12 @@ Node* InterpreterAssembler::LoadRegister(Node* reg_index) {
Node* InterpreterAssembler::LoadRegister(Register reg) { Node* InterpreterAssembler::LoadRegister(Register reg) {
return Load(MachineType::AnyTagged(), GetInterpretedFramePointer(), return Load(MachineType::AnyTagged(), GetInterpretedFramePointer(),
IntPtrConstant(reg.ToOperand() << kPointerSizeLog2)); IntPtrConstant(reg.ToOperand() << kSystemPointerSizeLog2));
} }
Node* InterpreterAssembler::LoadAndUntagRegister(Register reg) { Node* InterpreterAssembler::LoadAndUntagRegister(Register reg) {
return LoadAndUntagSmi(GetInterpretedFramePointer(), reg.ToOperand() return LoadAndUntagSmi(GetInterpretedFramePointer(),
<< kPointerSizeLog2); reg.ToOperand() << kSystemPointerSizeLog2);
} }
Node* InterpreterAssembler::LoadRegisterAtOperandIndex(int operand_index) { Node* InterpreterAssembler::LoadRegisterAtOperandIndex(int operand_index) {
@ -298,7 +298,7 @@ Node* InterpreterAssembler::RegisterLocationInRegisterList(
void InterpreterAssembler::StoreRegister(Node* value, Register reg) { void InterpreterAssembler::StoreRegister(Node* value, Register reg) {
StoreNoWriteBarrier( StoreNoWriteBarrier(
MachineRepresentation::kTagged, GetInterpretedFramePointer(), MachineRepresentation::kTagged, GetInterpretedFramePointer(),
IntPtrConstant(reg.ToOperand() << kPointerSizeLog2), value); IntPtrConstant(reg.ToOperand() << kSystemPointerSizeLog2), value);
} }
void InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { void InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) {
@ -308,7 +308,7 @@ void InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) {
} }
void InterpreterAssembler::StoreAndTagRegister(Node* value, Register reg) { void InterpreterAssembler::StoreAndTagRegister(Node* value, Register reg) {
int offset = reg.ToOperand() << kPointerSizeLog2; int offset = reg.ToOperand() << kSystemPointerSizeLog2;
StoreAndTagSmi(GetInterpretedFramePointer(), offset, value); StoreAndTagSmi(GetInterpretedFramePointer(), offset, value);
} }
@ -710,7 +710,7 @@ void InterpreterAssembler::IncrementCallCount(Node* feedback_vector,
Node* slot_id) { Node* slot_id) {
Comment("increment call count"); Comment("increment call count");
TNode<Smi> call_count = TNode<Smi> call_count =
CAST(LoadFeedbackVectorSlot(feedback_vector, slot_id, kPointerSize)); CAST(LoadFeedbackVectorSlot(feedback_vector, slot_id, kTaggedSize));
// The lowest {FeedbackNexus::CallCountField::kShift} bits of the call // The lowest {FeedbackNexus::CallCountField::kShift} bits of the call
// count are used as flags. To increment the call count by 1 we hence // count are used as flags. To increment the call count by 1 we hence
// have to increment by 1 << {FeedbackNexus::CallCountField::kShift}. // have to increment by 1 << {FeedbackNexus::CallCountField::kShift}.
@ -718,7 +718,7 @@ void InterpreterAssembler::IncrementCallCount(Node* feedback_vector,
call_count, SmiConstant(1 << FeedbackNexus::CallCountField::kShift)); call_count, SmiConstant(1 << FeedbackNexus::CallCountField::kShift));
// Count is Smi, so we don't need a write barrier. // Count is Smi, so we don't need a write barrier.
StoreFeedbackVectorSlot(feedback_vector, slot_id, new_count, StoreFeedbackVectorSlot(feedback_vector, slot_id, new_count,
SKIP_WRITE_BARRIER, kPointerSize); SKIP_WRITE_BARRIER, kTaggedSize);
} }
void InterpreterAssembler::CollectCallableFeedback(Node* target, Node* context, void InterpreterAssembler::CollectCallableFeedback(Node* target, Node* context,
@ -1419,7 +1419,7 @@ Node* InterpreterAssembler::DispatchToBytecode(Node* target_bytecode,
Node* target_code_entry = Node* target_code_entry =
Load(MachineType::Pointer(), DispatchTableRawPointer(), Load(MachineType::Pointer(), DispatchTableRawPointer(),
TimesPointerSize(target_bytecode)); TimesSystemPointerSize(target_bytecode));
return DispatchToBytecodeHandlerEntry(target_code_entry, new_bytecode_offset, return DispatchToBytecodeHandlerEntry(target_code_entry, new_bytecode_offset,
target_bytecode); target_bytecode);
@ -1476,7 +1476,7 @@ void InterpreterAssembler::DispatchWide(OperandScale operand_scale) {
Node* target_index = IntPtrAdd(base_index, next_bytecode); Node* target_index = IntPtrAdd(base_index, next_bytecode);
Node* target_code_entry = Node* target_code_entry =
Load(MachineType::Pointer(), DispatchTableRawPointer(), Load(MachineType::Pointer(), DispatchTableRawPointer(),
TimesPointerSize(target_index)); TimesSystemPointerSize(target_index));
DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset, DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset,
next_bytecode); next_bytecode);
@ -1563,8 +1563,8 @@ void InterpreterAssembler::TraceBytecodeDispatch(Node* target_bytecode) {
Node* source_bytecode_table_index = IntPtrConstant( Node* source_bytecode_table_index = IntPtrConstant(
static_cast<int>(bytecode_) * (static_cast<int>(Bytecode::kLast) + 1)); static_cast<int>(bytecode_) * (static_cast<int>(Bytecode::kLast) + 1));
Node* counter_offset = Node* counter_offset = TimesSystemPointerSize(
TimesPointerSize(IntPtrAdd(source_bytecode_table_index, target_bytecode)); IntPtrAdd(source_bytecode_table_index, target_bytecode));
Node* old_counter = Node* old_counter =
Load(MachineType::IntPtr(), counters_table, counter_offset); Load(MachineType::IntPtr(), counters_table, counter_offset);