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 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 *v8::String::NewFromUtf8(CcTest::isolate(), message)); | 1247 *v8::String::NewFromUtf8(CcTest::isolate(), message)); |
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 = i::Object::GetProperty( |
1258 i::GetProperty(builtins, "FormatMessage").ToHandleChecked(); | 1258 isolate, builtins, "FormatMessage").ToHandleChecked(); |
1259 i::Handle<i::Object> arg_handles[] = { format, args_array }; | 1259 i::Handle<i::Object> arg_handles[] = { format, args_array }; |
1260 i::Handle<i::Object> result = i::Execution::Call( | 1260 i::Handle<i::Object> result = i::Execution::Call( |
1261 isolate, format_fun, builtins, 2, arg_handles).ToHandleChecked(); | 1261 isolate, format_fun, builtins, 2, arg_handles).ToHandleChecked(); |
1262 CHECK(result->IsString()); | 1262 CHECK(result->IsString()); |
1263 for (int i = 0; i < args.length(); i++) { | 1263 for (int i = 0; i < args.length(); i++) { |
1264 i::DeleteArray(args[i]); | 1264 i::DeleteArray(args[i]); |
1265 } | 1265 } |
1266 i::DeleteArray(args.start()); | 1266 i::DeleteArray(args.start()); |
1267 i::DeleteArray(message); | 1267 i::DeleteArray(message); |
1268 return i::Handle<i::String>::cast(result); | 1268 return i::Handle<i::String>::cast(result); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 function = info.function(); | 1333 function = info.function(); |
1334 } | 1334 } |
1335 | 1335 |
1336 // Check that preparsing fails iff parsing fails. | 1336 // Check that preparsing fails iff parsing fails. |
1337 if (function == NULL) { | 1337 if (function == NULL) { |
1338 // Extract exception from the parser. | 1338 // Extract exception from the parser. |
1339 CHECK(isolate->has_pending_exception()); | 1339 CHECK(isolate->has_pending_exception()); |
1340 i::Handle<i::JSObject> exception_handle( | 1340 i::Handle<i::JSObject> exception_handle( |
1341 i::JSObject::cast(isolate->pending_exception())); | 1341 i::JSObject::cast(isolate->pending_exception())); |
1342 i::Handle<i::String> message_string = | 1342 i::Handle<i::String> message_string = |
1343 i::Handle<i::String>::cast( | 1343 i::Handle<i::String>::cast(i::Object::GetProperty( |
1344 i::GetProperty(exception_handle, "message").ToHandleChecked()); | 1344 isolate, exception_handle, "message").ToHandleChecked()); |
1345 | 1345 |
1346 if (result == kSuccess) { | 1346 if (result == kSuccess) { |
1347 i::OS::Print( | 1347 i::OS::Print( |
1348 "Parser failed on:\n" | 1348 "Parser failed on:\n" |
1349 "\t%s\n" | 1349 "\t%s\n" |
1350 "with error:\n" | 1350 "with error:\n" |
1351 "\t%s\n" | 1351 "\t%s\n" |
1352 "However, we expected no error.", | 1352 "However, we expected no error.", |
1353 source->ToCString().get(), message_string->ToCString().get()); | 1353 source->ToCString().get(), message_string->ToCString().get()); |
1354 CHECK(false); | 1354 CHECK(false); |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); | 2567 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); |
2568 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, | 2568 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, |
2569 kError); | 2569 kError); |
2570 | 2570 |
2571 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); | 2571 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); |
2572 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); | 2572 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); |
2573 | 2573 |
2574 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); | 2574 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); |
2575 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); | 2575 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); |
2576 } | 2576 } |
OLD | NEW |