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

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

Issue 1571873004: Ship ES2015 sloppy-mode const semantics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Associate with --harmony-shipping Created 4 years, 11 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
« no previous file with comments | « test/cctest/test-decls.cc ('k') | test/mjsunit/compiler/regress-96989.js » ('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 3553 matching lines...) Expand 10 before | Expand all | Expand 10 after
3564 CompileRun("\"use asm\";\n" 3564 CompileRun("\"use asm\";\n"
3565 "var foo = 1;\n" 3565 "var foo = 1;\n"
3566 "\"use asm\";\n" // Only the first one counts. 3566 "\"use asm\";\n" // Only the first one counts.
3567 "function bar() { \"use asm\"; var baz = 1; }"); 3567 "function bar() { \"use asm\"; var baz = 1; }");
3568 // Optimizing will double-count because the source is parsed twice. 3568 // Optimizing will double-count because the source is parsed twice.
3569 CHECK_EQ(i::FLAG_always_opt ? 4 : 2, use_counts[v8::Isolate::kUseAsm]); 3569 CHECK_EQ(i::FLAG_always_opt ? 4 : 2, use_counts[v8::Isolate::kUseAsm]);
3570 } 3570 }
3571 3571
3572 3572
3573 TEST(UseConstLegacyCount) { 3573 TEST(UseConstLegacyCount) {
3574 i::FLAG_legacy_const = true;
3574 i::Isolate* isolate = CcTest::i_isolate(); 3575 i::Isolate* isolate = CcTest::i_isolate();
3575 i::HandleScope scope(isolate); 3576 i::HandleScope scope(isolate);
3576 LocalContext env; 3577 LocalContext env;
3577 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; 3578 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {};
3578 global_use_counts = use_counts; 3579 global_use_counts = use_counts;
3579 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); 3580 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback);
3580 CompileRun( 3581 CompileRun(
3581 "const x = 1;\n" 3582 "const x = 1;\n"
3582 "var foo = 1;\n" 3583 "var foo = 1;\n"
3583 "const y = 1;\n" 3584 "const y = 1;\n"
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after
6418 "((a)/*\n*/=> a)(1)", 6419 "((a)/*\n*/=> a)(1)",
6419 "((a, b)\n=> a + b)(1, 2)", 6420 "((a, b)\n=> a + b)(1, 2)",
6420 "((a, b)/*\n*/=> a + b)(1, 2)", 6421 "((a, b)/*\n*/=> a + b)(1, 2)",
6421 NULL}; 6422 NULL};
6422 RunParserSyncTest(context_data, data, kError); 6423 RunParserSyncTest(context_data, data, kError);
6423 } 6424 }
6424 6425
6425 6426
6426 TEST(StrongModeFreeVariablesDeclaredByPreviousScript) { 6427 TEST(StrongModeFreeVariablesDeclaredByPreviousScript) {
6427 i::FLAG_strong_mode = true; 6428 i::FLAG_strong_mode = true;
6429 i::FLAG_legacy_const = true;
6428 v8::V8::Initialize(); 6430 v8::V8::Initialize();
6429 v8::HandleScope scope(CcTest::isolate()); 6431 v8::HandleScope scope(CcTest::isolate());
6430 v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate())); 6432 v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate()));
6431 v8::TryCatch try_catch(CcTest::isolate()); 6433 v8::TryCatch try_catch(CcTest::isolate());
6432 6434
6433 // Introduce a bunch of variables, in all language modes. 6435 // Introduce a bunch of variables, in all language modes.
6434 const char* script1 = 6436 const char* script1 =
6435 "var my_var1 = 0; \n" 6437 "var my_var1 = 0; \n"
6436 "function my_func1() { } \n" 6438 "function my_func1() { } \n"
6437 "const my_const1 = 0; \n"; 6439 "const my_const1 = 0; \n";
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
7770 } 7772 }
7771 7773
7772 7774
7773 TEST(MiscSyntaxErrors) { 7775 TEST(MiscSyntaxErrors) {
7774 const char* context_data[][2] = { 7776 const char* context_data[][2] = {
7775 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; 7777 {"'use strict'", ""}, {"", ""}, {NULL, NULL}};
7776 const char* error_data[] = {"for (();;) {}", NULL}; 7778 const char* error_data[] = {"for (();;) {}", NULL};
7777 7779
7778 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); 7780 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0);
7779 } 7781 }
OLDNEW
« no previous file with comments | « test/cctest/test-decls.cc ('k') | test/mjsunit/compiler/regress-96989.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698