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

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

Issue 2306413002: Fully deserialize the scope chain after parsing, not before (Closed)
Patch Set: updates Created 4 years, 3 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/test-parsing.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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698