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} | |
49 }); | 48 }); |
50 delete receiver.killMe; | 49 delete receiver.killMe; |
51 assertFalse(%HasFastProperties(receiver)); | 50 assertFalse(%HasFastProperties(receiver)); |
52 | 51 |
53 // The actual function to test, triggering the retrieval of the wrong map. | 52 // The actual function to test, triggering the retrieval of the wrong map. |
54 function callConstantFunctionOnPrototype(obj) { | 53 function callConstantFunctionOnPrototype(obj) { |
55 obj.holderMethod(); | 54 obj.holderMethod(); |
56 } | 55 } |
57 | 56 |
58 callConstantFunctionOnPrototype(receiver); | 57 callConstantFunctionOnPrototype(receiver); |
59 callConstantFunctionOnPrototype(receiver); | 58 callConstantFunctionOnPrototype(receiver); |
60 %OptimizeFunctionOnNextCall(callConstantFunctionOnPrototype); | 59 %OptimizeFunctionOnNextCall(callConstantFunctionOnPrototype); |
61 callConstantFunctionOnPrototype(receiver); | 60 callConstantFunctionOnPrototype(receiver); |
62 | 61 |
63 // Make sure that the function is still optimized. | 62 // Make sure that the function is still optimized. |
64 assertOptimized(callConstantFunctionOnPrototype); | 63 assertOptimized(callConstantFunctionOnPrototype); |
OLD | NEW |