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 "test/cctest/interpreter/bytecode-expectations-printer.h" | 5 #include "test/cctest/interpreter/bytecode-expectations-printer.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 #include <iostream> | 8 #include <iostream> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 v8::Local<v8::Script> BytecodeExpectationsPrinter::CompileScript( | 64 v8::Local<v8::Script> BytecodeExpectationsPrinter::CompileScript( |
65 const char* program) const { | 65 const char* program) const { |
66 v8::Local<v8::String> source = V8StringFromUTF8(program); | 66 v8::Local<v8::String> source = V8StringFromUTF8(program); |
67 return v8::Script::Compile(isolate_->GetCurrentContext(), source) | 67 return v8::Script::Compile(isolate_->GetCurrentContext(), source) |
68 .ToLocalChecked(); | 68 .ToLocalChecked(); |
69 } | 69 } |
70 | 70 |
71 v8::Local<v8::Module> BytecodeExpectationsPrinter::CompileModule( | 71 v8::Local<v8::Module> BytecodeExpectationsPrinter::CompileModule( |
72 const char* program) const { | 72 const char* program) const { |
73 v8::ScriptCompiler::Source source(V8StringFromUTF8(program)); | 73 ScriptOrigin origin = |
| 74 ScriptOrigin::ModuleOrigin(Local<v8::Value>(), isolate_); |
| 75 v8::ScriptCompiler::Source source(V8StringFromUTF8(program), origin); |
74 return v8::ScriptCompiler::CompileModule(isolate_, &source).ToLocalChecked(); | 76 return v8::ScriptCompiler::CompileModule(isolate_, &source).ToLocalChecked(); |
75 } | 77 } |
76 | 78 |
77 void BytecodeExpectationsPrinter::Run(v8::Local<v8::Script> script) const { | 79 void BytecodeExpectationsPrinter::Run(v8::Local<v8::Script> script) const { |
78 (void)script->Run(isolate_->GetCurrentContext()); | 80 (void)script->Run(isolate_->GetCurrentContext()); |
79 } | 81 } |
80 | 82 |
81 i::Handle<v8::internal::BytecodeArray> | 83 i::Handle<v8::internal::BytecodeArray> |
82 BytecodeExpectationsPrinter::GetBytecodeArrayForGlobal( | 84 BytecodeExpectationsPrinter::GetBytecodeArrayForGlobal( |
83 const char* global_name) const { | 85 const char* global_name) const { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 381 |
380 stream << "---\n"; | 382 stream << "---\n"; |
381 PrintCodeSnippet(stream, snippet); | 383 PrintCodeSnippet(stream, snippet); |
382 PrintBytecodeArray(stream, bytecode_array); | 384 PrintBytecodeArray(stream, bytecode_array); |
383 stream << '\n'; | 385 stream << '\n'; |
384 } | 386 } |
385 | 387 |
386 } // namespace interpreter | 388 } // namespace interpreter |
387 } // namespace internal | 389 } // namespace internal |
388 } // namespace v8 | 390 } // namespace v8 |
OLD | NEW |