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

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

Issue 210053003: Add index check in DoAccessArgumentsAt. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test and int3 Created 6 years, 9 months 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 | test/mjsunit/regress/regress-355523.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after
2903 2903
2904 2904
2905 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { 2905 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2906 Register arguments = ToRegister(instr->arguments()); 2906 Register arguments = ToRegister(instr->arguments());
2907 Register result = ToRegister(instr->result()); 2907 Register result = ToRegister(instr->result());
2908 2908
2909 if (instr->length()->IsConstantOperand() && 2909 if (instr->length()->IsConstantOperand() &&
2910 instr->index()->IsConstantOperand()) { 2910 instr->index()->IsConstantOperand()) {
2911 int32_t const_index = ToInteger32(LConstantOperand::cast(instr->index())); 2911 int32_t const_index = ToInteger32(LConstantOperand::cast(instr->index()));
2912 int32_t const_length = ToInteger32(LConstantOperand::cast(instr->length())); 2912 int32_t const_length = ToInteger32(LConstantOperand::cast(instr->length()));
2913 StackArgumentsAccessor args(arguments, const_length, 2913 if (const_index >= 0 && const_index < const_length) {
2914 ARGUMENTS_DONT_CONTAIN_RECEIVER); 2914 StackArgumentsAccessor args(arguments, const_length,
2915 __ movp(result, args.GetArgumentOperand(const_index)); 2915 ARGUMENTS_DONT_CONTAIN_RECEIVER);
2916 __ movp(result, args.GetArgumentOperand(const_index));
2917 } else if (FLAG_debug_code) {
2918 __ int3();
2919 }
2916 } else { 2920 } else {
2917 Register length = ToRegister(instr->length()); 2921 Register length = ToRegister(instr->length());
2918 // There are two words between the frame pointer and the last argument. 2922 // There are two words between the frame pointer and the last argument.
2919 // Subtracting from length accounts for one of them add one more. 2923 // Subtracting from length accounts for one of them add one more.
2920 if (instr->index()->IsRegister()) { 2924 if (instr->index()->IsRegister()) {
2921 __ subl(length, ToRegister(instr->index())); 2925 __ subl(length, ToRegister(instr->index()));
2922 } else { 2926 } else {
2923 __ subl(length, ToOperand(instr->index())); 2927 __ subl(length, ToOperand(instr->index()));
2924 } 2928 }
2925 StackArgumentsAccessor args(arguments, length, 2929 StackArgumentsAccessor args(arguments, length,
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after
5646 FixedArray::kHeaderSize - kPointerSize)); 5650 FixedArray::kHeaderSize - kPointerSize));
5647 __ bind(&done); 5651 __ bind(&done);
5648 } 5652 }
5649 5653
5650 5654
5651 #undef __ 5655 #undef __
5652 5656
5653 } } // namespace v8::internal 5657 } } // namespace v8::internal
5654 5658
5655 #endif // V8_TARGET_ARCH_X64 5659 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-355523.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698