[arm64] Address full-codegen issues with pools.

Inline SMI checks in ICs are performed with a TBZ/TBNZ instruction, which has a
32 kB range. To allow patching the SMI check, the location of the TBZ/TBNZ
instruction is stored after the call to the IC using a MOVZ instruction, in
particular using 11 bits of the immediate (so the number of instructions
between the inline data and the SMI check must be encodable in 11 bits).

To make sure we do not exceed these ranges, we need to block pool emission
between the check, the patch info, and the label the check branches to.

BUG=

Review-Url: https://codereview.chromium.org/2917403002
Cr-Commit-Position: refs/heads/master@{#45735}
This commit is contained in:
georgia.kouveli 2017-06-06 08:02:56 -07:00 committed by Commit Bot
parent 5005faed5c
commit c7fa0bf0e0

View File

@ -897,6 +897,8 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
// Perform the comparison as if via '==='.
__ Peek(x1, 0); // Switch value.
{
Assembler::BlockPoolsScope scope(masm_);
JumpPatchSite patch_site(masm_);
if (ShouldInlineSmiCase(Token::EQ_STRICT)) {
Label slow_case;
@ -914,6 +916,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code();
CallIC(ic, clause->CompareId());
patch_site.EmitPatchInfo();
}
Label skip;
__ B(&skip);
@ -1508,6 +1511,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
PopOperand(left);
// Perform combined smi check on both operands.
{
Assembler::BlockPoolsScope scope(masm_);
__ Orr(x10, left, right);
JumpPatchSite patch_site(masm_);
patch_site.EmitJumpIfSmi(x10, &both_smis);
@ -1515,14 +1520,13 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
__ Bind(&stub_call);
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
{
Assembler::BlockPoolsScope scope(masm_);
CallIC(code, expr->BinaryOperationFeedbackId());
patch_site.EmitPatchInfo();
}
__ B(&done);
__ B(&done);
__ Bind(&both_smis);
}
// Smi case. This code works in the same way as the smi-smi case in the type
// recording binary operation stub, see
// BinaryOpStub::GenerateSmiSmiOperation for comments.
@ -2351,6 +2355,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
}
// Inline smi case if we are in a loop.
{
Assembler::BlockPoolsScope scope(masm_);
Label stub_call, done;
JumpPatchSite patch_site(masm_);
@ -2362,9 +2368,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
// Save result for postfix expressions.
if (expr->is_postfix()) {
if (!context()->IsEffect()) {
// Save the result on the stack. If we have a named or keyed property we
// store the result under the receiver that is currently on top of the
// stack.
// Save the result on the stack. If we have a named or keyed property
// we store the result under the receiver that is currently on top of
// the stack.
switch (assign_type) {
case VARIABLE:
__ Push(x0);
@ -2426,13 +2432,12 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
SetExpressionPosition(expr);
{
Assembler::BlockPoolsScope scope(masm_);
Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD).code();
CallIC(code, expr->CountBinOpFeedbackId());
patch_site.EmitPatchInfo();
}
__ Bind(&done);
}
// Store the value returned in x0.
switch (assign_type) {
@ -2621,6 +2626,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
// Pop the stack value.
PopOperand(x1);
{
Assembler::BlockPoolsScope scope(masm_);
JumpPatchSite patch_site(masm_);
if (ShouldInlineSmiCase(op)) {
Label slow_case;
@ -2637,6 +2644,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
__ CompareAndSplit(x0, 0, cond, if_true, if_false, fall_through);
}
}
}
// Convert the result of the comparison into one expected for this
// expression's context.