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

Side by Side Diff: src/wasm/wasm-module-builder.cc

Issue 2782613002: Revert of [wasm][asm.js] Fix and enable several asm.js tests with the new parser. (Closed)
Patch Set: Created 3 years, 8 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/asmjs/asm-scanner.cc ('k') | test/mjsunit/asm/asm-validation.js » ('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/objects-inl.h" 8 #include "src/objects-inl.h"
9 #include "src/v8.h" 9 #include "src/v8.h"
10 #include "src/zone/zone-containers.h" 10 #include "src/zone/zone-containers.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 DCHECK_EQ(0, asm_offsets_.size()); 183 DCHECK_EQ(0, asm_offsets_.size());
184 asm_func_start_source_position_ = position; 184 asm_func_start_source_position_ = position;
185 last_asm_source_position_ = position; 185 last_asm_source_position_ = position;
186 } 186 }
187 187
188 void WasmFunctionBuilder::StashCode(std::vector<byte>* dst, size_t position) { 188 void WasmFunctionBuilder::StashCode(std::vector<byte>* dst, size_t position) {
189 if (dst == nullptr) { 189 if (dst == nullptr) {
190 body_.resize(position); 190 body_.resize(position);
191 return; 191 return;
192 } 192 }
193 DCHECK_LE(position, body_.size());
194 size_t len = body_.size() - position; 193 size_t len = body_.size() - position;
195 dst->resize(len); 194 dst->resize(len);
196 memcpy(dst->data(), body_.data() + position, len); 195 memcpy(dst->data(), &body_[position], len);
197 body_.resize(position); 196 body_.resize(position);
198 } 197 }
199 198
200 void WasmFunctionBuilder::WriteSignature(ZoneBuffer& buffer) const { 199 void WasmFunctionBuilder::WriteSignature(ZoneBuffer& buffer) const {
201 buffer.write_u32v(signature_index_); 200 buffer.write_u32v(signature_index_);
202 } 201 }
203 202
204 void WasmFunctionBuilder::WriteExports(ZoneBuffer& buffer) const { 203 void WasmFunctionBuilder::WriteExports(ZoneBuffer& buffer) const {
205 for (auto name : exported_names_) { 204 for (auto name : exported_names_) {
206 buffer.write_size(name.size()); 205 buffer.write_size(name.size());
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 // Emit the offset table per function. 587 // Emit the offset table per function.
589 for (auto function : functions_) { 588 for (auto function : functions_) {
590 function->WriteAsmWasmOffsetTable(buffer); 589 function->WriteAsmWasmOffsetTable(buffer);
591 } 590 }
592 // Append a 0 to indicate that this is an encoded table. 591 // Append a 0 to indicate that this is an encoded table.
593 buffer.write_u8(0); 592 buffer.write_u8(0);
594 } 593 }
595 } // namespace wasm 594 } // namespace wasm
596 } // namespace internal 595 } // namespace internal
597 } // namespace v8 596 } // namespace v8
OLDNEW
« no previous file with comments | « src/asmjs/asm-scanner.cc ('k') | test/mjsunit/asm/asm-validation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698