| OLD | NEW |
| 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 | 7 |
| 8 #include "src/shared/assert.h" | 8 #include "src/shared/assert.h" |
| 9 #include "src/shared/bytecodes.h" | 9 #include "src/shared/bytecodes.h" |
| 10 #include "src/shared/utils.h" | 10 #include "src/shared/utils.h" |
| 11 | 11 |
| 12 namespace fletch { | 12 namespace dartino { |
| 13 | 13 |
| 14 uint8 Bytecode::Print(uint8* bcp) { | 14 uint8 Bytecode::Print(uint8* bcp) { |
| 15 Opcode opcode = static_cast<Opcode>(*bcp); | 15 Opcode opcode = static_cast<Opcode>(*bcp); |
| 16 const char* bytecode_format = BytecodeFormat(opcode); | 16 const char* bytecode_format = BytecodeFormat(opcode); |
| 17 const char* print_format = PrintFormat(opcode); | 17 const char* print_format = PrintFormat(opcode); |
| 18 | 18 |
| 19 if (strcmp(bytecode_format, "") == 0) { | 19 if (strcmp(bytecode_format, "") == 0) { |
| 20 Print::Out(print_format); | 20 Print::Out(print_format); |
| 21 } else if (strcmp(bytecode_format, "B") == 0) { | 21 } else if (strcmp(bytecode_format, "B") == 0) { |
| 22 Print::Out(print_format, bcp[1]); | 22 Print::Out(print_format, bcp[1]); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 int delta = value >> 1; | 106 int delta = value >> 1; |
| 107 bcp -= delta; | 107 bcp -= delta; |
| 108 uint8* previous = NULL; | 108 uint8* previous = NULL; |
| 109 while (bcp != current_bcp) { | 109 while (bcp != current_bcp) { |
| 110 previous = bcp; | 110 previous = bcp; |
| 111 bcp += Bytecode::Size(static_cast<Opcode>(*bcp)); | 111 bcp += Bytecode::Size(static_cast<Opcode>(*bcp)); |
| 112 } | 112 } |
| 113 return previous; | 113 return previous; |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace fletch | 116 } // namespace dartino |
| OLD | NEW |