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

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

Issue 10876053: MIPS: Check that index and length are Smi in bounds check. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | « src/mips/lithium-codegen-mips.h ('k') | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after
3653 3653
3654 // Name is always in a2. 3654 // Name is always in a2.
3655 __ li(a2, Operand(instr->name())); 3655 __ li(a2, Operand(instr->name()));
3656 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) 3656 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3657 ? isolate()->builtins()->StoreIC_Initialize_Strict() 3657 ? isolate()->builtins()->StoreIC_Initialize_Strict()
3658 : isolate()->builtins()->StoreIC_Initialize(); 3658 : isolate()->builtins()->StoreIC_Initialize();
3659 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3659 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3660 } 3660 }
3661 3661
3662 3662
3663 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment,
3664 HValue* value,
3665 LOperand* operand) {
3666 if (value->representation().IsTagged() && !value->type().IsSmi()) {
3667 if (operand->IsRegister()) {
3668 __ And(at, ToRegister(operand), Operand(kSmiTagMask));
3669 DeoptimizeIf(ne, environment, at, Operand(zero_reg));
3670 } else {
3671 __ li(at, ToOperand(operand));
3672 __ And(at, at, Operand(kSmiTagMask));
3673 DeoptimizeIf(ne, environment, at, Operand(zero_reg));
3674 }
3675 }
3676 }
3677
3678
3663 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3679 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3680 DeoptIfTaggedButNotSmi(instr->environment(),
3681 instr->hydrogen()->length(),
3682 instr->length());
3683 DeoptIfTaggedButNotSmi(instr->environment(),
3684 instr->hydrogen()->index(),
3685 instr->index());
3664 if (instr->index()->IsConstantOperand()) { 3686 if (instr->index()->IsConstantOperand()) {
3665 int constant_index = 3687 int constant_index =
3666 ToInteger32(LConstantOperand::cast(instr->index())); 3688 ToInteger32(LConstantOperand::cast(instr->index()));
3667 if (instr->hydrogen()->length()->representation().IsTagged()) { 3689 if (instr->hydrogen()->length()->representation().IsTagged()) {
3668 __ li(at, Operand(Smi::FromInt(constant_index))); 3690 __ li(at, Operand(Smi::FromInt(constant_index)));
3669 } else { 3691 } else {
3670 __ li(at, Operand(constant_index)); 3692 __ li(at, Operand(constant_index));
3671 } 3693 }
3672 DeoptimizeIf(hs, 3694 DeoptimizeIf(hs,
3673 instr->environment(), 3695 instr->environment(),
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
5330 __ Subu(scratch, result, scratch); 5352 __ Subu(scratch, result, scratch);
5331 __ lw(result, FieldMemOperand(scratch, 5353 __ lw(result, FieldMemOperand(scratch,
5332 FixedArray::kHeaderSize - kPointerSize)); 5354 FixedArray::kHeaderSize - kPointerSize));
5333 __ bind(&done); 5355 __ bind(&done);
5334 } 5356 }
5335 5357
5336 5358
5337 #undef __ 5359 #undef __
5338 5360
5339 } } // namespace v8::internal 5361 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698