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/hydrogen-dehoist.cc

Issue 22314012: Fix Array index dehoisting. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix white-space. Created 7 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 | « no previous file | test/mjsunit/regress/regress-264203.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 20 matching lines...) Expand all
31 namespace internal { 31 namespace internal {
32 32
33 static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) { 33 static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) {
34 HValue* index = array_operation->GetKey()->ActualValue(); 34 HValue* index = array_operation->GetKey()->ActualValue();
35 if (!index->representation().IsSmiOrInteger32()) return; 35 if (!index->representation().IsSmiOrInteger32()) return;
36 if (!index->IsAdd() && !index->IsSub()) return; 36 if (!index->IsAdd() && !index->IsSub()) return;
37 37
38 HConstant* constant; 38 HConstant* constant;
39 HValue* subexpression; 39 HValue* subexpression;
40 HBinaryOperation* binary_operation = HBinaryOperation::cast(index); 40 HBinaryOperation* binary_operation = HBinaryOperation::cast(index);
41 if (binary_operation->left()->IsConstant()) { 41 if (binary_operation->left()->IsConstant() && index->IsAdd()) {
42 subexpression = binary_operation->right(); 42 subexpression = binary_operation->right();
43 constant = HConstant::cast(binary_operation->left()); 43 constant = HConstant::cast(binary_operation->left());
44 } else if (binary_operation->right()->IsConstant()) { 44 } else if (binary_operation->right()->IsConstant()) {
45 subexpression = binary_operation->left(); 45 subexpression = binary_operation->left();
46 constant = HConstant::cast(binary_operation->right()); 46 constant = HConstant::cast(binary_operation->right());
47 } else { 47 } else {
48 return; 48 return;
49 } 49 }
50 50
51 if (!constant->HasInteger32Value()) return; 51 if (!constant->HasInteger32Value()) return;
(...skipping 19 matching lines...) Expand all
71 if (instr->IsLoadKeyed()) { 71 if (instr->IsLoadKeyed()) {
72 DehoistArrayIndex(HLoadKeyed::cast(instr)); 72 DehoistArrayIndex(HLoadKeyed::cast(instr));
73 } else if (instr->IsStoreKeyed()) { 73 } else if (instr->IsStoreKeyed()) {
74 DehoistArrayIndex(HStoreKeyed::cast(instr)); 74 DehoistArrayIndex(HStoreKeyed::cast(instr));
75 } 75 }
76 } 76 }
77 } 77 }
78 } 78 }
79 79
80 } } // namespace v8::internal 80 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-264203.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698