Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 case FAST_ELEMENTS: | 129 case FAST_ELEMENTS: |
| 130 return to_kind == FAST_HOLEY_ELEMENTS; | 130 return to_kind == FAST_HOLEY_ELEMENTS; |
| 131 case FAST_HOLEY_ELEMENTS: | 131 case FAST_HOLEY_ELEMENTS: |
| 132 return false; | 132 return false; |
| 133 default: | 133 default: |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 ElementsKind GetUnifiedFastElementsKind(ElementsKind e1, ElementsKind e2) { | |
| 140 ASSERT(IsFastElementsKind(e1)); | |
| 141 ASSERT(IsFastElementsKind(e2)); | |
|
danno
2012/11/14 15:28:18
I think you can simplify this code:
int i1 = GetS
mvstanton
2012/11/16 15:15:06
Done.
| |
| 142 if (e1 == e2) { | |
| 143 return e1; | |
| 144 } | |
| 145 | |
| 146 int i1 = GetSequenceIndexFromFastElementsKind(e1); | |
| 147 int i2 = GetSequenceIndexFromFastElementsKind(e2); | |
| 148 ASSERT(i1 != i2); | |
| 149 int max = i1 > i2 ? i1 : i2; | |
| 150 int min = i1 < i2 ? i1 : i2; | |
| 151 // The only reason not to take the max as the result is if the max is packed a nd the | |
| 152 // min is holey | |
| 153 ElementsKind eMax = GetFastElementsKindFromSequenceIndex(max); | |
| 154 ElementsKind eMin = GetFastElementsKindFromSequenceIndex(min); | |
| 155 if (IsFastPackedElementsKind(eMax) && !IsFastPackedElementsKind(eMin)) { | |
| 156 return GetNextMoreGeneralFastElementsKind(eMin, false); | |
| 157 } | |
| 158 return eMax; | |
| 159 } | |
| 160 | |
| 161 | |
| 139 } } // namespace v8::internal | 162 } } // namespace v8::internal |
| OLD | NEW |