Index: src/parsing/parser.cc |
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
index 0ae1fb619a70ff1aa8bf224fa5a613ec99ebcea4..2e40b202654a800bac1766ec1899532734e54ec4 100644 |
--- a/src/parsing/parser.cc |
+++ b/src/parsing/parser.cc |
@@ -724,13 +724,20 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { |
source = String::Flatten(source); |
FunctionLiteral* result; |
+ int start_position = info->start_position(); |
+ int end_position = info->end_position(); |
+ if (start_position == 0 && end_position == 0) { |
+ end_position = source->length(); |
+ } |
+ |
{ |
- std::unique_ptr<Utf16CharacterStream> stream(ScannerStream::For(source)); |
+ std::unique_ptr<Utf16CharacterStream> stream( |
+ ScannerStream::For(source, start_position, end_position)); |
scanner_.Initialize(stream.get()); |
result = DoParseProgram(info); |
} |
if (result != NULL) { |
- DCHECK_EQ(scanner_.peek_location().beg_pos, source->length()); |
+ DCHECK_EQ(scanner_.peek_location().beg_pos, end_position); |
} |
HandleSourceURLComments(isolate, info->script()); |
@@ -2622,16 +2629,9 @@ FunctionLiteral* Parser::ParseFunctionLiteral( |
// FunctionExpression; even without enclosing parentheses it might be |
// immediately invoked. |
// - The function literal shouldn't be hinted to eagerly compile. |
- // - For asm.js functions the body needs to be available when module |
- // validation is active, because we examine the entire module at once. |
- |
- // Inner functions will be parsed using a temporary Zone. After parsing, we |
- // will migrate unresolved variable into a Scope in the main Zone. |
- // TODO(marja): Refactor parsing modes: simplify this. |
bool use_temp_zone = |
allow_lazy() && function_type == FunctionLiteral::kDeclaration && |
- eager_compile_hint != FunctionLiteral::kShouldEagerCompile && |
- !(FLAG_validate_asm && scope()->IsAsmModule()); |
+ eager_compile_hint != FunctionLiteral::kShouldEagerCompile; |
bool is_lazy_inner_function = |
use_temp_zone && FLAG_lazy_inner_functions && !is_lazy_top_level_function; |