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

Side by Side Diff: src/preparser-api.cc

Issue 13450007: Refactor parser mode configuration for correctness (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 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
« no previous file with comments | « src/preparser.cc ('k') | src/runtime.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 UnicodeInputStream::~UnicodeInputStream() { } 184 UnicodeInputStream::~UnicodeInputStream() { }
185 185
186 186
187 PreParserData Preparse(UnicodeInputStream* input, size_t max_stack) { 187 PreParserData Preparse(UnicodeInputStream* input, size_t max_stack) {
188 internal::InputStreamUtf16Buffer buffer(input); 188 internal::InputStreamUtf16Buffer buffer(input);
189 uintptr_t stack_limit = reinterpret_cast<uintptr_t>(&buffer) - max_stack; 189 uintptr_t stack_limit = reinterpret_cast<uintptr_t>(&buffer) - max_stack;
190 internal::UnicodeCache unicode_cache; 190 internal::UnicodeCache unicode_cache;
191 internal::Scanner scanner(&unicode_cache); 191 internal::Scanner scanner(&unicode_cache);
192 scanner.Initialize(&buffer); 192 scanner.Initialize(&buffer);
193 internal::CompleteParserRecorder recorder; 193 internal::CompleteParserRecorder recorder;
194 preparser::PreParser::PreParseResult result = 194 preparser::PreParser preparser(&scanner, &recorder, stack_limit);
195 preparser::PreParser::PreParseProgram(&scanner, 195 preparser.set_allow_lazy(true);
196 &recorder, 196 preparser::PreParser::PreParseResult result = preparser.PreParseProgram();
197 internal::kAllowLazy,
198 stack_limit);
199 if (result == preparser::PreParser::kPreParseStackOverflow) { 197 if (result == preparser::PreParser::kPreParseStackOverflow) {
200 return PreParserData::StackOverflow(); 198 return PreParserData::StackOverflow();
201 } 199 }
202 internal::Vector<unsigned> pre_data = recorder.ExtractData(); 200 internal::Vector<unsigned> pre_data = recorder.ExtractData();
203 size_t size = pre_data.length() * sizeof(pre_data[0]); 201 size_t size = pre_data.length() * sizeof(pre_data[0]);
204 unsigned char* data = reinterpret_cast<unsigned char*>(pre_data.start()); 202 unsigned char* data = reinterpret_cast<unsigned char*>(pre_data.start());
205 return PreParserData(size, data); 203 return PreParserData(size, data);
206 } 204 }
207 205
208 } // namespace v8. 206 } // namespace v8.
209 207
210 208
211 // Used by ASSERT macros and other immediate exits. 209 // Used by ASSERT macros and other immediate exits.
212 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) { 210 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) {
213 exit(EXIT_FAILURE); 211 exit(EXIT_FAILURE);
214 } 212 }
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698