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

Unified Diff: src/interpreter/bytecode-register-optimizer.cc

Issue 2035813002: [Interpreter] Move jump processing to bytecode array writer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_fix_bytecode
Patch Set: Address comments Created 4 years, 6 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 | « src/interpreter/bytecode-register-optimizer.h ('k') | src/interpreter/control-flow-builders.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-register-optimizer.cc
diff --git a/src/interpreter/bytecode-register-optimizer.cc b/src/interpreter/bytecode-register-optimizer.cc
index c7578b4b101f7d76a60144300d378683e495e4c0..223dbe2c1073e82053ebb677d6f05be7bf371539 100644
--- a/src/interpreter/bytecode-register-optimizer.cc
+++ b/src/interpreter/bytecode-register-optimizer.cc
@@ -198,44 +198,13 @@ BytecodeRegisterOptimizer::BytecodeRegisterOptimizer(
DCHECK(accumulator_info_->register_value() == accumulator_);
}
-void BytecodeRegisterOptimizer::FlushState() {
- if (flushed_) {
- return;
- }
-
- // Materialize all live registers.
- size_t count = register_info_table_.size();
- for (size_t i = 0; i < count; ++i) {
- RegisterInfo* reg_info = register_info_table_[i];
- if (!reg_info->IsOnlyMemberOfEquivalenceSet() &&
- !reg_info->materialized()) {
- DCHECK(RegisterIsTemporary(reg_info->register_value()) ||
- reg_info->register_value() == accumulator_);
- Materialize(reg_info);
- }
- }
-
- // Break all existing equivalences.
- for (size_t i = 0; i < count; ++i) {
- RegisterInfo* reg_info = register_info_table_[i];
- if (!reg_info->IsOnlyMemberOfEquivalenceSet()) {
- reg_info->MoveToNewEquivalenceSet(NextEquivalenceId(), true);
- }
- }
-
- flushed_ = true;
-}
-
-// override
-void BytecodeRegisterOptimizer::FlushBasicBlock() {
- FlushState();
- next_stage_->FlushBasicBlock();
-}
-
// override
-size_t BytecodeRegisterOptimizer::FlushForOffset() {
+Handle<BytecodeArray> BytecodeRegisterOptimizer::ToBytecodeArray(
+ int fixed_register_count, int parameter_count,
+ Handle<FixedArray> handler_table) {
FlushState();
- return next_stage_->FlushForOffset();
+ return next_stage_->ToBytecodeArray(fixed_register_count, parameter_count,
+ handler_table);
}
// override
@@ -283,6 +252,55 @@ void BytecodeRegisterOptimizer::Write(BytecodeNode* node) {
WriteToNextStage(node);
}
+// override
+void BytecodeRegisterOptimizer::WriteJump(BytecodeNode* node,
+ BytecodeLabel* label) {
+ FlushState();
+ next_stage_->WriteJump(node, label);
+}
+
+// override
+void BytecodeRegisterOptimizer::BindLabel(BytecodeLabel* label) {
+ FlushState();
+ next_stage_->BindLabel(label);
+}
+
+// override
+void BytecodeRegisterOptimizer::BindLabel(const BytecodeLabel& target,
+ BytecodeLabel* label) {
+ // There is no need to flush here, it will have been flushed when |target|
+ // was bound.
+ next_stage_->BindLabel(target, label);
+}
+
+void BytecodeRegisterOptimizer::FlushState() {
+ if (flushed_) {
+ return;
+ }
+
+ // Materialize all live registers.
+ size_t count = register_info_table_.size();
+ for (size_t i = 0; i < count; ++i) {
+ RegisterInfo* reg_info = register_info_table_[i];
+ if (!reg_info->IsOnlyMemberOfEquivalenceSet() &&
+ !reg_info->materialized()) {
+ DCHECK(RegisterIsTemporary(reg_info->register_value()) ||
+ reg_info->register_value() == accumulator_);
+ Materialize(reg_info);
+ }
+ }
+
+ // Break all existing equivalences.
+ for (size_t i = 0; i < count; ++i) {
+ RegisterInfo* reg_info = register_info_table_[i];
+ if (!reg_info->IsOnlyMemberOfEquivalenceSet()) {
+ reg_info->MoveToNewEquivalenceSet(NextEquivalenceId(), true);
+ }
+ }
+
+ flushed_ = true;
+}
+
void BytecodeRegisterOptimizer::WriteToNextStage(BytecodeNode* node) const {
next_stage_->Write(node);
}
« no previous file with comments | « src/interpreter/bytecode-register-optimizer.h ('k') | src/interpreter/control-flow-builders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698