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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // Call f and force deoptimization while processing the binary operation. | 369 // Call f and force deoptimization while processing the binary operation. |
370 CompileRun("deopt = true;" | 370 CompileRun("deopt = true;" |
371 "var result = f('a+', new X());"); | 371 "var result = f('a+', new X());"); |
372 } | 372 } |
373 NonIncrementalGC(); | 373 NonIncrementalGC(); |
374 | 374 |
375 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); | 375 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); |
376 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 376 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
377 v8::Handle<v8::Value> result = env->Global()->Get(v8_str("result")); | 377 v8::Handle<v8::Value> result = env->Global()->Get(v8_str("result")); |
378 CHECK(result->IsString()); | 378 CHECK(result->IsString()); |
379 v8::String::AsciiValue ascii(result); | 379 v8::String::Utf8Value utf8(result); |
380 CHECK_EQ("a+an X", *ascii); | 380 CHECK_EQ("a+an X", *utf8); |
381 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); | 381 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); |
382 } | 382 } |
383 | 383 |
384 | 384 |
385 static void CompileConstructorWithDeoptimizingValueOf() { | 385 static void CompileConstructorWithDeoptimizingValueOf() { |
386 CompileRun("var count = 0;" | 386 CompileRun("var count = 0;" |
387 "var result = 0;" | 387 "var result = 0;" |
388 "var deopt = false;" | 388 "var deopt = false;" |
389 "function X() { };" | 389 "function X() { };" |
390 "X.prototype.valueOf = function () {" | 390 "X.prototype.valueOf = function () {" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 NonIncrementalGC(); | 681 NonIncrementalGC(); |
682 | 682 |
683 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 683 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
684 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 684 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
685 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 685 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
686 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 686 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
687 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 687 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
688 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 688 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
689 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); | 689 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); |
690 } | 690 } |
OLD | NEW |