Commit f35e53ff authored by danno@chromium.org's avatar danno@chromium.org

Reintroduce fast path in full-codegen for VisitArrayLiteral.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/8472003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10078 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9664e48e
...@@ -1539,13 +1539,28 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { ...@@ -1539,13 +1539,28 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
} }
VisitForAccumulatorValue(subexpr); VisitForAccumulatorValue(subexpr);
// Store the subexpression value in the array's elements. if (constant_elements_kind == FAST_ELEMENTS) {
__ mov(ebx, Operand(esp, 0)); // Copy of array literal. // Fast-case array literal with ElementsKind of FAST_ELEMENTS, they cannot
__ mov(edi, FieldOperand(ebx, JSObject::kMapOffset)); // transition and don't need to call the runtime stub.
__ mov(ecx, Immediate(Smi::FromInt(i))); int offset = FixedArray::kHeaderSize + (i * kPointerSize);
__ mov(edx, Immediate(Smi::FromInt(expr->literal_index()))); __ mov(ebx, Operand(esp, 0)); // Copy of array literal.
StoreArrayLiteralElementStub stub; __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset));
__ CallStub(&stub); // Store the subexpression value in the array's elements.
__ mov(FieldOperand(ebx, offset), result_register());
// Update the write barrier for the array store.
__ RecordWriteField(ebx, offset, result_register(), ecx,
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
INLINE_SMI_CHECK);
} else {
// Store the subexpression value in the array's elements.
__ mov(ebx, Operand(esp, 0)); // Copy of array literal.
__ mov(edi, FieldOperand(ebx, JSObject::kMapOffset));
__ mov(ecx, Immediate(Smi::FromInt(i)));
__ mov(edx, Immediate(Smi::FromInt(expr->literal_index())));
StoreArrayLiteralElementStub stub;
__ CallStub(&stub);
}
PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS);
} }
......
...@@ -1542,13 +1542,28 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { ...@@ -1542,13 +1542,28 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
} }
VisitForAccumulatorValue(subexpr); VisitForAccumulatorValue(subexpr);
// Store the subexpression value in the array's elements. if (constant_elements_kind == FAST_ELEMENTS) {
__ movq(rbx, Operand(rsp, 0)); // Copy of array literal. // Fast-case array literal with ElementsKind of FAST_ELEMENTS, they cannot
__ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset)); // transition and don't need to call the runtime stub.
__ Move(rcx, Smi::FromInt(i)); int offset = FixedArray::kHeaderSize + (i * kPointerSize);
__ Move(rdx, Smi::FromInt(expr->literal_index())); __ movq(rbx, Operand(rsp, 0)); // Copy of array literal.
StoreArrayLiteralElementStub stub; __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset));
__ CallStub(&stub); // Store the subexpression value in the array's elements.
__ movq(FieldOperand(rbx, offset), result_register());
// Update the write barrier for the array store.
__ RecordWriteField(rbx, offset, result_register(), rcx,
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
INLINE_SMI_CHECK);
} else {
// Store the subexpression value in the array's elements.
__ movq(rbx, Operand(rsp, 0)); // Copy of array literal.
__ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset));
__ Move(rcx, Smi::FromInt(i));
__ Move(rdx, Smi::FromInt(expr->literal_index()));
StoreArrayLiteralElementStub stub;
__ CallStub(&stub);
}
PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS);
} }
......
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