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

Side by Side Diff: test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc

Issue 2579973002: Don't compile inner functions when compiling via the dispatcher (Closed)
Patch Set: added comment Created 4 years 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
« src/compiler.h ('K') | « src/interpreter/interpreter.cc ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 6
7 #include "include/v8.h" 7 #include "include/v8.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 V8::GetCurrentPlatform()->CallOnBackgroundThread(background_task, 316 V8::GetCurrentPlatform()->CallOnBackgroundThread(background_task,
317 Platform::kShortRunningTask); 317 Platform::kShortRunningTask);
318 semaphore.Wait(); 318 semaphore.Wait();
319 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); 319 ASSERT_TRUE(job->FinalizeCompilingOnMainThread());
320 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); 320 ASSERT_TRUE(job->status() == CompileJobStatus::kDone);
321 321
322 job->ResetOnMainThread(); 322 job->ResetOnMainThread();
323 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); 323 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial);
324 } 324 }
325 325
326 TEST_F(CompilerDispatcherJobTest, LazyInnerFunctions) {
327 const char script[] =
328 "function g() {\n"
329 " f = function() {\n"
330 " e = (function() { return 42; });\n"
331 " return e;\n"
332 " };\n"
333 " return f;\n"
334 "}\n"
335 "g();";
336 Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script));
337
338 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
339 i_isolate(), tracer(), handle(f->shared()), FLAG_stack_size));
340
341 job->PrepareToParseOnMainThread();
342 job->Parse();
343 ASSERT_TRUE(job->FinalizeParsingOnMainThread());
344 ASSERT_TRUE(job->PrepareToCompileOnMainThread());
345 job->Compile();
346 ASSERT_TRUE(job->FinalizeCompilingOnMainThread());
347 ASSERT_TRUE(job->status() == CompileJobStatus::kDone);
348
349 Handle<JSFunction> e = Handle<JSFunction>::cast(RunJS(isolate(), "f();"));
350
351 ASSERT_FALSE(e->shared()->HasBaselineCode());
352
353 job->ResetOnMainThread();
354 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial);
355 }
356
326 } // namespace internal 357 } // namespace internal
327 } // namespace v8 358 } // namespace v8
OLDNEW
« src/compiler.h ('K') | « src/interpreter/interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698