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

Side by Side Diff: src/parser.cc

Issue 18552: Fix bug where strings were not flattened before regexp. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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/runtime.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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 FunctionLiteral* Parser::ParseProgram(Handle<String> source, 1085 FunctionLiteral* Parser::ParseProgram(Handle<String> source,
1086 unibrow::CharacterStream* stream, 1086 unibrow::CharacterStream* stream,
1087 bool in_global_context) { 1087 bool in_global_context) {
1088 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1088 ZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1089 1089
1090 StatsRateScope timer(&Counters::parse); 1090 StatsRateScope timer(&Counters::parse);
1091 StringShape shape(*source); 1091 StringShape shape(*source);
1092 Counters::total_parse_size.Increment(source->length(shape)); 1092 Counters::total_parse_size.Increment(source->length(shape));
1093 1093
1094 // Initialize parser state. 1094 // Initialize parser state.
1095 source->TryFlatten(shape); 1095 source->TryFlattenIfNotFlat(shape);
1096 scanner_.Init(source, stream, 0); 1096 scanner_.Init(source, stream, 0);
1097 ASSERT(target_stack_ == NULL); 1097 ASSERT(target_stack_ == NULL);
1098 1098
1099 // Compute the parsing mode. 1099 // Compute the parsing mode.
1100 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY; 1100 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY;
1101 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY; 1101 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY;
1102 1102
1103 Scope::Type type = 1103 Scope::Type type =
1104 in_global_context 1104 in_global_context
1105 ? Scope::GLOBAL_SCOPE 1105 ? Scope::GLOBAL_SCOPE
(...skipping 28 matching lines...) Expand all
1134 return result; 1134 return result;
1135 } 1135 }
1136 1136
1137 1137
1138 FunctionLiteral* Parser::ParseLazy(Handle<String> source, 1138 FunctionLiteral* Parser::ParseLazy(Handle<String> source,
1139 Handle<String> name, 1139 Handle<String> name,
1140 int start_position, 1140 int start_position,
1141 bool is_expression) { 1141 bool is_expression) {
1142 ZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1142 ZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1143 StatsRateScope timer(&Counters::parse_lazy); 1143 StatsRateScope timer(&Counters::parse_lazy);
1144 source->TryFlatten(StringShape(*source)); 1144 source->TryFlattenIfNotFlat(StringShape(*source));
1145 StringShape shape(*source); 1145 StringShape shape(*source);
1146 Counters::total_parse_size.Increment(source->length(shape)); 1146 Counters::total_parse_size.Increment(source->length(shape));
1147 SafeStringInputBuffer buffer(source.location()); 1147 SafeStringInputBuffer buffer(source.location());
1148 1148
1149 // Initialize parser state. 1149 // Initialize parser state.
1150 scanner_.Init(source, &buffer, start_position); 1150 scanner_.Init(source, &buffer, start_position);
1151 ASSERT(target_stack_ == NULL); 1151 ASSERT(target_stack_ == NULL);
1152 mode_ = PARSE_EAGERLY; 1152 mode_ = PARSE_EAGERLY;
1153 1153
1154 // Place holder for the result. 1154 // Place holder for the result.
(...skipping 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after
4350 start_position, 4350 start_position,
4351 is_expression); 4351 is_expression);
4352 return result; 4352 return result;
4353 } 4353 }
4354 4354
4355 4355
4356 #undef NEW 4356 #undef NEW
4357 4357
4358 4358
4359 } } // namespace v8::internal 4359 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698