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

Side by Side Diff: src/compiler/js-context-specialization.cc

Issue 1387393002: [turbofan] Add initial support for global specialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AstGraphBuilder
Patch Set: Fix typo. Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/compiler/js-global-specialization.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-context-specialization.h" 5 #include "src/compiler/js-context-specialization.h"
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // before the function to which it belongs has initialized the slot. 88 // before the function to which it belongs has initialized the slot.
89 // We must be conservative and check if the value in the slot is currently the 89 // We must be conservative and check if the value in the slot is currently the
90 // hole or undefined. If it is neither of these, then it must be initialized. 90 // hole or undefined. If it is neither of these, then it must be initialized.
91 if (value->IsUndefined() || value->IsTheHole()) { 91 if (value->IsUndefined() || value->IsTheHole()) {
92 return NoChange(); 92 return NoChange();
93 } 93 }
94 94
95 // Success. The context load can be replaced with the constant. 95 // Success. The context load can be replaced with the constant.
96 // TODO(titzer): record the specialization for sharing code across multiple 96 // TODO(titzer): record the specialization for sharing code across multiple
97 // contexts that have the same value in the corresponding context slot. 97 // contexts that have the same value in the corresponding context slot.
98 if (value->IsConsString()) {
99 value = String::Flatten(Handle<String>::cast(value), TENURED);
100 }
98 Node* constant = jsgraph_->Constant(value); 101 Node* constant = jsgraph_->Constant(value);
99 ReplaceWithValue(node, constant); 102 ReplaceWithValue(node, constant);
100 return Replace(constant); 103 return Replace(constant);
101 } 104 }
102 105
103 106
104 Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) { 107 Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) {
105 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode()); 108 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
106 109
107 // Get the specialization context from the node. 110 // Get the specialization context from the node.
(...skipping 22 matching lines...) Expand all
130 } 133 }
131 134
132 135
133 JSOperatorBuilder* JSContextSpecialization::javascript() const { 136 JSOperatorBuilder* JSContextSpecialization::javascript() const {
134 return jsgraph()->javascript(); 137 return jsgraph()->javascript();
135 } 138 }
136 139
137 } // namespace compiler 140 } // namespace compiler
138 } // namespace internal 141 } // namespace internal
139 } // namespace v8 142 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/compiler/js-global-specialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698