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

Side by Side Diff: vm/snapshot_test.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_message.h" 10 #include "vm/dart_api_message.h"
11 #include "vm/dart_api_state.h" 11 #include "vm/dart_api_state.h"
12 #include "vm/snapshot.h" 12 #include "vm/snapshot.h"
13 #include "vm/symbols.h"
13 #include "vm/unit_test.h" 14 #include "vm/unit_test.h"
14 15
15 namespace dart { 16 namespace dart {
16 17
17 // Check if serialized and deserialized objects are equal. 18 // Check if serialized and deserialized objects are equal.
18 static bool Equals(const Object& expected, const Object& actual) { 19 static bool Equals(const Object& expected, const Object& actual) {
19 if (expected.IsNull()) { 20 if (expected.IsNull()) {
20 return actual.IsNull(); 21 return actual.IsNull();
21 } 22 }
22 if (expected.IsSmi()) { 23 if (expected.IsSmi()) {
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 " static fly() { return 5; }\n" 723 " static fly() { return 5; }\n"
723 " static s1() { return 'this is a string in the source'; }\n" 724 " static s1() { return 'this is a string in the source'; }\n"
724 " static s2() { return 'this is a \"string\" in the source'; }\n" 725 " static s2() { return 'this is a \"string\" in the source'; }\n"
725 " static s3() { return 'this is a \\\'string\\\' in \"the\" source'; }\n" 726 " static s3() { return 'this is a \\\'string\\\' in \"the\" source'; }\n"
726 " static s4() { return 'this \"is\" a \"string\" in \"the\" source'; }\n" 727 " static s4() { return 'this \"is\" a \"string\" in \"the\" source'; }\n"
727 "}\n"; 728 "}\n";
728 729
729 String& url = String::Handle(String::New("dart-test:SerializeScript")); 730 String& url = String::Handle(String::New("dart-test:SerializeScript"));
730 String& source = String::Handle(String::New(kScriptChars)); 731 String& source = String::Handle(String::New(kScriptChars));
731 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); 732 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource));
732 const String& lib_url = String::Handle(String::NewSymbol("TestLib")); 733 const String& lib_url = String::Handle(Symbols::New("TestLib"));
733 Library& lib = Library::Handle(Library::New(lib_url)); 734 Library& lib = Library::Handle(Library::New(lib_url));
734 lib.Register(); 735 lib.Register();
735 EXPECT(CompilerTest::TestCompileScript(lib, script)); 736 EXPECT(CompilerTest::TestCompileScript(lib, script));
736 737
737 // Write snapshot with object content. 738 // Write snapshot with object content.
738 uint8_t* buffer; 739 uint8_t* buffer;
739 SnapshotWriter writer(Snapshot::kScript, &buffer, &malloc_allocator); 740 SnapshotWriter writer(Snapshot::kScript, &buffer, &malloc_allocator);
740 writer.WriteObject(script.raw()); 741 writer.WriteObject(script.raw());
741 writer.FinalizeBuffer(); 742 writer.FinalizeBuffer();
742 743
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 EXPECT(Dart_ErrorHasException(result)); 1561 EXPECT(Dart_ErrorHasException(result));
1561 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", 1562 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n",
1562 Dart_GetError(result)); 1563 Dart_GetError(result));
1563 1564
1564 Dart_ExitScope(); 1565 Dart_ExitScope();
1565 } 1566 }
1566 1567
1567 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 1568 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
1568 1569
1569 } // namespace dart 1570 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698