Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: src/parser.cc

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 extension_(extension), 1159 extension_(extension),
1160 factory_(factory), 1160 factory_(factory),
1161 log_(log), 1161 log_(log),
1162 is_pre_parsing_(is_pre_parsing), 1162 is_pre_parsing_(is_pre_parsing),
1163 pre_data_(pre_data) { 1163 pre_data_(pre_data) {
1164 } 1164 }
1165 1165
1166 1166
1167 bool Parser::PreParseProgram(Handle<String> source, 1167 bool Parser::PreParseProgram(Handle<String> source,
1168 unibrow::CharacterStream* stream) { 1168 unibrow::CharacterStream* stream) {
1169 HistogramTimerScope timer(&Counters::pre_parse); 1169 HistogramTimerScope timer(&COUNTER(pre_parse));
1170 AssertNoZoneAllocation assert_no_zone_allocation; 1170 AssertNoZoneAllocation assert_no_zone_allocation;
1171 AssertNoAllocation assert_no_allocation; 1171 AssertNoAllocation assert_no_allocation;
1172 NoHandleAllocation no_handle_allocation; 1172 NoHandleAllocation no_handle_allocation;
1173 scanner_.Init(source, stream, 0); 1173 scanner_.Init(source, stream, 0);
1174 ASSERT(target_stack_ == NULL); 1174 ASSERT(target_stack_ == NULL);
1175 mode_ = PARSE_EAGERLY; 1175 mode_ = PARSE_EAGERLY;
1176 DummyScope top_scope; 1176 DummyScope top_scope;
1177 LexicalScope scope(this, &top_scope); 1177 LexicalScope scope(this, &top_scope);
1178 TemporaryScope temp_scope(this); 1178 TemporaryScope temp_scope(this);
1179 ZoneListWrapper<Statement> processor; 1179 ZoneListWrapper<Statement> processor;
1180 bool ok = true; 1180 bool ok = true;
1181 ParseSourceElements(&processor, Token::EOS, &ok); 1181 ParseSourceElements(&processor, Token::EOS, &ok);
1182 return !scanner().stack_overflow(); 1182 return !scanner().stack_overflow();
1183 } 1183 }
1184 1184
1185 1185
1186 FunctionLiteral* Parser::ParseProgram(Handle<String> source, 1186 FunctionLiteral* Parser::ParseProgram(Handle<String> source,
1187 unibrow::CharacterStream* stream, 1187 unibrow::CharacterStream* stream,
1188 bool in_global_context) { 1188 bool in_global_context) {
1189 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1189 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1190 1190
1191 HistogramTimerScope timer(&Counters::parse); 1191 HistogramTimerScope timer(&COUNTER(parse));
1192 Counters::total_parse_size.Increment(source->length()); 1192 INCREMENT_COUNTER(total_parse_size, source->length());
1193 1193
1194 // Initialize parser state. 1194 // Initialize parser state.
1195 source->TryFlattenIfNotFlat(); 1195 source->TryFlattenIfNotFlat();
1196 scanner_.Init(source, stream, 0); 1196 scanner_.Init(source, stream, 0);
1197 ASSERT(target_stack_ == NULL); 1197 ASSERT(target_stack_ == NULL);
1198 1198
1199 // Compute the parsing mode. 1199 // Compute the parsing mode.
1200 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY; 1200 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY;
1201 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY; 1201 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY;
1202 1202
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 if (result == NULL) zone_scope.DeleteOnExit(); 1239 if (result == NULL) zone_scope.DeleteOnExit();
1240 return result; 1240 return result;
1241 } 1241 }
1242 1242
1243 1243
1244 FunctionLiteral* Parser::ParseLazy(Handle<String> source, 1244 FunctionLiteral* Parser::ParseLazy(Handle<String> source,
1245 Handle<String> name, 1245 Handle<String> name,
1246 int start_position, 1246 int start_position,
1247 bool is_expression) { 1247 bool is_expression) {
1248 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1248 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1249 HistogramTimerScope timer(&Counters::parse_lazy); 1249 HistogramTimerScope timer(&COUNTER(parse_lazy));
1250 source->TryFlattenIfNotFlat(); 1250 source->TryFlattenIfNotFlat();
1251 Counters::total_parse_size.Increment(source->length()); 1251 INCREMENT_COUNTER(total_parse_size, source->length());
1252 SafeStringInputBuffer buffer(source.location()); 1252 SafeStringInputBuffer buffer(source.location());
1253 1253
1254 // Initialize parser state. 1254 // Initialize parser state.
1255 scanner_.Init(source, &buffer, start_position); 1255 scanner_.Init(source, &buffer, start_position);
1256 ASSERT(target_stack_ == NULL); 1256 ASSERT(target_stack_ == NULL);
1257 mode_ = PARSE_EAGERLY; 1257 mode_ = PARSE_EAGERLY;
1258 1258
1259 // Place holder for the result. 1259 // Place holder for the result.
1260 FunctionLiteral* result = NULL; 1260 FunctionLiteral* result = NULL;
1261 1261
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3603 bool is_lazily_compiled = 3603 bool is_lazily_compiled =
3604 mode() == PARSE_LAZILY && top_scope_->HasTrivialOuterContext(); 3604 mode() == PARSE_LAZILY && top_scope_->HasTrivialOuterContext();
3605 3605
3606 int materialized_literal_count; 3606 int materialized_literal_count;
3607 int expected_property_count; 3607 int expected_property_count;
3608 bool only_simple_this_property_assignments; 3608 bool only_simple_this_property_assignments;
3609 Handle<FixedArray> this_property_assignments; 3609 Handle<FixedArray> this_property_assignments;
3610 if (is_lazily_compiled && pre_data() != NULL) { 3610 if (is_lazily_compiled && pre_data() != NULL) {
3611 FunctionEntry entry = pre_data()->GetFunctionEnd(start_pos); 3611 FunctionEntry entry = pre_data()->GetFunctionEnd(start_pos);
3612 int end_pos = entry.end_pos(); 3612 int end_pos = entry.end_pos();
3613 Counters::total_preparse_skipped.Increment(end_pos - start_pos); 3613 INCREMENT_COUNTER(total_preparse_skipped, end_pos - start_pos);
3614 scanner_.SeekForward(end_pos); 3614 scanner_.SeekForward(end_pos);
3615 materialized_literal_count = entry.literal_count(); 3615 materialized_literal_count = entry.literal_count();
3616 expected_property_count = entry.property_count(); 3616 expected_property_count = entry.property_count();
3617 only_simple_this_property_assignments = false; 3617 only_simple_this_property_assignments = false;
3618 this_property_assignments = Factory::empty_fixed_array(); 3618 this_property_assignments = Factory::empty_fixed_array();
3619 } else { 3619 } else {
3620 ParseSourceElements(&body, Token::RBRACE, CHECK_OK); 3620 ParseSourceElements(&body, Token::RBRACE, CHECK_OK);
3621 materialized_literal_count = temp_scope.materialized_literal_count(); 3621 materialized_literal_count = temp_scope.materialized_literal_count();
3622 expected_property_count = temp_scope.expected_property_count(); 3622 expected_property_count = temp_scope.expected_property_count();
3623 only_simple_this_property_assignments = 3623 only_simple_this_property_assignments =
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
4787 start_position, 4787 start_position,
4788 is_expression); 4788 is_expression);
4789 return result; 4789 return result;
4790 } 4790 }
4791 4791
4792 4792
4793 #undef NEW 4793 #undef NEW
4794 4794
4795 4795
4796 } } // namespace v8::internal 4796 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698