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

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

Issue 1370303004: Distinction between FeedbackVectorICSlot and FeedbackVectorSlot eliminated. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed release builds Created 5 years, 2 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 | « test/cctest/interpreter/test-interpreter.cc ('k') | test/cctest/test-feedback-vector.h » ('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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 v8::Utils::OpenHandle( 302 v8::Utils::OpenHandle(
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 CHECK(!feedback_vector->is_empty());
313 int expected_ic_slots = 1; 313 FeedbackVectorSlot slot_for_a(0);
314 CHECK_EQ(expected_slots, feedback_vector->Slots());
315 CHECK_EQ(expected_ic_slots, feedback_vector->ICSlots());
316 FeedbackVectorICSlot slot_for_a(0);
317 Object* object = feedback_vector->Get(slot_for_a); 314 Object* object = feedback_vector->Get(slot_for_a);
318 CHECK(object->IsWeakCell() && 315 CHECK(object->IsWeakCell() &&
319 WeakCell::cast(object)->value()->IsJSFunction()); 316 WeakCell::cast(object)->value()->IsJSFunction());
320 317
321 CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);"); 318 CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);");
322 319
323 // Verify that the feedback is still "gathered" despite a recompilation 320 // Verify that the feedback is still "gathered" despite a recompilation
324 // of the full code. 321 // of the full code.
325 CHECK(f->IsOptimized()); 322 CHECK(f->IsOptimized());
326 CHECK(f->shared()->has_deoptimization_support()); 323 CHECK(f->shared()->has_deoptimization_support());
(...skipping 20 matching lines...) Expand all
347 "}" 344 "}"
348 "morphing_call = builder();"); 345 "morphing_call = builder();");
349 346
350 Handle<JSFunction> f = 347 Handle<JSFunction> f =
351 v8::Utils::OpenHandle( 348 v8::Utils::OpenHandle(
352 *v8::Handle<v8::Function>::Cast( 349 *v8::Handle<v8::Function>::Cast(
353 CcTest::global()->Get(v8_str("morphing_call")))); 350 CcTest::global()->Get(v8_str("morphing_call"))));
354 351
355 // Not compiled, and so no feedback vector allocated yet. 352 // Not compiled, and so no feedback vector allocated yet.
356 CHECK(!f->shared()->is_compiled()); 353 CHECK(!f->shared()->is_compiled());
357 CHECK_EQ(0, f->shared()->feedback_vector()->Slots()); 354 CHECK(f->shared()->feedback_vector()->is_empty());
358 CHECK_EQ(0, f->shared()->feedback_vector()->ICSlots());
359 355
360 CompileRun("morphing_call();"); 356 CompileRun("morphing_call();");
361 357
362 // Now a feedback vector is allocated. 358 // Now a feedback vector is allocated.
363 CHECK(f->shared()->is_compiled()); 359 CHECK(f->shared()->is_compiled());
364 int expected_slots = 0; 360 CHECK(!f->shared()->feedback_vector()->is_empty());
365 int expected_ic_slots = 2;
366 CHECK_EQ(expected_slots, f->shared()->feedback_vector()->Slots());
367 CHECK_EQ(expected_ic_slots, f->shared()->feedback_vector()->ICSlots());
368 } 361 }
369 362
370 363
371 // Test that optimized code for different closures is actually shared 364 // Test that optimized code for different closures is actually shared
372 // immediately by the FastNewClosureStub when run in the same context. 365 // immediately by the FastNewClosureStub when run in the same context.
373 TEST(OptimizedCodeSharing1) { 366 TEST(OptimizedCodeSharing1) {
374 FLAG_stress_compaction = false; 367 FLAG_stress_compaction = false;
375 FLAG_allow_natives_syntax = true; 368 FLAG_allow_natives_syntax = true;
376 FLAG_cache_optimized_code = true; 369 FLAG_cache_optimized_code = true;
377 CcTest::InitializeVM(); 370 CcTest::InitializeVM();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 CompileRun("function f() { a = 12345678 }; f();"); 691 CompileRun("function f() { a = 12345678 }; f();");
699 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 692 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
700 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 693 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
701 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 694 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
702 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 695 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
703 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 696 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
704 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 697 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
705 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 698 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
706 } 699 }
707 #endif 700 #endif
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/cctest/test-feedback-vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698