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

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

Issue 1901713003: [generators] Perform state dispatch in loop header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 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;

Powered by Google App Engine
This is Rietveld 408576698