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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 "function g() { var g = 1; function f(x) { return x * g }; return f; } " | 163 "function g() { var g = 1; function f(x) { return x * g }; return f; } " |
164 "g();"; | 164 "g();"; |
165 Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script)); | 165 Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script)); |
166 | 166 |
167 std::unique_ptr<CompilerDispatcherJob> job( | 167 std::unique_ptr<CompilerDispatcherJob> job( |
168 new CompilerDispatcherJob(i_isolate(), f, FLAG_stack_size)); | 168 new CompilerDispatcherJob(i_isolate(), f, FLAG_stack_size)); |
169 | 169 |
170 job->PrepareToParseOnMainThread(); | 170 job->PrepareToParseOnMainThread(); |
171 job->Parse(); | 171 job->Parse(); |
172 ASSERT_TRUE(job->FinalizeParsingOnMainThread()); | 172 ASSERT_TRUE(job->FinalizeParsingOnMainThread()); |
173 ASSERT_TRUE(job->status() == CompileJobStatus::kReadyToAnalyse); | 173 ASSERT_TRUE(job->PrepareToCompileOnMainThread()); |
| 174 ASSERT_TRUE(job->status() == CompileJobStatus::kReadyToCompile); |
174 | 175 |
175 const AstRawString* var_x = | 176 const AstRawString* var_x = |
176 job->parse_info_->ast_value_factory()->GetOneByteString("x"); | 177 job->parse_info_->ast_value_factory()->GetOneByteString("x"); |
177 Variable* var = job->parse_info_->literal()->scope()->Lookup(var_x); | 178 Variable* var = job->parse_info_->literal()->scope()->Lookup(var_x); |
178 ASSERT_TRUE(var); | 179 ASSERT_TRUE(var); |
179 ASSERT_TRUE(var->IsUnallocated()); | 180 ASSERT_TRUE(var->IsParameter()); |
180 | 181 |
181 const AstRawString* var_g = | 182 const AstRawString* var_g = |
182 job->parse_info_->ast_value_factory()->GetOneByteString("g"); | 183 job->parse_info_->ast_value_factory()->GetOneByteString("g"); |
183 var = job->parse_info_->literal()->scope()->Lookup(var_g); | 184 var = job->parse_info_->literal()->scope()->Lookup(var_g); |
184 ASSERT_TRUE(var); | 185 ASSERT_TRUE(var); |
185 ASSERT_TRUE(var->IsContextSlot()); | 186 ASSERT_TRUE(var->IsContextSlot()); |
186 | 187 |
187 job->ResetOnMainThread(); | 188 job->ResetOnMainThread(); |
188 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); | 189 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); |
189 } | 190 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 semaphore.Wait(); | 306 semaphore.Wait(); |
306 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); | 307 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); |
307 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); | 308 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); |
308 | 309 |
309 job->ResetOnMainThread(); | 310 job->ResetOnMainThread(); |
310 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); | 311 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); |
311 } | 312 } |
312 | 313 |
313 } // namespace internal | 314 } // namespace internal |
314 } // namespace v8 | 315 } // namespace v8 |
OLD | NEW |