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

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

Issue 2841613002: [compiler][modules] Constant-fold the loads of module cells. (Closed)
Patch Set: Rebase. Created 3 years, 7 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
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/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 417 }
418 break; 418 break;
419 } 419 }
420 } 420 }
421 DCHECK_EQ(1, effect->op()->EffectInputCount()); 421 DCHECK_EQ(1, effect->op()->EffectInputCount());
422 effect = NodeProperties::GetEffectInput(effect); 422 effect = NodeProperties::GetEffectInput(effect);
423 } 423 }
424 } 424 }
425 425
426 // static 426 // static
427 MaybeHandle<Context> NodeProperties::GetSpecializationContext(
428 Node* node, MaybeHandle<Context> context) {
429 switch (node->opcode()) {
430 case IrOpcode::kHeapConstant:
431 return Handle<Context>::cast(OpParameter<Handle<HeapObject>>(node));
432 case IrOpcode::kParameter: {
433 Node* const start = NodeProperties::GetValueInput(node, 0);
434 DCHECK_EQ(IrOpcode::kStart, start->opcode());
435 int const index = ParameterIndexOf(node->op());
436 // The context is always the last parameter to a JavaScript function, and
437 // {Parameter} indices start at -1, so value outputs of {Start} look like
438 // this: closure, receiver, param0, ..., paramN, context.
439 if (index == start->op()->ValueOutputCount() - 2) {
440 return context;
441 }
442 break;
443 }
444 default:
445 break;
446 }
447 return MaybeHandle<Context>();
448 }
449
450
451 // static
452 Node* NodeProperties::GetOuterContext(Node* node, size_t* depth) { 427 Node* NodeProperties::GetOuterContext(Node* node, size_t* depth) {
453 Node* context = NodeProperties::GetContextInput(node); 428 Node* context = NodeProperties::GetContextInput(node);
454 while (*depth > 0 && 429 while (*depth > 0 &&
455 IrOpcode::IsContextChainExtendingOpcode(context->opcode())) { 430 IrOpcode::IsContextChainExtendingOpcode(context->opcode())) {
456 context = NodeProperties::GetContextInput(context); 431 context = NodeProperties::GetContextInput(context);
457 (*depth)--; 432 (*depth)--;
458 } 433 }
459 return context; 434 return context;
460 } 435 }
461 436
(...skipping 16 matching lines...) Expand all
478 // static 453 // static
479 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { 454 bool NodeProperties::IsInputRange(Edge edge, int first, int num) {
480 if (num == 0) return false; 455 if (num == 0) return false;
481 int const index = edge.index(); 456 int const index = edge.index();
482 return first <= index && index < first + num; 457 return first <= index && index < first + num;
483 } 458 }
484 459
485 } // namespace compiler 460 } // namespace compiler
486 } // namespace internal 461 } // namespace internal
487 } // namespace v8 462 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698