OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" | 230 "function f(x) { calls++; if (x > 0) { f(x - 1); } else { g(); } };" |
231 "f(10); gc(); gc()"); | 231 "f(10); gc(); gc()"); |
232 } | 232 } |
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(Isolate::Current())); | 236 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); |
237 | 237 |
238 v8::Local<v8::Function> fun = | 238 v8::Local<v8::Function> fun = |
239 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); | 239 v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); |
240 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); | 240 Handle<v8::internal::JSFunction> f(v8::Utils::OpenHandle(*fun)); |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 TEST(DeoptimizeMultiple) { | 244 TEST(DeoptimizeMultiple) { |
245 v8::HandleScope scope; | 245 v8::HandleScope scope; |
246 const char* extension_list[] = { "v8/gc" }; | 246 const char* extension_list[] = { "v8/gc" }; |
247 v8::ExtensionConfiguration extensions(1, extension_list); | 247 v8::ExtensionConfiguration extensions(1, extension_list); |
248 LocalContext env(&extensions); | 248 LocalContext env(&extensions); |
249 | 249 |
250 { | 250 { |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 } | 706 } |
707 | 707 |
708 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); | 708 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); |
709 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); | 709 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); |
710 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); | 710 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); |
711 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); | 711 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); |
712 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); | 712 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); |
713 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); | 713 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); |
714 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); | 714 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); |
715 } | 715 } |
OLD | NEW |