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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 "function g() { count++; %DeoptimizeFunction(f); }" | 228 "function g() { count++; %DeoptimizeFunction(f); }" |
229 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" | 229 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" |
230 "f(10);"); | 230 "f(10);"); |
231 } | 231 } |
232 NonIncrementalGC(); | 232 NonIncrementalGC(); |
233 | 233 |
234 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 234 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
235 CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value()); | 235 CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value()); |
236 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 236 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
237 | 237 |
238 v8::Local<v8::Function> fun = | 238 v8::Local<v8::Function> fun = v8::Local<v8::Function>::Cast( |
239 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 239 env->Global()->Get(v8::String::NewFromUtf8(CcTest::isolate(), "f"))); |
240 CHECK(!fun.IsEmpty()); | 240 CHECK(!fun.IsEmpty()); |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 TEST(DeoptimizeMultiple) { | 244 TEST(DeoptimizeMultiple) { |
245 LocalContext env; | 245 LocalContext env; |
246 v8::HandleScope scope(env->GetIsolate()); | 246 v8::HandleScope scope(env->GetIsolate()); |
247 | 247 |
248 { | 248 { |
249 AlwaysOptimizeAllowNativesSyntaxNoInlining options; | 249 AlwaysOptimizeAllowNativesSyntaxNoInlining options; |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 NonIncrementalGC(); | 690 NonIncrementalGC(); |
691 | 691 |
692 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 692 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
693 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 693 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
694 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 694 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
695 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 695 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
696 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 696 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
697 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 697 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
698 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); | 698 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); |
699 } | 699 } |
OLD | NEW |