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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // Not compiled, and so no feedback vector allocated yet. | 355 // Not compiled, and so no feedback vector allocated yet. |
356 CHECK(!f->shared()->is_compiled()); | 356 CHECK(!f->shared()->is_compiled()); |
357 CHECK_EQ(0, f->shared()->feedback_vector()->Slots()); | 357 CHECK_EQ(0, f->shared()->feedback_vector()->Slots()); |
358 CHECK_EQ(0, f->shared()->feedback_vector()->ICSlots()); | 358 CHECK_EQ(0, f->shared()->feedback_vector()->ICSlots()); |
359 | 359 |
360 CompileRun("morphing_call();"); | 360 CompileRun("morphing_call();"); |
361 | 361 |
362 // Now a feedback vector is allocated. | 362 // Now a feedback vector is allocated. |
363 CHECK(f->shared()->is_compiled()); | 363 CHECK(f->shared()->is_compiled()); |
364 int expected_slots = 0; | 364 int expected_slots = 0; |
365 int expected_ic_slots = FLAG_vector_ics ? 2 : 1; | 365 int expected_ic_slots = 2; |
366 CHECK_EQ(expected_slots, f->shared()->feedback_vector()->Slots()); | 366 CHECK_EQ(expected_slots, f->shared()->feedback_vector()->Slots()); |
367 CHECK_EQ(expected_ic_slots, f->shared()->feedback_vector()->ICSlots()); | 367 CHECK_EQ(expected_ic_slots, f->shared()->feedback_vector()->ICSlots()); |
368 } | 368 } |
369 | 369 |
370 | 370 |
371 // Test that optimized code for different closures is actually shared | 371 // Test that optimized code for different closures is actually shared |
372 // immediately by the FastNewClosureStub when run in the same context. | 372 // immediately by the FastNewClosureStub when run in the same context. |
373 TEST(OptimizedCodeSharing) { | 373 TEST(OptimizedCodeSharing) { |
374 // Skip test if --cache-optimized-code is not activated by default because | 374 // Skip test if --cache-optimized-code is not activated by default because |
375 // FastNewClosureStub that is baked into the snapshot is incorrect. | 375 // FastNewClosureStub that is baked into the snapshot is incorrect. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 CompileRun("function f() { a = 12345678 }; f();"); | 559 CompileRun("function f() { a = 12345678 }; f();"); |
560 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 560 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
561 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 561 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
562 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 562 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
563 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 563 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
564 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 564 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
565 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 565 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
566 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 566 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
567 } | 567 } |
568 #endif | 568 #endif |
OLD | NEW |