| OLD | NEW |
| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 fni_(NULL), | 584 fni_(NULL), |
| 585 stack_overflow_(false), | 585 stack_overflow_(false), |
| 586 parenthesized_function_(false) { | 586 parenthesized_function_(false) { |
| 587 AstNode::ResetIds(); | 587 AstNode::ResetIds(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 | 590 |
| 591 FunctionLiteral* Parser::ParseProgram(Handle<String> source, | 591 FunctionLiteral* Parser::ParseProgram(Handle<String> source, |
| 592 bool in_global_context, | 592 bool in_global_context, |
| 593 StrictModeFlag strict_mode) { | 593 StrictModeFlag strict_mode) { |
| 594 CompilationZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT); | 594 ZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT); |
| 595 | 595 |
| 596 HistogramTimerScope timer(isolate()->counters()->parse()); | 596 HistogramTimerScope timer(isolate()->counters()->parse()); |
| 597 isolate()->counters()->total_parse_size()->Increment(source->length()); | 597 isolate()->counters()->total_parse_size()->Increment(source->length()); |
| 598 fni_ = new(zone()) FuncNameInferrer(); | 598 fni_ = new(zone()) FuncNameInferrer(); |
| 599 | 599 |
| 600 // Initialize parser state. | 600 // Initialize parser state. |
| 601 source->TryFlatten(); | 601 source->TryFlatten(); |
| 602 if (source->IsExternalTwoByteString()) { | 602 if (source->IsExternalTwoByteString()) { |
| 603 // Notice that the stream is destroyed at the end of the branch block. | 603 // Notice that the stream is destroyed at the end of the branch block. |
| 604 // The last line of the blocks can't be moved outside, even though they're | 604 // The last line of the blocks can't be moved outside, even though they're |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // Make sure the target stack is empty. | 666 // Make sure the target stack is empty. |
| 667 ASSERT(target_stack_ == NULL); | 667 ASSERT(target_stack_ == NULL); |
| 668 | 668 |
| 669 // If there was a syntax error we have to get rid of the AST | 669 // If there was a syntax error we have to get rid of the AST |
| 670 // and it is not safe to do so before the scope has been deleted. | 670 // and it is not safe to do so before the scope has been deleted. |
| 671 if (result == NULL) zone_scope->DeleteOnExit(); | 671 if (result == NULL) zone_scope->DeleteOnExit(); |
| 672 return result; | 672 return result; |
| 673 } | 673 } |
| 674 | 674 |
| 675 FunctionLiteral* Parser::ParseLazy(CompilationInfo* info) { | 675 FunctionLiteral* Parser::ParseLazy(CompilationInfo* info) { |
| 676 CompilationZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT); | 676 ZoneScope zone_scope(isolate(), DONT_DELETE_ON_EXIT); |
| 677 HistogramTimerScope timer(isolate()->counters()->parse_lazy()); | 677 HistogramTimerScope timer(isolate()->counters()->parse_lazy()); |
| 678 Handle<String> source(String::cast(script_->source())); | 678 Handle<String> source(String::cast(script_->source())); |
| 679 isolate()->counters()->total_parse_size()->Increment(source->length()); | 679 isolate()->counters()->total_parse_size()->Increment(source->length()); |
| 680 | 680 |
| 681 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 681 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
| 682 // Initialize parser state. | 682 // Initialize parser state. |
| 683 source->TryFlatten(); | 683 source->TryFlatten(); |
| 684 if (source->IsExternalTwoByteString()) { | 684 if (source->IsExternalTwoByteString()) { |
| 685 ExternalTwoByteStringUC16CharacterStream stream( | 685 ExternalTwoByteStringUC16CharacterStream stream( |
| 686 Handle<ExternalTwoByteString>::cast(source), | 686 Handle<ExternalTwoByteString>::cast(source), |
| (...skipping 4297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4984 info->is_global(), | 4984 info->is_global(), |
| 4985 info->StrictMode()); | 4985 info->StrictMode()); |
| 4986 } | 4986 } |
| 4987 } | 4987 } |
| 4988 | 4988 |
| 4989 info->SetFunction(result); | 4989 info->SetFunction(result); |
| 4990 return (result != NULL); | 4990 return (result != NULL); |
| 4991 } | 4991 } |
| 4992 | 4992 |
| 4993 } } // namespace v8::internal | 4993 } } // namespace v8::internal |
| OLD | NEW |