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

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

Issue 2680313002: Count closures using the feedback vector cell map, specialize if count==1. (Closed)
Patch Set: Only specialize if compiling from bytecode Created 3 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
« no previous file with comments | « src/objects.cc ('k') | test/debugger/debug/debug-liveedit-double-call.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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 for (int i = 0; i < 3; i++) { 378 for (int i = 0; i < 3; i++) {
379 LocalContext env; 379 LocalContext env;
380 env->Global() 380 env->Global()
381 ->Set(env.local(), v8_str("x"), v8::Integer::New(CcTest::isolate(), i)) 381 ->Set(env.local(), v8_str("x"), v8::Integer::New(CcTest::isolate(), i))
382 .FromJust(); 382 .FromJust();
383 CompileRun( 383 CompileRun(
384 "function MakeClosure() {" 384 "function MakeClosure() {"
385 " return function() { return x; };" 385 " return function() { return x; };"
386 "}" 386 "}"
387 "var closure0 = MakeClosure();" 387 "var closure0 = MakeClosure();"
388 "var closure1 = MakeClosure();" // We only share optimized code
389 // if there are at least two closures.
388 "%DebugPrint(closure0());" 390 "%DebugPrint(closure0());"
389 "%OptimizeFunctionOnNextCall(closure0);" 391 "%OptimizeFunctionOnNextCall(closure0);"
390 "%DebugPrint(closure0());" 392 "%DebugPrint(closure0());"
391 "var closure1 = MakeClosure(); closure1();" 393 "closure1();"
392 "var closure2 = MakeClosure(); closure2();"); 394 "var closure2 = MakeClosure(); closure2();");
393 Handle<JSFunction> fun1 = Handle<JSFunction>::cast( 395 Handle<JSFunction> fun1 = Handle<JSFunction>::cast(
394 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( 396 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
395 env->Global() 397 env->Global()
396 ->Get(env.local(), v8_str("closure1")) 398 ->Get(env.local(), v8_str("closure1"))
397 .ToLocalChecked()))); 399 .ToLocalChecked())));
398 Handle<JSFunction> fun2 = Handle<JSFunction>::cast( 400 Handle<JSFunction> fun2 = Handle<JSFunction>::cast(
399 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( 401 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
400 env->Global() 402 env->Global()
401 ->Get(env.local(), v8_str("closure2")) 403 ->Get(env.local(), v8_str("closure2"))
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 CompileRun("foo()"); 668 CompileRun("foo()");
667 CHECK_EQ(2, foo->feedback_vector()->invocation_count()); 669 CHECK_EQ(2, foo->feedback_vector()->invocation_count());
668 CompileRun("bar()"); 670 CompileRun("bar()");
669 CHECK_EQ(2, foo->feedback_vector()->invocation_count()); 671 CHECK_EQ(2, foo->feedback_vector()->invocation_count());
670 CompileRun("foo(); foo()"); 672 CompileRun("foo(); foo()");
671 CHECK_EQ(4, foo->feedback_vector()->invocation_count()); 673 CHECK_EQ(4, foo->feedback_vector()->invocation_count());
672 CompileRun("%BaselineFunctionOnNextCall(foo);"); 674 CompileRun("%BaselineFunctionOnNextCall(foo);");
673 CompileRun("foo();"); 675 CompileRun("foo();");
674 CHECK_EQ(5, foo->feedback_vector()->invocation_count()); 676 CHECK_EQ(5, foo->feedback_vector()->invocation_count());
675 } 677 }
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/debugger/debug/debug-liveedit-double-call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698