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

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

Issue 1697423003: Support blocks in asm->wasm global section. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge Created 4 years, 10 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 | « no previous file | test/mjsunit/wasm/asm-wasm.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/wasm/asm-wasm-builder.h" 7 #include "src/wasm/asm-wasm-builder.h"
8 #include "src/wasm/wasm-macro-gen.h" 8 #include "src/wasm/wasm-macro-gen.h"
9 #include "src/wasm/wasm-opcodes.h" 9 #include "src/wasm/wasm-opcodes.h"
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (stmt->statements()->length() == 1) { 103 if (stmt->statements()->length() == 1) {
104 ExpressionStatement* expr = 104 ExpressionStatement* expr =
105 stmt->statements()->at(0)->AsExpressionStatement(); 105 stmt->statements()->at(0)->AsExpressionStatement();
106 if (expr != nullptr) { 106 if (expr != nullptr) {
107 if (expr->expression()->IsAssignment()) { 107 if (expr->expression()->IsAssignment()) {
108 RECURSE(VisitExpressionStatement(expr)); 108 RECURSE(VisitExpressionStatement(expr));
109 return; 109 return;
110 } 110 }
111 } 111 }
112 } 112 }
113 DCHECK(in_function_); 113 if (in_function_) {
114 BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock, false, 114 BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock,
115 static_cast<byte>(stmt->statements()->length())); 115 false,
116 RECURSE(VisitStatements(stmt->statements())); 116 static_cast<byte>(stmt->statements()->length()));
117 DCHECK(block_size_ >= 0); 117 RECURSE(VisitStatements(stmt->statements()));
118 DCHECK(block_size_ >= 0);
119 } else {
120 RECURSE(VisitStatements(stmt->statements()));
121 }
118 } 122 }
119 123
120 class BlockVisitor { 124 class BlockVisitor {
121 private: 125 private:
122 int prev_block_size_; 126 int prev_block_size_;
123 uint32_t index_; 127 uint32_t index_;
124 AsmWasmBuilderImpl* builder_; 128 AsmWasmBuilderImpl* builder_;
125 129
126 public: 130 public:
127 BlockVisitor(AsmWasmBuilderImpl* builder, BreakableStatement* stmt, 131 BlockVisitor(AsmWasmBuilderImpl* builder, BreakableStatement* stmt,
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 // that zone in constructor may be thrown away once wasm module is written. 1288 // that zone in constructor may be thrown away once wasm module is written.
1285 WasmModuleIndex* AsmWasmBuilder::Run() { 1289 WasmModuleIndex* AsmWasmBuilder::Run() {
1286 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_); 1290 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_);
1287 impl.Compile(); 1291 impl.Compile();
1288 WasmModuleWriter* writer = impl.builder_->Build(zone_); 1292 WasmModuleWriter* writer = impl.builder_->Build(zone_);
1289 return writer->WriteTo(zone_); 1293 return writer->WriteTo(zone_);
1290 } 1294 }
1291 } // namespace wasm 1295 } // namespace wasm
1292 } // namespace internal 1296 } // namespace internal
1293 } // namespace v8 1297 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698