Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: test/cctest/test-serialize.cc

Issue 976623002: Serializer: correctly deal with internal references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed ports, disabled context specialization for serializer Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/compiler.cc ('K') | « src/x87/assembler-x87-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 { 1496 {
1497 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); 1497 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2));
1498 script = v8::ScriptCompiler::CompileUnbound( 1498 script = v8::ScriptCompiler::CompileUnbound(
1499 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); 1499 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache);
1500 } 1500 }
1501 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); 1501 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
1502 CHECK(result->ToString(isolate2)->Equals(v8_str("XY"))); 1502 CHECK(result->ToString(isolate2)->Equals(v8_str("XY")));
1503 } 1503 }
1504 isolate2->Dispose(); 1504 isolate2->Dispose();
1505 } 1505 }
1506
1507
1508 TEST(SerializeInternalReference) {
1509 // Disable experimental natives that are loaded after deserialization.
1510 FLAG_harmony_shipping = false;
1511 FLAG_turbo_asm = true;
1512 FLAG_turbo_deoptimization = false;
1513 FLAG_context_specialization = false;
1514 FLAG_allow_natives_syntax = true;
1515 FlagList::EnforceFlagImplications();
1516
1517 const char* source =
1518 "var foo = (function(stdlib, foreign, heap) {"
1519 " 'use asm';"
Michael Starzinger 2015/03/04 13:43:50 As discussed offline: I don't think we want to tri
1520 " function foo(i) {"
1521 " i = i|0;"
1522 " var j = 0;"
1523 " switch (i) {"
1524 " case 0:"
1525 " case 1: j = 1; break;"
1526 " case 2:"
1527 " case 3: j = 2; break;"
1528 " case 4:"
1529 " case 5: j = 3; break;"
1530 " default: j = 0; break;"
1531 " }"
1532 " return j|0;"
1533 " }"
1534 " return { foo: foo };"
1535 "})(this, {}, undefined).foo;"
1536 "foo(1);"
1537 "%DebugPrint(foo);";
1538
1539 v8::StartupData data = v8::V8::CreateSnapshotDataBlob(source);
1540 CHECK(data.data);
1541
1542 v8::Isolate::CreateParams params;
1543 params.snapshot_blob = &data;
1544 v8::Isolate* isolate = v8::Isolate::New(params);
1545 {
1546 v8::Isolate::Scope i_scope(isolate);
1547 v8::HandleScope h_scope(isolate);
1548 v8::Local<v8::Context> context = v8::Context::New(isolate);
1549 delete[] data.data; // We can dispose of the snapshot blob now.
1550 v8::Context::Scope c_scope(context);
1551 CHECK_EQ(3, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value());
1552 }
1553 isolate->Dispose();
1554 }
OLDNEW
« src/compiler.cc ('K') | « src/x87/assembler-x87-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698