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

Side by Side Diff: src/parser.cc

Issue 42020: - Added ability to call histograms from within v8... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 months 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/heap.cc ('k') | src/v8-counters.h » ('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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 allow_natives_syntax_(allow_natives_syntax), 1068 allow_natives_syntax_(allow_natives_syntax),
1069 extension_(extension), 1069 extension_(extension),
1070 factory_(factory), 1070 factory_(factory),
1071 log_(log), 1071 log_(log),
1072 is_pre_parsing_(is_pre_parsing), 1072 is_pre_parsing_(is_pre_parsing),
1073 pre_data_(pre_data) { 1073 pre_data_(pre_data) {
1074 } 1074 }
1075 1075
1076 1076
1077 bool Parser::PreParseProgram(unibrow::CharacterStream* stream) { 1077 bool Parser::PreParseProgram(unibrow::CharacterStream* stream) {
1078 StatsRateScope timer(&Counters::pre_parse); 1078 HistogramTimerScope timer(&Counters::pre_parse);
1079 StackGuard guard; 1079 StackGuard guard;
1080 AssertNoZoneAllocation assert_no_zone_allocation; 1080 AssertNoZoneAllocation assert_no_zone_allocation;
1081 AssertNoAllocation assert_no_allocation; 1081 AssertNoAllocation assert_no_allocation;
1082 NoHandleAllocation no_handle_allocation; 1082 NoHandleAllocation no_handle_allocation;
1083 scanner_.Init(Handle<String>(), stream, 0); 1083 scanner_.Init(Handle<String>(), stream, 0);
1084 ASSERT(target_stack_ == NULL); 1084 ASSERT(target_stack_ == NULL);
1085 mode_ = PARSE_EAGERLY; 1085 mode_ = PARSE_EAGERLY;
1086 DummyScope top_scope; 1086 DummyScope top_scope;
1087 LexicalScope scope(this, &top_scope); 1087 LexicalScope scope(this, &top_scope);
1088 TemporaryScope temp_scope(this); 1088 TemporaryScope temp_scope(this);
1089 ZoneListWrapper<Statement> processor; 1089 ZoneListWrapper<Statement> processor;
1090 bool ok = true; 1090 bool ok = true;
1091 ParseSourceElements(&processor, Token::EOS, &ok); 1091 ParseSourceElements(&processor, Token::EOS, &ok);
1092 return !scanner().stack_overflow(); 1092 return !scanner().stack_overflow();
1093 } 1093 }
1094 1094
1095 1095
1096 FunctionLiteral* Parser::ParseProgram(Handle<String> source, 1096 FunctionLiteral* Parser::ParseProgram(Handle<String> source,
1097 unibrow::CharacterStream* stream, 1097 unibrow::CharacterStream* stream,
1098 bool in_global_context) { 1098 bool in_global_context) {
1099 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1099 ZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1100 1100
1101 StatsRateScope timer(&Counters::parse); 1101 HistogramTimerScope timer(&Counters::parse);
1102 StringShape shape(*source); 1102 StringShape shape(*source);
1103 Counters::total_parse_size.Increment(source->length(shape)); 1103 Counters::total_parse_size.Increment(source->length(shape));
1104 1104
1105 // Initialize parser state. 1105 // Initialize parser state.
1106 source->TryFlattenIfNotFlat(shape); 1106 source->TryFlattenIfNotFlat(shape);
1107 scanner_.Init(source, stream, 0); 1107 scanner_.Init(source, stream, 0);
1108 ASSERT(target_stack_ == NULL); 1108 ASSERT(target_stack_ == NULL);
1109 1109
1110 // Compute the parsing mode. 1110 // Compute the parsing mode.
1111 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY; 1111 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 if (result == NULL) zone_scope.DeleteOnExit(); 1144 if (result == NULL) zone_scope.DeleteOnExit();
1145 return result; 1145 return result;
1146 } 1146 }
1147 1147
1148 1148
1149 FunctionLiteral* Parser::ParseLazy(Handle<String> source, 1149 FunctionLiteral* Parser::ParseLazy(Handle<String> source,
1150 Handle<String> name, 1150 Handle<String> name,
1151 int start_position, 1151 int start_position,
1152 bool is_expression) { 1152 bool is_expression) {
1153 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1153 ZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1154 StatsRateScope timer(&Counters::parse_lazy); 1154 HistogramTimerScope timer(&Counters::parse_lazy);
1155 source->TryFlattenIfNotFlat(StringShape(*source)); 1155 source->TryFlattenIfNotFlat(StringShape(*source));
1156 StringShape shape(*source); 1156 StringShape shape(*source);
1157 Counters::total_parse_size.Increment(source->length(shape)); 1157 Counters::total_parse_size.Increment(source->length(shape));
1158 SafeStringInputBuffer buffer(source.location()); 1158 SafeStringInputBuffer buffer(source.location());
1159 1159
1160 // Initialize parser state. 1160 // Initialize parser state.
1161 scanner_.Init(source, &buffer, start_position); 1161 scanner_.Init(source, &buffer, start_position);
1162 ASSERT(target_stack_ == NULL); 1162 ASSERT(target_stack_ == NULL);
1163 mode_ = PARSE_EAGERLY; 1163 mode_ = PARSE_EAGERLY;
1164 1164
(...skipping 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 start_position, 4561 start_position,
4562 is_expression); 4562 is_expression);
4563 return result; 4563 return result;
4564 } 4564 }
4565 4565
4566 4566
4567 #undef NEW 4567 #undef NEW
4568 4568
4569 4569
4570 } } // namespace v8::internal 4570 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698