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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 CompileTimeValue::IsCompileTimeValue(subexpr)) { | 1526 CompileTimeValue::IsCompileTimeValue(subexpr)) { |
1527 continue; | 1527 continue; |
1528 } | 1528 } |
1529 | 1529 |
1530 if (!result_saved) { | 1530 if (!result_saved) { |
1531 __ push(eax); | 1531 __ push(eax); |
1532 result_saved = true; | 1532 result_saved = true; |
1533 } | 1533 } |
1534 VisitForAccumulatorValue(subexpr); | 1534 VisitForAccumulatorValue(subexpr); |
1535 | 1535 |
1536 // Store the subexpression value in the array's elements. | 1536 if (constant_elements_kind == FAST_ELEMENTS) { |
1537 __ mov(ebx, Operand(esp, 0)); // Copy of array literal. | 1537 // Fast-case array literal with ElementsKind of FAST_ELEMENTS, they cannot |
1538 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset)); | 1538 // transition and don't need to call the runtime stub. |
1539 __ mov(ecx, Immediate(Smi::FromInt(i))); | 1539 int offset = FixedArray::kHeaderSize + (i * kPointerSize); |
1540 __ mov(edx, Immediate(Smi::FromInt(expr->literal_index()))); | 1540 __ mov(ebx, Operand(esp, 0)); // Copy of array literal. |
1541 StoreArrayLiteralElementStub stub; | 1541 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); |
1542 __ CallStub(&stub); | 1542 // Store the subexpression value in the array's elements. |
| 1543 __ mov(FieldOperand(ebx, offset), result_register()); |
| 1544 // Update the write barrier for the array store. |
| 1545 __ RecordWriteField(ebx, offset, result_register(), ecx, |
| 1546 kDontSaveFPRegs, |
| 1547 EMIT_REMEMBERED_SET, |
| 1548 INLINE_SMI_CHECK); |
| 1549 } else { |
| 1550 // Store the subexpression value in the array's elements. |
| 1551 __ mov(ebx, Operand(esp, 0)); // Copy of array literal. |
| 1552 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset)); |
| 1553 __ mov(ecx, Immediate(Smi::FromInt(i))); |
| 1554 __ mov(edx, Immediate(Smi::FromInt(expr->literal_index()))); |
| 1555 StoreArrayLiteralElementStub stub; |
| 1556 __ CallStub(&stub); |
| 1557 } |
1543 | 1558 |
1544 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); | 1559 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); |
1545 } | 1560 } |
1546 | 1561 |
1547 if (result_saved) { | 1562 if (result_saved) { |
1548 context()->PlugTOS(); | 1563 context()->PlugTOS(); |
1549 } else { | 1564 } else { |
1550 context()->Plug(eax); | 1565 context()->Plug(eax); |
1551 } | 1566 } |
1552 } | 1567 } |
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4348 *context_length = 0; | 4363 *context_length = 0; |
4349 return previous_; | 4364 return previous_; |
4350 } | 4365 } |
4351 | 4366 |
4352 | 4367 |
4353 #undef __ | 4368 #undef __ |
4354 | 4369 |
4355 } } // namespace v8::internal | 4370 } } // namespace v8::internal |
4356 | 4371 |
4357 #endif // V8_TARGET_ARCH_IA32 | 4372 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |