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

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

Issue 23014007: Rename "parallel recompilation" to "concurrent recompilation". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « src/x64/builtins-x64.cc ('k') | test/cctest/test-heap.cc » ('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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 private: 71 private:
72 bool always_opt_; 72 bool always_opt_;
73 bool allow_natives_syntax_; 73 bool allow_natives_syntax_;
74 bool use_inlining_; 74 bool use_inlining_;
75 }; 75 };
76 76
77 77
78 // Utility class to set --allow-natives-syntax and --nouse-inlining when 78 // Utility class to set --allow-natives-syntax and --nouse-inlining when
79 // constructed and return to their default state when destroyed. 79 // constructed and return to their default state when destroyed.
80 class AllowNativesSyntaxNoInliningNoParallel { 80 class AllowNativesSyntaxNoInliningNoConcurrent {
81 public: 81 public:
82 AllowNativesSyntaxNoInliningNoParallel() 82 AllowNativesSyntaxNoInliningNoConcurrent()
83 : allow_natives_syntax_(i::FLAG_allow_natives_syntax), 83 : allow_natives_syntax_(i::FLAG_allow_natives_syntax),
84 use_inlining_(i::FLAG_use_inlining), 84 use_inlining_(i::FLAG_use_inlining),
85 parallel_recompilation_(i::FLAG_parallel_recompilation) { 85 concurrent_recompilation_(i::FLAG_concurrent_recompilation) {
86 i::FLAG_allow_natives_syntax = true; 86 i::FLAG_allow_natives_syntax = true;
87 i::FLAG_use_inlining = false; 87 i::FLAG_use_inlining = false;
88 i::FLAG_parallel_recompilation = false; 88 i::FLAG_concurrent_recompilation = false;
89 } 89 }
90 90
91 ~AllowNativesSyntaxNoInliningNoParallel() { 91 ~AllowNativesSyntaxNoInliningNoConcurrent() {
92 i::FLAG_allow_natives_syntax = allow_natives_syntax_; 92 i::FLAG_allow_natives_syntax = allow_natives_syntax_;
93 i::FLAG_use_inlining = use_inlining_; 93 i::FLAG_use_inlining = use_inlining_;
94 i::FLAG_parallel_recompilation = parallel_recompilation_; 94 i::FLAG_concurrent_recompilation = concurrent_recompilation_;
95 } 95 }
96 96
97 private: 97 private:
98 bool allow_natives_syntax_; 98 bool allow_natives_syntax_;
99 bool use_inlining_; 99 bool use_inlining_;
100 bool parallel_recompilation_; 100 bool concurrent_recompilation_;
101 }; 101 };
102 102
103 103
104 // Abort any ongoing incremental marking to make sure that all weak global 104 // Abort any ongoing incremental marking to make sure that all weak global
105 // handle callbacks are processed. 105 // handle callbacks are processed.
106 static void NonIncrementalGC() { 106 static void NonIncrementalGC() {
107 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); 107 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
108 } 108 }
109 109
110 110
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 340 }
341 341
342 342
343 TEST(DeoptimizeBinaryOperationADDString) { 343 TEST(DeoptimizeBinaryOperationADDString) {
344 LocalContext env; 344 LocalContext env;
345 v8::HandleScope scope(env->GetIsolate()); 345 v8::HandleScope scope(env->GetIsolate());
346 346
347 const char* f_source = "function f(x, y) { return x + y; };"; 347 const char* f_source = "function f(x, y) { return x + y; };";
348 348
349 { 349 {
350 AllowNativesSyntaxNoInliningNoParallel options; 350 AllowNativesSyntaxNoInliningNoConcurrent options;
351 // Compile function f and collect to type feedback to insert binary op stub 351 // Compile function f and collect to type feedback to insert binary op stub
352 // call in the optimized code. 352 // call in the optimized code.
353 i::FLAG_prepare_always_opt = true; 353 i::FLAG_prepare_always_opt = true;
354 CompileRun("var count = 0;" 354 CompileRun("var count = 0;"
355 "var result = 0;" 355 "var result = 0;"
356 "var deopt = false;" 356 "var deopt = false;"
357 "function X() { };" 357 "function X() { };"
358 "X.prototype.toString = function () {" 358 "X.prototype.toString = function () {"
359 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'an X'" 359 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'an X'"
360 "};"); 360 "};");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 399
400 static void TestDeoptimizeBinaryOpHelper(LocalContext* env, 400 static void TestDeoptimizeBinaryOpHelper(LocalContext* env,
401 const char* binary_op) { 401 const char* binary_op) {
402 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> f_source_buffer; 402 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> f_source_buffer;
403 OS::SNPrintF(f_source_buffer, 403 OS::SNPrintF(f_source_buffer,
404 "function f(x, y) { return x %s y; };", 404 "function f(x, y) { return x %s y; };",
405 binary_op); 405 binary_op);
406 char* f_source = f_source_buffer.start(); 406 char* f_source = f_source_buffer.start();
407 407
408 AllowNativesSyntaxNoInliningNoParallel options; 408 AllowNativesSyntaxNoInliningNoConcurrent options;
409 // Compile function f and collect to type feedback to insert binary op stub 409 // Compile function f and collect to type feedback to insert binary op stub
410 // call in the optimized code. 410 // call in the optimized code.
411 i::FLAG_prepare_always_opt = true; 411 i::FLAG_prepare_always_opt = true;
412 CompileConstructorWithDeoptimizingValueOf(); 412 CompileConstructorWithDeoptimizingValueOf();
413 CompileRun(f_source); 413 CompileRun(f_source);
414 CompileRun("for (var i = 0; i < 5; i++) {" 414 CompileRun("for (var i = 0; i < 5; i++) {"
415 " f(8, new X());" 415 " f(8, new X());"
416 "};"); 416 "};");
417 417
418 // Compile an optimized version of f. 418 // Compile an optimized version of f.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 490 }
491 491
492 492
493 TEST(DeoptimizeCompare) { 493 TEST(DeoptimizeCompare) {
494 LocalContext env; 494 LocalContext env;
495 v8::HandleScope scope(env->GetIsolate()); 495 v8::HandleScope scope(env->GetIsolate());
496 496
497 const char* f_source = "function f(x, y) { return x < y; };"; 497 const char* f_source = "function f(x, y) { return x < y; };";
498 498
499 { 499 {
500 AllowNativesSyntaxNoInliningNoParallel options; 500 AllowNativesSyntaxNoInliningNoConcurrent options;
501 // Compile function f and collect to type feedback to insert compare ic 501 // Compile function f and collect to type feedback to insert compare ic
502 // call in the optimized code. 502 // call in the optimized code.
503 i::FLAG_prepare_always_opt = true; 503 i::FLAG_prepare_always_opt = true;
504 CompileRun("var count = 0;" 504 CompileRun("var count = 0;"
505 "var result = 0;" 505 "var result = 0;"
506 "var deopt = false;" 506 "var deopt = false;"
507 "function X() { };" 507 "function X() { };"
508 "X.prototype.toString = function () {" 508 "X.prototype.toString = function () {"
509 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'b'" 509 " if (deopt) { count++; %DeoptimizeFunction(f); } return 'b'"
510 "};"); 510 "};");
(...skipping 26 matching lines...) Expand all
537 LocalContext env; 537 LocalContext env;
538 v8::HandleScope scope(env->GetIsolate()); 538 v8::HandleScope scope(env->GetIsolate());
539 539
540 // Functions to generate load/store/keyed load/keyed store IC calls. 540 // Functions to generate load/store/keyed load/keyed store IC calls.
541 const char* f1_source = "function f1(x) { return x.y; };"; 541 const char* f1_source = "function f1(x) { return x.y; };";
542 const char* g1_source = "function g1(x) { x.y = 1; };"; 542 const char* g1_source = "function g1(x) { x.y = 1; };";
543 const char* f2_source = "function f2(x, y) { return x[y]; };"; 543 const char* f2_source = "function f2(x, y) { return x[y]; };";
544 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; 544 const char* g2_source = "function g2(x, y) { x[y] = 1; };";
545 545
546 { 546 {
547 AllowNativesSyntaxNoInliningNoParallel options; 547 AllowNativesSyntaxNoInliningNoConcurrent options;
548 // Compile functions and collect to type feedback to insert ic 548 // Compile functions and collect to type feedback to insert ic
549 // calls in the optimized code. 549 // calls in the optimized code.
550 i::FLAG_prepare_always_opt = true; 550 i::FLAG_prepare_always_opt = true;
551 CompileRun("var count = 0;" 551 CompileRun("var count = 0;"
552 "var result = 0;" 552 "var result = 0;"
553 "var deopt = false;" 553 "var deopt = false;"
554 "function X() { };" 554 "function X() { };"
555 "X.prototype.__defineGetter__('y', function () {" 555 "X.prototype.__defineGetter__('y', function () {"
556 " if (deopt) { count++; %DeoptimizeFunction(f1); };" 556 " if (deopt) { count++; %DeoptimizeFunction(f1); };"
557 " return 13;" 557 " return 13;"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 LocalContext env; 617 LocalContext env;
618 v8::HandleScope scope(env->GetIsolate()); 618 v8::HandleScope scope(env->GetIsolate());
619 619
620 // Functions to generate load/store/keyed load/keyed store IC calls. 620 // Functions to generate load/store/keyed load/keyed store IC calls.
621 const char* f1_source = "function f1(x) { return x.y; };"; 621 const char* f1_source = "function f1(x) { return x.y; };";
622 const char* g1_source = "function g1(x) { x.y = 1; };"; 622 const char* g1_source = "function g1(x) { x.y = 1; };";
623 const char* f2_source = "function f2(x, y) { return x[y]; };"; 623 const char* f2_source = "function f2(x, y) { return x[y]; };";
624 const char* g2_source = "function g2(x, y) { x[y] = 1; };"; 624 const char* g2_source = "function g2(x, y) { x[y] = 1; };";
625 625
626 { 626 {
627 AllowNativesSyntaxNoInliningNoParallel options; 627 AllowNativesSyntaxNoInliningNoConcurrent options;
628 // Compile functions and collect to type feedback to insert ic 628 // Compile functions and collect to type feedback to insert ic
629 // calls in the optimized code. 629 // calls in the optimized code.
630 i::FLAG_prepare_always_opt = true; 630 i::FLAG_prepare_always_opt = true;
631 CompileRun("var count = 0;" 631 CompileRun("var count = 0;"
632 "var result = 0;" 632 "var result = 0;"
633 "var deopt = false;" 633 "var deopt = false;"
634 "function X() { };" 634 "function X() { };"
635 "X.prototype.__defineGetter__('y', function () {" 635 "X.prototype.__defineGetter__('y', function () {"
636 " g1(this);" 636 " g1(this);"
637 " return 13;" 637 " return 13;"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 NonIncrementalGC(); 685 NonIncrementalGC();
686 686
687 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); 687 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized());
688 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); 688 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized());
689 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); 689 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized());
690 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); 690 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized());
691 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 691 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
692 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); 692 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value());
693 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); 693 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current()));
694 } 694 }
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698