| 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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 } | 1140 } |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 | 1143 |
| 1144 i::Handle<i::String> FormatMessage(i::ScriptData* data) { | 1144 i::Handle<i::String> FormatMessage(i::ScriptData* data) { |
| 1145 i::Isolate* isolate = CcTest::i_isolate(); | 1145 i::Isolate* isolate = CcTest::i_isolate(); |
| 1146 i::Factory* factory = isolate->factory(); | 1146 i::Factory* factory = isolate->factory(); |
| 1147 const char* message = data->BuildMessage(); | 1147 const char* message = data->BuildMessage(); |
| 1148 i::Handle<i::String> format = v8::Utils::OpenHandle( | 1148 i::Handle<i::String> format = v8::Utils::OpenHandle( |
| 1149 *v8::String::NewFromUtf8(CcTest::isolate(), message)); | 1149 *v8::String::NewFromUtf8(CcTest::isolate(), message)); |
| 1150 i::Vector<const char*> args = data->BuildArgs(); | 1150 const char* arg = data->BuildArg(); |
| 1151 i::Handle<i::JSArray> args_array = factory->NewJSArray(args.length()); | 1151 i::Handle<i::JSArray> args_array = factory->NewJSArray(arg == NULL ? 0 : 1); |
| 1152 for (int i = 0; i < args.length(); i++) { | 1152 if (arg != NULL) { |
| 1153 i::JSArray::SetElement( | 1153 i::JSArray::SetElement( |
| 1154 args_array, i, v8::Utils::OpenHandle(*v8::String::NewFromUtf8( | 1154 args_array, 0, v8::Utils::OpenHandle(*v8::String::NewFromUtf8( |
| 1155 CcTest::isolate(), args[i])), | 1155 CcTest::isolate(), arg)), |
| 1156 NONE, i::SLOPPY).Check(); | 1156 NONE, i::SLOPPY).Check(); |
| 1157 } | 1157 } |
| 1158 i::Handle<i::JSObject> builtins(isolate->js_builtins_object()); | 1158 i::Handle<i::JSObject> builtins(isolate->js_builtins_object()); |
| 1159 i::Handle<i::Object> format_fun = i::Object::GetProperty( | 1159 i::Handle<i::Object> format_fun = i::Object::GetProperty( |
| 1160 isolate, builtins, "FormatMessage").ToHandleChecked(); | 1160 isolate, builtins, "FormatMessage").ToHandleChecked(); |
| 1161 i::Handle<i::Object> arg_handles[] = { format, args_array }; | 1161 i::Handle<i::Object> arg_handles[] = { format, args_array }; |
| 1162 i::Handle<i::Object> result = i::Execution::Call( | 1162 i::Handle<i::Object> result = i::Execution::Call( |
| 1163 isolate, format_fun, builtins, 2, arg_handles).ToHandleChecked(); | 1163 isolate, format_fun, builtins, 2, arg_handles).ToHandleChecked(); |
| 1164 CHECK(result->IsString()); | 1164 CHECK(result->IsString()); |
| 1165 for (int i = 0; i < args.length(); i++) { | |
| 1166 i::DeleteArray(args[i]); | |
| 1167 } | |
| 1168 i::DeleteArray(args.start()); | |
| 1169 i::DeleteArray(message); | 1165 i::DeleteArray(message); |
| 1166 i::DeleteArray(arg); |
| 1170 return i::Handle<i::String>::cast(result); | 1167 return i::Handle<i::String>::cast(result); |
| 1171 } | 1168 } |
| 1172 | 1169 |
| 1173 | 1170 |
| 1174 enum ParserFlag { | 1171 enum ParserFlag { |
| 1175 kAllowLazy, | 1172 kAllowLazy, |
| 1176 kAllowNativesSyntax, | 1173 kAllowNativesSyntax, |
| 1177 kAllowHarmonyScoping, | 1174 kAllowHarmonyScoping, |
| 1178 kAllowModules, | 1175 kAllowModules, |
| 1179 kAllowGenerators, | 1176 kAllowGenerators, |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2452 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); | 2449 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); |
| 2453 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, | 2450 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, |
| 2454 kError); | 2451 kError); |
| 2455 | 2452 |
| 2456 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); | 2453 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); |
| 2457 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); | 2454 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); |
| 2458 | 2455 |
| 2459 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); | 2456 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); |
| 2460 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); | 2457 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); |
| 2461 } | 2458 } |
| OLD | NEW |