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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 151603004: A64: Synchronize with r16587. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | « test/cctest/test-mark-compact.cc ('k') | test/cctest/test-platform-linux.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 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result); 306 CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result);
307 i::ScriptDataImpl data(log.ExtractData()); 307 i::ScriptDataImpl data(log.ExtractData());
308 // Data contains syntax error. 308 // Data contains syntax error.
309 CHECK(data.has_error()); 309 CHECK(data.has_error());
310 } 310 }
311 } 311 }
312 312
313 313
314 TEST(RegressChromium62639) { 314 TEST(RegressChromium62639) {
315 v8::V8::Initialize(); 315 v8::V8::Initialize();
316 i::Isolate* isolate = i::Isolate::Current();
316 317
317 int marker; 318 int marker;
318 i::Isolate::Current()->stack_guard()->SetStackLimit( 319 isolate->stack_guard()->SetStackLimit(
319 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); 320 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
320 321
321 const char* program = "var x = 'something';\n" 322 const char* program = "var x = 'something';\n"
322 "escape: function() {}"; 323 "escape: function() {}";
323 // Fails parsing expecting an identifier after "function". 324 // Fails parsing expecting an identifier after "function".
324 // Before fix, didn't check *ok after Expect(Token::Identifier, ok), 325 // Before fix, didn't check *ok after Expect(Token::Identifier, ok),
325 // and then used the invalid currently scanned literal. This always 326 // and then used the invalid currently scanned literal. This always
326 // failed in debug mode, and sometimes crashed in release mode. 327 // failed in debug mode, and sometimes crashed in release mode.
327 328
328 i::Utf8ToUtf16CharacterStream stream( 329 i::Utf8ToUtf16CharacterStream stream(
329 reinterpret_cast<const i::byte*>(program), 330 reinterpret_cast<const i::byte*>(program),
330 static_cast<unsigned>(strlen(program))); 331 static_cast<unsigned>(strlen(program)));
331 i::ScriptDataImpl* data = i::PreParserApi::PreParse(&stream); 332 i::ScriptDataImpl* data = i::PreParserApi::PreParse(isolate, &stream);
332 CHECK(data->HasError()); 333 CHECK(data->HasError());
333 delete data; 334 delete data;
334 } 335 }
335 336
336 337
337 TEST(Regress928) { 338 TEST(Regress928) {
338 v8::V8::Initialize(); 339 v8::V8::Initialize();
339 i::Isolate* isolate = i::Isolate::Current(); 340 i::Isolate* isolate = i::Isolate::Current();
340 i::Factory* factory = isolate->factory(); 341 i::Factory* factory = isolate->factory();
341 342
342 // Preparsing didn't consider the catch clause of a try statement 343 // Preparsing didn't consider the catch clause of a try statement
343 // as with-content, which made it assume that a function inside 344 // as with-content, which made it assume that a function inside
344 // the block could be lazily compiled, and an extra, unexpected, 345 // the block could be lazily compiled, and an extra, unexpected,
345 // entry was added to the data. 346 // entry was added to the data.
346 int marker; 347 int marker;
347 isolate->stack_guard()->SetStackLimit( 348 isolate->stack_guard()->SetStackLimit(
348 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); 349 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
349 350
350 const char* program = 351 const char* program =
351 "try { } catch (e) { var foo = function () { /* first */ } }" 352 "try { } catch (e) { var foo = function () { /* first */ } }"
352 "var bar = function () { /* second */ }"; 353 "var bar = function () { /* second */ }";
353 354
354 v8::HandleScope handles(v8::Isolate::GetCurrent()); 355 v8::HandleScope handles(v8::Isolate::GetCurrent());
355 i::Handle<i::String> source( 356 i::Handle<i::String> source(
356 factory->NewStringFromAscii(i::CStrVector(program))); 357 factory->NewStringFromAscii(i::CStrVector(program)));
357 i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); 358 i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
358 i::ScriptDataImpl* data = i::PreParserApi::PreParse(&stream); 359 i::ScriptDataImpl* data = i::PreParserApi::PreParse(isolate, &stream);
359 CHECK(!data->HasError()); 360 CHECK(!data->HasError());
360 361
361 data->Initialize(); 362 data->Initialize();
362 363
363 int first_function = 364 int first_function =
364 static_cast<int>(strstr(program, "function") - program); 365 static_cast<int>(strstr(program, "function") - program);
365 int first_lbrace = first_function + i::StrLength("function () "); 366 int first_lbrace = first_function + i::StrLength("function () ");
366 CHECK_EQ('{', program[first_lbrace]); 367 CHECK_EQ('{', program[first_lbrace]);
367 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace); 368 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace);
368 CHECK(!entry1.is_valid()); 369 CHECK(!entry1.is_valid());
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 i, 1060 i,
1060 v8::Utils::OpenHandle(*v8::String::New(args[i])), 1061 v8::Utils::OpenHandle(*v8::String::New(args[i])),
1061 NONE, 1062 NONE,
1062 i::kNonStrictMode); 1063 i::kNonStrictMode);
1063 } 1064 }
1064 i::Handle<i::JSObject> builtins(isolate->js_builtins_object()); 1065 i::Handle<i::JSObject> builtins(isolate->js_builtins_object());
1065 i::Handle<i::Object> format_fun = 1066 i::Handle<i::Object> format_fun =
1066 i::GetProperty(builtins, "FormatMessage"); 1067 i::GetProperty(builtins, "FormatMessage");
1067 i::Handle<i::Object> arg_handles[] = { format, args_array }; 1068 i::Handle<i::Object> arg_handles[] = { format, args_array };
1068 bool has_exception = false; 1069 bool has_exception = false;
1069 i::Handle<i::Object> result = 1070 i::Handle<i::Object> result = i::Execution::Call(
1070 i::Execution::Call(format_fun, builtins, 2, arg_handles, &has_exception); 1071 isolate, format_fun, builtins, 2, arg_handles, &has_exception);
1071 CHECK(!has_exception); 1072 CHECK(!has_exception);
1072 CHECK(result->IsString()); 1073 CHECK(result->IsString());
1073 for (int i = 0; i < args.length(); i++) { 1074 for (int i = 0; i < args.length(); i++) {
1074 i::DeleteArray(args[i]); 1075 i::DeleteArray(args[i]);
1075 } 1076 }
1076 i::DeleteArray(args.start()); 1077 i::DeleteArray(args.start());
1077 i::DeleteArray(message); 1078 i::DeleteArray(message);
1078 return i::Handle<i::String>::cast(result); 1079 return i::Handle<i::String>::cast(result);
1079 } 1080 }
1080 1081
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 " b = function() { \n" 1318 " b = function() { \n"
1318 " 01; \n" 1319 " 01; \n"
1319 " }; \n" 1320 " }; \n"
1320 "}; \n"; 1321 "}; \n";
1321 v8::Script::Compile(v8::String::New(script)); 1322 v8::Script::Compile(v8::String::New(script));
1322 CHECK(try_catch.HasCaught()); 1323 CHECK(try_catch.HasCaught());
1323 v8::String::Utf8Value exception(try_catch.Exception()); 1324 v8::String::Utf8Value exception(try_catch.Exception());
1324 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", 1325 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.",
1325 *exception); 1326 *exception);
1326 } 1327 }
OLDNEW
« no previous file with comments | « test/cctest/test-mark-compact.cc ('k') | test/cctest/test-platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698