Commit d721a9d4 authored by Ilija Pavlovic's avatar Ilija Pavlovic Committed by Commit Bot

MIPS[64]: Delete unused code from macro assembler

Port for https://chromium-review.googlesource.com/c/571011/

In macro-assembler-mips64.*, function StubPrologue is left
intentionally. (See: https://codereview.chromium.org/2467513002)

TEST=
BUG=

Change-Id: I95de571c636cce88fc2c40e5d8c60162004634a6
Reviewed-on: https://chromium-review.googlesource.com/591127
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@imgtec.com>
Reviewed-by: 's avatarIvica Bogosavljevic <ivica.bogosavljevic@imgtec.com>
Cr-Commit-Position: refs/heads/master@{#47073}
parent b41f857b
......@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/code-generator.h"
#include "src/compilation-info.h"
#include "src/compiler/code-generator-impl.h"
#include "src/compiler/code-generator.h"
#include "src/compiler/gap-resolver.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/osr.h"
#include "src/mips/macro-assembler-mips.h"
#include "src/mips64/macro-assembler-mips64.h"
namespace v8 {
namespace internal {
......@@ -3452,6 +3452,7 @@ void CodeGenerator::FinishFrame(Frame* frame) {
void CodeGenerator::AssembleConstructFrame() {
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
if (frame_access_state()->has_frame()) {
if (descriptor->IsCFunctionCall()) {
__ Push(ra, fp);
......
......@@ -4130,18 +4130,6 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
}
void MacroAssembler::InitializeFieldsWithFiller(Register current_address,
Register end_address,
Register filler) {
Label loop, entry;
Branch(&entry);
bind(&loop);
sw(filler, MemOperand(current_address));
Addu(current_address, current_address, kPointerSize);
bind(&entry);
Branch(&loop, ult, current_address, Operand(end_address));
}
void MacroAssembler::CompareMapAndBranch(Register obj,
Register scratch,
Handle<Map> map,
......@@ -4949,16 +4937,6 @@ void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
bd);
}
void MacroAssembler::SetCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2) {
if (FLAG_native_code_counters && counter->Enabled()) {
li(scratch1, Operand(value));
li(scratch2, Operand(ExternalReference(counter)));
sw(scratch1, MemOperand(scratch2));
}
}
void MacroAssembler::IncrementCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2) {
DCHECK(value > 0);
......@@ -5765,50 +5743,6 @@ int TurboAssembler::CalculateStackPassedWords(int num_reg_arguments,
return stack_passed_words;
}
void MacroAssembler::EmitSeqStringSetCharCheck(Register string,
Register index,
Register value,
Register scratch,
uint32_t encoding_mask) {
Label is_object;
{
UseScratchRegisterScope temps(this);
Register scratch1 = temps.Acquire();
SmiTst(string, scratch1);
Check(ne, kNonObject, scratch1, Operand(zero_reg));
lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset));
lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
andi(scratch1, scratch1, kStringRepresentationMask | kStringEncodingMask);
li(scratch, Operand(encoding_mask));
Check(eq, kUnexpectedStringType, scratch1, Operand(scratch));
}
// The index is assumed to be untagged coming in, tag it to compare with the
// string length without using a temp register, it is restored at the end of
// this function.
Label index_tag_ok, index_tag_bad;
TrySmiTag(index, scratch, &index_tag_bad);
Branch(&index_tag_ok);
bind(&index_tag_bad);
Abort(kIndexIsTooLarge);
bind(&index_tag_ok);
{
UseScratchRegisterScope temps(this);
Register scratch1 = temps.Acquire();
lw(scratch1, FieldMemOperand(string, String::kLengthOffset));
Check(lt, kIndexIsTooLarge, index, Operand(scratch1));
}
DCHECK(Smi::kZero == 0);
Check(ge, kIndexIsNegative, index, Operand(zero_reg));
SmiUntag(index, index);
}
void TurboAssembler::PrepareCallCFunction(int num_reg_arguments,
int num_double_arguments,
Register scratch) {
......@@ -6102,88 +6036,6 @@ void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
bind(&done);
}
void MacroAssembler::ClampDoubleToUint8(Register result_reg,
DoubleRegister input_reg,
DoubleRegister temp_double_reg) {
Label above_zero;
Label done;
Label in_bounds;
Move(temp_double_reg, 0.0);
BranchF(&above_zero, NULL, gt, input_reg, temp_double_reg);
// Double value is less than zero, NaN or Inf, return 0.
mov(result_reg, zero_reg);
Branch(&done);
// Double value is >= 255, return 255.
bind(&above_zero);
Move(temp_double_reg, 255.0);
BranchF(&in_bounds, NULL, le, input_reg, temp_double_reg);
li(result_reg, Operand(255));
Branch(&done);
// In 0-255 range, round and truncate.
bind(&in_bounds);
cvt_w_d(temp_double_reg, input_reg);
mfc1(result_reg, temp_double_reg);
bind(&done);
}
void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg,
Register scratch_reg,
Label* no_memento_found) {
Label map_check;
Label top_check;
ExternalReference new_space_allocation_top_adr =
ExternalReference::new_space_allocation_top_address(isolate());
const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
const int kMementoLastWordOffset =
kMementoMapOffset + AllocationMemento::kSize - kPointerSize;
// Bail out if the object is not in new space.
JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
// If the object is in new space, we need to check whether it is on the same
// page as the current top.
Addu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand(new_space_allocation_top_adr));
lw(scratch, MemOperand(scratch));
Xor(scratch_reg, scratch_reg, Operand(scratch));
}
And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask));
Branch(&top_check, eq, scratch_reg, Operand(zero_reg));
// The object is on a different page than allocation top. Bail out if the
// object sits on the page boundary as no memento can follow and we cannot
// touch the memory following it.
Addu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
Xor(scratch_reg, scratch_reg, Operand(receiver_reg));
And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask));
Branch(no_memento_found, ne, scratch_reg, Operand(zero_reg));
// Continue with the actual map check.
jmp(&map_check);
// If top is on the same page as the current object, we need to check whether
// we are below top.
bind(&top_check);
Addu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand(new_space_allocation_top_adr));
lw(scratch, MemOperand(scratch));
Branch(no_memento_found, ge, scratch_reg, Operand(scratch));
}
// Memento map check.
bind(&map_check);
lw(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset));
Branch(no_memento_found, ne, scratch_reg,
Operand(isolate()->factory()->allocation_memento_map()));
}
Register GetRegisterThatIsNotOneOf(Register reg1,
Register reg2,
Register reg3,
......@@ -6275,36 +6127,6 @@ void CodePatcher::ChangeBranchCondition(Instr current_instr,
masm_.emit(current_instr);
}
void MacroAssembler::TruncatingDiv(Register result,
Register dividend,
int32_t divisor) {
DCHECK(!dividend.is(result));
DCHECK(!dividend.is(at));
DCHECK(!result.is(at));
base::MagicNumbersForDivision<uint32_t> mag =
base::SignedDivisionByConstant(static_cast<uint32_t>(divisor));
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand(mag.multiplier));
Mulh(result, dividend, Operand(scratch));
}
bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0;
if (divisor > 0 && neg) {
Addu(result, result, Operand(dividend));
}
if (divisor < 0 && !neg && mag.multiplier > 0) {
Subu(result, result, Operand(dividend));
}
if (mag.shift > 0) sra(result, result, mag.shift);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
srl(scratch, dividend, 31);
Addu(result, result, Operand(scratch));
}
} // namespace internal
} // namespace v8
......
......@@ -1226,12 +1226,6 @@ class MacroAssembler : public TurboAssembler {
// Must preserve the result register.
void PopStackHandler();
// Initialize fields with filler values. Fields starting at |current_address|
// not including |end_address| are overwritten with the value in |filler|. At
// the end the loop, |current_address| takes the value of |end_address|.
void InitializeFieldsWithFiller(Register current_address,
Register end_address, Register filler);
// -------------------------------------------------------------------------
// Support functions.
......@@ -1389,15 +1383,9 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
const char* name;
};
// Emit code for a truncating division by a constant. The dividend register is
// unchanged and at gets clobbered. Dividend and result must be different.
void TruncatingDiv(Register result, Register dividend, int32_t divisor);
// -------------------------------------------------------------------------
// StatsCounter support.
void SetCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2);
void IncrementCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2);
void DecrementCounter(StatsCounter* counter, int value,
......@@ -1523,12 +1511,6 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
void JumpIfNotUniqueNameInstanceType(Register reg, Label* not_unique_name);
void EmitSeqStringSetCharCheck(Register string,
Register index,
Register value,
Register scratch,
uint32_t encoding_mask);
// Checks if both objects are sequential one-byte strings and jumps to label
// if either is not. Assumes that neither object is a smi.
void JumpIfNonSmisNotBothSequentialOneByteStrings(Register first,
......@@ -1546,11 +1528,6 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
void ClampUint8(Register output_reg, Register input_reg);
void ClampDoubleToUint8(Register result_reg,
DoubleRegister input_reg,
DoubleRegister temp_double_reg);
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
......@@ -1599,15 +1576,6 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
// in a0. Assumes that any other register can be used as a scratch.
void CheckEnumCache(Label* call_runtime);
// AllocationMemento support. Arrays may have an associated AllocationMemento
// object that can be checked for in order to pretransition to another type.
// On entry, receiver_reg should point to the array object. scratch_reg gets
// clobbered. If no info is present jump to no_memento_found, otherwise fall
// through.
void TestJSArrayForAllocationMemento(Register receiver_reg,
Register scratch_reg,
Label* no_memento_found);
private:
// Helper functions for generating invokes.
void InvokePrologue(const ParameterCount& expected,
......
......@@ -4397,18 +4397,6 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
}
void MacroAssembler::InitializeFieldsWithFiller(Register current_address,
Register end_address,
Register filler) {
Label loop, entry;
Branch(&entry);
bind(&loop);
Sd(filler, MemOperand(current_address));
Daddu(current_address, current_address, kPointerSize);
bind(&entry);
Branch(&loop, ult, current_address, Operand(end_address));
}
void MacroAssembler::SubNanPreservePayloadAndSign_s(FPURegister fd,
FPURegister fs,
FPURegister ft) {
......@@ -5444,16 +5432,6 @@ void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
bd);
}
void MacroAssembler::SetCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2) {
if (FLAG_native_code_counters && counter->Enabled()) {
li(scratch1, Operand(value));
li(scratch2, Operand(ExternalReference(counter)));
Sw(scratch1, MemOperand(scratch2));
}
}
void MacroAssembler::IncrementCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2) {
DCHECK(value > 0);
......@@ -6330,36 +6308,6 @@ int TurboAssembler::CalculateStackPassedWords(int num_reg_arguments,
return stack_passed_words;
}
void MacroAssembler::EmitSeqStringSetCharCheck(Register string,
Register index,
Register value,
Register scratch,
uint32_t encoding_mask) {
Label is_object;
{
UseScratchRegisterScope temps(this);
Register scratch1 = temps.Acquire();
SmiTst(string, scratch1);
Check(ne, kNonObject, scratch1, Operand(zero_reg));
Ld(scratch1, FieldMemOperand(string, HeapObject::kMapOffset));
Lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
andi(scratch1, scratch1, kStringRepresentationMask | kStringEncodingMask);
li(scratch, Operand(encoding_mask));
Check(eq, kUnexpectedStringType, scratch1, Operand(scratch));
// TODO(plind): requires Smi size check code for mips32.
Ld(scratch1, FieldMemOperand(string, String::kLengthOffset));
Check(lt, kIndexIsTooLarge, index, Operand(scratch1));
}
DCHECK(Smi::kZero == 0);
Check(ge, kIndexIsNegative, index, Operand(zero_reg));
}
void TurboAssembler::PrepareCallCFunction(int num_reg_arguments,
int num_double_arguments,
Register scratch) {
......@@ -6649,88 +6597,6 @@ void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
bind(&done);
}
void MacroAssembler::ClampDoubleToUint8(Register result_reg,
DoubleRegister input_reg,
DoubleRegister temp_double_reg) {
Label above_zero;
Label done;
Label in_bounds;
Move(temp_double_reg, 0.0);
BranchF(&above_zero, NULL, gt, input_reg, temp_double_reg);
// Double value is less than zero, NaN or Inf, return 0.
mov(result_reg, zero_reg);
Branch(&done);
// Double value is >= 255, return 255.
bind(&above_zero);
Move(temp_double_reg, 255.0);
BranchF(&in_bounds, NULL, le, input_reg, temp_double_reg);
li(result_reg, Operand(255));
Branch(&done);
// In 0-255 range, round and truncate.
bind(&in_bounds);
cvt_w_d(temp_double_reg, input_reg);
mfc1(result_reg, temp_double_reg);
bind(&done);
}
void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg,
Register scratch_reg,
Label* no_memento_found) {
Label map_check;
Label top_check;
ExternalReference new_space_allocation_top_adr =
ExternalReference::new_space_allocation_top_address(isolate());
const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
const int kMementoLastWordOffset =
kMementoMapOffset + AllocationMemento::kSize - kPointerSize;
// Bail out if the object is not in new space.
JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
// If the object is in new space, we need to check whether it is on the same
// page as the current top.
Daddu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand(new_space_allocation_top_adr));
Ld(scratch, MemOperand(scratch));
Xor(scratch_reg, scratch_reg, Operand(scratch));
}
And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask));
Branch(&top_check, eq, scratch_reg, Operand(zero_reg));
// The object is on a different page than allocation top. Bail out if the
// object sits on the page boundary as no memento can follow and we cannot
// touch the memory following it.
Daddu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
Xor(scratch_reg, scratch_reg, Operand(receiver_reg));
And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask));
Branch(no_memento_found, ne, scratch_reg, Operand(zero_reg));
// Continue with the actual map check.
jmp(&map_check);
// If top is on the same page as the current object, we need to check whether
// we are below top.
bind(&top_check);
Daddu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand(new_space_allocation_top_adr));
Ld(scratch, MemOperand(scratch));
Branch(no_memento_found, ge, scratch_reg, Operand(scratch));
}
// Memento map check.
bind(&map_check);
Ld(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset));
Branch(no_memento_found, ne, scratch_reg,
Operand(isolate()->factory()->allocation_memento_map()));
}
Register GetRegisterThatIsNotOneOf(Register reg1,
Register reg2,
Register reg3,
......@@ -6821,37 +6687,6 @@ void CodePatcher::ChangeBranchCondition(Instr current_instr,
}
void MacroAssembler::TruncatingDiv(Register result,
Register dividend,
int32_t divisor) {
DCHECK(!dividend.is(result));
DCHECK(!dividend.is(at));
DCHECK(!result.is(at));
base::MagicNumbersForDivision<uint32_t> mag =
base::SignedDivisionByConstant(static_cast<uint32_t>(divisor));
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand(static_cast<int32_t>(mag.multiplier)));
Mulh(result, dividend, Operand(scratch));
}
bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0;
if (divisor > 0 && neg) {
Addu(result, result, Operand(dividend));
}
if (divisor < 0 && !neg && mag.multiplier > 0) {
Subu(result, result, Operand(dividend));
}
if (mag.shift > 0) sra(result, result, mag.shift);
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
srl(scratch, dividend, 31);
Addu(result, result, Operand(scratch));
}
}
} // namespace internal
} // namespace v8
......
......@@ -1330,12 +1330,6 @@ class MacroAssembler : public TurboAssembler {
// Must preserve the result register.
void PopStackHandler();
// Initialize fields with filler values. Fields starting at |current_address|
// not including |end_address| are overwritten with the value in |filler|. At
// the end the loop, |current_address| takes the value of |end_address|.
void InitializeFieldsWithFiller(Register current_address,
Register end_address, Register filler);
// -------------------------------------------------------------------------
// Support functions.
......@@ -1552,15 +1546,9 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
const char* name;
};
// Emit code for a truncating division by a constant. The dividend register is
// unchanged and at gets clobbered. Dividend and result must be different.
void TruncatingDiv(Register result, Register dividend, int32_t divisor);
// -------------------------------------------------------------------------
// StatsCounter support.
void SetCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2);
void IncrementCounter(StatsCounter* counter, int value,
Register scratch1, Register scratch2);
void DecrementCounter(StatsCounter* counter, int value,
......@@ -1717,12 +1705,6 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
void JumpIfNotUniqueNameInstanceType(Register reg, Label* not_unique_name);
void EmitSeqStringSetCharCheck(Register string,
Register index,
Register value,
Register scratch,
uint32_t encoding_mask);
// Checks if both objects are sequential one-byte strings and jumps to label
// if either is not. Assumes that neither object is a smi.
void JumpIfNonSmisNotBothSequentialOneByteStrings(Register first,
......@@ -1740,11 +1722,6 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
void ClampUint8(Register output_reg, Register input_reg);
void ClampDoubleToUint8(Register result_reg,
DoubleRegister input_reg,
DoubleRegister temp_double_reg);
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
......@@ -1785,15 +1762,6 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
// in a0. Assumes that any other register can be used as a scratch.
void CheckEnumCache(Label* call_runtime);
// AllocationMemento support. Arrays may have an associated AllocationMemento
// object that can be checked for in order to pretransition to another type.
// On entry, receiver_reg should point to the array object. scratch_reg gets
// clobbered. If no info is present jump to no_memento_found, otherwise fall
// through.
void TestJSArrayForAllocationMemento(Register receiver_reg,
Register scratch_reg,
Label* no_memento_found);
private:
// Helper functions for generating invokes.
void InvokePrologue(const ParameterCount& expected,
......
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