Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 11377132: Support all fast elements kinds in the major array operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments (and rebased) Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 name, &miss); 1516 name, &miss);
1517 1517
1518 if (argc == 0) { 1518 if (argc == 0) {
1519 // Noop, return the length. 1519 // Noop, return the length.
1520 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); 1520 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
1521 __ ret((argc + 1) * kPointerSize); 1521 __ ret((argc + 1) * kPointerSize);
1522 } else { 1522 } else {
1523 Label call_builtin; 1523 Label call_builtin;
1524 1524
1525 if (argc == 1) { // Otherwise fall through to call builtin. 1525 if (argc == 1) { // Otherwise fall through to call builtin.
1526 Label attempt_to_grow_elements, with_write_barrier; 1526 Label attempt_to_grow_elements, with_write_barrier, check_double;
1527 1527
1528 // Get the elements array of the object. 1528 // Get the elements array of the object.
1529 __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); 1529 __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset));
1530 1530
1531 // Check that the elements are in fast mode and writable. 1531 // Check that the elements are in fast mode and writable.
1532 __ cmp(FieldOperand(edi, HeapObject::kMapOffset), 1532 __ cmp(FieldOperand(edi, HeapObject::kMapOffset),
1533 Immediate(factory()->fixed_array_map())); 1533 Immediate(factory()->fixed_array_map()));
1534 __ j(not_equal, &call_builtin); 1534 __ j(not_equal, &check_double);
1535 1535
1536 // Get the array's length into eax and calculate new length. 1536 // Get the array's length into eax and calculate new length.
1537 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); 1537 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
1538 STATIC_ASSERT(kSmiTagSize == 1); 1538 STATIC_ASSERT(kSmiTagSize == 1);
1539 STATIC_ASSERT(kSmiTag == 0); 1539 STATIC_ASSERT(kSmiTag == 0);
1540 __ add(eax, Immediate(Smi::FromInt(argc))); 1540 __ add(eax, Immediate(Smi::FromInt(argc)));
1541 1541
1542 // Get the elements' length into ecx. 1542 // Get the elements' length into ecx.
1543 __ mov(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); 1543 __ mov(ecx, FieldOperand(edi, FixedArray::kLengthOffset));
1544 1544
(...skipping 10 matching lines...) Expand all
1555 1555
1556 // Store the value. 1556 // Store the value.
1557 __ mov(FieldOperand(edi, 1557 __ mov(FieldOperand(edi,
1558 eax, 1558 eax,
1559 times_half_pointer_size, 1559 times_half_pointer_size,
1560 FixedArray::kHeaderSize - argc * kPointerSize), 1560 FixedArray::kHeaderSize - argc * kPointerSize),
1561 ecx); 1561 ecx);
1562 1562
1563 __ ret((argc + 1) * kPointerSize); 1563 __ ret((argc + 1) * kPointerSize);
1564 1564
1565 __ bind(&check_double);
1566
1567
1568 // Check that the elements are in double mode.
1569 __ cmp(FieldOperand(edi, HeapObject::kMapOffset),
1570 Immediate(factory()->fixed_double_array_map()));
1571 __ j(not_equal, &call_builtin);
1572
1573 // Get the array's length into eax and calculate new length.
1574 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
1575 STATIC_ASSERT(kSmiTagSize == 1);
1576 STATIC_ASSERT(kSmiTag == 0);
1577 __ add(eax, Immediate(Smi::FromInt(argc)));
1578
1579 // Get the elements' length into ecx.
1580 __ mov(ecx, FieldOperand(edi, FixedArray::kLengthOffset));
1581
1582 // Check if we could survive without allocation.
1583 __ cmp(eax, ecx);
1584 __ j(greater, &call_builtin);
1585
1586 __ mov(ecx, Operand(esp, argc * kPointerSize));
1587 __ StoreNumberToDoubleElements(
1588 ecx, edi, eax, ecx, xmm0, &call_builtin, true, argc * kDoubleSize);
1589
1590 // Save new length.
1591 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
1592 __ ret((argc + 1) * kPointerSize);
1593
1565 __ bind(&with_write_barrier); 1594 __ bind(&with_write_barrier);
1566 1595
1567 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); 1596 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
1568 1597
1569 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { 1598 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) {
1570 Label fast_object, not_fast_object; 1599 Label fast_object, not_fast_object;
1571 __ CheckFastObjectElements(ebx, &not_fast_object, Label::kNear); 1600 __ CheckFastObjectElements(ebx, &not_fast_object, Label::kNear);
1572 __ jmp(&fast_object); 1601 __ jmp(&fast_object);
1573 // In case of fast smi-only, convert to fast object, otherwise bail out. 1602 // In case of fast smi-only, convert to fast object, otherwise bail out.
1574 __ bind(&not_fast_object); 1603 __ bind(&not_fast_object);
1575 __ CheckFastSmiElements(ebx, &call_builtin); 1604 __ CheckFastSmiElements(ebx, &call_builtin);
1605 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset),
1606 Immediate(factory()->heap_number_map()));
1607 __ j(equal, &call_builtin);
1576 // edi: elements array 1608 // edi: elements array
1577 // edx: receiver 1609 // edx: receiver
1578 // ebx: map 1610 // ebx: map
1579 Label try_holey_map; 1611 Label try_holey_map;
1580 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, 1612 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
1581 FAST_ELEMENTS, 1613 FAST_ELEMENTS,
1582 ebx, 1614 ebx,
1583 edi, 1615 edi,
1584 &try_holey_map); 1616 &try_holey_map);
1585 1617
(...skipping 2776 matching lines...) Expand 10 before | Expand all | Expand 10 after
4362 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4394 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4363 } 4395 }
4364 } 4396 }
4365 4397
4366 4398
4367 #undef __ 4399 #undef __
4368 4400
4369 } } // namespace v8::internal 4401 } } // namespace v8::internal
4370 4402
4371 #endif // V8_TARGET_ARCH_IA32 4403 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698