Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: test/cctest/test-compiler.cc

Issue 670953003: Move feedback slot allocation to post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased patch Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 " }" 341 " }"
342 " })();" 342 " })();"
343 "}" 343 "}"
344 "morphing_call = builder();"); 344 "morphing_call = builder();");
345 345
346 Handle<JSFunction> f = 346 Handle<JSFunction> f =
347 v8::Utils::OpenHandle( 347 v8::Utils::OpenHandle(
348 *v8::Handle<v8::Function>::Cast( 348 *v8::Handle<v8::Function>::Cast(
349 CcTest::global()->Get(v8_str("morphing_call")))); 349 CcTest::global()->Get(v8_str("morphing_call"))));
350 350
351 // Not compiled, and so no feedback vector allocated yet.
352 CHECK(!f->shared()->is_compiled());
353 CHECK_EQ(0, f->shared()->feedback_vector()->Slots());
354 CHECK_EQ(0, f->shared()->feedback_vector()->ICSlots());
355
356 CompileRun("morphing_call();");
357
358 // Now a feedback vector is allocated.
359 CHECK(f->shared()->is_compiled());
351 int expected_slots = 0; 360 int expected_slots = 0;
352 int expected_ic_slots = FLAG_vector_ics ? 2 : 1; 361 int expected_ic_slots = FLAG_vector_ics ? 2 : 1;
353 CHECK_EQ(expected_slots, f->shared()->feedback_vector()->Slots()); 362 CHECK_EQ(expected_slots, f->shared()->feedback_vector()->Slots());
354 CHECK_EQ(expected_ic_slots, f->shared()->feedback_vector()->ICSlots()); 363 CHECK_EQ(expected_ic_slots, f->shared()->feedback_vector()->ICSlots());
355
356 // And yet it's not compiled.
357 CHECK(!f->shared()->is_compiled());
358
359 CompileRun("morphing_call();");
360
361 // The vector should have the same size despite the new scoping.
362 CHECK_EQ(expected_slots, f->shared()->feedback_vector()->Slots());
363 CHECK_EQ(expected_ic_slots, f->shared()->feedback_vector()->ICSlots());
364 CHECK(f->shared()->is_compiled());
365 } 364 }
366 365
367 366
368 // Test that optimized code for different closures is actually shared 367 // Test that optimized code for different closures is actually shared
369 // immediately by the FastNewClosureStub when run in the same context. 368 // immediately by the FastNewClosureStub when run in the same context.
370 TEST(OptimizedCodeSharing) { 369 TEST(OptimizedCodeSharing) {
371 // Skip test if --cache-optimized-code is not activated by default because 370 // Skip test if --cache-optimized-code is not activated by default because
372 // FastNewClosureStub that is baked into the snapshot is incorrect. 371 // FastNewClosureStub that is baked into the snapshot is incorrect.
373 if (!FLAG_cache_optimized_code) return; 372 if (!FLAG_cache_optimized_code) return;
374 FLAG_stress_compaction = false; 373 FLAG_stress_compaction = false;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 CompileRun("function f() { a = 12345678 }; f();"); 445 CompileRun("function f() { a = 12345678 }; f();");
447 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 446 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
448 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 447 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
449 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 448 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
450 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 449 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
451 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 450 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
452 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 451 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
453 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 452 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
454 } 453 }
455 #endif 454 #endif
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698