OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 5303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5314 // multi-threaded setup. | 5314 // multi-threaded setup. |
5315 TEST(PreCompile) { | 5315 TEST(PreCompile) { |
5316 // TODO(155): This test would break without the initialization of V8. This is | 5316 // TODO(155): This test would break without the initialization of V8. This is |
5317 // a workaround for now to make this test not fail. | 5317 // a workaround for now to make this test not fail. |
5318 v8::V8::Initialize(); | 5318 v8::V8::Initialize(); |
5319 const char *script = "function foo(a) { return a+1; }"; | 5319 const char *script = "function foo(a) { return a+1; }"; |
5320 v8::ScriptData *sd = v8::ScriptData::PreCompile(script, strlen(script)); | 5320 v8::ScriptData *sd = v8::ScriptData::PreCompile(script, strlen(script)); |
5321 CHECK_NE(sd->Length(), 0); | 5321 CHECK_NE(sd->Length(), 0); |
5322 CHECK_NE(sd->Data(), NULL); | 5322 CHECK_NE(sd->Data(), NULL); |
5323 } | 5323 } |
| 5324 |
| 5325 |
| 5326 // This tests that we do not allow dictionary load/call inline caches |
| 5327 // to use functions that have not yet been compiled. The potential |
| 5328 // problem of loading a function that has not yet been compiled can |
| 5329 // arise because we share code between contexts via the compilation |
| 5330 // cache. |
| 5331 THREADED_TEST(DictionaryICLoadedFunction) { |
| 5332 v8::HandleScope scope; |
| 5333 // Test LoadIC. |
| 5334 for (int i = 0; i < 2; i++) { |
| 5335 LocalContext context; |
| 5336 context->Global()->Set(v8_str("tmp"), v8::True()); |
| 5337 context->Global()->Delete(v8_str("tmp")); |
| 5338 CompileRun("for (var j = 0; j < 10; j++) new RegExp('');"); |
| 5339 } |
| 5340 // Test CallIC. |
| 5341 for (int i = 0; i < 2; i++) { |
| 5342 LocalContext context; |
| 5343 context->Global()->Set(v8_str("tmp"), v8::True()); |
| 5344 context->Global()->Delete(v8_str("tmp")); |
| 5345 CompileRun("for (var j = 0; j < 10; j++) RegExp('')"); |
| 5346 } |
| 5347 } |
OLD | NEW |