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

Side by Side Diff: src/parser.cc

Issue 45010: Remove all uses of StringShape variables, since that has proven... (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/objects-inl.h ('k') | src/prettyprinter.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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 return !scanner().stack_overflow(); 1090 return !scanner().stack_overflow();
1091 } 1091 }
1092 1092
1093 1093
1094 FunctionLiteral* Parser::ParseProgram(Handle<String> source, 1094 FunctionLiteral* Parser::ParseProgram(Handle<String> source,
1095 unibrow::CharacterStream* stream, 1095 unibrow::CharacterStream* stream,
1096 bool in_global_context) { 1096 bool in_global_context) {
1097 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1097 ZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1098 1098
1099 HistogramTimerScope timer(&Counters::parse); 1099 HistogramTimerScope timer(&Counters::parse);
1100 StringShape shape(*source); 1100 Counters::total_parse_size.Increment(source->length());
1101 Counters::total_parse_size.Increment(source->length(shape));
1102 1101
1103 // Initialize parser state. 1102 // Initialize parser state.
1104 source->TryFlattenIfNotFlat(shape); 1103 source->TryFlattenIfNotFlat();
1105 scanner_.Init(source, stream, 0); 1104 scanner_.Init(source, stream, 0);
1106 ASSERT(target_stack_ == NULL); 1105 ASSERT(target_stack_ == NULL);
1107 1106
1108 // Compute the parsing mode. 1107 // Compute the parsing mode.
1109 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY; 1108 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY;
1110 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY; 1109 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY;
1111 1110
1112 Scope::Type type = 1111 Scope::Type type =
1113 in_global_context 1112 in_global_context
1114 ? Scope::GLOBAL_SCOPE 1113 ? Scope::GLOBAL_SCOPE
(...skipping 28 matching lines...) Expand all
1143 return result; 1142 return result;
1144 } 1143 }
1145 1144
1146 1145
1147 FunctionLiteral* Parser::ParseLazy(Handle<String> source, 1146 FunctionLiteral* Parser::ParseLazy(Handle<String> source,
1148 Handle<String> name, 1147 Handle<String> name,
1149 int start_position, 1148 int start_position,
1150 bool is_expression) { 1149 bool is_expression) {
1151 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1150 ZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1152 HistogramTimerScope timer(&Counters::parse_lazy); 1151 HistogramTimerScope timer(&Counters::parse_lazy);
1153 source->TryFlattenIfNotFlat(StringShape(*source)); 1152 source->TryFlattenIfNotFlat();
1154 StringShape shape(*source); 1153 Counters::total_parse_size.Increment(source->length());
1155 Counters::total_parse_size.Increment(source->length(shape));
1156 SafeStringInputBuffer buffer(source.location()); 1154 SafeStringInputBuffer buffer(source.location());
1157 1155
1158 // Initialize parser state. 1156 // Initialize parser state.
1159 scanner_.Init(source, &buffer, start_position); 1157 scanner_.Init(source, &buffer, start_position);
1160 ASSERT(target_stack_ == NULL); 1158 ASSERT(target_stack_ == NULL);
1161 mode_ = PARSE_EAGERLY; 1159 mode_ = PARSE_EAGERLY;
1162 1160
1163 // Place holder for the result. 1161 // Place holder for the result.
1164 FunctionLiteral* result = NULL; 1162 FunctionLiteral* result = NULL;
1165 1163
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after
4511 start_position, 4509 start_position,
4512 is_expression); 4510 is_expression);
4513 return result; 4511 return result;
4514 } 4512 }
4515 4513
4516 4514
4517 #undef NEW 4515 #undef NEW
4518 4516
4519 4517
4520 } } // namespace v8::internal 4518 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698