Index: src/interpreter/bytecode-array-builder.cc |
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
index f664349dd44b9952326bef8d8688a5297337bebe..23bf7548aaf5c2bca7f36f7225bc7c34582d2db5 100644 |
--- a/src/interpreter/bytecode-array-builder.cc |
+++ b/src/interpreter/bytecode-array-builder.cc |
@@ -96,7 +96,8 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone, |
int parameter_count, |
int context_count, int locals_count, |
FunctionLiteral* literal) |
- : isolate_(isolate), |
+ : generator_resume_points(0, zone), |
+ isolate_(isolate), |
zone_(zone), |
bytecodes_(zone), |
bytecode_generated_(false), |
@@ -110,7 +111,8 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone, |
parameter_count_(parameter_count), |
local_register_count_(locals_count), |
context_register_count_(context_count), |
- temporary_allocator_(zone, fixed_register_count()) { |
+ temporary_allocator_(zone, fixed_register_count()), |
+ generator_yields_seen_(0) { |
DCHECK_GE(parameter_count_, 0); |
DCHECK_GE(context_register_count_, 0); |
DCHECK_GE(local_register_count_, 0); |
@@ -875,6 +877,21 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole( |
return OutputJump(Bytecode::kJumpIfNotHole, label); |
} |
+ |
+BytecodeArrayBuilder& BytecodeArrayBuilder::IndexedJump( |
rmcilroy
2016/04/19 09:30:03
As mentioned in a comment below, I think this shou
neis
2016/04/19 11:02:15
Ack. I thought my IndexedJump would fit well next
|
+ Register index, int min, size_t size, ZoneVector<BytecodeLabel>& targets) { |
+ // TODO(neis): Optimize this by using a proper jump table. |
+ for (int i = min; i < min + size; i++) { |
+ DCHECK(0 <= i && i < targets.size()); |
+ LoadLiteral(Smi::FromInt(static_cast<int>(i))); |
+ CompareOperation(Token::Value::EQ_STRICT, index); |
+ JumpIfTrue(&(targets[i])); |
+ } |
+ Illegal(); // Should never get here. |
+ return *this; |
+} |
+ |
+ |
BytecodeArrayBuilder& BytecodeArrayBuilder::Throw() { |
Output(Bytecode::kThrow); |
exit_seen_in_block_ = true; |