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

Side by Side Diff: src/hydrogen.cc

Issue 12301026: Also check if the length ia a smi in a HBoundsCheck. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 RemovableSimulate removable) { 777 RemovableSimulate removable) {
778 ASSERT(current_block() != NULL); 778 ASSERT(current_block() != NULL);
779 current_block()->AddSimulate(id, removable); 779 current_block()->AddSimulate(id, removable);
780 } 780 }
781 781
782 782
783 HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index, 783 HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index,
784 HValue* length, 784 HValue* length,
785 BoundsCheckKeyMode key_mode, 785 BoundsCheckKeyMode key_mode,
786 Representation r) { 786 Representation r) {
787 HCheckSmiOrInt32* checked_index = 787 if (!index->type().IsSmi()) {
788 new(graph()->zone()) HCheckSmiOrInt32(index); 788 index = new(graph()->zone()) HCheckSmiOrInt32(index);
789 AddInstruction(checked_index); 789 AddInstruction(HCheckSmiOrInt32::cast(index));
790 }
791 if (!length->type().IsSmi()) {
792 length = new(graph()->zone()) HCheckSmiOrInt32(length);
793 AddInstruction(HCheckSmiOrInt32::cast(length));
794 }
790 HBoundsCheck* result = new(graph()->zone()) HBoundsCheck( 795 HBoundsCheck* result = new(graph()->zone()) HBoundsCheck(
791 checked_index, length, key_mode, r); 796 index, length, key_mode, r);
792 AddInstruction(result); 797 AddInstruction(result);
793 return result; 798 return result;
794 } 799 }
795 800
796 801
797 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { 802 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) {
798 HBasicBlock* b = graph()->CreateBasicBlock(); 803 HBasicBlock* b = graph()->CreateBasicBlock();
799 b->SetInitialEnvironment(env); 804 b->SetInitialEnvironment(env);
800 return b; 805 return b;
801 } 806 }
(...skipping 9865 matching lines...) Expand 10 before | Expand all | Expand 10 after
10667 } 10672 }
10668 } 10673 }
10669 10674
10670 #ifdef DEBUG 10675 #ifdef DEBUG
10671 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10676 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10672 if (allocator_ != NULL) allocator_->Verify(); 10677 if (allocator_ != NULL) allocator_->Verify();
10673 #endif 10678 #endif
10674 } 10679 }
10675 10680
10676 } } // namespace v8::internal 10681 } } // namespace v8::internal
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