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

Side by Side Diff: src/parser.h

Issue 220233006: PreParser fix: propagate reference erros properly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months 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
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 virtual const char* Data(); 97 virtual const char* Data();
98 virtual bool HasError(); 98 virtual bool HasError();
99 99
100 void Initialize(); 100 void Initialize();
101 void ReadNextSymbolPosition(); 101 void ReadNextSymbolPosition();
102 102
103 FunctionEntry GetFunctionEntry(int start); 103 FunctionEntry GetFunctionEntry(int start);
104 int GetSymbolIdentifier(); 104 int GetSymbolIdentifier();
105 bool SanityCheck(); 105 bool SanityCheck();
106 106
107 Scanner::Location MessageLocation(); 107 Scanner::Location MessageLocation() const;
108 const char* BuildMessage(); 108 bool IsReferenceError() const;
109 Vector<const char*> BuildArgs(); 109 const char* BuildMessage() const;
110 Vector<const char*> BuildArgs() const;
110 111
111 int symbol_count() { 112 int symbol_count() {
112 return (store_.length() > PreparseDataConstants::kHeaderSize) 113 return (store_.length() > PreparseDataConstants::kHeaderSize)
113 ? store_[PreparseDataConstants::kSymbolCountOffset] 114 ? store_[PreparseDataConstants::kSymbolCountOffset]
114 : 0; 115 : 0;
115 } 116 }
116 // The following functions should only be called if SanityCheck has 117 // The following functions should only be called if SanityCheck has
117 // returned true. 118 // returned true.
118 bool has_error() { return store_[PreparseDataConstants::kHasErrorOffset]; } 119 bool has_error() { return store_[PreparseDataConstants::kHasErrorOffset]; }
119 unsigned magic() { return store_[PreparseDataConstants::kMagicOffset]; } 120 unsigned magic() { return store_[PreparseDataConstants::kMagicOffset]; }
120 unsigned version() { return store_[PreparseDataConstants::kVersionOffset]; } 121 unsigned version() { return store_[PreparseDataConstants::kVersionOffset]; }
121 122
122 private: 123 private:
123 friend class v8::ScriptCompiler; 124 friend class v8::ScriptCompiler;
124 Vector<unsigned> store_; 125 Vector<unsigned> store_;
125 unsigned char* symbol_data_; 126 unsigned char* symbol_data_;
126 unsigned char* symbol_data_end_; 127 unsigned char* symbol_data_end_;
127 int function_index_; 128 int function_index_;
128 bool owns_store_; 129 bool owns_store_;
129 130
130 unsigned Read(int position); 131 unsigned Read(int position) const;
131 unsigned* ReadAddress(int position); 132 unsigned* ReadAddress(int position) const;
132 // Reads a number from the current symbols 133 // Reads a number from the current symbols
133 int ReadNumber(byte** source); 134 int ReadNumber(byte** source);
134 135
135 ScriptDataImpl(const char* backing_store, int length) 136 ScriptDataImpl(const char* backing_store, int length)
136 : store_(reinterpret_cast<unsigned*>(const_cast<char*>(backing_store)), 137 : store_(reinterpret_cast<unsigned*>(const_cast<char*>(backing_store)),
137 length / static_cast<int>(sizeof(unsigned))), 138 length / static_cast<int>(sizeof(unsigned))),
138 owns_store_(false) { 139 owns_store_(false) {
139 ASSERT_EQ(0, static_cast<int>( 140 ASSERT_EQ(0, static_cast<int>(
140 reinterpret_cast<intptr_t>(backing_store) % sizeof(unsigned))); 141 reinterpret_cast<intptr_t>(backing_store) % sizeof(unsigned)));
141 } 142 }
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 private: 838 private:
838 static const int kLiteralTypeSlot = 0; 839 static const int kLiteralTypeSlot = 0;
839 static const int kElementsSlot = 1; 840 static const int kElementsSlot = 1;
840 841
841 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 842 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
842 }; 843 };
843 844
844 } } // namespace v8::internal 845 } } // namespace v8::internal
845 846
846 #endif // V8_PARSER_H_ 847 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698