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

Side by Side Diff: test/cctest/test-func-name-inference.cc

Issue 2242463002: [interpreter] VisitForTest for bytecode generator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove unused/refactored code, add comment Created 4 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 CheckFunctionName(script, "return 2", ""); 280 CheckFunctionName(script, "return 2", "");
281 CheckFunctionName(script, "return 3", ""); 281 CheckFunctionName(script, "return 3", "");
282 } 282 }
283 283
284 284
285 TEST(MultipleFuncsConditional) { 285 TEST(MultipleFuncsConditional) {
286 CcTest::InitializeVM(); 286 CcTest::InitializeVM();
287 v8::HandleScope scope(CcTest::isolate()); 287 v8::HandleScope scope(CcTest::isolate());
288 288
289 v8::Local<v8::Script> script = Compile(CcTest::isolate(), 289 v8::Local<v8::Script> script = Compile(CcTest::isolate(),
290 "fun1 = 0 ?\n" 290 "var x = 0;\n"
291 "fun1 = x ?\n"
291 " function() { return 1; } :\n" 292 " function() { return 1; } :\n"
292 " function() { return 2; }"); 293 " function() { return 2; }");
293 CheckFunctionName(script, "return 1", "fun1"); 294 CheckFunctionName(script, "return 1", "fun1");
294 CheckFunctionName(script, "return 2", "fun1"); 295 CheckFunctionName(script, "return 2", "fun1");
295 } 296 }
296 297
297 298
298 TEST(MultipleFuncsInLiteral) { 299 TEST(MultipleFuncsInLiteral) {
299 CcTest::InitializeVM(); 300 CcTest::InitializeVM();
300 v8::HandleScope scope(CcTest::isolate()); 301 v8::HandleScope scope(CcTest::isolate());
301 302
302 v8::Local<v8::Script> script = 303 v8::Local<v8::Script> script =
303 Compile(CcTest::isolate(), 304 Compile(CcTest::isolate(),
305 "var x = 0;\n"
rmcilroy 2016/08/12 11:15:26 Were these changes intended?
klaasb 2016/08/12 16:00:13 I introduced these to keep the intention of these
rmcilroy 2016/08/15 09:37:11 How does the test fail? It seems like the function
klaasb 2016/08/15 11:53:04 If we skip generating bytecode for the branch, we
rmcilroy 2016/08/15 12:37:19 Ahh I see, so it's not actually the function name
304 "function MyClass() {}\n" 306 "function MyClass() {}\n"
305 "MyClass.prototype = {\n" 307 "MyClass.prototype = {\n"
306 " method1: 0 ? function() { return 1; } :\n" 308 " method1: x ? function() { return 1; } :\n"
307 " function() { return 2; } }"); 309 " function() { return 2; } }");
308 CheckFunctionName(script, "return 1", "MyClass.method1"); 310 CheckFunctionName(script, "return 1", "MyClass.method1");
309 CheckFunctionName(script, "return 2", "MyClass.method1"); 311 CheckFunctionName(script, "return 2", "MyClass.method1");
310 } 312 }
311 313
312 314
313 TEST(AnonymousInAnonymousClosure1) { 315 TEST(AnonymousInAnonymousClosure1) {
314 CcTest::InitializeVM(); 316 CcTest::InitializeVM();
315 v8::HandleScope scope(CcTest::isolate()); 317 v8::HandleScope scope(CcTest::isolate());
316 318
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 " };\n" 534 " };\n"
533 " var foo = 10;\n" 535 " var foo = 10;\n"
534 " function f() {\n" 536 " function f() {\n"
535 " return wrapCode();\n" 537 " return wrapCode();\n"
536 " }\n" 538 " }\n"
537 " this.ref = f;\n" 539 " this.ref = f;\n"
538 "})()"); 540 "})()");
539 script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked(); 541 script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked();
540 CheckFunctionName(script, "return 2012", ""); 542 CheckFunctionName(script, "return 2012", "");
541 } 543 }
OLDNEW
« src/interpreter/bytecode-generator.cc ('K') | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698