OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 body.elements(), | 1269 body.elements(), |
1270 temp_scope.materialized_literal_count(), | 1270 temp_scope.materialized_literal_count(), |
1271 temp_scope.expected_property_count(), | 1271 temp_scope.expected_property_count(), |
1272 temp_scope.only_simple_this_property_assignments(), | 1272 temp_scope.only_simple_this_property_assignments(), |
1273 temp_scope.this_property_assignments(), | 1273 temp_scope.this_property_assignments(), |
1274 0, | 1274 0, |
1275 0, | 1275 0, |
1276 source->length(), | 1276 source->length(), |
1277 false)); | 1277 false)); |
1278 } else if (scanner().stack_overflow()) { | 1278 } else if (scanner().stack_overflow()) { |
1279 Top::StackOverflow(); | 1279 Isolate::Current()->StackOverflow(); |
1280 } | 1280 } |
1281 } | 1281 } |
1282 | 1282 |
1283 // Make sure the target stack is empty. | 1283 // Make sure the target stack is empty. |
1284 ASSERT(target_stack_ == NULL); | 1284 ASSERT(target_stack_ == NULL); |
1285 | 1285 |
1286 // If there was a syntax error we have to get rid of the AST | 1286 // If there was a syntax error we have to get rid of the AST |
1287 // and it is not safe to do so before the scope has been deleted. | 1287 // and it is not safe to do so before the scope has been deleted. |
1288 if (result == NULL) zone_scope.DeleteOnExit(); | 1288 if (result == NULL) zone_scope.DeleteOnExit(); |
1289 return result; | 1289 return result; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 // The only errors should be stack overflows. | 1324 // The only errors should be stack overflows. |
1325 ASSERT(ok || scanner_.stack_overflow()); | 1325 ASSERT(ok || scanner_.stack_overflow()); |
1326 } | 1326 } |
1327 | 1327 |
1328 // Make sure the target stack is empty. | 1328 // Make sure the target stack is empty. |
1329 ASSERT(target_stack_ == NULL); | 1329 ASSERT(target_stack_ == NULL); |
1330 | 1330 |
1331 // If there was a stack overflow we have to get rid of AST and it is | 1331 // If there was a stack overflow we have to get rid of AST and it is |
1332 // not safe to do before scope has been deleted. | 1332 // not safe to do before scope has been deleted. |
1333 if (result == NULL) { | 1333 if (result == NULL) { |
1334 Top::StackOverflow(); | 1334 Isolate::Current()->StackOverflow(); |
1335 zone_scope.DeleteOnExit(); | 1335 zone_scope.DeleteOnExit(); |
1336 } | 1336 } |
1337 return result; | 1337 return result; |
1338 } | 1338 } |
1339 | 1339 |
1340 FunctionLiteral* Parser::ParseJson(Handle<String> source) { | 1340 FunctionLiteral* Parser::ParseJson(Handle<String> source) { |
1341 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); | 1341 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); |
1342 | 1342 |
1343 HistogramTimerScope timer(&Counters::parse); | 1343 HistogramTimerScope timer(&Counters::parse); |
1344 Counters::total_parse_size.Increment(source->length()); | 1344 Counters::total_parse_size.Increment(source->length()); |
(...skipping 21 matching lines...) Expand all Loading... |
1366 statement.elements(), | 1366 statement.elements(), |
1367 temp_scope.materialized_literal_count(), | 1367 temp_scope.materialized_literal_count(), |
1368 temp_scope.expected_property_count(), | 1368 temp_scope.expected_property_count(), |
1369 temp_scope.only_simple_this_property_assignments(), | 1369 temp_scope.only_simple_this_property_assignments(), |
1370 temp_scope.this_property_assignments(), | 1370 temp_scope.this_property_assignments(), |
1371 0, | 1371 0, |
1372 0, | 1372 0, |
1373 source->length(), | 1373 source->length(), |
1374 false)); | 1374 false)); |
1375 } else if (scanner().stack_overflow()) { | 1375 } else if (scanner().stack_overflow()) { |
1376 Top::StackOverflow(); | 1376 Isolate::Current()->StackOverflow(); |
1377 } | 1377 } |
1378 } | 1378 } |
1379 | 1379 |
1380 // Make sure the target stack is empty. | 1380 // Make sure the target stack is empty. |
1381 ASSERT(target_stack_ == NULL); | 1381 ASSERT(target_stack_ == NULL); |
1382 | 1382 |
1383 // If there was a syntax error we have to get rid of the AST | 1383 // If there was a syntax error we have to get rid of the AST |
1384 // and it is not safe to do so before the scope has been deleted. | 1384 // and it is not safe to do so before the scope has been deleted. |
1385 if (result == NULL) zone_scope.DeleteOnExit(); | 1385 if (result == NULL) zone_scope.DeleteOnExit(); |
1386 return result; | 1386 return result; |
1387 } | 1387 } |
1388 | 1388 |
1389 void Parser::ReportMessage(const char* type, Vector<const char*> args) { | 1389 void Parser::ReportMessage(const char* type, Vector<const char*> args) { |
1390 Scanner::Location source_location = scanner_.location(); | 1390 Scanner::Location source_location = scanner_.location(); |
1391 ReportMessageAt(source_location, type, args); | 1391 ReportMessageAt(source_location, type, args); |
1392 } | 1392 } |
1393 | 1393 |
1394 | 1394 |
1395 void AstBuildingParser::ReportMessageAt(Scanner::Location source_location, | 1395 void AstBuildingParser::ReportMessageAt(Scanner::Location source_location, |
1396 const char* type, | 1396 const char* type, |
1397 Vector<const char*> args) { | 1397 Vector<const char*> args) { |
1398 MessageLocation location(script_, | 1398 MessageLocation location(script_, |
1399 source_location.beg_pos, source_location.end_pos); | 1399 source_location.beg_pos, source_location.end_pos); |
1400 Handle<JSArray> array = Factory::NewJSArray(args.length()); | 1400 Handle<JSArray> array = Factory::NewJSArray(args.length()); |
1401 for (int i = 0; i < args.length(); i++) { | 1401 for (int i = 0; i < args.length(); i++) { |
1402 SetElement(array, i, Factory::NewStringFromUtf8(CStrVector(args[i]))); | 1402 SetElement(array, i, Factory::NewStringFromUtf8(CStrVector(args[i]))); |
1403 } | 1403 } |
1404 Handle<Object> result = Factory::NewSyntaxError(type, array); | 1404 Handle<Object> result = Factory::NewSyntaxError(type, array); |
1405 Top::Throw(*result, &location); | 1405 Isolate::Current()->Throw(*result, &location); |
1406 } | 1406 } |
1407 | 1407 |
1408 | 1408 |
1409 void PreParser::ReportMessageAt(Scanner::Location source_location, | 1409 void PreParser::ReportMessageAt(Scanner::Location source_location, |
1410 const char* type, | 1410 const char* type, |
1411 Vector<const char*> args) { | 1411 Vector<const char*> args) { |
1412 recorder()->LogMessage(source_location, type, args); | 1412 recorder()->LogMessage(source_location, type, args); |
1413 } | 1413 } |
1414 | 1414 |
1415 | 1415 |
(...skipping 2872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4288 } else { | 4288 } else { |
4289 return kEndMarker; | 4289 return kEndMarker; |
4290 } | 4290 } |
4291 } | 4291 } |
4292 | 4292 |
4293 | 4293 |
4294 void RegExpParser::Advance() { | 4294 void RegExpParser::Advance() { |
4295 if (next_pos_ < in()->length()) { | 4295 if (next_pos_ < in()->length()) { |
4296 StackLimitCheck check; | 4296 StackLimitCheck check; |
4297 if (check.HasOverflowed()) { | 4297 if (check.HasOverflowed()) { |
4298 ReportError(CStrVector(Top::kStackOverflowMessage)); | 4298 ReportError(CStrVector(Isolate::kStackOverflowMessage)); |
4299 } else if (ZONE->excess_allocation()) { | 4299 } else if (ZONE->excess_allocation()) { |
4300 ReportError(CStrVector("Regular expression too large")); | 4300 ReportError(CStrVector("Regular expression too large")); |
4301 } else { | 4301 } else { |
4302 current_ = in()->Get(next_pos_); | 4302 current_ = in()->Get(next_pos_); |
4303 next_pos_++; | 4303 next_pos_++; |
4304 } | 4304 } |
4305 } else { | 4305 } else { |
4306 current_ = kEndMarker; | 4306 current_ = kEndMarker; |
4307 has_more_ = false; | 4307 has_more_ = false; |
4308 } | 4308 } |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5179 parser.ParseLazy(script_source, name, | 5179 parser.ParseLazy(script_source, name, |
5180 start_position, end_position, is_expression); | 5180 start_position, end_position, is_expression); |
5181 return result; | 5181 return result; |
5182 } | 5182 } |
5183 | 5183 |
5184 | 5184 |
5185 #undef NEW | 5185 #undef NEW |
5186 | 5186 |
5187 | 5187 |
5188 } } // namespace v8::internal | 5188 } } // namespace v8::internal |
OLD | NEW |