| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 Vector<unsigned> backing_; | 81 Vector<unsigned> backing_; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 | 84 |
| 85 class ScriptData { | 85 class ScriptData { |
| 86 public: | 86 public: |
| 87 explicit ScriptData(Vector<unsigned> store) | 87 explicit ScriptData(Vector<unsigned> store) |
| 88 : store_(store), | 88 : store_(store), |
| 89 owns_store_(true) { } | 89 owns_store_(true) { } |
| 90 | 90 |
| 91 // Create an empty ScriptData that is guaranteed to not satisfy | 91 ScriptData(Vector<unsigned> store, bool owns_store) |
| 92 // a SanityCheck. | 92 : store_(store), |
| 93 ScriptData() : owns_store_(false) { } | 93 owns_store_(owns_store) { } |
| 94 | 94 |
| 95 // The created ScriptData won't take ownership of the data. If the alignment | 95 // The created ScriptData won't take ownership of the data. If the alignment |
| 96 // is not correct, this will copy the data (and the created ScriptData will | 96 // is not correct, this will copy the data (and the created ScriptData will |
| 97 // take ownership of the copy). | 97 // take ownership of the copy). |
| 98 static ScriptData* New(const char* data, int length); | 98 static ScriptData* New(const char* data, int length); |
| 99 | 99 |
| 100 virtual ~ScriptData(); | 100 virtual ~ScriptData(); |
| 101 virtual int Length(); | 101 virtual int Length(); |
| 102 virtual const char* Data(); | 102 virtual const char* Data(); |
| 103 virtual bool HasError(); | 103 virtual bool HasError(); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 FunctionLiteral* ParseLazy(Utf16CharacterStream* source); | 660 FunctionLiteral* ParseLazy(Utf16CharacterStream* source); |
| 661 | 661 |
| 662 Isolate* isolate() { return isolate_; } | 662 Isolate* isolate() { return isolate_; } |
| 663 CompilationInfo* info() const { return info_; } | 663 CompilationInfo* info() const { return info_; } |
| 664 | 664 |
| 665 // Called by ParseProgram after setting up the scanner. | 665 // Called by ParseProgram after setting up the scanner. |
| 666 FunctionLiteral* DoParseProgram(CompilationInfo* info, | 666 FunctionLiteral* DoParseProgram(CompilationInfo* info, |
| 667 Handle<String> source); | 667 Handle<String> source); |
| 668 | 668 |
| 669 // Report syntax error | 669 // Report syntax error |
| 670 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 670 void ReportInvalidCachedData(Handle<String> name, bool* ok); |
| 671 | 671 |
| 672 void SetCachedData(ScriptData** data, | 672 void SetCachedData(ScriptData** data, |
| 673 CachedDataMode cached_data_mode) { | 673 CachedDataMode cached_data_mode) { |
| 674 cached_data_mode_ = cached_data_mode; | 674 cached_data_mode_ = cached_data_mode; |
| 675 if (cached_data_mode == NO_CACHED_DATA) { | 675 if (cached_data_mode == NO_CACHED_DATA) { |
| 676 cached_data_ = NULL; | 676 cached_data_ = NULL; |
| 677 } else { | 677 } else { |
| 678 ASSERT(data != NULL); | 678 ASSERT(data != NULL); |
| 679 cached_data_ = data; | 679 cached_data_ = data; |
| 680 symbol_cache_.Initialize(*data ? (*data)->symbol_count() : 0, zone()); | 680 symbol_cache_.Initialize(*data ? (*data)->symbol_count() : 0, zone()); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 private: | 832 private: |
| 833 static const int kLiteralTypeSlot = 0; | 833 static const int kLiteralTypeSlot = 0; |
| 834 static const int kElementsSlot = 1; | 834 static const int kElementsSlot = 1; |
| 835 | 835 |
| 836 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 836 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 837 }; | 837 }; |
| 838 | 838 |
| 839 } } // namespace v8::internal | 839 } } // namespace v8::internal |
| 840 | 840 |
| 841 #endif // V8_PARSER_H_ | 841 #endif // V8_PARSER_H_ |
| OLD | NEW |