| 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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
| 6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
| 7 | 7 |
| 8 #include "allocation.h" | 8 #include "allocation.h" |
| 9 #include "ast.h" | 9 #include "ast.h" |
| 10 #include "compiler.h" // For CachedDataMode | 10 #include "compiler.h" // For CachedDataMode |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void Initialize(); | 82 void Initialize(); |
| 83 void ReadNextSymbolPosition(); | 83 void ReadNextSymbolPosition(); |
| 84 | 84 |
| 85 FunctionEntry GetFunctionEntry(int start); | 85 FunctionEntry GetFunctionEntry(int start); |
| 86 int GetSymbolIdentifier(); | 86 int GetSymbolIdentifier(); |
| 87 bool SanityCheck(); | 87 bool SanityCheck(); |
| 88 | 88 |
| 89 Scanner::Location MessageLocation() const; | 89 Scanner::Location MessageLocation() const; |
| 90 bool IsReferenceError() const; | 90 bool IsReferenceError() const; |
| 91 const char* BuildMessage() const; | 91 const char* BuildMessage() const; |
| 92 Vector<const char*> BuildArgs() const; | 92 const char* BuildArg() const; |
| 93 | 93 |
| 94 int function_count() { | 94 int function_count() { |
| 95 int functions_size = | 95 int functions_size = |
| 96 static_cast<int>(store_[PreparseDataConstants::kFunctionsSizeOffset]); | 96 static_cast<int>(store_[PreparseDataConstants::kFunctionsSizeOffset]); |
| 97 if (functions_size < 0) return 0; | 97 if (functions_size < 0) return 0; |
| 98 if (functions_size % FunctionEntry::kSize != 0) return 0; | 98 if (functions_size % FunctionEntry::kSize != 0) return 0; |
| 99 return functions_size / FunctionEntry::kSize; | 99 return functions_size / FunctionEntry::kSize; |
| 100 } | 100 } |
| 101 // The following functions should only be called if SanityCheck has | 101 // The following functions should only be called if SanityCheck has |
| 102 // returned true. | 102 // returned true. |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 Expression* NewThrowTypeError(const char* type, Handle<Object> arg, int pos); | 508 Expression* NewThrowTypeError(const char* type, Handle<Object> arg, int pos); |
| 509 | 509 |
| 510 // Generic AST generator for throwing errors from compiled code. | 510 // Generic AST generator for throwing errors from compiled code. |
| 511 Expression* NewThrowError( | 511 Expression* NewThrowError( |
| 512 Handle<String> constructor, const char* type, | 512 Handle<String> constructor, const char* type, |
| 513 Vector<Handle<Object> > arguments, int pos); | 513 Vector<Handle<Object> > arguments, int pos); |
| 514 | 514 |
| 515 // Reporting errors. | 515 // Reporting errors. |
| 516 void ReportMessageAt(Scanner::Location source_location, | 516 void ReportMessageAt(Scanner::Location source_location, |
| 517 const char* message, | 517 const char* message, |
| 518 Vector<const char*> args, | 518 const char* arg, |
| 519 bool is_reference_error = false); | 519 bool is_reference_error = false); |
| 520 void ReportMessage(const char* message, | 520 void ReportMessage(const char* message, |
| 521 Vector<Handle<String> > args, | 521 Handle<String> arg, |
| 522 bool is_reference_error = false); | 522 bool is_reference_error = false); |
| 523 void ReportMessageAt(Scanner::Location source_location, | 523 void ReportMessageAt(Scanner::Location source_location, |
| 524 const char* message, | 524 const char* message, |
| 525 Vector<Handle<String> > args, | 525 Handle<String> args, |
| 526 bool is_reference_error = false); | 526 bool is_reference_error = false); |
| 527 | 527 |
| 528 // "null" return type creators. | 528 // "null" return type creators. |
| 529 static Handle<String> EmptyIdentifier() { | 529 static Handle<String> EmptyIdentifier() { |
| 530 return Handle<String>(); | 530 return Handle<String>(); |
| 531 } | 531 } |
| 532 static Expression* EmptyExpression() { | 532 static Expression* EmptyExpression() { |
| 533 return NULL; | 533 return NULL; |
| 534 } | 534 } |
| 535 static Literal* EmptyLiteral() { | 535 static Literal* EmptyLiteral() { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 private: | 819 private: |
| 820 static const int kLiteralTypeSlot = 0; | 820 static const int kLiteralTypeSlot = 0; |
| 821 static const int kElementsSlot = 1; | 821 static const int kElementsSlot = 1; |
| 822 | 822 |
| 823 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 823 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 824 }; | 824 }; |
| 825 | 825 |
| 826 } } // namespace v8::internal | 826 } } // namespace v8::internal |
| 827 | 827 |
| 828 #endif // V8_PARSER_H_ | 828 #endif // V8_PARSER_H_ |
| OLD | NEW |