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/signature.h" | 5 #include "src/signature.h" |
6 | 6 |
7 #include "src/handles.h" | 7 #include "src/handles.h" |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 void WasmFunctionBuilder::Emit(WasmOpcode opcode) { | 124 void WasmFunctionBuilder::Emit(WasmOpcode opcode) { |
125 body_.push_back(static_cast<byte>(opcode)); | 125 body_.push_back(static_cast<byte>(opcode)); |
126 } | 126 } |
127 | 127 |
128 | 128 |
129 void WasmFunctionBuilder::EmitWithU8(WasmOpcode opcode, const byte immediate) { | 129 void WasmFunctionBuilder::EmitWithU8(WasmOpcode opcode, const byte immediate) { |
130 body_.push_back(static_cast<byte>(opcode)); | 130 body_.push_back(static_cast<byte>(opcode)); |
131 body_.push_back(immediate); | 131 body_.push_back(immediate); |
132 } | 132 } |
133 | 133 |
| 134 void WasmFunctionBuilder::EmitWithU8U8(WasmOpcode opcode, const byte imm1, |
| 135 const byte imm2) { |
| 136 body_.push_back(static_cast<byte>(opcode)); |
| 137 body_.push_back(imm1); |
| 138 body_.push_back(imm2); |
| 139 } |
| 140 |
134 void WasmFunctionBuilder::EmitWithVarInt(WasmOpcode opcode, | 141 void WasmFunctionBuilder::EmitWithVarInt(WasmOpcode opcode, |
135 uint32_t immediate) { | 142 uint32_t immediate) { |
136 body_.push_back(static_cast<byte>(opcode)); | 143 body_.push_back(static_cast<byte>(opcode)); |
137 size_t immediate_size = SizeOfVarInt(immediate); | 144 size_t immediate_size = SizeOfVarInt(immediate); |
138 body_.insert(body_.end(), immediate_size, 0); | 145 body_.insert(body_.end(), immediate_size, 0); |
139 byte* p = &body_[body_.size() - immediate_size]; | 146 byte* p = &body_[body_.size() - immediate_size]; |
140 EmitVarInt(&p, immediate); | 147 EmitVarInt(&p, immediate); |
141 } | 148 } |
142 | 149 |
143 uint32_t WasmFunctionBuilder::EmitEditableVarIntImmediate() { | 150 uint32_t WasmFunctionBuilder::EmitEditableVarIntImmediate() { |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 next = next | 0x80; | 647 next = next | 0x80; |
641 } | 648 } |
642 output.push_back(next); | 649 output.push_back(next); |
643 shift += 7; | 650 shift += 7; |
644 } while ((next & 0x80) != 0); | 651 } while ((next & 0x80) != 0); |
645 return output; | 652 return output; |
646 } | 653 } |
647 } // namespace wasm | 654 } // namespace wasm |
648 } // namespace internal | 655 } // namespace internal |
649 } // namespace v8 | 656 } // namespace v8 |
OLD | NEW |