| OLD | NEW |
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 "function X() { };" | 390 "function X() { };" |
| 391 "X.prototype.valueOf = function () {" | 391 "X.prototype.valueOf = function () {" |
| 392 " if (deopt) { count++; %DeoptimizeFunction(f); } return 8" | 392 " if (deopt) { count++; %DeoptimizeFunction(f); } return 8" |
| 393 "};"); | 393 "};"); |
| 394 } | 394 } |
| 395 | 395 |
| 396 | 396 |
| 397 static void TestDeoptimizeBinaryOpHelper(LocalContext* env, | 397 static void TestDeoptimizeBinaryOpHelper(LocalContext* env, |
| 398 const char* binary_op) { | 398 const char* binary_op) { |
| 399 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> f_source_buffer; | 399 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> f_source_buffer; |
| 400 OS::SNPrintF(f_source_buffer, | 400 SNPrintF(f_source_buffer, |
| 401 "function f(x, y) { return x %s y; };", | 401 "function f(x, y) { return x %s y; };", |
| 402 binary_op); | 402 binary_op); |
| 403 char* f_source = f_source_buffer.start(); | 403 char* f_source = f_source_buffer.start(); |
| 404 | 404 |
| 405 AllowNativesSyntaxNoInlining options; | 405 AllowNativesSyntaxNoInlining options; |
| 406 // Compile function f and collect to type feedback to insert binary op stub | 406 // Compile function f and collect to type feedback to insert binary op stub |
| 407 // call in the optimized code. | 407 // call in the optimized code. |
| 408 i::FLAG_prepare_always_opt = true; | 408 i::FLAG_prepare_always_opt = true; |
| 409 CompileConstructorWithDeoptimizingValueOf(); | 409 CompileConstructorWithDeoptimizingValueOf(); |
| 410 CompileRun(f_source); | 410 CompileRun(f_source); |
| 411 CompileRun("for (var i = 0; i < 5; i++) {" | 411 CompileRun("for (var i = 0; i < 5; i++) {" |
| 412 " f(8, new X());" | 412 " f(8, new X());" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 } | 688 } |
| 689 NonIncrementalGC(); | 689 NonIncrementalGC(); |
| 690 | 690 |
| 691 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 691 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
| 692 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 692 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
| 693 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 693 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
| 694 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 694 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
| 695 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 695 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
| 696 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 696 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
| 697 } | 697 } |
| OLD | NEW |