| 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 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 function new_object() { | 37 function new_object() { |
| 38 var o = {}; | 38 var o = {}; |
| 39 o.a = 1; | 39 o.a = 1; |
| 40 o.b = 2; | 40 o.b = 2; |
| 41 return o; | 41 return o; |
| 42 } | 42 } |
| 43 | 43 |
| 44 function add_field(obj) { | 44 function add_field(obj) { |
| 45 // Assign twice to make the field non-constant. |
| 46 // TODO(ishell): update test once constant field tracking is done. |
| 47 obj.c = 0; |
| 45 obj.c = 3; | 48 obj.c = 3; |
| 46 } | 49 } |
| 47 var obj1 = new_object(); | 50 var obj1 = new_object(); |
| 48 var obj2 = new_object(); | 51 var obj2 = new_object(); |
| 49 add_field(obj1); | 52 add_field(obj1); |
| 50 add_field(obj2); | 53 add_field(obj2); |
| 51 %OptimizeFunctionOnNextCall(add_field, "concurrent"); | 54 %OptimizeFunctionOnNextCall(add_field, "concurrent"); |
| 52 | 55 |
| 53 var o = new_object(); | 56 var o = new_object(); |
| 54 // Kick off recompilation. | 57 // Kick off recompilation. |
| 55 add_field(o); | 58 add_field(o); |
| 56 // Invalidate transition map after compile graph has been created. | 59 // Invalidate transition map after compile graph has been created. |
| 57 o.c = 2.2; | 60 o.c = 2.2; |
| 58 // In the mean time, concurrent recompiling is still blocked. | 61 // In the mean time, concurrent recompiling is still blocked. |
| 59 assertUnoptimized(add_field, "no sync"); | 62 assertUnoptimized(add_field, "no sync"); |
| 60 // Let concurrent recompilation proceed. | 63 // Let concurrent recompilation proceed. |
| 61 %UnblockConcurrentRecompilation(); | 64 %UnblockConcurrentRecompilation(); |
| 62 // Sync with background thread to conclude optimization that bailed out. | 65 // Sync with background thread to conclude optimization that bailed out. |
| 63 assertUnoptimized(add_field, "sync"); | 66 assertUnoptimized(add_field, "sync"); |
| 64 // Clear type info for stress runs. | 67 // Clear type info for stress runs. |
| 65 %ClearFunctionTypeFeedback(add_field); | 68 %ClearFunctionTypeFeedback(add_field); |
| OLD | NEW |