Revision f230a1cf deps/v8/test/cctest/test-serialize.cc

View differences:

deps/v8/test/cctest/test-serialize.cc
84 84

  
85 85
template <class T>
86 86
static Address AddressOf(T id) {
87
  return ExternalReference(id, i::Isolate::Current()).address();
87
  return ExternalReference(id, CcTest::i_isolate()).address();
88 88
}
89 89

  
90 90

  
......
100 100

  
101 101

  
102 102
TEST(ExternalReferenceEncoder) {
103
  Isolate* isolate = i::Isolate::Current();
103
  Isolate* isolate = CcTest::i_isolate();
104 104
  isolate->stats_table()->SetCounterFunction(counter_function);
105 105
  v8::V8::Initialize();
106 106

  
......
137 137

  
138 138

  
139 139
TEST(ExternalReferenceDecoder) {
140
  Isolate* isolate = i::Isolate::Current();
140
  Isolate* isolate = CcTest::i_isolate();
141 141
  isolate->stats_table()->SetCounterFunction(counter_function);
142 142
  v8::V8::Initialize();
143 143

  
......
251 251
  // can be loaded from v8natives.js and their addresses can be processed.  This
252 252
  // will clear the pending fixups array, which would otherwise contain GC roots
253 253
  // that would confuse the serialization/deserialization process.
254
  v8::Isolate* isolate = v8::Isolate::GetCurrent();
254
  v8::Isolate* isolate = CcTest::isolate();
255 255
  {
256 256
    v8::HandleScope scope(isolate);
257 257
    v8::Context::New(isolate);
258 258
  }
259
  WriteToFile(reinterpret_cast<Isolate*>(isolate),
260
              FLAG_testing_serialization_file);
259

  
260
  Isolate* internal_isolate = CcTest::i_isolate();
261
  internal_isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "serialize");
262
  WriteToFile(internal_isolate, FLAG_testing_serialization_file);
261 263
}
262 264

  
263 265

  
264 266
// Test that the whole heap can be serialized.
265 267
TEST(Serialize) {
266 268
  if (!Snapshot::HaveASnapshotToStartFrom()) {
267
    Serializer::Enable(Isolate::Current());
269
    Serializer::Enable(CcTest::i_isolate());
268 270
    v8::V8::Initialize();
269 271
    Serialize();
270 272
  }
......
274 276
// Test that heap serialization is non-destructive.
275 277
TEST(SerializeTwice) {
276 278
  if (!Snapshot::HaveASnapshotToStartFrom()) {
277
    Serializer::Enable(Isolate::Current());
279
    Serializer::Enable(CcTest::i_isolate());
278 280
    v8::V8::Initialize();
279 281
    Serialize();
280 282
    Serialize();
......
291 293

  
292 294

  
293 295
static void SanityCheck() {
294
  Isolate* isolate = Isolate::Current();
295
  v8::HandleScope scope(v8::Isolate::GetCurrent());
296
  Isolate* isolate = CcTest::i_isolate();
297
  v8::HandleScope scope(CcTest::isolate());
296 298
#ifdef VERIFY_HEAP
297
  HEAP->Verify();
299
  CcTest::heap()->Verify();
298 300
#endif
299 301
  CHECK(isolate->global_object()->IsJSObject());
300 302
  CHECK(isolate->native_context()->IsContext());
301
  CHECK(HEAP->string_table()->IsStringTable());
303
  CHECK(CcTest::heap()->string_table()->IsStringTable());
302 304
  CHECK(!isolate->factory()->InternalizeOneByteString(
303 305
      STATIC_ASCII_VECTOR("Empty"))->IsFailure());
304 306
}
......
309 311
  // serialization.  That doesn't matter.  We don't need to be able to
310 312
  // serialize a snapshot in a VM that is booted from a snapshot.
311 313
  if (!Snapshot::HaveASnapshotToStartFrom()) {
312
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
314
    v8::Isolate* isolate = CcTest::isolate();
313 315
    v8::HandleScope scope(isolate);
314 316
    Deserialize();
315 317

  
......
323 325

  
324 326
DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
325 327
  if (!Snapshot::HaveASnapshotToStartFrom()) {
326
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
328
    v8::Isolate* isolate = CcTest::isolate();
327 329
    v8::HandleScope scope(isolate);
328 330
    Deserialize();
329 331

  
......
337 339

  
338 340
DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
339 341
  if (!Snapshot::HaveASnapshotToStartFrom()) {
340
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
342
    v8::Isolate* isolate = CcTest::isolate();
341 343
    v8::HandleScope scope(isolate);
342 344
    Deserialize();
343 345

  
......
355 357
DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
356 358
               SerializeTwice) {
357 359
  if (!Snapshot::HaveASnapshotToStartFrom()) {
358
    v8::Isolate* isolate = v8::Isolate::GetCurrent();
360
    v8::Isolate* isolate = CcTest::isolate();
359 361
    v8::HandleScope scope(isolate);
360 362
    Deserialize();
361 363

  
......
372 374

  
373 375
TEST(PartialSerialization) {
374 376
  if (!Snapshot::HaveASnapshotToStartFrom()) {
375
    Isolate* isolate = Isolate::Current();
377
    Isolate* isolate = CcTest::i_isolate();
376 378
    Serializer::Enable(isolate);
377 379
    v8::V8::Initialize();
378 380
    v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
......
495 497
    int snapshot_size = 0;
496 498
    byte* snapshot = ReadBytes(file_name, &snapshot_size);
497 499

  
498
    Isolate* isolate = Isolate::Current();
500
    Isolate* isolate = CcTest::i_isolate();
499 501
    Object* root;
500 502
    {
501 503
      SnapshotByteSource source(snapshot, snapshot_size);
......
523 525

  
524 526
TEST(ContextSerialization) {
525 527
  if (!Snapshot::HaveASnapshotToStartFrom()) {
526
    Isolate* isolate = Isolate::Current();
528
    Isolate* isolate = CcTest::i_isolate();
527 529
    Serializer::Enable(isolate);
528 530
    v8::V8::Initialize();
529 531
    v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
......
607 609
    int snapshot_size = 0;
608 610
    byte* snapshot = ReadBytes(file_name, &snapshot_size);
609 611

  
610
    Isolate* isolate = Isolate::Current();
612
    Isolate* isolate = CcTest::i_isolate();
611 613
    Object* root;
612 614
    {
613 615
      SnapshotByteSource source(snapshot, snapshot_size);

Also available in: Unified diff