| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSING_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
| 6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 int total_preparse_skipped_; | 1022 int total_preparse_skipped_; |
| 1023 HistogramTimer* pre_parse_timer_; | 1023 HistogramTimer* pre_parse_timer_; |
| 1024 | 1024 |
| 1025 bool parsing_on_main_thread_; | 1025 bool parsing_on_main_thread_; |
| 1026 | 1026 |
| 1027 #ifdef DEBUG | 1027 #ifdef DEBUG |
| 1028 void Print(AstNode* node); | 1028 void Print(AstNode* node); |
| 1029 #endif // DEBUG | 1029 #endif // DEBUG |
| 1030 }; | 1030 }; |
| 1031 | 1031 |
| 1032 | |
| 1033 // Support for handling complex values (array and object literals) that | |
| 1034 // can be fully handled at compile time. | |
| 1035 class CompileTimeValue: public AllStatic { | |
| 1036 public: | |
| 1037 enum LiteralType { | |
| 1038 OBJECT_LITERAL_FAST_ELEMENTS, | |
| 1039 OBJECT_LITERAL_SLOW_ELEMENTS, | |
| 1040 ARRAY_LITERAL | |
| 1041 }; | |
| 1042 | |
| 1043 static bool IsCompileTimeValue(Expression* expression); | |
| 1044 | |
| 1045 // Get the value as a compile time value. | |
| 1046 static Handle<FixedArray> GetValue(Isolate* isolate, Expression* expression); | |
| 1047 | |
| 1048 // Get the type of a compile time value returned by GetValue(). | |
| 1049 static LiteralType GetLiteralType(Handle<FixedArray> value); | |
| 1050 | |
| 1051 // Get the elements array of a compile time value returned by GetValue(). | |
| 1052 static Handle<FixedArray> GetElements(Handle<FixedArray> value); | |
| 1053 | |
| 1054 private: | |
| 1055 static const int kLiteralTypeSlot = 0; | |
| 1056 static const int kElementsSlot = 1; | |
| 1057 | |
| 1058 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | |
| 1059 }; | |
| 1060 | |
| 1061 } // namespace internal | 1032 } // namespace internal |
| 1062 } // namespace v8 | 1033 } // namespace v8 |
| 1063 | 1034 |
| 1064 #endif // V8_PARSING_PARSER_H_ | 1035 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |