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

Side by Side Diff: src/x64/ic-x64.cc

Issue 35413006: Correct handling of arrays with callbacks in the prototype chain. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Bugfix: check on dictionary elements was incorrect. Added test. Re-enabled test. Created 7 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/objects.cc ('k') | src/x64/macro-assembler-x64.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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 // rax: value 602 // rax: value
603 // rbx: receiver's elements array (a FixedArray) 603 // rbx: receiver's elements array (a FixedArray)
604 // rcx: index 604 // rcx: index
605 // rdx: receiver (a JSArray) 605 // rdx: receiver (a JSArray)
606 // r9: map of receiver 606 // r9: map of receiver
607 if (check_map == kCheckMap) { 607 if (check_map == kCheckMap) {
608 __ movq(rdi, FieldOperand(rbx, HeapObject::kMapOffset)); 608 __ movq(rdi, FieldOperand(rbx, HeapObject::kMapOffset));
609 __ CompareRoot(rdi, Heap::kFixedArrayMapRootIndex); 609 __ CompareRoot(rdi, Heap::kFixedArrayMapRootIndex);
610 __ j(not_equal, fast_double); 610 __ j(not_equal, fast_double);
611 } 611 }
612
613 // HOLECHECK: guards "A[i] = V"
614 // We have to go to the runtime if the current value is the hole because
615 // there may be a callback on the element
616 Label holecheck_passed1;
617 __ movq(kScratchRegister, FieldOperand(rbx,
618 rcx,
619 times_pointer_size,
620 FixedArray::kHeaderSize));
621 __ CompareRoot(kScratchRegister, Heap::kTheHoleValueRootIndex);
622 __ j(not_equal, &holecheck_passed1);
623 __ JumpIfDictionaryInPrototypeChain(rdx, rdi, kScratchRegister, slow);
624
625 __ bind(&holecheck_passed1);
626
612 // Smi stores don't require further checks. 627 // Smi stores don't require further checks.
613 Label non_smi_value; 628 Label non_smi_value;
614 __ JumpIfNotSmi(rax, &non_smi_value); 629 __ JumpIfNotSmi(rax, &non_smi_value);
615 if (increment_length == kIncrementLength) { 630 if (increment_length == kIncrementLength) {
616 // Add 1 to receiver->length. 631 // Add 1 to receiver->length.
617 __ leal(rdi, Operand(rcx, 1)); 632 __ leal(rdi, Operand(rcx, 1));
618 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rdi); 633 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rdi);
619 } 634 }
620 // It's irrelevant whether array is smi-only or not when writing a smi. 635 // It's irrelevant whether array is smi-only or not when writing a smi.
621 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), 636 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize),
(...skipping 19 matching lines...) Expand all
641 __ ret(0); 656 __ ret(0);
642 657
643 __ bind(fast_double); 658 __ bind(fast_double);
644 if (check_map == kCheckMap) { 659 if (check_map == kCheckMap) {
645 // Check for fast double array case. If this fails, call through to the 660 // Check for fast double array case. If this fails, call through to the
646 // runtime. 661 // runtime.
647 // rdi: elements array's map 662 // rdi: elements array's map
648 __ CompareRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); 663 __ CompareRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex);
649 __ j(not_equal, slow); 664 __ j(not_equal, slow);
650 } 665 }
666
667 // HOLECHECK: guards "A[i] double hole?"
668 // We have to see if the double version of the hole is present. If so
669 // go to the runtime.
670 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32);
671 __ cmpl(FieldOperand(rbx, rcx, times_8, offset), Immediate(kHoleNanUpper32));
672 __ j(not_equal, &fast_double_without_map_check);
673 __ JumpIfDictionaryInPrototypeChain(rdx, rdi, kScratchRegister, slow);
674
651 __ bind(&fast_double_without_map_check); 675 __ bind(&fast_double_without_map_check);
652 __ StoreNumberToDoubleElements(rax, rbx, rcx, xmm0, 676 __ StoreNumberToDoubleElements(rax, rbx, rcx, xmm0,
653 &transition_double_elements); 677 &transition_double_elements);
654 if (increment_length == kIncrementLength) { 678 if (increment_length == kIncrementLength) {
655 // Add 1 to receiver->length. 679 // Add 1 to receiver->length.
656 __ leal(rdi, Operand(rcx, 1)); 680 __ leal(rdi, Operand(rcx, 1));
657 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rdi); 681 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rdi);
658 } 682 }
659 __ ret(0); 683 __ ret(0);
660 684
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) 1702 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1679 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 1703 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1680 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 1704 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1681 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1705 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1682 } 1706 }
1683 1707
1684 1708
1685 } } // namespace v8::internal 1709 } } // namespace v8::internal
1686 1710
1687 #endif // V8_TARGET_ARCH_X64 1711 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698