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

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

Issue 888613002: Initial switch to Chromium-style CHECK_* and DCHECK_* macros. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix slow dchecks. Created 5 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
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 v8::Local<v8::Context> context = v8::Context::New(isolate); 368 v8::Local<v8::Context> context = v8::Context::New(isolate);
369 v8::Context::Scope context_scope(context); 369 v8::Context::Scope context_scope(context);
370 CcTest::i_isolate()->stack_guard()->SetStackLimit( 370 CcTest::i_isolate()->stack_guard()->SetStackLimit(
371 i::GetCurrentStackPosition() - 128 * 1024); 371 i::GetCurrentStackPosition() - 128 * 1024);
372 372
373 { 373 {
374 const char* source = "var myo = {if: \"foo\"}; myo.if;"; 374 const char* source = "var myo = {if: \"foo\"}; myo.if;";
375 v8::Local<v8::Value> result = ParserCacheCompileRun(source); 375 v8::Local<v8::Value> result = ParserCacheCompileRun(source);
376 CHECK(result->IsString()); 376 CHECK(result->IsString());
377 v8::String::Utf8Value utf8(result); 377 v8::String::Utf8Value utf8(result);
378 CHECK_EQ("foo", *utf8); 378 CHECK_EQ(0, strcmp("foo", *utf8));
379 } 379 }
380 380
381 { 381 {
382 const char* source = "var myo = {\"bar\": \"foo\"}; myo[\"bar\"];"; 382 const char* source = "var myo = {\"bar\": \"foo\"}; myo[\"bar\"];";
383 v8::Local<v8::Value> result = ParserCacheCompileRun(source); 383 v8::Local<v8::Value> result = ParserCacheCompileRun(source);
384 CHECK(result->IsString()); 384 CHECK(result->IsString());
385 v8::String::Utf8Value utf8(result); 385 v8::String::Utf8Value utf8(result);
386 CHECK_EQ("foo", *utf8); 386 CHECK_EQ(0, strcmp("foo", *utf8));
387 } 387 }
388 388
389 { 389 {
390 const char* source = "var myo = {1: \"foo\"}; myo[1];"; 390 const char* source = "var myo = {1: \"foo\"}; myo[1];";
391 v8::Local<v8::Value> result = ParserCacheCompileRun(source); 391 v8::Local<v8::Value> result = ParserCacheCompileRun(source);
392 CHECK(result->IsString()); 392 CHECK(result->IsString());
393 v8::String::Utf8Value utf8(result); 393 v8::String::Utf8Value utf8(result);
394 CHECK_EQ("foo", *utf8); 394 CHECK_EQ(0, strcmp("foo", *utf8));
395 } 395 }
396 } 396 }
397 397
398 398
399 TEST(RegressChromium62639) { 399 TEST(RegressChromium62639) {
400 v8::V8::Initialize(); 400 v8::V8::Initialize();
401 i::Isolate* isolate = CcTest::i_isolate(); 401 i::Isolate* isolate = CcTest::i_isolate();
402 402
403 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 403 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
404 128 * 1024); 404 128 * 1024);
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 const char* script = 1663 const char* script =
1664 "\"use strict\"; \n" 1664 "\"use strict\"; \n"
1665 "a = function() { \n" 1665 "a = function() { \n"
1666 " b = function() { \n" 1666 " b = function() { \n"
1667 " 01; \n" 1667 " 01; \n"
1668 " }; \n" 1668 " }; \n"
1669 "}; \n"; 1669 "}; \n";
1670 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); 1670 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script));
1671 CHECK(try_catch.HasCaught()); 1671 CHECK(try_catch.HasCaught());
1672 v8::String::Utf8Value exception(try_catch.Exception()); 1672 v8::String::Utf8Value exception(try_catch.Exception());
1673 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", 1673 CHECK_EQ(0,
1674 *exception); 1674 strcmp("SyntaxError: Octal literals are not allowed in strict mode.",
1675 *exception));
1675 } 1676 }
1676 1677
1677 1678
1678 void RunParserSyncTest(const char* context_data[][2], 1679 void RunParserSyncTest(const char* context_data[][2],
1679 const char* statement_data[], 1680 const char* statement_data[],
1680 ParserSyncTestResult result, 1681 ParserSyncTestResult result,
1681 const ParserFlag* flags = NULL, 1682 const ParserFlag* flags = NULL,
1682 int flags_len = 0, 1683 int flags_len = 0,
1683 const ParserFlag* always_true_flags = NULL, 1684 const ParserFlag* always_true_flags = NULL,
1684 int always_true_len = 0, 1685 int always_true_len = 0,
(...skipping 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4791 isolate->heap()->HashSeed(), 4792 isolate->heap()->HashSeed(),
4792 isolate->unicode_cache()}; 4793 isolate->unicode_cache()};
4793 i::Parser parser(&info, &parse_info); 4794 i::Parser parser(&info, &parse_info);
4794 parser.set_allow_harmony_classes(true); 4795 parser.set_allow_harmony_classes(true);
4795 parser.set_allow_harmony_modules(true); 4796 parser.set_allow_harmony_modules(true);
4796 parser.set_allow_harmony_scoping(true); 4797 parser.set_allow_harmony_scoping(true);
4797 info.MarkAsModule(); 4798 info.MarkAsModule();
4798 CHECK(!parser.Parse()); 4799 CHECK(!parser.Parse());
4799 } 4800 }
4800 } 4801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698