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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } else { | 77 } else { |
78 source = isolate->factory()->NewStringFromAsciiChecked(test_script); | 78 source = isolate->factory()->NewStringFromAsciiChecked(test_script); |
79 } | 79 } |
80 Handle<Script> script = isolate->factory()->NewScript(source); | 80 Handle<Script> script = isolate->factory()->NewScript(source); |
81 Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo( | 81 Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo( |
82 isolate->factory()->NewStringFromAsciiChecked("f"), | 82 isolate->factory()->NewStringFromAsciiChecked("f"), |
83 isolate->builtins()->CompileLazy(), false); | 83 isolate->builtins()->CompileLazy(), false); |
84 SharedFunctionInfo::SetScript(shared, script); | 84 SharedFunctionInfo::SetScript(shared, script); |
85 shared->set_end_position(source->length()); | 85 shared->set_end_position(source->length()); |
86 shared->set_outer_scope_info(ScopeInfo::Empty(isolate)); | 86 shared->set_outer_scope_info(ScopeInfo::Empty(isolate)); |
| 87 shared->set_function_literal_num(1); |
87 return scope.CloseAndEscape(shared); | 88 return scope.CloseAndEscape(shared); |
88 } | 89 } |
89 | 90 |
90 Handle<Object> RunJS(v8::Isolate* isolate, const char* script) { | 91 Handle<Object> RunJS(v8::Isolate* isolate, const char* script) { |
91 return Utils::OpenHandle( | 92 return Utils::OpenHandle( |
92 *v8::Script::Compile( | 93 *v8::Script::Compile( |
93 isolate->GetCurrentContext(), | 94 isolate->GetCurrentContext(), |
94 v8::String::NewFromUtf8(isolate, script, v8::NewStringType::kNormal) | 95 v8::String::NewFromUtf8(isolate, script, v8::NewStringType::kNormal) |
95 .ToLocalChecked()) | 96 .ToLocalChecked()) |
96 .ToLocalChecked() | 97 .ToLocalChecked() |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 semaphore.Wait(); | 311 semaphore.Wait(); |
311 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); | 312 ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); |
312 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); | 313 ASSERT_TRUE(job->status() == CompileJobStatus::kDone); |
313 | 314 |
314 job->ResetOnMainThread(); | 315 job->ResetOnMainThread(); |
315 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); | 316 ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); |
316 } | 317 } |
317 | 318 |
318 } // namespace internal | 319 } // namespace internal |
319 } // namespace v8 | 320 } // namespace v8 |
OLD | NEW |