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

Unified Diff: src/compiler/js-context-specialization.cc

Issue 1218873005: [turbofan] Context specialization is the job of the JSContextSpecialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mini-nit. Created 5 years, 5 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-context-specialization.h ('k') | src/compiler/js-inlining.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-context-specialization.cc
diff --git a/src/compiler/js-context-specialization.cc b/src/compiler/js-context-specialization.cc
index bb44f5928bb0efe87537c116b605189550f6ea49..e4d4d80f52f9daea326dbf113223d3edf6c2a4e4 100644
--- a/src/compiler/js-context-specialization.cc
+++ b/src/compiler/js-context-specialization.cc
@@ -15,18 +15,40 @@ namespace v8 {
namespace internal {
namespace compiler {
-Reduction JSContextSpecializer::Reduce(Node* node) {
- if (node->opcode() == IrOpcode::kJSLoadContext) {
- return ReduceJSLoadContext(node);
+Reduction JSContextSpecialization::Reduce(Node* node) {
+ switch (node->opcode()) {
+ case IrOpcode::kParameter:
+ return ReduceParameter(node);
+ case IrOpcode::kJSLoadContext:
+ return ReduceJSLoadContext(node);
+ case IrOpcode::kJSStoreContext:
+ return ReduceJSStoreContext(node);
+ default:
+ break;
}
- if (node->opcode() == IrOpcode::kJSStoreContext) {
- return ReduceJSStoreContext(node);
+ return NoChange();
+}
+
+
+Reduction JSContextSpecialization::ReduceParameter(Node* node) {
+ DCHECK_EQ(IrOpcode::kParameter, node->opcode());
+ Node* const start = NodeProperties::GetValueInput(node, 0);
+ DCHECK_EQ(IrOpcode::kStart, start->opcode());
+ int const index = ParameterIndexOf(node->op());
+ // The context is always the last parameter to a JavaScript function, and
+ // {Parameter} indices start at -1, so value outputs of {Start} look like
+ // this: closure, receiver, param0, ..., paramN, context.
+ if (index == start->op()->ValueOutputCount() - 2) {
+ Handle<Context> context_constant;
+ if (context().ToHandle(&context_constant)) {
+ return Replace(jsgraph()->Constant(context_constant));
+ }
}
return NoChange();
}
-Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) {
+Reduction JSContextSpecialization::ReduceJSLoadContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
@@ -75,7 +97,7 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) {
}
-Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) {
+Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
@@ -103,10 +125,12 @@ Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) {
}
-Isolate* JSContextSpecializer::isolate() const { return jsgraph()->isolate(); }
+Isolate* JSContextSpecialization::isolate() const {
+ return jsgraph()->isolate();
+}
-JSOperatorBuilder* JSContextSpecializer::javascript() const {
+JSOperatorBuilder* JSContextSpecialization::javascript() const {
return jsgraph()->javascript();
}
« no previous file with comments | « src/compiler/js-context-specialization.h ('k') | src/compiler/js-inlining.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698