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

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

Issue 2577063002: Reland of "Store SharedFunctionInfos of a Script in a FixedArray indexed by their ID" (Closed)
Patch Set: fix 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
« no previous file with comments | « test/cctest/test-serialize.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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 HandleScope scope(isolate); 84 HandleScope scope(isolate);
85 Handle<String> source; 85 Handle<String> source;
86 if (maybe_resource) { 86 if (maybe_resource) {
87 source = isolate->factory() 87 source = isolate->factory()
88 ->NewExternalStringFromOneByte(maybe_resource) 88 ->NewExternalStringFromOneByte(maybe_resource)
89 .ToHandleChecked(); 89 .ToHandleChecked();
90 } else { 90 } else {
91 source = isolate->factory()->NewStringFromAsciiChecked(test_script); 91 source = isolate->factory()->NewStringFromAsciiChecked(test_script);
92 } 92 }
93 Handle<Script> script = isolate->factory()->NewScript(source); 93 Handle<Script> script = isolate->factory()->NewScript(source);
94 Handle<FixedArray> infos = isolate->factory()->NewFixedArray(3);
95 script->set_shared_function_infos(*infos);
94 Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo( 96 Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo(
95 isolate->factory()->NewStringFromAsciiChecked("f"), 97 isolate->factory()->NewStringFromAsciiChecked("f"),
96 isolate->builtins()->CompileLazy(), false); 98 isolate->builtins()->CompileLazy(), false);
97 SharedFunctionInfo::SetScript(shared, script);
98 shared->set_end_position(source->length()); 99 shared->set_end_position(source->length());
99 shared->set_outer_scope_info(ScopeInfo::Empty(isolate)); 100 shared->set_outer_scope_info(ScopeInfo::Empty(isolate));
100 shared->set_function_literal_id(1); 101 shared->set_function_literal_id(1);
102 SharedFunctionInfo::SetScript(shared, script);
101 return scope.CloseAndEscape(shared); 103 return scope.CloseAndEscape(shared);
102 } 104 }
103 105
104 } // namespace 106 } // namespace
105 107
106 TEST_F(CompilerDispatcherJobTest, Construct) { 108 TEST_F(CompilerDispatcherJobTest, Construct) {
107 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( 109 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
108 i_isolate(), tracer(), CreateSharedFunctionInfo(i_isolate(), nullptr), 110 i_isolate(), tracer(), CreateSharedFunctionInfo(i_isolate(), nullptr),
109 FLAG_stack_size)); 111 FLAG_stack_size));
110 } 112 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 semaphore.Wait(); 318 semaphore.Wait();
317 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); 319 ASSERT_TRUE(job->FinalizeCompilingOnMainThread());
318 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); 320 ASSERT_TRUE(job->status() == CompileJobStatus::kDone);
319 321
320 job->ResetOnMainThread(); 322 job->ResetOnMainThread();
321 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); 323 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial);
322 } 324 }
323 325
324 } // namespace internal 326 } // namespace internal
325 } // namespace v8 327 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698