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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 | 322 |
323 void BytecodeExpectationsPrinter::PrintExpectation( | 323 void BytecodeExpectationsPrinter::PrintExpectation( |
324 std::ostream& stream, const std::string& snippet) const { | 324 std::ostream& stream, const std::string& snippet) const { |
325 std::string source_code = | 325 std::string source_code = |
326 wrap_ ? WrapCodeInFunction(test_function_name_.c_str(), snippet) | 326 wrap_ ? WrapCodeInFunction(test_function_name_.c_str(), snippet) |
327 : snippet; | 327 : snippet; |
328 | 328 |
329 v8::Local<v8::Script> script = Compile(source_code.c_str()); | 329 v8::Local<v8::Script> script = Compile(source_code.c_str()); |
330 | 330 |
331 if (execute_) Run(script); | 331 i::Handle<i::BytecodeArray> bytecode_array; |
332 | 332 if (top_level_) { |
333 i::Handle<i::BytecodeArray> bytecode_array = | 333 bytecode_array = GetBytecodeArrayForScript(script); |
334 top_level_ ? GetBytecodeArrayForScript(script) | 334 } else { |
335 : GetBytecodeArrayForGlobal(test_function_name_.c_str()); | 335 Run(script); |
| 336 bytecode_array = GetBytecodeArrayForGlobal(test_function_name_.c_str()); |
| 337 } |
336 | 338 |
337 stream << "---\n"; | 339 stream << "---\n"; |
338 PrintCodeSnippet(stream, snippet); | 340 PrintCodeSnippet(stream, snippet); |
339 PrintBytecodeArray(stream, bytecode_array); | 341 PrintBytecodeArray(stream, bytecode_array); |
340 stream << '\n'; | 342 stream << '\n'; |
341 } | 343 } |
342 | 344 |
343 } // namespace interpreter | 345 } // namespace interpreter |
344 } // namespace internal | 346 } // namespace internal |
345 } // namespace v8 | 347 } // namespace v8 |
OLD | NEW |