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

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

Issue 866493003: Retry "Use a WeakCell in the CallIC type vector." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 10 months 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
« no previous file with comments | « src/x64/interface-descriptors-x64.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 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(0); 316 FeedbackVectorICSlot slot_for_a(0);
317 CHECK(feedback_vector->Get(slot_for_a)->IsJSFunction()); 317 Object* object = feedback_vector->Get(slot_for_a);
318 CHECK(object->IsWeakCell() &&
319 WeakCell::cast(object)->value()->IsJSFunction());
318 320
319 CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);"); 321 CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);");
320 322
321 // Verify that the feedback is still "gathered" despite a recompilation 323 // Verify that the feedback is still "gathered" despite a recompilation
322 // of the full code. 324 // of the full code.
323 CHECK(f->IsOptimized()); 325 CHECK(f->IsOptimized());
324 CHECK(f->shared()->has_deoptimization_support()); 326 CHECK(f->shared()->has_deoptimization_support());
325 CHECK(f->shared()->feedback_vector()->Get(slot_for_a)->IsJSFunction()); 327 object = f->shared()->feedback_vector()->Get(slot_for_a);
328 CHECK(object->IsWeakCell() &&
329 WeakCell::cast(object)->value()->IsJSFunction());
326 } 330 }
327 331
328 332
329 TEST(FeedbackVectorUnaffectedByScopeChanges) { 333 TEST(FeedbackVectorUnaffectedByScopeChanges) {
330 if (i::FLAG_always_opt || !i::FLAG_lazy) return; 334 if (i::FLAG_always_opt || !i::FLAG_lazy) return;
331 CcTest::InitializeVM(); 335 CcTest::InitializeVM();
332 v8::HandleScope scope(CcTest::isolate()); 336 v8::HandleScope scope(CcTest::isolate());
333 337
334 CompileRun("function builder() {" 338 CompileRun("function builder() {"
335 " call_target = function() { return 3; };" 339 " call_target = function() { return 3; };"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 CompileRun("function f() { a = 12345678 }; f();"); 449 CompileRun("function f() { a = 12345678 }; f();");
446 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 450 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
447 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 451 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
448 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 452 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
449 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 453 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
450 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 454 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
451 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 455 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
452 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 456 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
453 } 457 }
454 #endif 458 #endif
OLDNEW
« no previous file with comments | « src/x64/interface-descriptors-x64.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698