OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 CompileTimeValue::IsCompileTimeValue(subexpr)) { | 1529 CompileTimeValue::IsCompileTimeValue(subexpr)) { |
1530 continue; | 1530 continue; |
1531 } | 1531 } |
1532 | 1532 |
1533 if (!result_saved) { | 1533 if (!result_saved) { |
1534 __ push(rax); | 1534 __ push(rax); |
1535 result_saved = true; | 1535 result_saved = true; |
1536 } | 1536 } |
1537 VisitForAccumulatorValue(subexpr); | 1537 VisitForAccumulatorValue(subexpr); |
1538 | 1538 |
1539 // Store the subexpression value in the array's elements. | 1539 if (constant_elements_kind == FAST_ELEMENTS) { |
1540 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal. | 1540 // Fast-case array literal with ElementsKind of FAST_ELEMENTS, they cannot |
1541 __ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset)); | 1541 // transition and don't need to call the runtime stub. |
1542 __ Move(rcx, Smi::FromInt(i)); | 1542 int offset = FixedArray::kHeaderSize + (i * kPointerSize); |
1543 __ Move(rdx, Smi::FromInt(expr->literal_index())); | 1543 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal. |
1544 StoreArrayLiteralElementStub stub; | 1544 __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset)); |
1545 __ CallStub(&stub); | 1545 // Store the subexpression value in the array's elements. |
| 1546 __ movq(FieldOperand(rbx, offset), result_register()); |
| 1547 // Update the write barrier for the array store. |
| 1548 __ RecordWriteField(rbx, offset, result_register(), rcx, |
| 1549 kDontSaveFPRegs, |
| 1550 EMIT_REMEMBERED_SET, |
| 1551 INLINE_SMI_CHECK); |
| 1552 } else { |
| 1553 // Store the subexpression value in the array's elements. |
| 1554 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal. |
| 1555 __ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset)); |
| 1556 __ Move(rcx, Smi::FromInt(i)); |
| 1557 __ Move(rdx, Smi::FromInt(expr->literal_index())); |
| 1558 StoreArrayLiteralElementStub stub; |
| 1559 __ CallStub(&stub); |
| 1560 } |
1546 | 1561 |
1547 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); | 1562 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); |
1548 } | 1563 } |
1549 | 1564 |
1550 if (result_saved) { | 1565 if (result_saved) { |
1551 context()->PlugTOS(); | 1566 context()->PlugTOS(); |
1552 } else { | 1567 } else { |
1553 context()->Plug(rax); | 1568 context()->Plug(rax); |
1554 } | 1569 } |
1555 } | 1570 } |
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4313 *context_length = 0; | 4328 *context_length = 0; |
4314 return previous_; | 4329 return previous_; |
4315 } | 4330 } |
4316 | 4331 |
4317 | 4332 |
4318 #undef __ | 4333 #undef __ |
4319 | 4334 |
4320 } } // namespace v8::internal | 4335 } } // namespace v8::internal |
4321 | 4336 |
4322 #endif // V8_TARGET_ARCH_X64 | 4337 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |