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

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

Issue 1529053003: [turbofan] Flatten cons strings before embedding them into optimized code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@HeapConstants
Patch Set: Created 5 years 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 | « no previous file | src/compiler/js-frame-specialization.cc » ('j') | src/compiler/js-graph.cc » ('J')
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // before the function to which it belongs has initialized the slot. 70 // before the function to which it belongs has initialized the slot.
71 // We must be conservative and check if the value in the slot is currently the 71 // We must be conservative and check if the value in the slot is currently the
72 // hole or undefined. If it is neither of these, then it must be initialized. 72 // hole or undefined. If it is neither of these, then it must be initialized.
73 if (value->IsUndefined() || value->IsTheHole()) { 73 if (value->IsUndefined() || value->IsTheHole()) {
74 return NoChange(); 74 return NoChange();
75 } 75 }
76 76
77 // Success. The context load can be replaced with the constant. 77 // Success. The context load can be replaced with the constant.
78 // TODO(titzer): record the specialization for sharing code across multiple 78 // TODO(titzer): record the specialization for sharing code across multiple
79 // contexts that have the same value in the corresponding context slot. 79 // contexts that have the same value in the corresponding context slot.
80 if (value->IsConsString()) {
81 value = String::Flatten(Handle<String>::cast(value), TENURED);
82 }
83 Node* constant = jsgraph_->Constant(value); 80 Node* constant = jsgraph_->Constant(value);
84 ReplaceWithValue(node, constant); 81 ReplaceWithValue(node, constant);
85 return Replace(constant); 82 return Replace(constant);
86 } 83 }
87 84
88 85
89 Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) { 86 Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) {
90 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode()); 87 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
91 88
92 // Get the specialization context from the node. 89 // Get the specialization context from the node.
(...skipping 22 matching lines...) Expand all
115 } 112 }
116 113
117 114
118 JSOperatorBuilder* JSContextSpecialization::javascript() const { 115 JSOperatorBuilder* JSContextSpecialization::javascript() const {
119 return jsgraph()->javascript(); 116 return jsgraph()->javascript();
120 } 117 }
121 118
122 } // namespace compiler 119 } // namespace compiler
123 } // namespace internal 120 } // namespace internal
124 } // namespace v8 121 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-frame-specialization.cc » ('j') | src/compiler/js-graph.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698