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

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

Issue 2771183002: [wasm][asm.js] Fix and enable several asm.js tests with the new parser. (Closed)
Patch Set: fix Created 3 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/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());
193 size_t len = body_.size() - position; 194 size_t len = body_.size() - position;
195 if (len == 0) {
196 // Early out here as body_[position] is out of bounds in this case.
Clemens Hammacher 2017/03/28 09:52:02 dst->resize(0) is not needed here? You can avoid
bradnelson 2017/03/28 15:30:50 Ah good point. Done.
197 return;
198 }
194 dst->resize(len); 199 dst->resize(len);
195 memcpy(dst->data(), &body_[position], len); 200 memcpy(dst->data(), &body_[position], len);
196 body_.resize(position); 201 body_.resize(position);
197 } 202 }
198 203
199 void WasmFunctionBuilder::WriteSignature(ZoneBuffer& buffer) const { 204 void WasmFunctionBuilder::WriteSignature(ZoneBuffer& buffer) const {
200 buffer.write_u32v(signature_index_); 205 buffer.write_u32v(signature_index_);
201 } 206 }
202 207
203 void WasmFunctionBuilder::WriteExports(ZoneBuffer& buffer) const { 208 void WasmFunctionBuilder::WriteExports(ZoneBuffer& buffer) const {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 // Emit the offset table per function. 592 // Emit the offset table per function.
588 for (auto function : functions_) { 593 for (auto function : functions_) {
589 function->WriteAsmWasmOffsetTable(buffer); 594 function->WriteAsmWasmOffsetTable(buffer);
590 } 595 }
591 // Append a 0 to indicate that this is an encoded table. 596 // Append a 0 to indicate that this is an encoded table.
592 buffer.write_u8(0); 597 buffer.write_u8(0);
593 } 598 }
594 } // namespace wasm 599 } // namespace wasm
595 } // namespace internal 600 } // namespace internal
596 } // namespace v8 601 } // 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