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 17 matching lines...) Expand all Loading... |
28 #include "elements-kind.h" | 28 #include "elements-kind.h" |
29 | 29 |
30 #include "api.h" | 30 #include "api.h" |
31 #include "elements.h" | 31 #include "elements.h" |
32 #include "objects.h" | 32 #include "objects.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 | 37 |
| 38 int ElementsKindToShiftSize(ElementsKind elements_kind) { |
| 39 switch (elements_kind) { |
| 40 case EXTERNAL_BYTE_ELEMENTS: |
| 41 case EXTERNAL_PIXEL_ELEMENTS: |
| 42 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 43 return 0; |
| 44 case EXTERNAL_SHORT_ELEMENTS: |
| 45 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 46 return 1; |
| 47 case EXTERNAL_INT_ELEMENTS: |
| 48 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 49 case EXTERNAL_FLOAT_ELEMENTS: |
| 50 return 2; |
| 51 case EXTERNAL_DOUBLE_ELEMENTS: |
| 52 case FAST_DOUBLE_ELEMENTS: |
| 53 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 54 return 3; |
| 55 case FAST_SMI_ELEMENTS: |
| 56 case FAST_ELEMENTS: |
| 57 case FAST_HOLEY_SMI_ELEMENTS: |
| 58 case FAST_HOLEY_ELEMENTS: |
| 59 case DICTIONARY_ELEMENTS: |
| 60 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 61 return kPointerSizeLog2; |
| 62 } |
| 63 UNREACHABLE(); |
| 64 return 0; |
| 65 } |
| 66 |
| 67 |
38 const char* ElementsKindToString(ElementsKind kind) { | 68 const char* ElementsKindToString(ElementsKind kind) { |
39 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); | 69 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); |
40 return accessor->name(); | 70 return accessor->name(); |
41 } | 71 } |
42 | 72 |
43 | 73 |
44 void PrintElementsKind(FILE* out, ElementsKind kind) { | 74 void PrintElementsKind(FILE* out, ElementsKind kind) { |
45 PrintF(out, "%s", ElementsKindToString(kind)); | 75 PrintF(out, "%s", ElementsKindToString(kind)); |
46 } | 76 } |
47 | 77 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return to_kind == FAST_HOLEY_ELEMENTS; | 169 return to_kind == FAST_HOLEY_ELEMENTS; |
140 case FAST_HOLEY_ELEMENTS: | 170 case FAST_HOLEY_ELEMENTS: |
141 return false; | 171 return false; |
142 default: | 172 default: |
143 return false; | 173 return false; |
144 } | 174 } |
145 } | 175 } |
146 | 176 |
147 | 177 |
148 } } // namespace v8::internal | 178 } } // namespace v8::internal |
OLD | NEW |