OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // We assume dict usage for null prototype. | 39 // We assume dict usage for null prototype. |
40 var holder = Object.create(null, { | 40 var holder = Object.create(null, { |
41 holderMethod: {value: function() {}} | 41 holderMethod: {value: function() {}} |
42 }); | 42 }); |
43 assertFalse(%HasFastProperties(holder)); | 43 assertFalse(%HasFastProperties(holder)); |
44 | 44 |
45 // Create a receiver into dictionary mode. | 45 // Create a receiver into dictionary mode. |
46 var receiver = Object.create(holder, { | 46 var receiver = Object.create(holder, { |
47 killMe: {value: 0, configurable: true}, | 47 killMe: {value: 0, configurable: true}, |
| 48 keepMe: {value: 0, configurable: true} |
48 }); | 49 }); |
49 delete receiver.killMe; | 50 delete receiver.killMe; |
50 assertFalse(%HasFastProperties(receiver)); | 51 assertFalse(%HasFastProperties(receiver)); |
51 | 52 |
52 // The actual function to test, triggering the retrieval of the wrong map. | 53 // The actual function to test, triggering the retrieval of the wrong map. |
53 function callConstantFunctionOnPrototype(obj) { | 54 function callConstantFunctionOnPrototype(obj) { |
54 obj.holderMethod(); | 55 obj.holderMethod(); |
55 } | 56 } |
56 | 57 |
57 callConstantFunctionOnPrototype(receiver); | 58 callConstantFunctionOnPrototype(receiver); |
58 callConstantFunctionOnPrototype(receiver); | 59 callConstantFunctionOnPrototype(receiver); |
59 %OptimizeFunctionOnNextCall(callConstantFunctionOnPrototype); | 60 %OptimizeFunctionOnNextCall(callConstantFunctionOnPrototype); |
60 callConstantFunctionOnPrototype(receiver); | 61 callConstantFunctionOnPrototype(receiver); |
61 | 62 |
62 // Make sure that the function is still optimized. | 63 // Make sure that the function is still optimized. |
63 assertOptimized(callConstantFunctionOnPrototype); | 64 assertOptimized(callConstantFunctionOnPrototype); |
OLD | NEW |