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

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

Issue 2281463002: [Test] Fix CompilerDispatcher test. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | 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/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" 10 #include "src/compiler-dispatcher/compiler-dispatcher-job.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 ASSERT_TRUE(job->status() == CompileJobStatus::kFailed); 208 ASSERT_TRUE(job->status() == CompileJobStatus::kFailed);
209 ASSERT_TRUE(i_isolate()->has_pending_exception()); 209 ASSERT_TRUE(i_isolate()->has_pending_exception());
210 210
211 i_isolate()->clear_pending_exception(); 211 i_isolate()->clear_pending_exception();
212 job->ResetOnMainThread(); 212 job->ResetOnMainThread();
213 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); 213 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial);
214 } 214 }
215 215
216 TEST_F(CompilerDispatcherJobTest, CompileFailureToFinalize) { 216 TEST_F(CompilerDispatcherJobTest, CompileFailureToFinalize) {
217 std::string raw_script("() { var a = "); 217 std::string raw_script("() { var a = ");
218 for (int i = 0; i < 1000; i++) { 218 for (int i = 0; i < 2000; i++) {
219 raw_script += "'x' + "; 219 raw_script += "'x' + ";
220 } 220 }
221 raw_script += " 'x'; }"; 221 raw_script += " 'x'; }";
222 ScriptResource script(raw_script.c_str(), strlen(raw_script.c_str())); 222 ScriptResource script(raw_script.c_str(), strlen(raw_script.c_str()));
223 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( 223 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
224 i_isolate(), CreateFunction(i_isolate(), &script), 100)); 224 i_isolate(), CreateFunction(i_isolate(), &script), 100));
225 225
226 job->PrepareToParseOnMainThread(); 226 job->PrepareToParseOnMainThread();
227 job->Parse(); 227 job->Parse();
228 job->FinalizeParsingOnMainThread(); 228 job->FinalizeParsingOnMainThread();
229 job->PrepareToCompileOnMainThread(); 229 job->PrepareToCompileOnMainThread();
230 job->Compile(); 230 job->Compile();
231 ASSERT_FALSE(job->FinalizeCompilingOnMainThread()); 231 ASSERT_FALSE(job->FinalizeCompilingOnMainThread());
232 ASSERT_TRUE(job->status() == CompileJobStatus::kFailed); 232 ASSERT_TRUE(job->status() == CompileJobStatus::kFailed);
233 ASSERT_TRUE(i_isolate()->has_pending_exception()); 233 ASSERT_TRUE(i_isolate()->has_pending_exception());
234 234
235 i_isolate()->clear_pending_exception(); 235 i_isolate()->clear_pending_exception();
236 job->ResetOnMainThread(); 236 job->ResetOnMainThread();
237 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); 237 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial);
238 } 238 }
239 239
240 } // namespace internal 240 } // namespace internal
241 } // namespace v8 241 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698