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

Side by Side Diff: src/wasm/encoder.cc

Issue 1775123003: [wasm] Encode immediates to Load and Store as varint. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/wasm/encoder.h ('k') | src/wasm/wasm-macro-gen.h » ('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/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
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
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
OLDNEW
« no previous file with comments | « src/wasm/encoder.h ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698