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

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

Issue 5686006: Add array bound checks to code generated for SwapElements. This fixes a bug t... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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/full-codegen-ia32.cc ('k') | test/mjsunit/regress/regress-swapelements.js » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 6764 matching lines...) Expand 10 before | Expand all | Expand 10 after
6775 // Check the object's elements are in fast case and writable. 6775 // Check the object's elements are in fast case and writable.
6776 __ movq(tmp1.reg(), FieldOperand(object.reg(), JSObject::kElementsOffset)); 6776 __ movq(tmp1.reg(), FieldOperand(object.reg(), JSObject::kElementsOffset));
6777 __ CompareRoot(FieldOperand(tmp1.reg(), HeapObject::kMapOffset), 6777 __ CompareRoot(FieldOperand(tmp1.reg(), HeapObject::kMapOffset),
6778 Heap::kFixedArrayMapRootIndex); 6778 Heap::kFixedArrayMapRootIndex);
6779 deferred->Branch(not_equal); 6779 deferred->Branch(not_equal);
6780 6780
6781 // Check that both indices are smis. 6781 // Check that both indices are smis.
6782 Condition both_smi = masm()->CheckBothSmi(index1.reg(), index2.reg()); 6782 Condition both_smi = masm()->CheckBothSmi(index1.reg(), index2.reg());
6783 deferred->Branch(NegateCondition(both_smi)); 6783 deferred->Branch(NegateCondition(both_smi));
6784 6784
6785 // Check that both indices are valid.
6786 __ movq(tmp2.reg(), FieldOperand(object.reg(), JSArray::kLengthOffset));
6787 __ cmpl(tmp2.reg(), index1.reg());
6788 deferred->Branch(below_equal);
6789 __ cmpl(tmp2.reg(), index2.reg());
6790 deferred->Branch(below_equal);
6791
6785 // Bring addresses into index1 and index2. 6792 // Bring addresses into index1 and index2.
6786 __ SmiToInteger32(index1.reg(), index1.reg()); 6793 __ SmiToInteger32(index1.reg(), index1.reg());
6787 __ lea(index1.reg(), FieldOperand(tmp1.reg(), 6794 __ lea(index1.reg(), FieldOperand(tmp1.reg(),
6788 index1.reg(), 6795 index1.reg(),
6789 times_pointer_size, 6796 times_pointer_size,
6790 FixedArray::kHeaderSize)); 6797 FixedArray::kHeaderSize));
6791 __ SmiToInteger32(index2.reg(), index2.reg()); 6798 __ SmiToInteger32(index2.reg(), index2.reg());
6792 __ lea(index2.reg(), FieldOperand(tmp1.reg(), 6799 __ lea(index2.reg(), FieldOperand(tmp1.reg(),
6793 index2.reg(), 6800 index2.reg(),
6794 times_pointer_size, 6801 times_pointer_size,
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
8806 #undef __ 8813 #undef __
8807 8814
8808 void RecordWriteStub::Generate(MacroAssembler* masm) { 8815 void RecordWriteStub::Generate(MacroAssembler* masm) {
8809 masm->RecordWriteHelper(object_, addr_, scratch_); 8816 masm->RecordWriteHelper(object_, addr_, scratch_);
8810 masm->ret(0); 8817 masm->ret(0);
8811 } 8818 }
8812 8819
8813 } } // namespace v8::internal 8820 } } // namespace v8::internal
8814 8821
8815 #endif // V8_TARGET_ARCH_X64 8822 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/regress/regress-swapelements.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698