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

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

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