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

Side by Side Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1146963002: Add %GetCallerJSFunction intrinsic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 6 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/js-intrinsic-lowering.h ('k') | src/compiler/linkage.cc » ('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 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/js-intrinsic-lowering.h" 5 #include "src/compiler/js-intrinsic-lowering.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "src/compiler/access-builder.h" 9 #include "src/compiler/access-builder.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 case Runtime::kInlineUnlikely: 77 case Runtime::kInlineUnlikely:
78 return ReduceUnLikely(node, BranchHint::kFalse); 78 return ReduceUnLikely(node, BranchHint::kFalse);
79 case Runtime::kInlineValueOf: 79 case Runtime::kInlineValueOf:
80 return ReduceValueOf(node); 80 return ReduceValueOf(node);
81 case Runtime::kInlineIsMinusZero: 81 case Runtime::kInlineIsMinusZero:
82 return ReduceIsMinusZero(node); 82 return ReduceIsMinusZero(node);
83 case Runtime::kInlineFixedArraySet: 83 case Runtime::kInlineFixedArraySet:
84 return ReduceFixedArraySet(node); 84 return ReduceFixedArraySet(node);
85 case Runtime::kInlineGetTypeFeedbackVector: 85 case Runtime::kInlineGetTypeFeedbackVector:
86 return ReduceGetTypeFeedbackVector(node); 86 return ReduceGetTypeFeedbackVector(node);
87 case Runtime::kInlineGetCallerJSFunction:
88 return ReduceGetCallerJSFunction(node);
87 default: 89 default:
88 break; 90 break;
89 } 91 }
90 return NoChange(); 92 return NoChange();
91 } 93 }
92 94
93 95
94 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { 96 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) {
95 Node* high = NodeProperties::GetValueInput(node, 0); 97 Node* high = NodeProperties::GetValueInput(node, 0);
96 Node* low = NodeProperties::GetValueInput(node, 1); 98 Node* low = NodeProperties::GetValueInput(node, 1);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 Node* effect = NodeProperties::GetEffectInput(node); 450 Node* effect = NodeProperties::GetEffectInput(node);
449 Node* control = NodeProperties::GetControlInput(node); 451 Node* control = NodeProperties::GetControlInput(node);
450 FieldAccess access = AccessBuilder::ForJSFunctionSharedFunctionInfo(); 452 FieldAccess access = AccessBuilder::ForJSFunctionSharedFunctionInfo();
451 Node* load = 453 Node* load =
452 graph()->NewNode(simplified()->LoadField(access), func, effect, control); 454 graph()->NewNode(simplified()->LoadField(access), func, effect, control);
453 access = AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector(); 455 access = AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector();
454 return Change(node, simplified()->LoadField(access), load, load, control); 456 return Change(node, simplified()->LoadField(access), load, load, control);
455 } 457 }
456 458
457 459
460 Reduction JSIntrinsicLowering::ReduceGetCallerJSFunction(Node* node) {
461 Node* effect = NodeProperties::GetEffectInput(node);
462 Node* control = NodeProperties::GetControlInput(node);
463
464 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0);
465 Node* outer_frame = frame_state->InputAt(kFrameStateOuterStateInput);
466 if (outer_frame->opcode() == IrOpcode::kFrameState) {
467 // Use the runtime implementation to throw the appropriate error if the
468 // containing function is inlined.
469 return NoChange();
470 }
471
472 // TODO(danno): This implementation forces intrinsic lowering to happen after
473 // inlining, which is fine for now, but eventually the frame-querying logic
474 // probably should go later, e.g. in instruction selection, so that there is
475 // no phase-ordering dependency.
476 FieldAccess access = AccessBuilder::ForFrameCallerFramePtr();
477 Node* fp = graph()->NewNode(machine()->LoadFramePointer());
478 Node* next_fp =
479 graph()->NewNode(simplified()->LoadField(access), fp, effect, control);
480 return Change(node, simplified()->LoadField(AccessBuilder::ForFrameMarker()),
481 next_fp, effect, control);
482 }
483
484
458 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, 485 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
459 Node* b) { 486 Node* b) {
460 node->set_op(op); 487 node->set_op(op);
461 node->ReplaceInput(0, a); 488 node->ReplaceInput(0, a);
462 node->ReplaceInput(1, b); 489 node->ReplaceInput(1, b);
463 node->TrimInputCount(2); 490 node->TrimInputCount(2);
464 RelaxControls(node); 491 RelaxControls(node);
465 return Changed(node); 492 return Changed(node);
466 } 493 }
467 494
(...skipping 24 matching lines...) Expand all
492 } 519 }
493 520
494 521
495 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { 522 MachineOperatorBuilder* JSIntrinsicLowering::machine() const {
496 return jsgraph()->machine(); 523 return jsgraph()->machine();
497 } 524 }
498 525
499 } // namespace compiler 526 } // namespace compiler
500 } // namespace internal 527 } // namespace internal
501 } // namespace v8 528 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698