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

Unified Diff: src/wasm/asm-wasm-builder.cc

Issue 1775873002: [Wasm] Convert many of the fixed-size values to LEB128. (Closed) Base URL: http://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix windows 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/wasm/ast-decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/asm-wasm-builder.cc
diff --git a/src/wasm/asm-wasm-builder.cc b/src/wasm/asm-wasm-builder.cc
index 5be074acdfe98c3e61e2670ff49e84a30b42aa85..e5a4bb508ff7273daff38943cfb791967caa1d12 100644
--- a/src/wasm/asm-wasm-builder.cc
+++ b/src/wasm/asm-wasm-builder.cc
@@ -138,13 +138,14 @@ class AsmWasmBuilderImpl : public AstVisitor {
: builder_(builder) {
builder_->breakable_blocks_.push_back(std::make_pair(stmt, is_loop));
builder_->current_function_builder_->Emit(opcode);
- index_ = builder_->current_function_builder_->EmitEditableImmediate(0);
+ index_ =
+ builder_->current_function_builder_->EmitEditableVarIntImmediate();
prev_block_size_ = builder_->block_size_;
builder_->block_size_ = initial_block_size;
}
~BlockVisitor() {
- builder_->current_function_builder_->EditImmediate(index_,
- builder_->block_size_);
+ builder_->current_function_builder_->EditVarIntImmediate(
+ index_, builder_->block_size_);
builder_->block_size_ = prev_block_size_;
builder_->breakable_blocks_.pop_back();
}
@@ -193,7 +194,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
}
}
DCHECK(i >= 0);
- current_function_builder_->EmitWithU8(kExprBr, block_distance);
+ current_function_builder_->EmitWithVarInt(kExprBr, block_distance);
current_function_builder_->Emit(kExprNop);
}
@@ -216,7 +217,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
}
}
DCHECK(i >= 0);
- current_function_builder_->EmitWithU8(kExprBr, block_distance);
+ current_function_builder_->EmitWithVarInt(kExprBr, block_distance);
current_function_builder_->Emit(kExprNop);
}
@@ -292,7 +293,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
RECURSE(Visit(stmt->body()));
current_function_builder_->Emit(kExprIf);
RECURSE(Visit(stmt->cond()));
- current_function_builder_->EmitWithU8(kExprBr, 0);
+ current_function_builder_->EmitWithVarInt(kExprBr, 0);
current_function_builder_->Emit(kExprNop);
}
@@ -302,7 +303,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
1);
current_function_builder_->Emit(kExprIf);
RECURSE(Visit(stmt->cond()));
- current_function_builder_->EmitWithU8(kExprBr, 0);
+ current_function_builder_->EmitWithVarInt(kExprBr, 0);
RECURSE(Visit(stmt->body()));
}
@@ -319,7 +320,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
current_function_builder_->Emit(kExprIf);
current_function_builder_->Emit(kExprI32Eqz);
RECURSE(Visit(stmt->cond()));
- current_function_builder_->EmitWithU8(kExprBr, 1);
+ current_function_builder_->EmitWithVarInt(kExprBr, 1);
current_function_builder_->Emit(kExprNop);
}
if (stmt->body() != nullptr) {
@@ -331,7 +332,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
RECURSE(Visit(stmt->next()));
}
block_size_++;
- current_function_builder_->EmitWithU8(kExprBr, 0);
+ current_function_builder_->EmitWithVarInt(kExprBr, 0);
current_function_builder_->Emit(kExprNop);
}
@@ -1058,8 +1059,8 @@ class AsmWasmBuilderImpl : public AstVisitor {
VariableProxy* var = p->obj()->AsVariableProxy();
DCHECK_NOT_NULL(var);
FunctionTableIndices* indices = LookupFunctionTable(var->var());
- current_function_builder_->EmitWithU8(kExprCallIndirect,
- indices->signature_index);
+ current_function_builder_->EmitWithVarInt(kExprCallIndirect,
+ indices->signature_index);
current_function_builder_->Emit(kExprI32Add);
// TODO(bradnelson): variable size
byte code[] = {WASM_I32V(indices->start_index)};
@@ -1283,7 +1284,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
break;
}
case Token::COMMA: {
- current_function_builder_->EmitWithU8(kExprBlock, 2);
+ current_function_builder_->EmitWithVarInt(kExprBlock, 2);
break;
}
default:
« no previous file with comments | « no previous file | src/wasm/ast-decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698