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 5256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5267 CHECK_EQ(42, value->Int32Value()); | 5267 CHECK_EQ(42, value->Int32Value()); |
5268 templ->SetAccessor(v8_str("externalSymbol722"), | 5268 templ->SetAccessor(v8_str("externalSymbol722"), |
5269 ExternalSymbolGetter, | 5269 ExternalSymbolGetter, |
5270 ExternalSymbolSetter); | 5270 ExternalSymbolSetter); |
5271 context->Global()->Set(v8_str("obj"), templ->NewInstance()); | 5271 context->Global()->Set(v8_str("obj"), templ->NewInstance()); |
5272 value = CompileRun("obj.externalSymbol722"); | 5272 value = CompileRun("obj.externalSymbol722"); |
5273 CHECK_EQ(true, value->BooleanValue()); | 5273 CHECK_EQ(true, value->BooleanValue()); |
5274 value = CompileRun("obj.externalSymbol722 = 42"); | 5274 value = CompileRun("obj.externalSymbol722 = 42"); |
5275 v8::V8::SetExternalSymbolCallback(NULL); | 5275 v8::V8::SetExternalSymbolCallback(NULL); |
5276 } | 5276 } |
| 5277 |
| 5278 |
| 5279 // This test verifies that pre-compilation (aka preparsing) can be called |
| 5280 // without initializing the whole VM. Thus we cannot run this test in a |
| 5281 // multi-threaded setup. |
| 5282 TEST(PreCompile) { |
| 5283 // TODO(155): This test would break without the initialization of V8. This is |
| 5284 // a workaround for now to make this test not fail. |
| 5285 v8::V8::Initialize(); |
| 5286 const char *script = "function foo(a) { return a+1; }"; |
| 5287 v8::ScriptData *sd = v8::ScriptData::PreCompile(script, strlen(script)); |
| 5288 CHECK_NE(sd->Length(), 0); |
| 5289 CHECK_NE(sd->Data(), NULL); |
| 5290 } |
OLD | NEW |