OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 fni_ = new(zone()) FuncNameInferrer(isolate(), zone()); | 852 fni_ = new(zone()) FuncNameInferrer(isolate(), zone()); |
853 | 853 |
854 // Initialize parser state. | 854 // Initialize parser state. |
855 CompleteParserRecorder recorder; | 855 CompleteParserRecorder recorder; |
856 if (cached_data_mode_ == PRODUCE_CACHED_DATA) { | 856 if (cached_data_mode_ == PRODUCE_CACHED_DATA) { |
857 log_ = &recorder; | 857 log_ = &recorder; |
858 } else if (cached_data_mode_ == CONSUME_CACHED_DATA) { | 858 } else if (cached_data_mode_ == CONSUME_CACHED_DATA) { |
859 (*cached_data_)->Initialize(); | 859 (*cached_data_)->Initialize(); |
860 } | 860 } |
861 | 861 |
862 source->TryFlatten(); | 862 source = String::Flatten(source); |
863 FunctionLiteral* result; | 863 FunctionLiteral* result; |
864 if (source->IsExternalTwoByteString()) { | 864 if (source->IsExternalTwoByteString()) { |
865 // Notice that the stream is destroyed at the end of the branch block. | 865 // Notice that the stream is destroyed at the end of the branch block. |
866 // The last line of the blocks can't be moved outside, even though they're | 866 // The last line of the blocks can't be moved outside, even though they're |
867 // identical calls. | 867 // identical calls. |
868 ExternalTwoByteStringUtf16CharacterStream stream( | 868 ExternalTwoByteStringUtf16CharacterStream stream( |
869 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); | 869 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); |
870 scanner_.Initialize(&stream); | 870 scanner_.Initialize(&stream); |
871 result = DoParseProgram(info(), source); | 871 result = DoParseProgram(info(), source); |
872 } else { | 872 } else { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 HistogramTimerScope timer_scope(isolate()->counters()->parse_lazy()); | 991 HistogramTimerScope timer_scope(isolate()->counters()->parse_lazy()); |
992 Handle<String> source(String::cast(script_->source())); | 992 Handle<String> source(String::cast(script_->source())); |
993 isolate()->counters()->total_parse_size()->Increment(source->length()); | 993 isolate()->counters()->total_parse_size()->Increment(source->length()); |
994 ElapsedTimer timer; | 994 ElapsedTimer timer; |
995 if (FLAG_trace_parse) { | 995 if (FLAG_trace_parse) { |
996 timer.Start(); | 996 timer.Start(); |
997 } | 997 } |
998 Handle<SharedFunctionInfo> shared_info = info()->shared_info(); | 998 Handle<SharedFunctionInfo> shared_info = info()->shared_info(); |
999 | 999 |
1000 // Initialize parser state. | 1000 // Initialize parser state. |
1001 source->TryFlatten(); | 1001 source = String::Flatten(source); |
1002 FunctionLiteral* result; | 1002 FunctionLiteral* result; |
1003 if (source->IsExternalTwoByteString()) { | 1003 if (source->IsExternalTwoByteString()) { |
1004 ExternalTwoByteStringUtf16CharacterStream stream( | 1004 ExternalTwoByteStringUtf16CharacterStream stream( |
1005 Handle<ExternalTwoByteString>::cast(source), | 1005 Handle<ExternalTwoByteString>::cast(source), |
1006 shared_info->start_position(), | 1006 shared_info->start_position(), |
1007 shared_info->end_position()); | 1007 shared_info->end_position()); |
1008 result = ParseLazy(&stream); | 1008 result = ParseLazy(&stream); |
1009 } else { | 1009 } else { |
1010 GenericStringUtf16CharacterStream stream(source, | 1010 GenericStringUtf16CharacterStream stream(source, |
1011 shared_info->start_position(), | 1011 shared_info->start_position(), |
(...skipping 3666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4678 ASSERT(info()->isolate()->has_pending_exception()); | 4678 ASSERT(info()->isolate()->has_pending_exception()); |
4679 } else { | 4679 } else { |
4680 result = ParseProgram(); | 4680 result = ParseProgram(); |
4681 } | 4681 } |
4682 } | 4682 } |
4683 info()->SetFunction(result); | 4683 info()->SetFunction(result); |
4684 return (result != NULL); | 4684 return (result != NULL); |
4685 } | 4685 } |
4686 | 4686 |
4687 } } // namespace v8::internal | 4687 } } // namespace v8::internal |
OLD | NEW |