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

Unified Diff: src/ia32/full-codegen-ia32.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/full-codegen-ia32.cc
===================================================================
--- src/ia32/full-codegen-ia32.cc (revision 6016)
+++ src/ia32/full-codegen-ia32.cc (working copy)
@@ -3108,6 +3108,13 @@
__ test(temp, Immediate(kSmiTagMask));
__ j(not_zero, &slow_case);
+ // Check that both indices are valid.
+ __ mov(temp, FieldOperand(object, JSArray::kLengthOffset));
+ __ cmp(temp, Operand(index_1));
+ __ j(below_equal, &slow_case);
+ __ cmp(temp, Operand(index_2));
+ __ j(below_equal, &slow_case);
+
// Bring addresses into index1 and index2.
__ lea(index_1, CodeGenerator::FixedArrayElementOperand(elements, index_1));
__ lea(index_2, CodeGenerator::FixedArrayElementOperand(elements, index_2));
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698