OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 } | 1365 } |
1366 | 1366 |
1367 | 1367 |
1368 TEST(SerializeToplevelFlagChange) { | 1368 TEST(SerializeToplevelFlagChange) { |
1369 FLAG_serialize_toplevel = true; | 1369 FLAG_serialize_toplevel = true; |
1370 | 1370 |
1371 const char* source = "function f() { return 'abc'; }; f() + 'def'"; | 1371 const char* source = "function f() { return 'abc'; }; f() + 'def'"; |
1372 v8::ScriptCompiler::CachedData* cache = ProduceCache(source); | 1372 v8::ScriptCompiler::CachedData* cache = ProduceCache(source); |
1373 | 1373 |
1374 v8::Isolate* isolate2 = v8::Isolate::New(); | 1374 v8::Isolate* isolate2 = v8::Isolate::New(); |
| 1375 |
1375 FLAG_allow_natives_syntax = true; // Flag change should trigger cache reject. | 1376 FLAG_allow_natives_syntax = true; // Flag change should trigger cache reject. |
| 1377 FlagList::EnforceFlagImplications(); |
1376 { | 1378 { |
1377 v8::Isolate::Scope iscope(isolate2); | 1379 v8::Isolate::Scope iscope(isolate2); |
1378 v8::HandleScope scope(isolate2); | 1380 v8::HandleScope scope(isolate2); |
1379 v8::Local<v8::Context> context = v8::Context::New(isolate2); | 1381 v8::Local<v8::Context> context = v8::Context::New(isolate2); |
1380 v8::Context::Scope context_scope(context); | 1382 v8::Context::Scope context_scope(context); |
1381 | 1383 |
1382 v8::Local<v8::String> source_str = v8_str(source); | 1384 v8::Local<v8::String> source_str = v8_str(source); |
1383 v8::ScriptOrigin origin(v8_str("test")); | 1385 v8::ScriptOrigin origin(v8_str("test")); |
1384 v8::ScriptCompiler::Source source(source_str, origin, cache); | 1386 v8::ScriptCompiler::Source source(source_str, origin, cache); |
1385 v8::ScriptCompiler::CompileUnbound(isolate2, &source, | 1387 v8::ScriptCompiler::CompileUnbound(isolate2, &source, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 v8::Local<v8::Context> context = v8::Context::New(isolate); | 1523 v8::Local<v8::Context> context = v8::Context::New(isolate); |
1522 delete[] data.data; // We can dispose of the snapshot blob now. | 1524 delete[] data.data; // We can dispose of the snapshot blob now. |
1523 v8::Context::Scope c_scope(context); | 1525 v8::Context::Scope c_scope(context); |
1524 v8::Handle<v8::Function> foo = | 1526 v8::Handle<v8::Function> foo = |
1525 v8::Handle<v8::Function>::Cast(CompileRun("foo")); | 1527 v8::Handle<v8::Function>::Cast(CompileRun("foo")); |
1526 CHECK(v8::Utils::OpenHandle(*foo)->code()->is_turbofanned()); | 1528 CHECK(v8::Utils::OpenHandle(*foo)->code()->is_turbofanned()); |
1527 CHECK_EQ(3, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value()); | 1529 CHECK_EQ(3, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value()); |
1528 } | 1530 } |
1529 isolate->Dispose(); | 1531 isolate->Dispose(); |
1530 } | 1532 } |
OLD | NEW |