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

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
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 preparser(&scanner, &recorder, stack_limit);
195 preparser.set_allow_lazy(true);
194 preparser::PreParser::PreParseResult result = 196 preparser::PreParser::PreParseResult result =
195 preparser::PreParser::PreParseProgram(&scanner, 197 preparser.PreParseProgram();
Michael Starzinger 2013/04/05 10:30:33 nit: Should fit into one line now.
wingo 2013/04/05 12:00:14 Done.
196 &recorder,
197 internal::kAllowLazy,
198 stack_limit);
199 if (result == preparser::PreParser::kPreParseStackOverflow) { 198 if (result == preparser::PreParser::kPreParseStackOverflow) {
200 return PreParserData::StackOverflow(); 199 return PreParserData::StackOverflow();
201 } 200 }
202 internal::Vector<unsigned> pre_data = recorder.ExtractData(); 201 internal::Vector<unsigned> pre_data = recorder.ExtractData();
203 size_t size = pre_data.length() * sizeof(pre_data[0]); 202 size_t size = pre_data.length() * sizeof(pre_data[0]);
204 unsigned char* data = reinterpret_cast<unsigned char*>(pre_data.start()); 203 unsigned char* data = reinterpret_cast<unsigned char*>(pre_data.start());
205 return PreParserData(size, data); 204 return PreParserData(size, data);
206 } 205 }
207 206
208 } // namespace v8. 207 } // namespace v8.
209 208
210 209
211 // Used by ASSERT macros and other immediate exits. 210 // Used by ASSERT macros and other immediate exits.
212 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) { 211 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) {
213 exit(EXIT_FAILURE); 212 exit(EXIT_FAILURE);
214 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698