| 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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 continue; | 1486 continue; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 if (!result_saved) { | 1489 if (!result_saved) { |
| 1490 __ push(rax); | 1490 __ push(rax); |
| 1491 result_saved = true; | 1491 result_saved = true; |
| 1492 } | 1492 } |
| 1493 VisitForAccumulatorValue(subexpr); | 1493 VisitForAccumulatorValue(subexpr); |
| 1494 | 1494 |
| 1495 // Store the subexpression value in the array's elements. | 1495 // Store the subexpression value in the array's elements. |
| 1496 __ movq(r8, Operand(rsp, 0)); // Copy of array literal. | 1496 __ movq(rbx, Operand(rsp, 0)); // Copy of array literal. |
| 1497 __ movq(rdi, FieldOperand(r8, JSObject::kMapOffset)); | 1497 __ movq(rdi, FieldOperand(rbx, JSObject::kMapOffset)); |
| 1498 __ movq(rbx, FieldOperand(r8, JSObject::kElementsOffset)); | 1498 __ Move(rcx, Smi::FromInt(i)); |
| 1499 int offset = FixedArray::kHeaderSize + (i * kPointerSize); | 1499 __ movq(rdx, Immediate(expr->literal_index())); |
| 1500 | 1500 StoreArrayLiteralElementStub stub; |
| 1501 Label element_done; | 1501 __ CallStub(&stub); |
| 1502 Label double_elements; | |
| 1503 Label smi_element; | |
| 1504 Label slow_elements; | |
| 1505 Label fast_elements; | |
| 1506 __ CheckFastElements(rdi, &double_elements); | |
| 1507 | |
| 1508 // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS | |
| 1509 __ JumpIfSmi(result_register(), &smi_element); | |
| 1510 __ CheckFastSmiOnlyElements(rdi, &fast_elements); | |
| 1511 | |
| 1512 // Store into the array literal requires a elements transition. Call into | |
| 1513 // the runtime. | |
| 1514 __ bind(&slow_elements); | |
| 1515 __ push(r8); // Copy of array literal. | |
| 1516 __ Push(Smi::FromInt(i)); | |
| 1517 __ push(result_register()); | |
| 1518 __ Push(Smi::FromInt(NONE)); // PropertyAttributes | |
| 1519 __ Push(Smi::FromInt(strict_mode_flag())); // Strict mode. | |
| 1520 __ CallRuntime(Runtime::kSetProperty, 5); | |
| 1521 __ jmp(&element_done); | |
| 1522 | |
| 1523 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. | |
| 1524 __ bind(&double_elements); | |
| 1525 __ movq(rcx, Immediate(i)); | |
| 1526 __ StoreNumberToDoubleElements(result_register(), | |
| 1527 rbx, | |
| 1528 rcx, | |
| 1529 xmm0, | |
| 1530 &slow_elements); | |
| 1531 __ jmp(&element_done); | |
| 1532 | |
| 1533 // Array literal has ElementsKind of FAST_ELEMENTS and value is an object. | |
| 1534 __ bind(&fast_elements); | |
| 1535 __ movq(FieldOperand(rbx, offset), result_register()); | |
| 1536 // Update the write barrier for the array store. | |
| 1537 __ RecordWriteField(rbx, offset, result_register(), rcx, | |
| 1538 kDontSaveFPRegs, | |
| 1539 EMIT_REMEMBERED_SET, | |
| 1540 OMIT_SMI_CHECK); | |
| 1541 __ jmp(&element_done); | |
| 1542 | |
| 1543 // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or | |
| 1544 // FAST_ELEMENTS, and value is Smi. | |
| 1545 __ bind(&smi_element); | |
| 1546 __ movq(FieldOperand(rbx, offset), result_register()); | |
| 1547 // Fall through | |
| 1548 | |
| 1549 __ bind(&element_done); | |
| 1550 | 1502 |
| 1551 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); | 1503 PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); |
| 1552 } | 1504 } |
| 1553 | 1505 |
| 1554 if (result_saved) { | 1506 if (result_saved) { |
| 1555 context()->PlugTOS(); | 1507 context()->PlugTOS(); |
| 1556 } else { | 1508 } else { |
| 1557 context()->Plug(rax); | 1509 context()->Plug(rax); |
| 1558 } | 1510 } |
| 1559 } | 1511 } |
| (...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4304 *context_length = 0; | 4256 *context_length = 0; |
| 4305 return previous_; | 4257 return previous_; |
| 4306 } | 4258 } |
| 4307 | 4259 |
| 4308 | 4260 |
| 4309 #undef __ | 4261 #undef __ |
| 4310 | 4262 |
| 4311 } } // namespace v8::internal | 4263 } } // namespace v8::internal |
| 4312 | 4264 |
| 4313 #endif // V8_TARGET_ARCH_X64 | 4265 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |