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 292 matching lines...) Loading... |
303 *v8::Handle<v8::Function>::Cast( | 303 *v8::Handle<v8::Function>::Cast( |
304 CcTest::global()->Get(v8_str("f")))); | 304 CcTest::global()->Get(v8_str("f")))); |
305 | 305 |
306 // We shouldn't have deoptimization support. We want to recompile and | 306 // We shouldn't have deoptimization support. We want to recompile and |
307 // verify that our feedback vector preserves information. | 307 // verify that our feedback vector preserves information. |
308 CHECK(!f->shared()->has_deoptimization_support()); | 308 CHECK(!f->shared()->has_deoptimization_support()); |
309 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); | 309 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); |
310 | 310 |
311 // Verify that we gathered feedback. | 311 // Verify that we gathered feedback. |
312 int expected_slots = 0; | 312 int expected_slots = 0; |
313 int expected_ic_slots = FLAG_vector_ics ? 2 : 1; | 313 int expected_ic_slots = 1; |
314 CHECK_EQ(expected_slots, feedback_vector->Slots()); | 314 CHECK_EQ(expected_slots, feedback_vector->Slots()); |
315 CHECK_EQ(expected_ic_slots, feedback_vector->ICSlots()); | 315 CHECK_EQ(expected_ic_slots, feedback_vector->ICSlots()); |
316 FeedbackVectorICSlot slot_for_a(FLAG_vector_ics ? 1 : 0); | 316 FeedbackVectorICSlot slot_for_a(0); |
317 CHECK(feedback_vector->Get(slot_for_a)->IsJSFunction()); | 317 CHECK(feedback_vector->Get(slot_for_a)->IsJSFunction()); |
318 | 318 |
319 CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);"); | 319 CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);"); |
320 | 320 |
321 // Verify that the feedback is still "gathered" despite a recompilation | 321 // Verify that the feedback is still "gathered" despite a recompilation |
322 // of the full code. | 322 // of the full code. |
323 CHECK(f->IsOptimized()); | 323 CHECK(f->IsOptimized()); |
324 CHECK(f->shared()->has_deoptimization_support()); | 324 CHECK(f->shared()->has_deoptimization_support()); |
325 CHECK(f->shared()->feedback_vector()->Get(slot_for_a)->IsJSFunction()); | 325 CHECK(f->shared()->feedback_vector()->Get(slot_for_a)->IsJSFunction()); |
326 } | 326 } |
(...skipping 118 matching lines...) Loading... |
445 CompileRun("function f() { a = 12345678 }; f();"); | 445 CompileRun("function f() { a = 12345678 }; f();"); |
446 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 446 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
447 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 447 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
448 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 448 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
449 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 449 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
450 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 450 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
451 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 451 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
452 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 452 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
453 } | 453 } |
454 #endif | 454 #endif |
OLD | NEW |