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

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

Issue 429583002: Revert "Make --always-opt also optimize toplevel code." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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-heap.cc ('k') | test/mjsunit/debug-compile-event-newfunction.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 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2978 CHECK(var->is_used() || !expected); 2978 CHECK(var->is_used() || !expected);
2979 CHECK(var->maybe_assigned() == expected); 2979 CHECK(var->maybe_assigned() == expected);
2980 } 2980 }
2981 } 2981 }
2982 } 2982 }
2983 2983
2984 namespace { 2984 namespace {
2985 2985
2986 int* global_use_counts = NULL; 2986 int* global_use_counts = NULL;
2987 2987
2988 void UseCounterCallback(v8::Isolate* isolate, 2988 void MockUseCounterCallback(v8::Isolate* isolate,
2989 v8::Isolate::UseCounterFeature feature) { 2989 v8::Isolate::UseCounterFeature feature) {
2990 ++global_use_counts[feature]; 2990 ++global_use_counts[feature];
2991 } 2991 }
2992 2992
2993 } 2993 }
2994 2994
2995 2995
2996 TEST(UseAsmUseCount) { 2996 TEST(UseAsmUseCount) {
2997 i::Isolate* isolate = CcTest::i_isolate(); 2997 i::Isolate* isolate = CcTest::i_isolate();
2998 i::HandleScope scope(isolate); 2998 i::HandleScope scope(isolate);
2999 LocalContext env; 2999 LocalContext env;
3000 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; 3000 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {};
3001 global_use_counts = use_counts; 3001 global_use_counts = use_counts;
3002 CcTest::isolate()->SetUseCounterCallback(UseCounterCallback); 3002 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback);
3003 CompileRun("\"use asm\";\n" 3003 CompileRun("\"use asm\";\n"
3004 "var foo = 1;\n" 3004 "var foo = 1;\n"
3005 "\"use asm\";\n" // Only the first one counts. 3005 "\"use asm\";\n" // Only the first one counts.
3006 "function bar() { \"use asm\"; var baz = 1; }"); 3006 "function bar() { \"use asm\"; var baz = 1; }");
3007 // Optimizing will double-count because the source is parsed twice. 3007 CHECK_EQ(2, use_counts[v8::Isolate::kUseAsm]);
3008 CHECK_EQ(i::FLAG_always_opt ? 4 : 2, use_counts[v8::Isolate::kUseAsm]);
3009 } 3008 }
3010 3009
3011 3010
3012 TEST(ErrorsArrowFunctions) { 3011 TEST(ErrorsArrowFunctions) {
3013 // Tests that parser and preparser generate the same kind of errors 3012 // Tests that parser and preparser generate the same kind of errors
3014 // on invalid arrow function syntax. 3013 // on invalid arrow function syntax.
3015 const char* context_data[][2] = { 3014 const char* context_data[][2] = {
3016 {"", ";"}, 3015 {"", ";"},
3017 {"v = ", ";"}, 3016 {"v = ", ";"},
3018 {"bar ? (", ") : baz;"}, 3017 {"bar ? (", ") : baz;"},
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3163 3162
3164 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {}) 3163 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {})
3165 "foo ? bar : baz => {}", 3164 "foo ? bar : baz => {}",
3166 NULL 3165 NULL
3167 }; 3166 };
3168 3167
3169 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 3168 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
3170 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 3169 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
3171 always_flags, ARRAY_SIZE(always_flags)); 3170 always_flags, ARRAY_SIZE(always_flags));
3172 } 3171 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/mjsunit/debug-compile-event-newfunction.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698