OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 4368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4379 script->set_source_url(*source_url); | 4379 script->set_source_url(*source_url); |
4380 } | 4380 } |
4381 Handle<String> source_mapping_url = scanner_.SourceMappingUrl(isolate); | 4381 Handle<String> source_mapping_url = scanner_.SourceMappingUrl(isolate); |
4382 if (!source_mapping_url.is_null()) { | 4382 if (!source_mapping_url.is_null()) { |
4383 script->set_source_mapping_url(*source_mapping_url); | 4383 script->set_source_mapping_url(*source_mapping_url); |
4384 } | 4384 } |
4385 } | 4385 } |
4386 | 4386 |
4387 | 4387 |
4388 void Parser::Internalize(Isolate* isolate, Handle<Script> script, bool error) { | 4388 void Parser::Internalize(Isolate* isolate, Handle<Script> script, bool error) { |
4389 // Internalize strings. | 4389 // Internalize strings and values. |
4390 ast_value_factory()->Internalize(isolate); | 4390 ast_value_factory()->Internalize(isolate); |
4391 | 4391 |
4392 // Error processing. | 4392 // Error processing. |
4393 if (error) { | 4393 if (error) { |
4394 if (stack_overflow()) { | 4394 if (stack_overflow()) { |
4395 isolate->StackOverflow(); | 4395 isolate->StackOverflow(); |
4396 } else { | 4396 } else { |
4397 DCHECK(pending_error_handler_.has_pending_error()); | 4397 DCHECK(pending_error_handler_.has_pending_error()); |
4398 pending_error_handler_.ThrowPendingError(isolate, script); | 4398 pending_error_handler_.ThrowPendingError(isolate, script); |
4399 } | 4399 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4446 } else { | 4446 } else { |
4447 result = ParseProgram(isolate, info); | 4447 result = ParseProgram(isolate, info); |
4448 } | 4448 } |
4449 } else { | 4449 } else { |
4450 SetCachedData(info); | 4450 SetCachedData(info); |
4451 result = ParseProgram(isolate, info); | 4451 result = ParseProgram(isolate, info); |
4452 } | 4452 } |
4453 info->set_literal(result); | 4453 info->set_literal(result); |
4454 | 4454 |
4455 Internalize(isolate, info->script(), result == NULL); | 4455 Internalize(isolate, info->script(), result == NULL); |
4456 DCHECK(ast_value_factory()->IsInternalized()); | |
4457 return (result != NULL); | 4456 return (result != NULL); |
4458 } | 4457 } |
4459 | 4458 |
4460 | 4459 |
4461 void Parser::ParseOnBackground(ParseInfo* info) { | 4460 void Parser::ParseOnBackground(ParseInfo* info) { |
4462 parsing_on_main_thread_ = false; | 4461 parsing_on_main_thread_ = false; |
4463 | 4462 |
4464 DCHECK(info->literal() == NULL); | 4463 DCHECK(info->literal() == NULL); |
4465 FunctionLiteral* result = NULL; | 4464 FunctionLiteral* result = NULL; |
4466 | 4465 |
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5988 Block* try_block = factory()->NewBlock(nullptr, 1, false, nopos); | 5987 Block* try_block = factory()->NewBlock(nullptr, 1, false, nopos); |
5989 try_block->statements()->Add(loop, zone()); | 5988 try_block->statements()->Add(loop, zone()); |
5990 | 5989 |
5991 FinalizeIteratorUse(var_completion, closing_condition, loop->iterator(), | 5990 FinalizeIteratorUse(var_completion, closing_condition, loop->iterator(), |
5992 try_block, final_loop); | 5991 try_block, final_loop); |
5993 } | 5992 } |
5994 | 5993 |
5995 return final_loop; | 5994 return final_loop; |
5996 } | 5995 } |
5997 | 5996 |
5998 #ifdef DEBUG | |
5999 void Parser::Print(AstNode* node) { | |
6000 ast_value_factory()->Internalize(Isolate::Current()); | |
6001 node->Print(Isolate::Current()); | |
6002 } | |
6003 #endif // DEBUG | |
6004 | |
6005 #undef CHECK_OK | 5997 #undef CHECK_OK |
6006 #undef CHECK_OK_VOID | 5998 #undef CHECK_OK_VOID |
6007 #undef CHECK_FAILED | 5999 #undef CHECK_FAILED |
6008 | 6000 |
6009 } // namespace internal | 6001 } // namespace internal |
6010 } // namespace v8 | 6002 } // namespace v8 |
OLD | NEW |