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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1373903005: [Interpreter] Add for/while/do support to the bytecode generator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate comments / re-work IfBuilder. Created 5 years, 3 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
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 9c6b5905ccf19ecb436b9689b5f0ba6a93762c13..f4e05c728c589cde92c6cc0beac48fc7fe9fa75d 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -10,6 +10,7 @@ namespace interpreter {
BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone)
: isolate_(isolate),
+ zone_(zone),
bytecodes_(zone),
bytecode_generated_(false),
last_block_end_(0),
@@ -314,6 +315,17 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(BytecodeLabel* label) {
}
+BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(
+ BytecodeLabel* unbound, const BytecodeLabel* const bound) {
+ DCHECK_EQ(unbound->is_bound(), false);
+ DCHECK_EQ(bound->is_bound(), true);
+ PatchJump(bytecodes()->begin() + bound->offset(),
+ bytecodes()->begin() + unbound->offset());
+ unbound->bind_to(bound->offset());
+ return *this;
+}
+
+
// static
bool BytecodeArrayBuilder::IsJumpWithImm8Operand(Bytecode jump_bytecode) {
rmcilroy 2015/10/01 12:12:07 replace this with your newly added Bytecodes::IsJu
oth 2015/10/01 13:13:56 Done.
return jump_bytecode == Bytecode::kJump ||
@@ -347,7 +359,6 @@ void BytecodeArrayBuilder::PatchJump(
DCHECK(IsJumpWithImm8Operand(jump_bytecode));
DCHECK_EQ(Bytecodes::Size(jump_bytecode), 2);
- DCHECK_GE(delta, 0);
rmcilroy 2015/10/01 12:12:07 Maybe make this DCHECK_NE(delta, 0) instead of rem
oth 2015/10/01 13:13:56 Done.
if (FitsInImm8Operand(delta)) {
// Just update the operand

Powered by Google App Engine
This is Rietveld 408576698