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

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: Tweaks 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
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 if (FLAG_turbo_deoptimization) {
Michael Starzinger 2015/06/05 11:21:56 This flag no longer exists, we can just perform th
danno 2015/06/05 11:49:59 Done.
465 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0);
466 Node* outer_frame = frame_state->InputAt(kFrameStateOuterStateInput);
467 if (outer_frame->opcode() == IrOpcode::kFrameState) {
468 // Use the runtime implementation to throw the appropriate error if the
469 // containing function is inlined.
470 return NoChange();
471 }
472 }
473
474 // TODO(danno): If FLAG_turbo_deoptimization is false then this intrinsic
475 // always returns the JSFunction from the caller's frame, regardless of
476 // inlining depth, which isn't correct. This implementation also forces
477 // intrinsic lowering to happen after inlining, which is fine for now, but
478 // eventually the frame-querying logic probably should go later, e.g. in
479 // instruction selection, so that there is no phase-ordering dependency.
Michael Starzinger 2015/06/05 11:21:56 nit: The TODO now no longer applies, correct?
danno 2015/06/05 11:49:59 Sort of. The inlining ordering dependency still ex
480 FieldAccess access = AccessBuilder::ForFrameCallerFramePtr();
481 Node* fp = graph()->NewNode(machine()->LoadFramePointer());
482 Node* next_fp =
483 graph()->NewNode(simplified()->LoadField(access), fp, effect, control);
484 return Change(node, simplified()->LoadField(AccessBuilder::ForFrameMarker()),
485 next_fp, effect, control);
486 }
487
488
458 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, 489 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
459 Node* b) { 490 Node* b) {
460 node->set_op(op); 491 node->set_op(op);
461 node->ReplaceInput(0, a); 492 node->ReplaceInput(0, a);
462 node->ReplaceInput(1, b); 493 node->ReplaceInput(1, b);
463 node->TrimInputCount(2); 494 node->TrimInputCount(2);
464 RelaxControls(node); 495 RelaxControls(node);
465 return Changed(node); 496 return Changed(node);
466 } 497 }
467 498
(...skipping 24 matching lines...) Expand all
492 } 523 }
493 524
494 525
495 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { 526 MachineOperatorBuilder* JSIntrinsicLowering::machine() const {
496 return jsgraph()->machine(); 527 return jsgraph()->machine();
497 } 528 }
498 529
499 } // namespace compiler 530 } // namespace compiler
500 } // namespace internal 531 } // namespace internal
501 } // namespace v8 532 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698