author | sundar |
Wed, 06 May 2015 20:04:42 +0530 | |
changeset 30394 | 72a59e4dffea |
parent 26067 | b32ccc3a76c9 |
child 32698 | 927e0fd20492 |
permissions | -rw-r--r-- |
24777
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
1 |
/* |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
24777
diff
changeset
|
4 |
* |
24777
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
24777
diff
changeset
|
8 |
* |
24777
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
13 |
* accompanied this code). |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
24777
diff
changeset
|
14 |
* |
24777
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
26067
b32ccc3a76c9
8055199: Tidy up Nashorn codebase for code standards (August 2014)
attila
parents:
24777
diff
changeset
|
18 |
* |
24777
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
21 |
* questions. |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
22 |
*/ |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
23 |
|
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
24 |
/** |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
25 |
* JDK-8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
26 |
* |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
27 |
* @test |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
28 |
* @run |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
29 |
*/ |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
30 |
|
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
31 |
__noSuchProperty__ = function(name) { |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
32 |
return 1; |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
33 |
} |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
34 |
|
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
35 |
function func(obj) { |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
36 |
with(obj) { |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
37 |
// this "foo" getter site becomes megamorphic |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
38 |
// due to different 'with' scope objects. |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
39 |
foo; |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
40 |
} |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
41 |
} |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
42 |
|
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
43 |
for (var i = 0; i < 20; i++) { |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
44 |
var obj = {}; |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
45 |
obj.foo = i; |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
46 |
obj[i] = i; |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
47 |
func(obj); |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
48 |
} |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
49 |
|
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
50 |
// pass a 'with' scope object that does not have 'foo'. |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
51 |
// callsite inside func should see __noSuchProperty__ |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
52 |
// hook on global scope object. |
ed1974940ff4
8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
sundar
parents:
diff
changeset
|
53 |
func({}); |