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

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: 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 | no next file » | 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 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 2911
2912 2912
2913 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { 2913 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2914 Register arguments = ToRegister(instr->arguments()); 2914 Register arguments = ToRegister(instr->arguments());
2915 Register result = ToRegister(instr->result()); 2915 Register result = ToRegister(instr->result());
2916 2916
2917 if (instr->length()->IsConstantOperand() && 2917 if (instr->length()->IsConstantOperand() &&
2918 instr->index()->IsConstantOperand()) { 2918 instr->index()->IsConstantOperand()) {
2919 int32_t const_index = ToInteger32(LConstantOperand::cast(instr->index())); 2919 int32_t const_index = ToInteger32(LConstantOperand::cast(instr->index()));
2920 int32_t const_length = ToInteger32(LConstantOperand::cast(instr->length())); 2920 int32_t const_length = ToInteger32(LConstantOperand::cast(instr->length()));
2921 StackArgumentsAccessor args(arguments, const_length, 2921 if (const_index >= 0 && const_index < const_length) {
2922 ARGUMENTS_DONT_CONTAIN_RECEIVER); 2922 StackArgumentsAccessor args(arguments, const_length,
2923 __ movp(result, args.GetArgumentOperand(const_index)); 2923 ARGUMENTS_DONT_CONTAIN_RECEIVER);
2924 __ movp(result, args.GetArgumentOperand(const_index));
ulan 2014/03/24 15:43:10 This move is guarded by HBoundsCheck at run-time,
2925 } else if (FLAG_debug_code) {
2926 __ Abort(const_index < 0 ? kIndexIsNegative : kIndexIsTooLarge);
2927 }
2924 } else { 2928 } else {
2925 Register length = ToRegister(instr->length()); 2929 Register length = ToRegister(instr->length());
2926 // There are two words between the frame pointer and the last argument. 2930 // There are two words between the frame pointer and the last argument.
2927 // Subtracting from length accounts for one of them add one more. 2931 // Subtracting from length accounts for one of them add one more.
2928 if (instr->index()->IsRegister()) { 2932 if (instr->index()->IsRegister()) {
2929 __ subl(length, ToRegister(instr->index())); 2933 __ subl(length, ToRegister(instr->index()));
2930 } else { 2934 } else {
2931 __ subl(length, ToOperand(instr->index())); 2935 __ subl(length, ToOperand(instr->index()));
2932 } 2936 }
2933 StackArgumentsAccessor args(arguments, length, 2937 StackArgumentsAccessor args(arguments, length,
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after
5659 FixedArray::kHeaderSize - kPointerSize)); 5663 FixedArray::kHeaderSize - kPointerSize));
5660 __ bind(&done); 5664 __ bind(&done);
5661 } 5665 }
5662 5666
5663 5667
5664 #undef __ 5668 #undef __
5665 5669
5666 } } // namespace v8::internal 5670 } } // namespace v8::internal
5667 5671
5668 #endif // V8_TARGET_ARCH_X64 5672 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698