-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Writing to proto can leave the TypeHandler::protoCachesWereInvalidate…
…d set, and writing to proto again with the same type on the RHS object can skip proto cache invalidation
- Loading branch information
Showing
3 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
function f1() { | ||
var o1 = {},o2 = {}; | ||
var proto1 = {a:'a',b:'b'},proto2 = {a:'a'}; | ||
o1.__proto__ = proto1; | ||
o2.__proto__ = proto2; | ||
|
||
function a(o) { return o.a; } | ||
function b(o) { return o.b; } | ||
|
||
a(o1); | ||
a(o2); | ||
b(o1); | ||
b(o2); | ||
proto2.__proto__ = {b:'b'}; | ||
if (b(o2) !== 'b') { | ||
WScript.Echo('fail'); | ||
} | ||
} | ||
|
||
f1() | ||
f1(); | ||
|
||
function f2() { | ||
var o1 = {b:'b'},o2 = {b:'b'}; | ||
var proto1 = {a:'a',b:'b'},proto2 = {a:'a'}; | ||
o1.__proto__ = proto1; | ||
o2.__proto__ = proto2; | ||
|
||
function a(o) { return o.a; } | ||
function b(o) { return o.b; } | ||
|
||
a(o1); | ||
a(o2); | ||
|
||
delete o1.b; | ||
delete o2.b; | ||
|
||
b(o1); | ||
b(o2); | ||
proto2.__proto__ = {b:'b'}; | ||
if (b(o2) !== 'b') { | ||
WScript.Echo('fail'); | ||
} | ||
} | ||
|
||
f2(); | ||
f2(); | ||
|
||
WScript.Echo('pass'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters