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

Side by Side Diff: src/compiler/node-properties.cc

Issue 2635243002: [turbofan] Refactor IsSame into NodeProperties. (Closed)
Patch Set: Update. Created 3 years, 11 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/node-properties.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/node-properties.h" 5 #include "src/compiler/node-properties.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DCHECK_NULL(projections[index]); 305 DCHECK_NULL(projections[index]);
306 projections[index] = use; 306 projections[index] = use;
307 } 307 }
308 #ifdef DEBUG 308 #ifdef DEBUG
309 for (size_t index = 0; index < projection_count; ++index) { 309 for (size_t index = 0; index < projection_count; ++index) {
310 DCHECK_NOT_NULL(projections[index]); 310 DCHECK_NOT_NULL(projections[index]);
311 } 311 }
312 #endif 312 #endif
313 } 313 }
314 314
315 // static
316 bool NodeProperties::IsSame(Node* a, Node* b) {
317 for (;;) {
318 if (a->opcode() == IrOpcode::kCheckHeapObject) {
319 a = GetValueInput(a, 0);
320 continue;
321 }
322 if (b->opcode() == IrOpcode::kCheckHeapObject) {
323 b = GetValueInput(b, 0);
324 continue;
325 }
326 return a == b;
327 }
328 }
315 329
316 // static 330 // static
317 MaybeHandle<Context> NodeProperties::GetSpecializationContext( 331 MaybeHandle<Context> NodeProperties::GetSpecializationContext(
318 Node* node, MaybeHandle<Context> context) { 332 Node* node, MaybeHandle<Context> context) {
319 switch (node->opcode()) { 333 switch (node->opcode()) {
320 case IrOpcode::kHeapConstant: 334 case IrOpcode::kHeapConstant:
321 return Handle<Context>::cast(OpParameter<Handle<HeapObject>>(node)); 335 return Handle<Context>::cast(OpParameter<Handle<HeapObject>>(node));
322 case IrOpcode::kParameter: { 336 case IrOpcode::kParameter: {
323 Node* const start = NodeProperties::GetValueInput(node, 0); 337 Node* const start = NodeProperties::GetValueInput(node, 0);
324 DCHECK_EQ(IrOpcode::kStart, start->opcode()); 338 DCHECK_EQ(IrOpcode::kStart, start->opcode());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // static 382 // static
369 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { 383 bool NodeProperties::IsInputRange(Edge edge, int first, int num) {
370 if (num == 0) return false; 384 if (num == 0) return false;
371 int const index = edge.index(); 385 int const index = edge.index();
372 return first <= index && index < first + num; 386 return first <= index && index < first + num;
373 } 387 }
374 388
375 } // namespace compiler 389 } // namespace compiler
376 } // namespace internal 390 } // namespace internal
377 } // namespace v8 391 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node-properties.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698