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

Side by Side Diff: src/arm/codegen-arm.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 | « no previous file | src/ia32/codegen-ia32.cc » ('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 5574 matching lines...) Expand 10 before | Expand all | Expand 10 after
5585 // Smi-tagging is equivalent to multiplying by 2. 5585 // Smi-tagging is equivalent to multiplying by 2.
5586 STATIC_ASSERT(kSmiTag == 0); 5586 STATIC_ASSERT(kSmiTag == 0);
5587 STATIC_ASSERT(kSmiTagSize == 1); 5587 STATIC_ASSERT(kSmiTagSize == 1);
5588 5588
5589 // Check that both indices are smis. 5589 // Check that both indices are smis.
5590 __ mov(tmp2, index1); 5590 __ mov(tmp2, index1);
5591 __ orr(tmp2, tmp2, index2); 5591 __ orr(tmp2, tmp2, index2);
5592 __ tst(tmp2, Operand(kSmiTagMask)); 5592 __ tst(tmp2, Operand(kSmiTagMask));
5593 deferred->Branch(nz); 5593 deferred->Branch(nz);
5594 5594
5595 // Check that both indices are valid.
5596 __ ldr(tmp2, FieldMemOperand(object, JSArray::kLengthOffset));
5597 __ cmp(tmp2, index1);
5598 __ cmp(tmp2, index2, hi);
5599 deferred->Branch(ls);
5600
5595 // Bring the offsets into the fixed array in tmp1 into index1 and 5601 // Bring the offsets into the fixed array in tmp1 into index1 and
5596 // index2. 5602 // index2.
5597 __ mov(tmp2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 5603 __ mov(tmp2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
5598 __ add(index1, tmp2, Operand(index1, LSL, kPointerSizeLog2 - kSmiTagSize)); 5604 __ add(index1, tmp2, Operand(index1, LSL, kPointerSizeLog2 - kSmiTagSize));
5599 __ add(index2, tmp2, Operand(index2, LSL, kPointerSizeLog2 - kSmiTagSize)); 5605 __ add(index2, tmp2, Operand(index2, LSL, kPointerSizeLog2 - kSmiTagSize));
5600 5606
5601 // Swap elements. 5607 // Swap elements.
5602 Register tmp3 = object; 5608 Register tmp3 = object;
5603 object = no_reg; 5609 object = no_reg;
5604 __ ldr(tmp3, MemOperand(tmp1, index1)); 5610 __ ldr(tmp3, MemOperand(tmp1, index1));
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
7364 BinaryOpIC::GetName(runtime_operands_type_)); 7370 BinaryOpIC::GetName(runtime_operands_type_));
7365 return name_; 7371 return name_;
7366 } 7372 }
7367 7373
7368 7374
7369 #undef __ 7375 #undef __
7370 7376
7371 } } // namespace v8::internal 7377 } } // namespace v8::internal
7372 7378
7373 #endif // V8_TARGET_ARCH_ARM 7379 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698