OLD | NEW |
---|---|
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 V8::GetCurrentPlatform()->CallOnBackgroundThread(background_task, | 315 V8::GetCurrentPlatform()->CallOnBackgroundThread(background_task, |
316 Platform::kShortRunningTask); | 316 Platform::kShortRunningTask); |
317 semaphore.Wait(); | 317 semaphore.Wait(); |
318 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); | 318 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); |
319 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); | 319 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); |
320 | 320 |
321 job->ResetOnMainThread(); | 321 job->ResetOnMainThread(); |
322 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); | 322 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); |
323 } | 323 } |
324 | 324 |
325 TEST_F(CompilerDispatcherJobTest, LazyInnerFunctions) { | |
326 const char script[] = | |
327 "function g() {\n" | |
328 " f = function() {\n" | |
329 " e = (function() { return 42; });\n" | |
330 " return e;\n" | |
331 " };\n" | |
332 " return f;\n" | |
333 "}\n" | |
334 "g();"; | |
335 Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script)); | |
336 | |
337 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( | |
338 i_isolate(), tracer(), handle(f->shared()), FLAG_stack_size)); | |
339 | |
340 job->PrepareToParseOnMainThread(); | |
341 job->Parse(); | |
342 ASSERT_TRUE(job->FinalizeParsingOnMainThread()); | |
343 ASSERT_TRUE(job->PrepareToCompileOnMainThread()); | |
344 job->Compile(); | |
345 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); | |
346 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); | |
347 | |
348 Handle<JSFunction> e = Handle<JSFunction>::cast(RunJS(isolate(), "f();")); | |
349 | |
350 ASSERT_FALSE(e->shared()->HasBaselineCode()); | |
marja
2017/01/05 19:25:22
Hmm, I don't understand why this test is removed..
rmcilroy
2017/01/06 17:08:14
This was part of the revert of the LazyCompileMode
| |
351 | |
352 job->ResetOnMainThread(); | |
353 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); | |
354 } | |
355 | |
356 } // namespace internal | 325 } // namespace internal |
357 } // namespace v8 | 326 } // namespace v8 |
OLD | NEW |