OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 int start_position, | 161 int start_position, |
162 int end_position, | 162 int end_position, |
163 bool is_expression); | 163 bool is_expression); |
164 | 164 |
165 | 165 |
166 // Support for handling complex values (array and object literals) that | 166 // Support for handling complex values (array and object literals) that |
167 // can be fully handled at compile time. | 167 // can be fully handled at compile time. |
168 class CompileTimeValue: public AllStatic { | 168 class CompileTimeValue: public AllStatic { |
169 public: | 169 public: |
170 enum Type { | 170 enum Type { |
171 OBJECT_LITERAL, | 171 OBJECT_LITERAL_FAST_ELEMENTS, |
| 172 OBJECT_LITERAL_SLOW_ELEMENTS, |
172 ARRAY_LITERAL | 173 ARRAY_LITERAL |
173 }; | 174 }; |
174 | 175 |
175 static bool IsCompileTimeValue(Expression* expression); | 176 static bool IsCompileTimeValue(Expression* expression); |
176 | 177 |
177 // Get the value as a compile time value. | 178 // Get the value as a compile time value. |
178 static Handle<FixedArray> GetValue(Expression* expression); | 179 static Handle<FixedArray> GetValue(Expression* expression); |
179 | 180 |
180 // Get the type of a compile time value returned by GetValue(). | 181 // Get the type of a compile time value returned by GetValue(). |
181 static Type GetType(Handle<FixedArray> value); | 182 static Type GetType(Handle<FixedArray> value); |
182 | 183 |
183 // Get the elements array of a compile time value returned by GetValue(). | 184 // Get the elements array of a compile time value returned by GetValue(). |
184 static Handle<FixedArray> GetElements(Handle<FixedArray> value); | 185 static Handle<FixedArray> GetElements(Handle<FixedArray> value); |
185 | 186 |
186 private: | 187 private: |
187 static const int kTypeSlot = 0; | 188 static const int kTypeSlot = 0; |
188 static const int kElementsSlot = 1; | 189 static const int kElementsSlot = 1; |
189 | 190 |
190 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 191 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
191 }; | 192 }; |
192 | 193 |
193 | 194 |
194 } } // namespace v8::internal | 195 } } // namespace v8::internal |
195 | 196 |
196 #endif // V8_PARSER_H_ | 197 #endif // V8_PARSER_H_ |
OLD | NEW |