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 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 v8::ScriptCompiler::CompileUnbound(isolate2, &source, | 1381 v8::ScriptCompiler::CompileUnbound(isolate2, &source, |
1382 v8::ScriptCompiler::kConsumeCodeCache); | 1382 v8::ScriptCompiler::kConsumeCodeCache); |
1383 CHECK(cache->rejected); | 1383 CHECK(cache->rejected); |
1384 } | 1384 } |
1385 isolate2->Dispose(); | 1385 isolate2->Dispose(); |
1386 } | 1386 } |
1387 | 1387 |
1388 | 1388 |
1389 TEST(SerializeWithHarmonyScoping) { | 1389 TEST(SerializeWithHarmonyScoping) { |
1390 FLAG_serialize_toplevel = true; | 1390 FLAG_serialize_toplevel = true; |
1391 FLAG_harmony_scoping = true; | |
1392 | 1391 |
1393 const char* source1 = "'use strict'; let x = 'X'"; | 1392 const char* source1 = "'use strict'; let x = 'X'"; |
1394 const char* source2 = "'use strict'; let y = 'Y'"; | 1393 const char* source2 = "'use strict'; let y = 'Y'"; |
1395 const char* source3 = "'use strict'; x + y"; | 1394 const char* source3 = "'use strict'; x + y"; |
1396 | 1395 |
1397 v8::ScriptCompiler::CachedData* cache; | 1396 v8::ScriptCompiler::CachedData* cache; |
1398 | 1397 |
1399 v8::Isolate* isolate1 = v8::Isolate::New(); | 1398 v8::Isolate* isolate1 = v8::Isolate::New(); |
1400 { | 1399 { |
1401 v8::Isolate::Scope iscope(isolate1); | 1400 v8::Isolate::Scope iscope(isolate1); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 v8::Local<v8::Context> context = v8::Context::New(isolate); | 1490 v8::Local<v8::Context> context = v8::Context::New(isolate); |
1492 delete[] data.data; // We can dispose of the snapshot blob now. | 1491 delete[] data.data; // We can dispose of the snapshot blob now. |
1493 v8::Context::Scope c_scope(context); | 1492 v8::Context::Scope c_scope(context); |
1494 v8::Handle<v8::Function> foo = | 1493 v8::Handle<v8::Function> foo = |
1495 v8::Handle<v8::Function>::Cast(CompileRun("foo")); | 1494 v8::Handle<v8::Function>::Cast(CompileRun("foo")); |
1496 CHECK(v8::Utils::OpenHandle(*foo)->code()->is_turbofanned()); | 1495 CHECK(v8::Utils::OpenHandle(*foo)->code()->is_turbofanned()); |
1497 CHECK_EQ(3, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value()); | 1496 CHECK_EQ(3, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value()); |
1498 } | 1497 } |
1499 isolate->Dispose(); | 1498 isolate->Dispose(); |
1500 } | 1499 } |
OLD | NEW |