OLD | NEW |
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/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // the {receiver} along the {effect}s. | 430 // the {receiver} along the {effect}s. |
431 if (IsSame(receiver, effect)) return kNoReceiverMaps; | 431 if (IsSame(receiver, effect)) return kNoReceiverMaps; |
432 | 432 |
433 // Continue with the next {effect}. | 433 // Continue with the next {effect}. |
434 DCHECK_EQ(1, effect->op()->EffectInputCount()); | 434 DCHECK_EQ(1, effect->op()->EffectInputCount()); |
435 effect = NodeProperties::GetEffectInput(effect); | 435 effect = NodeProperties::GetEffectInput(effect); |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 // static | 439 // static |
440 MaybeHandle<Context> NodeProperties::GetSpecializationContext( | |
441 Node* node, MaybeHandle<Context> context) { | |
442 switch (node->opcode()) { | |
443 case IrOpcode::kHeapConstant: | |
444 return Handle<Context>::cast(OpParameter<Handle<HeapObject>>(node)); | |
445 case IrOpcode::kParameter: { | |
446 Node* const start = NodeProperties::GetValueInput(node, 0); | |
447 DCHECK_EQ(IrOpcode::kStart, start->opcode()); | |
448 int const index = ParameterIndexOf(node->op()); | |
449 // The context is always the last parameter to a JavaScript function, and | |
450 // {Parameter} indices start at -1, so value outputs of {Start} look like | |
451 // this: closure, receiver, param0, ..., paramN, context. | |
452 if (index == start->op()->ValueOutputCount() - 2) { | |
453 return context; | |
454 } | |
455 break; | |
456 } | |
457 default: | |
458 break; | |
459 } | |
460 return MaybeHandle<Context>(); | |
461 } | |
462 | |
463 | |
464 // static | |
465 Node* NodeProperties::GetOuterContext(Node* node, size_t* depth) { | 440 Node* NodeProperties::GetOuterContext(Node* node, size_t* depth) { |
466 Node* context = NodeProperties::GetContextInput(node); | 441 Node* context = NodeProperties::GetContextInput(node); |
467 while (*depth > 0 && | 442 while (*depth > 0 && |
468 IrOpcode::IsContextChainExtendingOpcode(context->opcode())) { | 443 IrOpcode::IsContextChainExtendingOpcode(context->opcode())) { |
469 context = NodeProperties::GetContextInput(context); | 444 context = NodeProperties::GetContextInput(context); |
470 (*depth)--; | 445 (*depth)--; |
471 } | 446 } |
472 return context; | 447 return context; |
473 } | 448 } |
474 | 449 |
(...skipping 16 matching lines...) Expand all Loading... |
491 // static | 466 // static |
492 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { | 467 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { |
493 if (num == 0) return false; | 468 if (num == 0) return false; |
494 int const index = edge.index(); | 469 int const index = edge.index(); |
495 return first <= index && index < first + num; | 470 return first <= index && index < first + num; |
496 } | 471 } |
497 | 472 |
498 } // namespace compiler | 473 } // namespace compiler |
499 } // namespace internal | 474 } // namespace internal |
500 } // namespace v8 | 475 } // namespace v8 |
OLD | NEW |