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

Side by Side Diff: vm/snapshot_test.cc

Issue 8772061: First step towards generation of application script snapshots (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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
« no previous file with comments | « vm/snapshot.cc ('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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 26 matching lines...) Expand all
37 37
38 38
39 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { 39 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
40 return reinterpret_cast<uint8_t*>(realloc(ptr, new_size)); 40 return reinterpret_cast<uint8_t*>(realloc(ptr, new_size));
41 } 41 }
42 42
43 43
44 TEST_CASE(SerializeNull) { 44 TEST_CASE(SerializeNull) {
45 // Write snapshot with object content. 45 // Write snapshot with object content.
46 uint8_t* buffer; 46 uint8_t* buffer;
47 SnapshotWriter writer(false, &buffer, &allocator); 47 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
48 const Object& null_object = Object::Handle(); 48 const Object& null_object = Object::Handle();
49 writer.WriteObject(null_object.raw()); 49 writer.WriteObject(null_object.raw());
50 writer.FinalizeBuffer(); 50 writer.FinalizeBuffer();
51 51
52 // Create a snapshot object using the buffer. 52 // Create a snapshot object using the buffer.
53 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 53 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
54 54
55 // Read object back from the snapshot. 55 // Read object back from the snapshot.
56 Isolate* isolate= Isolate::Current(); 56 Isolate* isolate= Isolate::Current();
57 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 57 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
58 const Object& serialized_object = Object::Handle(reader.ReadObject()); 58 const Object& serialized_object = Object::Handle(reader.ReadObject());
59 EXPECT(Equals(null_object, serialized_object)); 59 EXPECT(Equals(null_object, serialized_object));
60 } 60 }
61 61
62 62
63 TEST_CASE(SerializeSmi1) { 63 TEST_CASE(SerializeSmi1) {
64 // Write snapshot with object content. 64 // Write snapshot with object content.
65 uint8_t* buffer; 65 uint8_t* buffer;
66 SnapshotWriter writer(false, &buffer, &allocator); 66 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
67 const Smi& smi = Smi::Handle(Smi::New(124)); 67 const Smi& smi = Smi::Handle(Smi::New(124));
68 writer.WriteObject(smi.raw()); 68 writer.WriteObject(smi.raw());
69 writer.FinalizeBuffer(); 69 writer.FinalizeBuffer();
70 70
71 // Create a snapshot object using the buffer. 71 // Create a snapshot object using the buffer.
72 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 72 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
73 73
74 // Read object back from the snapshot. 74 // Read object back from the snapshot.
75 Isolate* isolate= Isolate::Current(); 75 Isolate* isolate= Isolate::Current();
76 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 76 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
77 const Object& serialized_object = Object::Handle(reader.ReadObject()); 77 const Object& serialized_object = Object::Handle(reader.ReadObject());
78 EXPECT(Equals(smi, serialized_object)); 78 EXPECT(Equals(smi, serialized_object));
79 } 79 }
80 80
81 81
82 TEST_CASE(SerializeSmi2) { 82 TEST_CASE(SerializeSmi2) {
83 // Write snapshot with object content. 83 // Write snapshot with object content.
84 uint8_t* buffer; 84 uint8_t* buffer;
85 SnapshotWriter writer(false, &buffer, &allocator); 85 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
86 const Smi& smi = Smi::Handle(Smi::New(-1)); 86 const Smi& smi = Smi::Handle(Smi::New(-1));
87 writer.WriteObject(smi.raw()); 87 writer.WriteObject(smi.raw());
88 writer.FinalizeBuffer(); 88 writer.FinalizeBuffer();
89 89
90 // Create a snapshot object using the buffer. 90 // Create a snapshot object using the buffer.
91 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 91 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
92 92
93 // Read object back from the snapshot. 93 // Read object back from the snapshot.
94 Isolate* isolate= Isolate::Current(); 94 Isolate* isolate= Isolate::Current();
95 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 95 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
96 const Object& serialized_object = Object::Handle(reader.ReadObject()); 96 const Object& serialized_object = Object::Handle(reader.ReadObject());
97 EXPECT(Equals(smi, serialized_object)); 97 EXPECT(Equals(smi, serialized_object));
98 } 98 }
99 99
100 100
101 TEST_CASE(SerializeDouble) { 101 TEST_CASE(SerializeDouble) {
102 // Write snapshot with object content. 102 // Write snapshot with object content.
103 uint8_t* buffer; 103 uint8_t* buffer;
104 SnapshotWriter writer(false, &buffer, &allocator); 104 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
105 const Double& dbl = Double::Handle(Double::New(101.29)); 105 const Double& dbl = Double::Handle(Double::New(101.29));
106 writer.WriteObject(dbl.raw()); 106 writer.WriteObject(dbl.raw());
107 writer.FinalizeBuffer(); 107 writer.FinalizeBuffer();
108 108
109 // Create a snapshot object using the buffer. 109 // Create a snapshot object using the buffer.
110 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 110 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
111 111
112 // Read object back from the snapshot. 112 // Read object back from the snapshot.
113 Isolate* isolate= Isolate::Current(); 113 Isolate* isolate= Isolate::Current();
114 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 114 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
115 const Object& serialized_object = Object::Handle(reader.ReadObject()); 115 const Object& serialized_object = Object::Handle(reader.ReadObject());
116 EXPECT(Equals(dbl, serialized_object)); 116 EXPECT(Equals(dbl, serialized_object));
117 } 117 }
118 118
119 119
120 TEST_CASE(SerializeBool) { 120 TEST_CASE(SerializeBool) {
121 // Write snapshot with object content. 121 // Write snapshot with object content.
122 uint8_t* buffer; 122 uint8_t* buffer;
123 SnapshotWriter writer(false, &buffer, &allocator); 123 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
124 const Bool& bool1 = Bool::Handle(Bool::True()); 124 const Bool& bool1 = Bool::Handle(Bool::True());
125 const Bool& bool2 = Bool::Handle(Bool::False()); 125 const Bool& bool2 = Bool::Handle(Bool::False());
126 writer.WriteObject(bool1.raw()); 126 writer.WriteObject(bool1.raw());
127 writer.WriteObject(bool2.raw()); 127 writer.WriteObject(bool2.raw());
128 writer.FinalizeBuffer(); 128 writer.FinalizeBuffer();
129 129
130 // Create a snapshot object using the buffer. 130 // Create a snapshot object using the buffer.
131 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 131 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
132 132
133 // Read object back from the snapshot. 133 // Read object back from the snapshot.
134 Isolate* isolate= Isolate::Current(); 134 Isolate* isolate= Isolate::Current();
135 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 135 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
136 EXPECT(Bool::True() == reader.ReadObject()); 136 EXPECT(Bool::True() == reader.ReadObject());
137 EXPECT(Bool::False() == reader.ReadObject()); 137 EXPECT(Bool::False() == reader.ReadObject());
138 } 138 }
139 139
140 140
141 TEST_CASE(SerializeBigint) { 141 TEST_CASE(SerializeBigint) {
142 // Write snapshot with object content. 142 // Write snapshot with object content.
143 uint8_t* buffer; 143 uint8_t* buffer;
144 SnapshotWriter writer(false, &buffer, &allocator); 144 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
145 const Bigint& bigint = Bigint::Handle(Bigint::New(0xfffffffffLL)); 145 const Bigint& bigint = Bigint::Handle(Bigint::New(0xfffffffffLL));
146 writer.WriteObject(bigint.raw()); 146 writer.WriteObject(bigint.raw());
147 writer.FinalizeBuffer(); 147 writer.FinalizeBuffer();
148 148
149 // Create a snapshot object using the buffer. 149 // Create a snapshot object using the buffer.
150 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 150 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
151 151
152 // Read object back from the snapshot. 152 // Read object back from the snapshot.
153 Isolate* isolate= Isolate::Current(); 153 Isolate* isolate= Isolate::Current();
154 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 154 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
155 Bigint& obj = Bigint::Handle(); 155 Bigint& obj = Bigint::Handle();
156 obj ^= reader.ReadObject(); 156 obj ^= reader.ReadObject();
157 OS::Print("%lld", BigintOperations::ToInt64(obj)); 157 OS::Print("%lld", BigintOperations::ToInt64(obj));
158 EXPECT_EQ(BigintOperations::ToInt64(bigint), BigintOperations::ToInt64(obj)); 158 EXPECT_EQ(BigintOperations::ToInt64(bigint), BigintOperations::ToInt64(obj));
159 } 159 }
160 160
161 161
162 TEST_CASE(SerializeSingletons) { 162 TEST_CASE(SerializeSingletons) {
163 // Write snapshot with object content. 163 // Write snapshot with object content.
164 uint8_t* buffer; 164 uint8_t* buffer;
165 SnapshotWriter writer(false, &buffer, &allocator); 165 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
166 writer.WriteObject(Object::class_class()); 166 writer.WriteObject(Object::class_class());
167 writer.WriteObject(Object::null_class()); 167 writer.WriteObject(Object::null_class());
168 writer.WriteObject(Object::type_class()); 168 writer.WriteObject(Object::type_class());
169 writer.WriteObject(Object::type_parameter_class()); 169 writer.WriteObject(Object::type_parameter_class());
170 writer.WriteObject(Object::instantiated_type_class()); 170 writer.WriteObject(Object::instantiated_type_class());
171 writer.WriteObject(Object::abstract_type_arguments_class()); 171 writer.WriteObject(Object::abstract_type_arguments_class());
172 writer.WriteObject(Object::type_arguments_class()); 172 writer.WriteObject(Object::type_arguments_class());
173 writer.WriteObject(Object::instantiated_type_arguments_class()); 173 writer.WriteObject(Object::instantiated_type_arguments_class());
174 writer.WriteObject(Object::function_class()); 174 writer.WriteObject(Object::function_class());
175 writer.WriteObject(Object::field_class()); 175 writer.WriteObject(Object::field_class());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 EXPECT(Object::pc_descriptors_class() == reader.ReadObject()); 208 EXPECT(Object::pc_descriptors_class() == reader.ReadObject());
209 EXPECT(Object::exception_handlers_class() == reader.ReadObject()); 209 EXPECT(Object::exception_handlers_class() == reader.ReadObject());
210 EXPECT(Object::context_class() == reader.ReadObject()); 210 EXPECT(Object::context_class() == reader.ReadObject());
211 EXPECT(Object::context_scope_class() == reader.ReadObject()); 211 EXPECT(Object::context_scope_class() == reader.ReadObject());
212 } 212 }
213 213
214 214
215 TEST_CASE(SerializeString) { 215 TEST_CASE(SerializeString) {
216 // Write snapshot with object content. 216 // Write snapshot with object content.
217 uint8_t* buffer; 217 uint8_t* buffer;
218 SnapshotWriter writer(false, &buffer, &allocator); 218 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
219 String& str = String::Handle(String::New("This string shall be serialized")); 219 String& str = String::Handle(String::New("This string shall be serialized"));
220 writer.WriteObject(str.raw()); 220 writer.WriteObject(str.raw());
221 writer.FinalizeBuffer(); 221 writer.FinalizeBuffer();
222 222
223 // Create a snapshot object using the buffer. 223 // Create a snapshot object using the buffer.
224 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 224 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
225 225
226 // Read object back from the snapshot. 226 // Read object back from the snapshot.
227 Isolate* isolate= Isolate::Current(); 227 Isolate* isolate= Isolate::Current();
228 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 228 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
229 String& serialized_str = String::Handle(); 229 String& serialized_str = String::Handle();
230 serialized_str ^= reader.ReadObject(); 230 serialized_str ^= reader.ReadObject();
231 EXPECT(str.Equals(serialized_str)); 231 EXPECT(str.Equals(serialized_str));
232 } 232 }
233 233
234 234
235 TEST_CASE(SerializeArray) { 235 TEST_CASE(SerializeArray) {
236 // Write snapshot with object content. 236 // Write snapshot with object content.
237 uint8_t* buffer; 237 uint8_t* buffer;
238 SnapshotWriter writer(false, &buffer, &allocator); 238 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
239 const int kArrayLength = 10; 239 const int kArrayLength = 10;
240 Array& array = Array::Handle(Array::New(kArrayLength)); 240 Array& array = Array::Handle(Array::New(kArrayLength));
241 Smi& smi = Smi::Handle(); 241 Smi& smi = Smi::Handle();
242 for (int i = 0; i < kArrayLength; i++) { 242 for (int i = 0; i < kArrayLength; i++) {
243 smi ^= Smi::New(i); 243 smi ^= Smi::New(i);
244 array.SetAt(i, smi); 244 array.SetAt(i, smi);
245 } 245 }
246 writer.WriteObject(array.raw()); 246 writer.WriteObject(array.raw());
247 writer.FinalizeBuffer(); 247 writer.FinalizeBuffer();
248 248
(...skipping 19 matching lines...) Expand all
268 String& url = String::Handle(String::New("dart-test:SerializeScript")); 268 String& url = String::Handle(String::New("dart-test:SerializeScript"));
269 String& source = String::Handle(String::New(kScriptChars)); 269 String& source = String::Handle(String::New(kScriptChars));
270 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); 270 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource));
271 const String& lib_url = String::Handle(String::NewSymbol("TestLib")); 271 const String& lib_url = String::Handle(String::NewSymbol("TestLib"));
272 Library& lib = Library::Handle(Library::New(lib_url)); 272 Library& lib = Library::Handle(Library::New(lib_url));
273 lib.Register(); 273 lib.Register();
274 EXPECT(CompilerTest::TestCompileScript(lib, script)); 274 EXPECT(CompilerTest::TestCompileScript(lib, script));
275 275
276 // Write snapshot with object content. 276 // Write snapshot with object content.
277 uint8_t* buffer; 277 uint8_t* buffer;
278 SnapshotWriter writer(false, &buffer, &allocator); 278 SnapshotWriter writer(Snapshot::kMessage, &buffer, &allocator);
279 writer.WriteObject(script.raw()); 279 writer.WriteObject(script.raw());
280 writer.FinalizeBuffer(); 280 writer.FinalizeBuffer();
281 281
282 // Create a snapshot object using the buffer. 282 // Create a snapshot object using the buffer.
283 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 283 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
284 284
285 // Read object back from the snapshot. 285 // Read object back from the snapshot.
286 Isolate* isolate= Isolate::Current(); 286 Isolate* isolate= Isolate::Current();
287 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store()); 287 SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
288 Script& serialized_script = Script::Handle(); 288 Script& serialized_script = Script::Handle();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 // Create a test library and Load up a test script in it. 338 // Create a test library and Load up a test script in it.
339 TestCase::LoadTestScript(kScriptChars, NULL); 339 TestCase::LoadTestScript(kScriptChars, NULL);
340 timer1.Stop(); 340 timer1.Stop();
341 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime()); 341 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime());
342 342
343 // Write snapshot with object content. 343 // Write snapshot with object content.
344 Isolate* isolate = Isolate::Current(); 344 Isolate* isolate = Isolate::Current();
345 Zone zone(isolate); 345 Zone zone(isolate);
346 HandleScope scope(isolate); 346 HandleScope scope(isolate);
347 SnapshotWriter writer(true, &buffer, &allocator); 347 SnapshotWriter writer(Snapshot::kFull, &buffer, &allocator);
348 writer.WriteFullSnapshot(); 348 writer.WriteFullSnapshot();
349 } 349 }
350 350
351 // Now Create another isolate using the snapshot and execute a method 351 // Now Create another isolate using the snapshot and execute a method
352 // from the script. 352 // from the script.
353 Timer timer2(true, "Snapshot_test"); 353 Timer timer2(true, "Snapshot_test");
354 timer2.Start(); 354 timer2.Start();
355 TestCase::CreateTestIsolateFromSnapshot(buffer); 355 TestCase::CreateTestIsolateFromSnapshot(buffer);
356 { 356 {
357 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 357 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 Zone zone(isolate); 393 Zone zone(isolate);
394 HandleScope scope(isolate); 394 HandleScope scope(isolate);
395 395
396 // Create a test library and Load up a test script in it. 396 // Create a test library and Load up a test script in it.
397 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 397 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
398 ClassFinalizer::FinalizePendingClasses(); 398 ClassFinalizer::FinalizePendingClasses();
399 timer1.Stop(); 399 timer1.Stop();
400 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime()); 400 OS::PrintErr("Without Snapshot: %dus\n", timer1.TotalElapsedTime());
401 401
402 // Write snapshot with object content. 402 // Write snapshot with object content.
403 SnapshotWriter writer(true, &buffer, &allocator); 403 SnapshotWriter writer(Snapshot::kFull, &buffer, &allocator);
404 writer.WriteFullSnapshot(); 404 writer.WriteFullSnapshot();
405 405
406 // Invoke a function which returns an object. 406 // Invoke a function which returns an object.
407 Dart_Handle result = Dart_InvokeStatic(lib, 407 Dart_Handle result = Dart_InvokeStatic(lib,
408 Dart_NewString("FieldsTest"), 408 Dart_NewString("FieldsTest"),
409 Dart_NewString("testMain"), 409 Dart_NewString("testMain"),
410 0, 410 0,
411 NULL); 411 NULL);
412 EXPECT_VALID(result); 412 EXPECT_VALID(result);
413 } 413 }
(...skipping 17 matching lines...) Expand all
431 if (Dart_IsError(result)) { 431 if (Dart_IsError(result)) {
432 // Print the error. It is probably an unhandled exception. 432 // Print the error. It is probably an unhandled exception.
433 fprintf(stderr, "%s\n", Dart_GetError(result)); 433 fprintf(stderr, "%s\n", Dart_GetError(result));
434 } 434 }
435 EXPECT_VALID(result); 435 EXPECT_VALID(result);
436 Dart_ExitScope(); 436 Dart_ExitScope();
437 } 437 }
438 Dart_ShutdownIsolate(); 438 Dart_ShutdownIsolate();
439 free(buffer); 439 free(buffer);
440 } 440 }
441
442
443 UNIT_TEST_CASE(ScriptSnapshot) {
444 const char* kScriptChars =
445 "class Fields {\n"
446 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n"
447 " int fld1;\n"
448 " final int fld2;\n"
449 " static int fld3;\n"
450 " static final int fld4 = 10;\n"
451 "}\n"
452 "class FieldsTest {\n"
453 " static Fields testMain() {\n"
454 " Fields obj = new Fields(10, 20);\n"
455 " return obj;\n"
456 " }\n"
457 "}\n";
458 Dart_Handle result;
459
460 uint8_t* buffer;
461 intptr_t size;
462
463 // Start an Isolate, load a script and create a script snapshot.
464 {
465 TestIsolateScope __test_isolate__;
466 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
467
468 // Create a test library and Load up a test script in it.
469 TestCase::LoadTestScript(kScriptChars, NULL);
470
471 // Write out the script snapshot.
472 result = Dart_CreateScriptSnapshot(TestCase::lib(), &buffer, &size);
473 EXPECT_VALID(result);
474 Dart_ExitScope();
475 }
476
477 // Now Create another isolate and load the application snapshot and
478 // execute it.
479 {
480 TestIsolateScope __test_isolate__;
481 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
482
483 // Load the test library from the snapshot.
484 result = Dart_LoadScriptFromSnapshot(buffer);
485 EXPECT_VALID(result);
486
487 // Invoke a function which returns an object.
488 result = Dart_InvokeStatic(result,
489 Dart_NewString("FieldsTest"),
490 Dart_NewString("testMain"),
491 0,
492 NULL);
493 EXPECT_VALID(result);
494 Dart_ExitScope();
495 }
496 Dart_ShutdownIsolate();
497 free(buffer);
498 }
499
441 #endif // TARGET_ARCH_IA32. 500 #endif // TARGET_ARCH_IA32.
442 501
443 } // namespace dart 502 } // namespace dart
OLDNEW
« no previous file with comments | « vm/snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698