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

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

Issue 199973004: Continued fix for 351257. Reusing the feedback vector is too complex. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/cctest/test-heap.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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 v8::String::NewFromUtf8(CcTest::isolate(), buffer.start()); 305 v8::String::NewFromUtf8(CcTest::isolate(), buffer.start());
306 v8::Script::Compile(script_body, &origin)->Run(); 306 v8::Script::Compile(script_body, &origin)->Run();
307 v8::Local<v8::Function> f = 307 v8::Local<v8::Function> f =
308 v8::Local<v8::Function>::Cast(context->Global()->Get( 308 v8::Local<v8::Function>::Cast(context->Global()->Get(
309 v8::String::NewFromUtf8(CcTest::isolate(), "f"))); 309 v8::String::NewFromUtf8(CcTest::isolate(), "f")));
310 CHECK_EQ(i, f->GetScriptLineNumber()); 310 CHECK_EQ(i, f->GetScriptLineNumber());
311 } 311 }
312 } 312 }
313 313
314 314
315 TEST(FeedbackVectorRecreatedOnScopeChanges) {
316 if (i::FLAG_always_opt || !i::FLAG_lazy) return;
317 CcTest::InitializeVM();
318 v8::HandleScope scope(CcTest::isolate());
319
320 CompileRun("function builder() {"
321 " call_target = function() { return 3; };"
322 " return (function() {"
323 " eval('');"
324 " return function() {"
325 " 'use strict';"
326 " call_target();"
327 " }"
328 " })();"
329 "}"
330 "morphing_call = builder();");
331
332 Handle<JSFunction> f =
333 v8::Utils::OpenHandle(
334 *v8::Handle<v8::Function>::Cast(
335 CcTest::global()->Get(v8_str("morphing_call"))));
336
337 // morphing_call should have one feedback vector slot for the call to
338 // call_target(), scoping analysis having been performed.
339 CHECK_EQ(1, f->shared()->feedback_vector()->length());
340 // And yet it's not compiled.
341 CHECK(!f->shared()->is_compiled());
342
343 CompileRun("morphing_call();");
344
345 // On scoping analysis after lazy compile, the call is now a global
346 // call which needs no feedback vector slot.
347 CHECK_EQ(0, f->shared()->feedback_vector()->length());
348 CHECK(f->shared()->is_compiled());
349 }
350
351
315 // Test that optimized code for different closures is actually shared 352 // Test that optimized code for different closures is actually shared
316 // immediately by the FastNewClosureStub when run in the same context. 353 // immediately by the FastNewClosureStub when run in the same context.
317 TEST(OptimizedCodeSharing) { 354 TEST(OptimizedCodeSharing) {
318 // Skip test if --cache-optimized-code is not activated by default because 355 // Skip test if --cache-optimized-code is not activated by default because
319 // FastNewClosureStub that is baked into the snapshot is incorrect. 356 // FastNewClosureStub that is baked into the snapshot is incorrect.
320 if (!FLAG_cache_optimized_code) return; 357 if (!FLAG_cache_optimized_code) return;
321 FLAG_stress_compaction = false; 358 FLAG_stress_compaction = false;
322 FLAG_allow_natives_syntax = true; 359 FLAG_allow_natives_syntax = true;
323 CcTest::InitializeVM(); 360 CcTest::InitializeVM();
324 v8::HandleScope scope(CcTest::isolate()); 361 v8::HandleScope scope(CcTest::isolate());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 CompileRun("function f() { a = 12345678 }; f();"); 430 CompileRun("function f() { a = 12345678 }; f();");
394 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 431 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
395 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 432 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
396 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 433 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
397 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 434 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
398 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 435 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
399 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 436 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
400 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 437 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
401 } 438 }
402 #endif 439 #endif
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698