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

Side by Side Diff: src/elements-kind.cc

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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
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 17 matching lines...) Expand all
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 13 matching lines...) Expand all
61 ElementsKind* fast_elements_kind_sequence = 91 ElementsKind* fast_elements_kind_sequence =
62 new ElementsKind[kFastElementsKindCount]; 92 new ElementsKind[kFastElementsKindCount];
63 *fast_elements_kind_sequence_ptr = fast_elements_kind_sequence; 93 *fast_elements_kind_sequence_ptr = fast_elements_kind_sequence;
64 STATIC_ASSERT(FAST_SMI_ELEMENTS == FIRST_FAST_ELEMENTS_KIND); 94 STATIC_ASSERT(FAST_SMI_ELEMENTS == FIRST_FAST_ELEMENTS_KIND);
65 fast_elements_kind_sequence[0] = FAST_SMI_ELEMENTS; 95 fast_elements_kind_sequence[0] = FAST_SMI_ELEMENTS;
66 fast_elements_kind_sequence[1] = FAST_HOLEY_SMI_ELEMENTS; 96 fast_elements_kind_sequence[1] = FAST_HOLEY_SMI_ELEMENTS;
67 fast_elements_kind_sequence[2] = FAST_DOUBLE_ELEMENTS; 97 fast_elements_kind_sequence[2] = FAST_DOUBLE_ELEMENTS;
68 fast_elements_kind_sequence[3] = FAST_HOLEY_DOUBLE_ELEMENTS; 98 fast_elements_kind_sequence[3] = FAST_HOLEY_DOUBLE_ELEMENTS;
69 fast_elements_kind_sequence[4] = FAST_ELEMENTS; 99 fast_elements_kind_sequence[4] = FAST_ELEMENTS;
70 fast_elements_kind_sequence[5] = FAST_HOLEY_ELEMENTS; 100 fast_elements_kind_sequence[5] = FAST_HOLEY_ELEMENTS;
101
102 // Verify that kFastElementsKindPackedToHoley is correct.
103 STATIC_ASSERT(FAST_SMI_ELEMENTS + kFastElementsKindPackedToHoley ==
104 FAST_HOLEY_SMI_ELEMENTS);
105 STATIC_ASSERT(FAST_DOUBLE_ELEMENTS + kFastElementsKindPackedToHoley ==
106 FAST_HOLEY_DOUBLE_ELEMENTS);
107 STATIC_ASSERT(FAST_ELEMENTS + kFastElementsKindPackedToHoley ==
108 FAST_HOLEY_ELEMENTS);
71 } 109 }
72 }; 110 };
73 111
74 112
75 static LazyInstance<ElementsKind*, 113 static LazyInstance<ElementsKind*,
76 InitializeFastElementsKindSequence>::type 114 InitializeFastElementsKindSequence>::type
77 fast_elements_kind_sequence = LAZY_INSTANCE_INITIALIZER; 115 fast_elements_kind_sequence = LAZY_INSTANCE_INITIALIZER;
78 116
79 117
80 ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number) { 118 ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return to_kind == FAST_HOLEY_ELEMENTS; 169 return to_kind == FAST_HOLEY_ELEMENTS;
132 case FAST_HOLEY_ELEMENTS: 170 case FAST_HOLEY_ELEMENTS:
133 return false; 171 return false;
134 default: 172 default:
135 return false; 173 return false;
136 } 174 }
137 } 175 }
138 176
139 177
140 } } // namespace v8::internal 178 } } // namespace v8::internal
OLDNEW
« include/v8-platform.h ('K') | « src/elements-kind.h ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698