| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } else { | 51 } else { |
| 52 assertUnreachable('Unexpected type ' + scripts[i].type); | 52 assertUnreachable('Unexpected type ' + scripts[i].type); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 // This has to be updated if the number of native scripts change. | 56 // This has to be updated if the number of native scripts change. |
| 57 assertEquals(12, native_count); | 57 assertEquals(12, native_count); |
| 58 // If no snapshot is used, only the 'gc' extension is loaded. | 58 // If no snapshot is used, only the 'gc' extension is loaded. |
| 59 // If snapshot is used, all extensions are cached in the snapshot. | 59 // If snapshot is used, all extensions are cached in the snapshot. |
| 60 assertTrue(extension_count == 1 || extension_count == 5); | 60 assertTrue(extension_count == 1 || extension_count == 5); |
| 61 assertEquals(2, normal_count); // This script and mjsunit.js. | 61 // This script and mjsunit.js has been loaded. If using d8, d8 loads |
| 62 // a normal script during startup too. |
| 63 assertTrue(normal_count == 2 || normal_count == 3); |
| 62 | 64 |
| 63 // Test a builtins script. | 65 // Test a builtins script. |
| 64 var math_script = Debug.findScript('native math.js'); | 66 var math_script = Debug.findScript('native math.js'); |
| 65 assertEquals('native math.js', math_script.name); | 67 assertEquals('native math.js', math_script.name); |
| 66 assertEquals(Debug.ScriptType.Native, math_script.type); | 68 assertEquals(Debug.ScriptType.Native, math_script.type); |
| 67 | 69 |
| 68 // Test a builtins delay loaded script. | 70 // Test a builtins delay loaded script. |
| 69 var date_delay_script = Debug.findScript('native date.js'); | 71 var date_delay_script = Debug.findScript('native date.js'); |
| 70 assertEquals('native date.js', date_delay_script.name); | 72 assertEquals('native date.js', date_delay_script.name); |
| 71 assertEquals(Debug.ScriptType.Native, date_delay_script.type); | 73 assertEquals(Debug.ScriptType.Native, date_delay_script.type); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 83 } | 85 } |
| 84 | 86 |
| 85 // Test a normal script. | 87 // Test a normal script. |
| 86 var mjsunit_js_script = Debug.findScript(/mjsunit.js/); | 88 var mjsunit_js_script = Debug.findScript(/mjsunit.js/); |
| 87 assertTrue(/mjsunit.js/.test(mjsunit_js_script.name)); | 89 assertTrue(/mjsunit.js/.test(mjsunit_js_script.name)); |
| 88 assertEquals(Debug.ScriptType.Normal, mjsunit_js_script.type); | 90 assertEquals(Debug.ScriptType.Normal, mjsunit_js_script.type); |
| 89 | 91 |
| 90 // Check a nonexistent script. | 92 // Check a nonexistent script. |
| 91 var dummy_script = Debug.findScript('dummy.js'); | 93 var dummy_script = Debug.findScript('dummy.js'); |
| 92 assertTrue(typeof dummy_script == 'undefined'); | 94 assertTrue(typeof dummy_script == 'undefined'); |
| OLD | NEW |