| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "api.h" | 30 #include "api.h" |
| 31 #include "ast.h" | 31 #include "ast.h" |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "compiler.h" |
| 33 #include "platform.h" | 34 #include "platform.h" |
| 34 #include "runtime.h" | 35 #include "runtime.h" |
| 35 #include "parser.h" | 36 #include "parser.h" |
| 36 #include "scopes.h" | 37 #include "scopes.h" |
| 37 #include "string-stream.h" | 38 #include "string-stream.h" |
| 38 | 39 |
| 39 namespace v8 { namespace internal { | 40 namespace v8 { namespace internal { |
| 40 | 41 |
| 41 class ParserFactory; | 42 class ParserFactory; |
| 42 class ParserLog; | 43 class ParserLog; |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 ZoneListWrapper<Statement> processor; | 1090 ZoneListWrapper<Statement> processor; |
| 1090 bool ok = true; | 1091 bool ok = true; |
| 1091 ParseSourceElements(&processor, Token::EOS, &ok); | 1092 ParseSourceElements(&processor, Token::EOS, &ok); |
| 1092 return !scanner().stack_overflow(); | 1093 return !scanner().stack_overflow(); |
| 1093 } | 1094 } |
| 1094 | 1095 |
| 1095 | 1096 |
| 1096 FunctionLiteral* Parser::ParseProgram(Handle<String> source, | 1097 FunctionLiteral* Parser::ParseProgram(Handle<String> source, |
| 1097 unibrow::CharacterStream* stream, | 1098 unibrow::CharacterStream* stream, |
| 1098 bool in_global_context) { | 1099 bool in_global_context) { |
| 1099 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); | 1100 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); |
| 1100 | 1101 |
| 1101 HistogramTimerScope timer(&Counters::parse); | 1102 HistogramTimerScope timer(&Counters::parse); |
| 1102 Counters::total_parse_size.Increment(source->length()); | 1103 Counters::total_parse_size.Increment(source->length()); |
| 1103 | 1104 |
| 1104 // Initialize parser state. | 1105 // Initialize parser state. |
| 1105 source->TryFlattenIfNotFlat(); | 1106 source->TryFlattenIfNotFlat(); |
| 1106 scanner_.Init(source, stream, 0); | 1107 scanner_.Init(source, stream, 0); |
| 1107 ASSERT(target_stack_ == NULL); | 1108 ASSERT(target_stack_ == NULL); |
| 1108 | 1109 |
| 1109 // Compute the parsing mode. | 1110 // Compute the parsing mode. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 // and it is not safe to do so before the scope has been deleted. | 1143 // and it is not safe to do so before the scope has been deleted. |
| 1143 if (result == NULL) zone_scope.DeleteOnExit(); | 1144 if (result == NULL) zone_scope.DeleteOnExit(); |
| 1144 return result; | 1145 return result; |
| 1145 } | 1146 } |
| 1146 | 1147 |
| 1147 | 1148 |
| 1148 FunctionLiteral* Parser::ParseLazy(Handle<String> source, | 1149 FunctionLiteral* Parser::ParseLazy(Handle<String> source, |
| 1149 Handle<String> name, | 1150 Handle<String> name, |
| 1150 int start_position, | 1151 int start_position, |
| 1151 bool is_expression) { | 1152 bool is_expression) { |
| 1152 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); | 1153 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); |
| 1153 HistogramTimerScope timer(&Counters::parse_lazy); | 1154 HistogramTimerScope timer(&Counters::parse_lazy); |
| 1154 source->TryFlattenIfNotFlat(); | 1155 source->TryFlattenIfNotFlat(); |
| 1155 Counters::total_parse_size.Increment(source->length()); | 1156 Counters::total_parse_size.Increment(source->length()); |
| 1156 SafeStringInputBuffer buffer(source.location()); | 1157 SafeStringInputBuffer buffer(source.location()); |
| 1157 | 1158 |
| 1158 // Initialize parser state. | 1159 // Initialize parser state. |
| 1159 scanner_.Init(source, &buffer, start_position); | 1160 scanner_.Init(source, &buffer, start_position); |
| 1160 ASSERT(target_stack_ == NULL); | 1161 ASSERT(target_stack_ == NULL); |
| 1161 mode_ = PARSE_EAGERLY; | 1162 mode_ = PARSE_EAGERLY; |
| 1162 | 1163 |
| (...skipping 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4570 start_position, | 4571 start_position, |
| 4571 is_expression); | 4572 is_expression); |
| 4572 return result; | 4573 return result; |
| 4573 } | 4574 } |
| 4574 | 4575 |
| 4575 | 4576 |
| 4576 #undef NEW | 4577 #undef NEW |
| 4577 | 4578 |
| 4578 | 4579 |
| 4579 } } // namespace v8::internal | 4580 } } // namespace v8::internal |
| OLD | NEW |