Commit e3fb2e73 authored by jyan's avatar jyan Committed by Commit bot

s390: Remove usages of Heap::NewSpaceStart and its external reference

Port f2a58593

Original commit message:
    Replace the uses with proper page flag lookups.

R=mlippautz@chromium.org, joransiu@ca.ibm.com, mbrandy@us.ibm.com, michael_dawson@ca.ibm.com
BUG=chromium:581412
LOG=N
TEST=mjsunit/allocation-site-info

Review URL: https://codereview.chromium.org/1848003002

Cr-Commit-Position: refs/heads/master@{#35179}
parent da97b701
......@@ -4440,9 +4440,10 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
Register object = ToRegister(instr->object());
Register temp = ToRegister(instr->temp());
Register temp1 = ToRegister(instr->temp1());
Register temp2 = ToRegister(instr->temp2());
Label no_memento_found;
__ TestJSArrayForAllocationMemento(object, temp, &no_memento_found);
__ TestJSArrayForAllocationMemento(object, temp1, temp2, &no_memento_found);
DeoptimizeIf(eq, instr, Deoptimizer::kMementoFound);
__ bind(&no_memento_found);
}
......
......@@ -2063,9 +2063,10 @@ LInstruction* LChunkBuilder::DoTransitionElementsKind(
LInstruction* LChunkBuilder::DoTrapAllocationMemento(
HTrapAllocationMemento* instr) {
LOperand* object = UseRegister(instr->object());
LOperand* temp = TempRegister();
LOperand* temp1 = TempRegister();
LOperand* temp2 = TempRegister();
LTrapAllocationMemento* result =
new (zone()) LTrapAllocationMemento(object, temp);
new (zone()) LTrapAllocationMemento(object, temp1, temp2);
return AssignEnvironment(result);
}
......
......@@ -1945,15 +1945,17 @@ class LTransitionElementsKind final : public LTemplateInstruction<0, 2, 1> {
ElementsKind to_kind() { return hydrogen()->to_kind(); }
};
class LTrapAllocationMemento final : public LTemplateInstruction<0, 1, 1> {
class LTrapAllocationMemento final : public LTemplateInstruction<0, 1, 2> {
public:
LTrapAllocationMemento(LOperand* object, LOperand* temp) {
LTrapAllocationMemento(LOperand* object, LOperand* temp1, LOperand* temp2) {
inputs_[0] = object;
temps_[0] = temp;
temps_[0] = temp1;
temps_[1] = temp2;
}
LOperand* object() { return inputs_[0]; }
LOperand* temp() { return temps_[0]; }
LOperand* temp1() { return temps_[0]; }
LOperand* temp2() { return temps_[1]; }
DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento, "trap-allocation-memento")
};
......
......@@ -123,7 +123,7 @@ void ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
if (mode == TRACK_ALLOCATION_SITE) {
DCHECK(allocation_memento_found != NULL);
__ JumpIfJSArrayHasAllocationMemento(receiver, scratch_elements,
__ JumpIfJSArrayHasAllocationMemento(receiver, scratch_elements, r1,
allocation_memento_found);
}
......@@ -153,7 +153,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
scratch2));
if (mode == TRACK_ALLOCATION_SITE) {
__ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail);
__ JumpIfJSArrayHasAllocationMemento(receiver, elements, scratch2, fail);
}
// Check for empty arrays, which only require a map transition and no changes
......@@ -278,7 +278,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
scratch));
if (mode == TRACK_ALLOCATION_SITE) {
__ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail);
__ JumpIfJSArrayHasAllocationMemento(receiver, elements, scratch3, fail);
}
// Check for empty arrays, which only require a map transition and no changes
......
......@@ -3704,20 +3704,46 @@ void MacroAssembler::StoreRepresentation(Register src, const MemOperand& mem,
void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg,
Register scratch_reg,
Register scratch2_reg,
Label* no_memento_found) {
ExternalReference new_space_start =
ExternalReference::new_space_start(isolate());
Label map_check;
Label top_check;
ExternalReference new_space_allocation_top =
ExternalReference::new_space_allocation_top_address(isolate());
AddP(scratch_reg, receiver_reg,
Operand(JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag));
CmpP(scratch_reg, Operand(new_space_start));
blt(no_memento_found);
mov(ip, Operand(new_space_allocation_top));
LoadP(ip, MemOperand(ip));
CmpP(scratch_reg, ip);
const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize;
Register mask = scratch2_reg;
DCHECK(!AreAliased(receiver_reg, scratch_reg, mask));
// Bail out if the object is not in new space.
JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
DCHECK((~Page::kPageAlignmentMask & 0xffff) == 0);
LoadImmP(mask, Operand((~Page::kPageAlignmentMask >> 16)));
AddP(scratch_reg, receiver_reg, Operand(kMementoEndOffset));
// If the object is in new space, we need to check whether it is on the same
// page as the current top.
XorP(r0, scratch_reg, Operand(new_space_allocation_top));
AndP(r0, r0, mask);
beq(&top_check, Label::kNear);
// 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.
XorP(r0, scratch_reg, receiver_reg);
AndP(r0, r0, mask);
bne(no_memento_found);
// Continue with the actual map check.
b(&map_check, Label::kNear);
// If top is on the same page as the current object, we need to check whether
// we are below top.
bind(&top_check);
CmpP(scratch_reg, Operand(new_space_allocation_top));
bgt(no_memento_found);
LoadP(scratch_reg, MemOperand(scratch_reg, -AllocationMemento::kSize));
// Memento map check.
bind(&map_check);
LoadP(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset));
CmpP(scratch_reg, Operand(isolate()->factory()->allocation_memento_map()));
}
......
......@@ -1788,13 +1788,15 @@ class MacroAssembler : public Assembler {
// If allocation info is present, condition flags are set to eq.
void TestJSArrayForAllocationMemento(Register receiver_reg,
Register scratch_reg,
Register scratch2_reg,
Label* no_memento_found);
void JumpIfJSArrayHasAllocationMemento(Register receiver_reg,
Register scratch_reg,
Register scratch2_reg,
Label* memento_found) {
Label no_memento_found;
TestJSArrayForAllocationMemento(receiver_reg, scratch_reg,
TestJSArrayForAllocationMemento(receiver_reg, scratch_reg, scratch2_reg,
&no_memento_found);
beq(memento_found);
bind(&no_memento_found);
......
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