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

Unified Diff: src/compiler/js-type-feedback.cc

Issue 1038953002: [turbofan] Reduce JSLoadProperty and JSStoreProperty of strings to JSLoadNamed and JSStoreNamed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/compiler/js-type-feedback.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-type-feedback.cc
diff --git a/src/compiler/js-type-feedback.cc b/src/compiler/js-type-feedback.cc
index bdd61df87e8a4c2b868a7abc9f18da430d18b1f1..a17f4f154264bf08e321c8de37027680f9beb767 100644
--- a/src/compiler/js-type-feedback.cc
+++ b/src/compiler/js-type-feedback.cc
@@ -13,6 +13,7 @@
#include "src/compiler/access-builder.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/node-aux-data.h"
+#include "src/compiler/node-matchers.h"
#include "src/compiler/simplified-operator.h"
namespace v8 {
@@ -32,17 +33,36 @@ void JSTypeFeedbackTable::Record(Node* node, TypeFeedbackId id) {
Reduction JSTypeFeedbackSpecializer::Reduce(Node* node) {
- // TODO(turbofan): type feedback currently requires deoptimization.
- if (!FLAG_turbo_deoptimization) return NoChange();
switch (node->opcode()) {
- case IrOpcode::kJSLoadProperty:
+ case IrOpcode::kJSLoadProperty: {
+ HeapObjectMatcher<Name> match(node->InputAt(1));
+ if (match.HasValue() && match.Value().handle()->IsName()) {
+ // LoadProperty(o, "constant") => LoadNamed["constant"](o).
+ Unique<Name> name = match.Value();
+ const VectorSlotPair& feedback =
+ LoadPropertyParametersOf(node->op()).feedback();
+ node->set_op(jsgraph()->javascript()->LoadNamed(name, feedback));
+ node->RemoveInput(1);
+ return ReduceJSLoadNamed(node);
+ }
return ReduceJSLoadProperty(node);
+ }
case IrOpcode::kJSLoadNamed:
return ReduceJSLoadNamed(node);
case IrOpcode::kJSStoreNamed:
return ReduceJSStoreNamed(node);
- case IrOpcode::kJSStoreProperty:
+ case IrOpcode::kJSStoreProperty: {
+ HeapObjectMatcher<Name> match(node->InputAt(1));
+ if (match.HasValue() && match.Value().handle()->IsName()) {
+ // StoreProperty(o, "constant", v) => StoreNamed["constant"](o, v).
+ Unique<Name> name = match.Value();
+ LanguageMode language_mode = OpParameter<LanguageMode>(node);
+ node->set_op(jsgraph()->javascript()->StoreNamed(language_mode, name));
+ node->RemoveInput(1);
+ return ReduceJSStoreNamed(node);
+ }
return ReduceJSStoreProperty(node);
+ }
default:
break;
}
@@ -118,6 +138,9 @@ static bool GetInObjectFieldAccess(LoadOrStore mode, Handle<Map> map,
Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) {
DCHECK(node->opcode() == IrOpcode::kJSLoadNamed);
+ // TODO(turbofan): type feedback currently requires deoptimization.
+ if (!FLAG_turbo_deoptimization) return NoChange();
+
TypeFeedbackId id = js_type_feedback_->find(node);
if (id.IsNone() || oracle()->LoadIsUninitialized(id)) return NoChange();
@@ -164,6 +187,9 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadProperty(Node* node) {
Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) {
DCHECK(node->opcode() == IrOpcode::kJSStoreNamed);
+ // TODO(turbofan): type feedback currently requires deoptimization.
+ if (!FLAG_turbo_deoptimization) return NoChange();
+
TypeFeedbackId id = js_type_feedback_->find(node);
if (id.IsNone() || oracle()->StoreIsUninitialized(id)) return NoChange();
« no previous file with comments | « src/compiler/js-type-feedback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698