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

Side by Side Diff: src/interpreter/bytecodes.cc

Issue 1825103002: [interpreter] Fix and test for printing of bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Additional checks, incorporate comments. Created 4 years, 9 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 | test/unittests/interpreter/bytecodes-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/interpreter/bytecodes.h" 5 #include "src/interpreter/bytecodes.h"
6 6
7 #include "src/frames.h" 7 #include "src/frames.h"
8 #include "src/interpreter/bytecode-traits.h" 8 #include "src/interpreter/bytecode-traits.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // static 484 // static
485 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start, 485 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start,
486 int parameter_count) { 486 int parameter_count) {
487 Vector<char> buf = Vector<char>::New(50); 487 Vector<char> buf = Vector<char>::New(50);
488 488
489 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]); 489 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]);
490 int prefix_offset = 0; 490 int prefix_offset = 0;
491 OperandScale operand_scale = OperandScale::kSingle; 491 OperandScale operand_scale = OperandScale::kSingle;
492 if (IsPrefixScalingBytecode(bytecode)) { 492 if (IsPrefixScalingBytecode(bytecode)) {
493 prefix_offset = 1; 493 prefix_offset = 1;
494 operand_scale = Bytecodes::PrefixBytecodeToOperandScale(bytecode);
494 bytecode = Bytecodes::FromByte(bytecode_start[1]); 495 bytecode = Bytecodes::FromByte(bytecode_start[1]);
495 } 496 }
496 int bytecode_size = Bytecodes::Size(bytecode, operand_scale); 497 int bytecode_size = Bytecodes::Size(bytecode, operand_scale);
497 for (int i = 0; i < prefix_offset + bytecode_size; i++) { 498 for (int i = 0; i < prefix_offset + bytecode_size; i++) {
498 SNPrintF(buf, "%02x ", bytecode_start[i]); 499 SNPrintF(buf, "%02x ", bytecode_start[i]);
499 os << buf.start(); 500 os << buf.start();
500 } 501 }
501 const int kBytecodeColumnSize = 6; 502 const int kBytecodeColumnSize = 6;
502 for (int i = prefix_offset + bytecode_size; i < kBytecodeColumnSize; i++) { 503 for (int i = prefix_offset + bytecode_size; i < kBytecodeColumnSize; i++) {
503 os << " "; 504 os << " ";
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } else { 677 } else {
677 std::ostringstream s; 678 std::ostringstream s;
678 s << "r" << index(); 679 s << "r" << index();
679 return s.str(); 680 return s.str();
680 } 681 }
681 } 682 }
682 683
683 } // namespace interpreter 684 } // namespace interpreter
684 } // namespace internal 685 } // namespace internal
685 } // namespace v8 686 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/interpreter/bytecodes-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698