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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1008213002: [turbofan] Cache for reusing value vector nodes in frame states. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Another attempt Created 5 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
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 9ba7236e4200b3bd7f9074140dda6066064c35b4..c11caea8f8276ca45872ce0bb3025d0f2e64d010 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -12,6 +12,7 @@
#include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h"
+#include "src/compiler/state-values-utils.h"
#include "src/full-codegen.h"
#include "src/parser.h"
#include "src/scopes.h"
@@ -392,7 +393,9 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
input_buffer_size_(0),
input_buffer_(nullptr),
exit_control_(nullptr),
- loop_assignment_analysis_(loop) {
+ loop_assignment_analysis_(loop),
+ state_values_cache_(new (local_zone->New(sizeof(StateValuesCache)))
+ StateValuesCache(jsgraph)) {
InitializeAstVisitor(info->isolate(), local_zone);
}
@@ -602,7 +605,7 @@ AstGraphBuilder::Environment::Environment(
void AstGraphBuilder::Environment::UpdateStateValues(Node** state_values,
int offset, int count) {
bool should_update = false;
- Node** env_values = (count == 0) ? NULL : &values()->at(offset);
+ Node** env_values = (count == 0) ? nullptr : &values()->at(offset);
if (*state_values == NULL || (*state_values)->InputCount() != count) {
should_update = true;
} else {
@@ -621,12 +624,20 @@ void AstGraphBuilder::Environment::UpdateStateValues(Node** state_values,
}
+void AstGraphBuilder::Environment::UpdateStateValuesWithCache(
+ Node** state_values, int offset, int count) {
+ Node** env_values = (count == 0) ? nullptr : &values()->at(offset);
+ *state_values = builder_->state_values_cache_->GetNodeForValues(
+ env_values, static_cast<size_t>(count));
+}
+
+
Node* AstGraphBuilder::Environment::Checkpoint(
BailoutId ast_id, OutputFrameStateCombine combine) {
if (!FLAG_turbo_deoptimization) return nullptr;
UpdateStateValues(&parameters_node_, 0, parameters_count());
- UpdateStateValues(&locals_node_, parameters_count(), locals_count());
+ UpdateStateValuesWithCache(&locals_node_, parameters_count(), locals_count());
UpdateStateValues(&stack_node_, parameters_count() + locals_count(),
stack_height());

Powered by Google App Engine
This is Rietveld 408576698