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

Side by Side Diff: src/compiler/js-graph.cc

Issue 539503002: [turbofan] Initial version of ValueNumberingReducer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Nit and clang-format. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/compiler.gyp ('k') | src/compiler/machine-operator.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-graph.h" 5 #include "src/compiler/js-graph.h"
6 #include "src/compiler/node-properties-inl.h" 6 #include "src/compiler/node-properties-inl.h"
7 #include "src/compiler/typer.h" 7 #include "src/compiler/typer.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Node* JSGraph::HeapConstant(PrintableUnique<Object> value) { 97 Node* JSGraph::HeapConstant(PrintableUnique<Object> value) {
98 // TODO(turbofan): canonicalize heap constants using Unique<T> 98 // TODO(turbofan): canonicalize heap constants using Unique<T>
99 return NewNode(common()->HeapConstant(value)); 99 return NewNode(common()->HeapConstant(value));
100 } 100 }
101 101
102 102
103 Node* JSGraph::HeapConstant(Handle<Object> value) { 103 Node* JSGraph::HeapConstant(Handle<Object> value) {
104 // TODO(titzer): We could also match against the addresses of immortable 104 // TODO(titzer): We could also match against the addresses of immortable
105 // immovables here, even without access to the heap, thus always 105 // immovables here, even without access to the heap, thus always
106 // canonicalizing references to them. 106 // canonicalizing references to them.
107 return HeapConstant( 107 // return HeapConstant(
108 PrintableUnique<Object>::CreateUninitialized(zone(), value)); 108 // PrintableUnique<Object>::CreateUninitialized(zone(), value));
109 // TODO(turbofan): This is a work-around to make Unique::HashCode() work for
110 // value numbering. We need some sane way to compute a unique hash code for
111 // arbitrary handles here.
112 PrintableUnique<Object> unique(
113 zone(), reinterpret_cast<Address>(*value.location()), value);
114 return HeapConstant(unique);
109 } 115 }
110 116
111 117
112 Node* JSGraph::Constant(Handle<Object> value) { 118 Node* JSGraph::Constant(Handle<Object> value) {
113 // Dereference the handle to determine if a number constant or other 119 // Dereference the handle to determine if a number constant or other
114 // canonicalized node can be used. 120 // canonicalized node can be used.
115 if (value->IsNumber()) { 121 if (value->IsNumber()) {
116 return Constant(value->Number()); 122 return Constant(value->Number());
117 } else if (value->IsUndefined()) { 123 } else if (value->IsUndefined()) {
118 return UndefinedConstant(); 124 return UndefinedConstant();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 Node* JSGraph::ExternalConstant(ExternalReference reference) { 180 Node* JSGraph::ExternalConstant(ExternalReference reference) {
175 Node** loc = cache_.FindExternalConstant(reference); 181 Node** loc = cache_.FindExternalConstant(reference);
176 if (*loc == NULL) { 182 if (*loc == NULL) {
177 *loc = NewNode(common()->ExternalConstant(reference)); 183 *loc = NewNode(common()->ExternalConstant(reference));
178 } 184 }
179 return *loc; 185 return *loc;
180 } 186 }
181 } // namespace compiler 187 } // namespace compiler
182 } // namespace internal 188 } // namespace internal
183 } // namespace v8 189 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/compiler.gyp ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698