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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 factory_(factory), | 1189 factory_(factory), |
1190 log_(log), | 1190 log_(log), |
1191 is_pre_parsing_(is_pre_parsing), | 1191 is_pre_parsing_(is_pre_parsing), |
1192 pre_data_(pre_data) { | 1192 pre_data_(pre_data) { |
1193 } | 1193 } |
1194 | 1194 |
1195 | 1195 |
1196 bool Parser::PreParseProgram(Handle<String> source, | 1196 bool Parser::PreParseProgram(Handle<String> source, |
1197 unibrow::CharacterStream* stream) { | 1197 unibrow::CharacterStream* stream) { |
1198 HistogramTimerScope timer(&Counters::pre_parse); | 1198 HistogramTimerScope timer(&Counters::pre_parse); |
1199 StackGuard guard; | |
1200 AssertNoZoneAllocation assert_no_zone_allocation; | 1199 AssertNoZoneAllocation assert_no_zone_allocation; |
1201 AssertNoAllocation assert_no_allocation; | 1200 AssertNoAllocation assert_no_allocation; |
1202 NoHandleAllocation no_handle_allocation; | 1201 NoHandleAllocation no_handle_allocation; |
1203 scanner_.Init(source, stream, 0); | 1202 scanner_.Init(source, stream, 0); |
1204 ASSERT(target_stack_ == NULL); | 1203 ASSERT(target_stack_ == NULL); |
1205 mode_ = PARSE_EAGERLY; | 1204 mode_ = PARSE_EAGERLY; |
1206 DummyScope top_scope; | 1205 DummyScope top_scope; |
1207 LexicalScope scope(this, &top_scope); | 1206 LexicalScope scope(this, &top_scope); |
1208 TemporaryScope temp_scope(this); | 1207 TemporaryScope temp_scope(this); |
1209 ZoneListWrapper<Statement> processor; | 1208 ZoneListWrapper<Statement> processor; |
(...skipping 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4833 // the expected 50% too large. | 4832 // the expected 50% too large. |
4834 Vector<unsigned> store = parser.recorder()->store()->ToVector().Clone(); | 4833 Vector<unsigned> store = parser.recorder()->store()->ToVector().Clone(); |
4835 return new ScriptDataImpl(store); | 4834 return new ScriptDataImpl(store); |
4836 } | 4835 } |
4837 | 4836 |
4838 | 4837 |
4839 bool ParseRegExp(FlatStringReader* input, | 4838 bool ParseRegExp(FlatStringReader* input, |
4840 bool multiline, | 4839 bool multiline, |
4841 RegExpCompileData* result) { | 4840 RegExpCompileData* result) { |
4842 ASSERT(result != NULL); | 4841 ASSERT(result != NULL); |
4843 // Make sure we have a stack guard. | |
4844 StackGuard guard; | |
4845 RegExpParser parser(input, &result->error, multiline); | 4842 RegExpParser parser(input, &result->error, multiline); |
4846 RegExpTree* tree = parser.ParsePattern(); | 4843 RegExpTree* tree = parser.ParsePattern(); |
4847 if (parser.failed()) { | 4844 if (parser.failed()) { |
4848 ASSERT(tree == NULL); | 4845 ASSERT(tree == NULL); |
4849 ASSERT(!result->error.is_null()); | 4846 ASSERT(!result->error.is_null()); |
4850 } else { | 4847 } else { |
4851 ASSERT(tree != NULL); | 4848 ASSERT(tree != NULL); |
4852 ASSERT(result->error.is_null()); | 4849 ASSERT(result->error.is_null()); |
4853 result->tree = tree; | 4850 result->tree = tree; |
4854 int capture_count = parser.captures_started(); | 4851 int capture_count = parser.captures_started(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4905 start_position, | 4902 start_position, |
4906 is_expression); | 4903 is_expression); |
4907 return result; | 4904 return result; |
4908 } | 4905 } |
4909 | 4906 |
4910 | 4907 |
4911 #undef NEW | 4908 #undef NEW |
4912 | 4909 |
4913 | 4910 |
4914 } } // namespace v8::internal | 4911 } } // namespace v8::internal |
OLD | NEW |