Skip to content

Commit 6646d73

Browse files
bmeurerCommit bot
authored andcommitted
[turbofan] Use ObjectIsReceiver directly for inlining.
Don't bother using %_IsJSReceiver, which immediately gets lowered to ObjectIsReceiver anyways (by the JSIntrinsicLowering), but requires some complicated rewiring of effect/control chains. [email protected] BUG=chromium:640369 Review-Url: https://codereview.chromium.org/2271973003 Cr-Commit-Position: refs/heads/master@{#38864}
1 parent ce13866 commit 6646d73

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

src/compiler/js-inlining.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "src/compiler/node-matchers.h"
1717
#include "src/compiler/node-properties.h"
1818
#include "src/compiler/operator-properties.h"
19+
#include "src/compiler/simplified-operator.h"
1920
#include "src/compiler/type-hint-analyzer.h"
2021
#include "src/isolate-inl.h"
2122
#include "src/parsing/parse-info.h"
@@ -435,20 +436,15 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
435436
NodeProperties::ReplaceEffectInput(node, create);
436437
// Insert a check of the return value to determine whether the return
437438
// value or the implicit receiver should be selected as a result of the
438-
// call. The check is wired into the successful control completion.
439-
Node* success = graph()->NewNode(common()->IfSuccess(), node);
440-
Node* check = graph()->NewNode(
441-
javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), node,
442-
context, node, success);
439+
// call.
440+
Node* check = graph()->NewNode(simplified()->ObjectIsReceiver(), node);
443441
Node* select =
444442
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
445443
check, node, create);
446-
NodeProperties::ReplaceUses(node, select, check, check, node);
444+
NodeProperties::ReplaceUses(node, select, node, node, node);
447445
// Fix-up inputs that have been mangled by the {ReplaceUses} call above.
448446
NodeProperties::ReplaceValueInput(select, node, 1); // Fix-up input.
449447
NodeProperties::ReplaceValueInput(check, node, 0); // Fix-up input.
450-
NodeProperties::ReplaceEffectInput(check, node); // Fix-up input.
451-
NodeProperties::ReplaceControlInput(success, node); // Fix-up input.
452448
receiver = create; // The implicit receiver.
453449
}
454450

@@ -527,6 +523,10 @@ JSOperatorBuilder* JSInliner::javascript() const {
527523

528524
CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); }
529525

526+
SimplifiedOperatorBuilder* JSInliner::simplified() const {
527+
return jsgraph()->simplified();
528+
}
529+
530530
} // namespace compiler
531531
} // namespace internal
532532
} // namespace v8

src/compiler/js-inlining.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class JSInliner final : public AdvancedReducer {
3838
private:
3939
CommonOperatorBuilder* common() const;
4040
JSOperatorBuilder* javascript() const;
41+
SimplifiedOperatorBuilder* simplified() const;
4142
Graph* graph() const;
4243
JSGraph* jsgraph() const { return jsgraph_; }
4344

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax
6+
7+
function A() {
8+
this.x = 0;
9+
for (var i = 0; i < max; ) {}
10+
}
11+
function foo() {
12+
for (var i = 0; i < 1; i = 2) %OptimizeOsr();
13+
return new A();
14+
}
15+
try { foo(); } catch (e) { }

0 commit comments

Comments
 (0)