| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 i::Vector<const char*> args = data->BuildArgs(); | 1248 i::Vector<const char*> args = data->BuildArgs(); |
| 1249 i::Handle<i::JSArray> args_array = factory->NewJSArray(args.length()); | 1249 i::Handle<i::JSArray> args_array = factory->NewJSArray(args.length()); |
| 1250 for (int i = 0; i < args.length(); i++) { | 1250 for (int i = 0; i < args.length(); i++) { |
| 1251 i::JSArray::SetElement( | 1251 i::JSArray::SetElement( |
| 1252 args_array, i, v8::Utils::OpenHandle(*v8::String::NewFromUtf8( | 1252 args_array, i, v8::Utils::OpenHandle(*v8::String::NewFromUtf8( |
| 1253 CcTest::isolate(), args[i])), | 1253 CcTest::isolate(), args[i])), |
| 1254 NONE, i::SLOPPY).Check(); | 1254 NONE, i::SLOPPY).Check(); |
| 1255 } | 1255 } |
| 1256 i::Handle<i::JSObject> builtins(isolate->js_builtins_object()); | 1256 i::Handle<i::JSObject> builtins(isolate->js_builtins_object()); |
| 1257 i::Handle<i::Object> format_fun = | 1257 i::Handle<i::Object> format_fun = |
| 1258 i::GetProperty(builtins, "FormatMessage"); | 1258 i::GetProperty(builtins, "FormatMessage").ToHandleChecked(); |
| 1259 i::Handle<i::Object> arg_handles[] = { format, args_array }; | 1259 i::Handle<i::Object> arg_handles[] = { format, args_array }; |
| 1260 bool has_exception = false; | 1260 bool has_exception = false; |
| 1261 i::Handle<i::Object> result = i::Execution::Call( | 1261 i::Handle<i::Object> result = i::Execution::Call( |
| 1262 isolate, format_fun, builtins, 2, arg_handles, &has_exception); | 1262 isolate, format_fun, builtins, 2, arg_handles, &has_exception); |
| 1263 CHECK(!has_exception); | 1263 CHECK(!has_exception); |
| 1264 CHECK(result->IsString()); | 1264 CHECK(result->IsString()); |
| 1265 for (int i = 0; i < args.length(); i++) { | 1265 for (int i = 0; i < args.length(); i++) { |
| 1266 i::DeleteArray(args[i]); | 1266 i::DeleteArray(args[i]); |
| 1267 } | 1267 } |
| 1268 i::DeleteArray(args.start()); | 1268 i::DeleteArray(args.start()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 function = info.function(); | 1335 function = info.function(); |
| 1336 } | 1336 } |
| 1337 | 1337 |
| 1338 // Check that preparsing fails iff parsing fails. | 1338 // Check that preparsing fails iff parsing fails. |
| 1339 if (function == NULL) { | 1339 if (function == NULL) { |
| 1340 // Extract exception from the parser. | 1340 // Extract exception from the parser. |
| 1341 CHECK(isolate->has_pending_exception()); | 1341 CHECK(isolate->has_pending_exception()); |
| 1342 i::Handle<i::JSObject> exception_handle( | 1342 i::Handle<i::JSObject> exception_handle( |
| 1343 i::JSObject::cast(isolate->pending_exception())); | 1343 i::JSObject::cast(isolate->pending_exception())); |
| 1344 i::Handle<i::String> message_string = | 1344 i::Handle<i::String> message_string = |
| 1345 i::Handle<i::String>::cast(i::GetProperty(exception_handle, "message")); | 1345 i::Handle<i::String>::cast( |
| 1346 i::GetProperty(exception_handle, "message").ToHandleChecked()); |
| 1346 | 1347 |
| 1347 if (result == kSuccess) { | 1348 if (result == kSuccess) { |
| 1348 i::OS::Print( | 1349 i::OS::Print( |
| 1349 "Parser failed on:\n" | 1350 "Parser failed on:\n" |
| 1350 "\t%s\n" | 1351 "\t%s\n" |
| 1351 "with error:\n" | 1352 "with error:\n" |
| 1352 "\t%s\n" | 1353 "\t%s\n" |
| 1353 "However, we expected no error.", | 1354 "However, we expected no error.", |
| 1354 source->ToCString().get(), message_string->ToCString().get()); | 1355 source->ToCString().get(), message_string->ToCString().get()); |
| 1355 CHECK(false); | 1356 CHECK(false); |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); | 2569 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); |
| 2569 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, | 2570 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, |
| 2570 kError); | 2571 kError); |
| 2571 | 2572 |
| 2572 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); | 2573 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); |
| 2573 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); | 2574 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); |
| 2574 | 2575 |
| 2575 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); | 2576 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); |
| 2576 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); | 2577 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); |
| 2577 } | 2578 } |
| OLD | NEW |