Skip to content

Commit 52a9e67

Browse files
jaro-sevcikCommit Bot
authored andcommitted
[turbofan] Fix ObjectCreate's side effect annotation.
Bug: chromium:888923 Change-Id: Ifb22cd9b34f53de3cf6e47cd92f3c0abeb10ac79 Reviewed-on: https://chromium-review.googlesource.com/1245763 Reviewed-by: Benedikt Meurer <[email protected]> Commit-Queue: Jaroslav Sevcik <[email protected]> Cr-Commit-Position: refs/heads/master@{#56236}
1 parent 568979f commit 52a9e67

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

src/compiler/js-operator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) {
622622
V(CreateKeyValueArray, Operator::kEliminatable, 2, 1) \
623623
V(CreatePromise, Operator::kEliminatable, 0, 1) \
624624
V(CreateTypedArray, Operator::kNoProperties, 5, 1) \
625-
V(CreateObject, Operator::kNoWrite, 1, 1) \
625+
V(CreateObject, Operator::kNoProperties, 1, 1) \
626626
V(ObjectIsArray, Operator::kNoProperties, 1, 1) \
627627
V(HasProperty, Operator::kNoProperties, 2, 1) \
628628
V(HasInPrototypeChain, Operator::kNoProperties, 2, 1) \
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2018 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() {
8+
function f(o) {
9+
o.x;
10+
Object.create(o);
11+
return o.y.a;
12+
}
13+
14+
f({ x : 0, y : { a : 1 } });
15+
f({ x : 0, y : { a : 2 } });
16+
%OptimizeFunctionOnNextCall(f);
17+
assertEquals(3, f({ x : 0, y : { a : 3 } }));
18+
})();
19+
20+
(function() {
21+
function f(o) {
22+
let a = o.y;
23+
Object.create(o);
24+
return o.x + a;
25+
}
26+
27+
f({ x : 42, y : 21 });
28+
f({ x : 42, y : 21 });
29+
%OptimizeFunctionOnNextCall(f);
30+
assertEquals(63, f({ x : 42, y : 21 }));
31+
})();

0 commit comments

Comments
 (0)