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

Side by Side Diff: src/parser.cc

Issue 8590027: Fix the ScopeIterator reimplemantation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ScopeIterator fix and test cases. Created 9 years 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
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 5357 matching lines...) Expand 10 before | Expand all | Expand 10 after
5368 5368
5369 // Extract the accumulated data from the recorder as a single 5369 // Extract the accumulated data from the recorder as a single
5370 // contiguous vector that we are responsible for disposing. 5370 // contiguous vector that we are responsible for disposing.
5371 Vector<unsigned> store = recorder->ExtractData(); 5371 Vector<unsigned> store = recorder->ExtractData();
5372 return new ScriptDataImpl(store); 5372 return new ScriptDataImpl(store);
5373 } 5373 }
5374 5374
5375 5375
5376 // Preparse, but only collect data that is immediately useful, 5376 // Preparse, but only collect data that is immediately useful,
5377 // even if the preparser data is only used once. 5377 // even if the preparser data is only used once.
5378 ScriptDataImpl* ParserApi::PartialPreParse(UC16CharacterStream* source, 5378 ScriptDataImpl* ParserApi::PartialPreParse(Handle<String> source,
5379 v8::Extension* extension, 5379 v8::Extension* extension,
5380 int flags) { 5380 int flags) {
5381 bool allow_lazy = FLAG_lazy && (extension == NULL); 5381 bool allow_lazy = FLAG_lazy && (extension == NULL);
5382 if (!allow_lazy) { 5382 if (!allow_lazy) {
5383 // Partial preparsing is only about lazily compiled functions. 5383 // Partial preparsing is only about lazily compiled functions.
5384 // If we don't allow lazy compilation, the log data will be empty. 5384 // If we don't allow lazy compilation, the log data will be empty.
5385 return NULL; 5385 return NULL;
5386 } 5386 }
5387 flags |= kAllowLazy; 5387 flags |= kAllowLazy;
5388 PartialParserRecorder recorder; 5388 PartialParserRecorder recorder;
5389 return DoPreParse(source, flags, &recorder); 5389 int source_length = source->length();
5390 if (source->IsExternalTwoByteString()) {
5391 ExternalTwoByteStringUC16CharacterStream stream(
5392 Handle<ExternalTwoByteString>::cast(source), 0, source_length);
5393 return DoPreParse(&stream, flags, &recorder);
5394 } else {
5395 GenericStringUC16CharacterStream stream(source, 0, source_length);
5396 return DoPreParse(&stream, flags, &recorder);
5397 }
5390 } 5398 }
5391 5399
5392 5400
5393 ScriptDataImpl* ParserApi::PreParse(UC16CharacterStream* source, 5401 ScriptDataImpl* ParserApi::PreParse(UC16CharacterStream* source,
5394 v8::Extension* extension, 5402 v8::Extension* extension,
5395 int flags) { 5403 int flags) {
5396 Handle<Script> no_script; 5404 Handle<Script> no_script;
5397 if (FLAG_lazy && (extension == NULL)) { 5405 if (FLAG_lazy && (extension == NULL)) {
5398 flags |= kAllowLazy; 5406 flags |= kAllowLazy;
5399 } 5407 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 ASSERT(info->isolate()->has_pending_exception()); 5468 ASSERT(info->isolate()->has_pending_exception());
5461 } else { 5469 } else {
5462 result = parser.ParseProgram(info); 5470 result = parser.ParseProgram(info);
5463 } 5471 }
5464 } 5472 }
5465 info->SetFunction(result); 5473 info->SetFunction(result);
5466 return (result != NULL); 5474 return (result != NULL);
5467 } 5475 }
5468 5476
5469 } } // namespace v8::internal 5477 } } // namespace v8::internal
OLDNEW
« src/compiler.cc ('K') | « src/parser.h ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698