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

Side by Side Diff: src/parser.cc

Issue 661181: - Pushed source code for functions into old space.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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/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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 1227
1228 FunctionLiteral* Parser::ParseProgram(Handle<String> source, 1228 FunctionLiteral* Parser::ParseProgram(Handle<String> source,
1229 unibrow::CharacterStream* stream, 1229 unibrow::CharacterStream* stream,
1230 bool in_global_context) { 1230 bool in_global_context) {
1231 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1231 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1232 1232
1233 HistogramTimerScope timer(&Counters::parse); 1233 HistogramTimerScope timer(&Counters::parse);
1234 Counters::total_parse_size.Increment(source->length()); 1234 Counters::total_parse_size.Increment(source->length());
1235 1235
1236 // Initialize parser state. 1236 // Initialize parser state.
1237 source->TryFlattenIfNotFlat(); 1237 source->TryFlatten();
1238 scanner_.Init(source, stream, 0, JAVASCRIPT); 1238 scanner_.Init(source, stream, 0, JAVASCRIPT);
1239 ASSERT(target_stack_ == NULL); 1239 ASSERT(target_stack_ == NULL);
1240 1240
1241 // Compute the parsing mode. 1241 // Compute the parsing mode.
1242 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY; 1242 mode_ = FLAG_lazy ? PARSE_LAZILY : PARSE_EAGERLY;
1243 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY; 1243 if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY;
1244 1244
1245 Scope::Type type = 1245 Scope::Type type =
1246 in_global_context 1246 in_global_context
1247 ? Scope::GLOBAL_SCOPE 1247 ? Scope::GLOBAL_SCOPE
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 return result; 1282 return result;
1283 } 1283 }
1284 1284
1285 1285
1286 FunctionLiteral* Parser::ParseLazy(Handle<String> source, 1286 FunctionLiteral* Parser::ParseLazy(Handle<String> source,
1287 Handle<String> name, 1287 Handle<String> name,
1288 int start_position, 1288 int start_position,
1289 bool is_expression) { 1289 bool is_expression) {
1290 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1290 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1291 HistogramTimerScope timer(&Counters::parse_lazy); 1291 HistogramTimerScope timer(&Counters::parse_lazy);
1292 source->TryFlattenIfNotFlat(); 1292 source->TryFlatten();
1293 Counters::total_parse_size.Increment(source->length()); 1293 Counters::total_parse_size.Increment(source->length());
1294 SafeStringInputBuffer buffer(source.location()); 1294 SafeStringInputBuffer buffer(source.location());
1295 1295
1296 // Initialize parser state. 1296 // Initialize parser state.
1297 scanner_.Init(source, &buffer, start_position, JAVASCRIPT); 1297 scanner_.Init(source, &buffer, start_position, JAVASCRIPT);
1298 ASSERT(target_stack_ == NULL); 1298 ASSERT(target_stack_ == NULL);
1299 mode_ = PARSE_EAGERLY; 1299 mode_ = PARSE_EAGERLY;
1300 1300
1301 // Place holder for the result. 1301 // Place holder for the result.
1302 FunctionLiteral* result = NULL; 1302 FunctionLiteral* result = NULL;
(...skipping 28 matching lines...) Expand all
1331 } 1331 }
1332 1332
1333 FunctionLiteral* Parser::ParseJson(Handle<String> source, 1333 FunctionLiteral* Parser::ParseJson(Handle<String> source,
1334 unibrow::CharacterStream* stream) { 1334 unibrow::CharacterStream* stream) {
1335 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); 1335 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
1336 1336
1337 HistogramTimerScope timer(&Counters::parse); 1337 HistogramTimerScope timer(&Counters::parse);
1338 Counters::total_parse_size.Increment(source->length()); 1338 Counters::total_parse_size.Increment(source->length());
1339 1339
1340 // Initialize parser state. 1340 // Initialize parser state.
1341 source->TryFlattenIfNotFlat(); 1341 source->TryFlatten(TENURED);
1342 scanner_.Init(source, stream, 0, JSON); 1342 scanner_.Init(source, stream, 0, JSON);
1343 ASSERT(target_stack_ == NULL); 1343 ASSERT(target_stack_ == NULL);
1344 1344
1345 FunctionLiteral* result = NULL; 1345 FunctionLiteral* result = NULL;
1346 Handle<String> no_name = factory()->EmptySymbol(); 1346 Handle<String> no_name = factory()->EmptySymbol();
1347 1347
1348 { 1348 {
1349 Scope* scope = factory()->NewScope(top_scope_, Scope::GLOBAL_SCOPE, false); 1349 Scope* scope = factory()->NewScope(top_scope_, Scope::GLOBAL_SCOPE, false);
1350 LexicalScope lexical_scope(this, scope); 1350 LexicalScope lexical_scope(this, scope);
1351 TemporaryScope temp_scope(this); 1351 TemporaryScope temp_scope(this);
(...skipping 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after
5081 Handle<String> name, 5081 Handle<String> name,
5082 int start_position, 5082 int start_position,
5083 int end_position, 5083 int end_position,
5084 bool is_expression) { 5084 bool is_expression) {
5085 bool allow_natives_syntax_before = always_allow_natives_syntax; 5085 bool allow_natives_syntax_before = always_allow_natives_syntax;
5086 always_allow_natives_syntax = true; 5086 always_allow_natives_syntax = true;
5087 AstBuildingParser parser(script, true, NULL, NULL); // always allow 5087 AstBuildingParser parser(script, true, NULL, NULL); // always allow
5088 always_allow_natives_syntax = allow_natives_syntax_before; 5088 always_allow_natives_syntax = allow_natives_syntax_before;
5089 // Parse the function by pulling the function source from the script source. 5089 // Parse the function by pulling the function source from the script source.
5090 Handle<String> script_source(String::cast(script->source())); 5090 Handle<String> script_source(String::cast(script->source()));
5091 Handle<String> function_source =
5092 SubString(script_source, start_position, end_position, TENURED);
5091 FunctionLiteral* result = 5093 FunctionLiteral* result =
5092 parser.ParseLazy(SubString(script_source, start_position, end_position), 5094 parser.ParseLazy(function_source, name, start_position, is_expression);
5093 name,
5094 start_position,
5095 is_expression);
5096 return result; 5095 return result;
5097 } 5096 }
5098 5097
5099 5098
5100 #undef NEW 5099 #undef NEW
5101 5100
5102 5101
5103 } } // namespace v8::internal 5102 } } // 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