OLD | NEW |
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/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/interpreter-assembler.h" | 8 #include "src/compiler/interpreter-assembler.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 Do##Name(&assembler); \ | 41 Do##Name(&assembler); \ |
42 Handle<Code> code = assembler.GenerateCode(); \ | 42 Handle<Code> code = assembler.GenerateCode(); \ |
43 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ | 43 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ |
44 } | 44 } |
45 BYTECODE_LIST(GENERATE_CODE) | 45 BYTECODE_LIST(GENERATE_CODE) |
46 #undef GENERATE_CODE | 46 #undef GENERATE_CODE |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 // LoadLiteral0 <dst> | 51 // LdaZero |
52 // | 52 // |
53 // Load literal '0' into the destination register. | 53 // Load literal '0' into the accumulator. |
54 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) { | 54 void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) { |
55 Node* register_index = __ BytecodeOperand(0); | 55 // TODO(rmcilroy) Implement. |
56 __ StoreRegister(__ NumberConstant(0), register_index); | |
57 __ Dispatch(); | |
58 } | 56 } |
59 | 57 |
60 | 58 |
61 // LoadSmi8 <dst>, <imm8> | 59 // LdaSmi8 <imm8> |
62 // | 60 // |
63 // Load an 8-bit integer literal into destination register as a Smi. | 61 // Load an 8-bit integer literal into the accumulator as a Smi. |
64 void Interpreter::DoLoadSmi8(compiler::InterpreterAssembler* assembler) { | 62 void Interpreter::DoLdaSmi8(compiler::InterpreterAssembler* assembler) { |
65 // TODO(rmcilroy) Convert an 8-bit integer to a Smi. | 63 // TODO(rmcilroy) Implement 8-bit integer to SMI promotion. |
66 } | 64 } |
67 | 65 |
68 | 66 |
| 67 // LdaUndefined |
| 68 // |
| 69 // Load Undefined into the accumulator. |
| 70 void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) { |
| 71 // TODO(rmcilroy) Implement. |
| 72 } |
| 73 |
| 74 |
| 75 // LdaNull |
| 76 // |
| 77 // Load Null into the accumulator. |
| 78 void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) { |
| 79 // TODO(rmcilroy) Implement. |
| 80 } |
| 81 |
| 82 |
| 83 // LdaTheHole |
| 84 // |
| 85 // Load TheHole into the accumulator. |
| 86 void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) { |
| 87 // TODO(rmcilroy) Implement. |
| 88 } |
| 89 |
| 90 |
| 91 // LdaTrue |
| 92 // |
| 93 // Load True into the accumulator. |
| 94 void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) { |
| 95 // TODO(rmcilroy) Implement. |
| 96 } |
| 97 |
| 98 |
| 99 // LdaFalse |
| 100 // |
| 101 // Load False into the accumulator. |
| 102 void Interpreter::DoLdaFalse(compiler::InterpreterAssembler* assembler) { |
| 103 // TODO(rmcilroy) Implement. |
| 104 } |
| 105 |
| 106 |
| 107 // Ldar <src> |
| 108 // |
| 109 // Load accumulator with value from register <src>. |
| 110 void Interpreter::DoLdar(compiler::InterpreterAssembler* assembler) { |
| 111 // TODO(rmcilroy) Implement. |
| 112 } |
| 113 |
| 114 |
| 115 // Star <dst> |
| 116 // |
| 117 // Store accumulator to register <dst>. |
| 118 void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) { |
| 119 // TODO(rmcilroy) Implement. |
| 120 } |
| 121 |
| 122 |
| 123 // Add <src> |
| 124 // |
| 125 // Add register <src> to accumulator. |
| 126 void Interpreter::DoAdd(compiler::InterpreterAssembler* assembler) { |
| 127 // TODO(rmcilroy) Implement. |
| 128 } |
| 129 |
| 130 |
| 131 // Sub <src> |
| 132 // |
| 133 // Subtract register <src> from accumulator. |
| 134 void Interpreter::DoSub(compiler::InterpreterAssembler* assembler) { |
| 135 // TODO(rmcilroy) Implement. |
| 136 } |
| 137 |
| 138 |
| 139 // Mul <src> |
| 140 // |
| 141 // Multiply accumulator by register <src>. |
| 142 void Interpreter::DoMul(compiler::InterpreterAssembler* assembler) { |
| 143 // TODO(rmcilroy) Implement add register to accumulator. |
| 144 } |
| 145 |
| 146 |
| 147 // Div <src> |
| 148 // |
| 149 // Divide register <src> by accumulator. |
| 150 void Interpreter::DoDiv(compiler::InterpreterAssembler* assembler) { |
| 151 // TODO(rmcilroy) Implement. |
| 152 } |
| 153 |
| 154 |
69 // Return | 155 // Return |
70 // | 156 // |
71 // Return the value in register 0. | 157 // Return the value in register 0. |
72 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 158 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
73 __ Return(); | 159 __ Return(); |
74 } | 160 } |
75 | 161 |
76 | 162 |
77 } // namespace interpreter | 163 } // namespace interpreter |
78 } // namespace internal | 164 } // namespace internal |
79 } // namespace v8 | 165 } // namespace v8 |
OLD | NEW |