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

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

Issue 6639024: Get rid of distinction between below- and above-watermark in page allocation.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 LocalContext env; 387 LocalContext env;
388 TestResource* resource = new TestResource(two_byte_source); 388 TestResource* resource = new TestResource(two_byte_source);
389 Local<String> source = String::NewExternal(resource); 389 Local<String> source = String::NewExternal(resource);
390 Local<Script> script = Script::Compile(source); 390 Local<Script> script = Script::Compile(source);
391 Local<Value> value = script->Run(); 391 Local<Value> value = script->Run();
392 CHECK(value->IsNumber()); 392 CHECK(value->IsNumber());
393 CHECK_EQ(7, value->Int32Value()); 393 CHECK_EQ(7, value->Int32Value());
394 CHECK(source->IsExternal()); 394 CHECK(source->IsExternal());
395 CHECK_EQ(resource, 395 CHECK_EQ(resource,
396 static_cast<TestResource*>(source->GetExternalStringResource())); 396 static_cast<TestResource*>(source->GetExternalStringResource()));
397 i::Heap::CollectAllGarbage(false); 397 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
398 CHECK_EQ(0, TestResource::dispose_count); 398 CHECK_EQ(0, TestResource::dispose_count);
399 } 399 }
400 i::CompilationCache::Clear(); 400 i::CompilationCache::Clear();
401 i::Heap::CollectAllGarbage(false); 401 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
402 CHECK_EQ(1, TestResource::dispose_count); 402 CHECK_EQ(1, TestResource::dispose_count);
403 } 403 }
404 404
405 405
406 THREADED_TEST(ScriptUsingAsciiStringResource) { 406 THREADED_TEST(ScriptUsingAsciiStringResource) {
407 TestAsciiResource::dispose_count = 0; 407 TestAsciiResource::dispose_count = 0;
408 const char* c_source = "1 + 2 * 3"; 408 const char* c_source = "1 + 2 * 3";
409 { 409 {
410 v8::HandleScope scope; 410 v8::HandleScope scope;
411 LocalContext env; 411 LocalContext env;
412 Local<String> source = 412 Local<String> source =
413 String::NewExternal(new TestAsciiResource(i::StrDup(c_source))); 413 String::NewExternal(new TestAsciiResource(i::StrDup(c_source)));
414 Local<Script> script = Script::Compile(source); 414 Local<Script> script = Script::Compile(source);
415 Local<Value> value = script->Run(); 415 Local<Value> value = script->Run();
416 CHECK(value->IsNumber()); 416 CHECK(value->IsNumber());
417 CHECK_EQ(7, value->Int32Value()); 417 CHECK_EQ(7, value->Int32Value());
418 i::Heap::CollectAllGarbage(false); 418 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
419 CHECK_EQ(0, TestAsciiResource::dispose_count); 419 CHECK_EQ(0, TestAsciiResource::dispose_count);
420 } 420 }
421 i::CompilationCache::Clear(); 421 i::CompilationCache::Clear();
422 i::Heap::CollectAllGarbage(false); 422 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
423 CHECK_EQ(1, TestAsciiResource::dispose_count); 423 CHECK_EQ(1, TestAsciiResource::dispose_count);
424 } 424 }
425 425
426 426
427 THREADED_TEST(ScriptMakingExternalString) { 427 THREADED_TEST(ScriptMakingExternalString) {
428 TestResource::dispose_count = 0; 428 TestResource::dispose_count = 0;
429 uint16_t* two_byte_source = AsciiToTwoByteString("1 + 2 * 3"); 429 uint16_t* two_byte_source = AsciiToTwoByteString("1 + 2 * 3");
430 { 430 {
431 v8::HandleScope scope; 431 v8::HandleScope scope;
432 LocalContext env; 432 LocalContext env;
433 Local<String> source = String::New(two_byte_source); 433 Local<String> source = String::New(two_byte_source);
434 // Trigger GCs so that the newly allocated string moves to old gen. 434 // Trigger GCs so that the newly allocated string moves to old gen.
435 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now 435 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
436 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now 436 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
437 bool success = source->MakeExternal(new TestResource(two_byte_source)); 437 bool success = source->MakeExternal(new TestResource(two_byte_source));
438 CHECK(success); 438 CHECK(success);
439 Local<Script> script = Script::Compile(source); 439 Local<Script> script = Script::Compile(source);
440 Local<Value> value = script->Run(); 440 Local<Value> value = script->Run();
441 CHECK(value->IsNumber()); 441 CHECK(value->IsNumber());
442 CHECK_EQ(7, value->Int32Value()); 442 CHECK_EQ(7, value->Int32Value());
443 i::Heap::CollectAllGarbage(false); 443 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
444 CHECK_EQ(0, TestResource::dispose_count); 444 CHECK_EQ(0, TestResource::dispose_count);
445 } 445 }
446 i::CompilationCache::Clear(); 446 i::CompilationCache::Clear();
447 i::Heap::CollectAllGarbage(false); 447 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
448 CHECK_EQ(1, TestResource::dispose_count); 448 CHECK_EQ(1, TestResource::dispose_count);
449 } 449 }
450 450
451 451
452 THREADED_TEST(ScriptMakingExternalAsciiString) { 452 THREADED_TEST(ScriptMakingExternalAsciiString) {
453 TestAsciiResource::dispose_count = 0; 453 TestAsciiResource::dispose_count = 0;
454 const char* c_source = "1 + 2 * 3"; 454 const char* c_source = "1 + 2 * 3";
455 { 455 {
456 v8::HandleScope scope; 456 v8::HandleScope scope;
457 LocalContext env; 457 LocalContext env;
458 Local<String> source = v8_str(c_source); 458 Local<String> source = v8_str(c_source);
459 // Trigger GCs so that the newly allocated string moves to old gen. 459 // Trigger GCs so that the newly allocated string moves to old gen.
460 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now 460 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
461 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now 461 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
462 bool success = source->MakeExternal( 462 bool success = source->MakeExternal(
463 new TestAsciiResource(i::StrDup(c_source))); 463 new TestAsciiResource(i::StrDup(c_source)));
464 CHECK(success); 464 CHECK(success);
465 Local<Script> script = Script::Compile(source); 465 Local<Script> script = Script::Compile(source);
466 Local<Value> value = script->Run(); 466 Local<Value> value = script->Run();
467 CHECK(value->IsNumber()); 467 CHECK(value->IsNumber());
468 CHECK_EQ(7, value->Int32Value()); 468 CHECK_EQ(7, value->Int32Value());
469 i::Heap::CollectAllGarbage(false); 469 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
470 CHECK_EQ(0, TestAsciiResource::dispose_count); 470 CHECK_EQ(0, TestAsciiResource::dispose_count);
471 } 471 }
472 i::CompilationCache::Clear(); 472 i::CompilationCache::Clear();
473 i::Heap::CollectAllGarbage(false); 473 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
474 CHECK_EQ(1, TestAsciiResource::dispose_count); 474 CHECK_EQ(1, TestAsciiResource::dispose_count);
475 } 475 }
476 476
477 477
478 TEST(MakingExternalStringConditions) { 478 TEST(MakingExternalStringConditions) {
479 v8::HandleScope scope; 479 v8::HandleScope scope;
480 LocalContext env; 480 LocalContext env;
481 481
482 // Free some space in the new space so that we can check freshness. 482 // Free some space in the new space so that we can check freshness.
483 i::Heap::CollectGarbage(i::NEW_SPACE); 483 i::Heap::CollectGarbage(i::NEW_SPACE);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); 564 uint16_t* two_byte_string = AsciiToTwoByteString("test string");
565 Local<String> string = 565 Local<String> string =
566 String::NewExternal(new TestResource(two_byte_string)); 566 String::NewExternal(new TestResource(two_byte_string));
567 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); 567 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
568 // Trigger GCs so that the newly allocated string moves to old gen. 568 // Trigger GCs so that the newly allocated string moves to old gen.
569 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now 569 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
570 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now 570 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
571 i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring); 571 i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring);
572 CHECK(isymbol->IsSymbol()); 572 CHECK(isymbol->IsSymbol());
573 } 573 }
574 i::Heap::CollectAllGarbage(false); 574 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
575 i::Heap::CollectAllGarbage(false); 575 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
576 } 576 }
577 577
578 578
579 THREADED_TEST(UsingExternalAsciiString) { 579 THREADED_TEST(UsingExternalAsciiString) {
580 { 580 {
581 v8::HandleScope scope; 581 v8::HandleScope scope;
582 const char* one_byte_string = "test string"; 582 const char* one_byte_string = "test string";
583 Local<String> string = String::NewExternal( 583 Local<String> string = String::NewExternal(
584 new TestAsciiResource(i::StrDup(one_byte_string))); 584 new TestAsciiResource(i::StrDup(one_byte_string)));
585 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); 585 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
586 // Trigger GCs so that the newly allocated string moves to old gen. 586 // Trigger GCs so that the newly allocated string moves to old gen.
587 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now 587 i::Heap::CollectGarbage(i::NEW_SPACE); // in survivor space now
588 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now 588 i::Heap::CollectGarbage(i::NEW_SPACE); // in old gen now
589 i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring); 589 i::Handle<i::String> isymbol = i::Factory::SymbolFromString(istring);
590 CHECK(isymbol->IsSymbol()); 590 CHECK(isymbol->IsSymbol());
591 } 591 }
592 i::Heap::CollectAllGarbage(false); 592 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
593 i::Heap::CollectAllGarbage(false); 593 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
594 } 594 }
595 595
596 596
597 THREADED_TEST(ScavengeExternalString) { 597 THREADED_TEST(ScavengeExternalString) {
598 TestResource::dispose_count = 0; 598 TestResource::dispose_count = 0;
599 bool in_new_space = false; 599 bool in_new_space = false;
600 { 600 {
601 v8::HandleScope scope; 601 v8::HandleScope scope;
602 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); 602 uint16_t* two_byte_string = AsciiToTwoByteString("test string");
603 Local<String> string = 603 Local<String> string =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 TestAsciiResourceWithDisposeControl::dispose_calls = 0; 660 TestAsciiResourceWithDisposeControl::dispose_calls = 0;
661 TestAsciiResourceWithDisposeControl res_stack(i::StrDup(c_source), false); 661 TestAsciiResourceWithDisposeControl res_stack(i::StrDup(c_source), false);
662 { 662 {
663 v8::HandleScope scope; 663 v8::HandleScope scope;
664 LocalContext env; 664 LocalContext env;
665 Local<String> source = String::NewExternal(&res_stack); 665 Local<String> source = String::NewExternal(&res_stack);
666 Local<Script> script = Script::Compile(source); 666 Local<Script> script = Script::Compile(source);
667 Local<Value> value = script->Run(); 667 Local<Value> value = script->Run();
668 CHECK(value->IsNumber()); 668 CHECK(value->IsNumber());
669 CHECK_EQ(7, value->Int32Value()); 669 CHECK_EQ(7, value->Int32Value());
670 i::Heap::CollectAllGarbage(false); 670 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
671 CHECK_EQ(0, TestAsciiResource::dispose_count); 671 CHECK_EQ(0, TestAsciiResource::dispose_count);
672 } 672 }
673 i::CompilationCache::Clear(); 673 i::CompilationCache::Clear();
674 i::Heap::CollectAllGarbage(false); 674 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
675 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls); 675 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
676 CHECK_EQ(0, TestAsciiResource::dispose_count); 676 CHECK_EQ(0, TestAsciiResource::dispose_count);
677 677
678 // Use a heap allocated external string resource allocated object. 678 // Use a heap allocated external string resource allocated object.
679 TestAsciiResource::dispose_count = 0; 679 TestAsciiResource::dispose_count = 0;
680 TestAsciiResourceWithDisposeControl::dispose_calls = 0; 680 TestAsciiResourceWithDisposeControl::dispose_calls = 0;
681 TestAsciiResource* res_heap = 681 TestAsciiResource* res_heap =
682 new TestAsciiResourceWithDisposeControl(i::StrDup(c_source), true); 682 new TestAsciiResourceWithDisposeControl(i::StrDup(c_source), true);
683 { 683 {
684 v8::HandleScope scope; 684 v8::HandleScope scope;
685 LocalContext env; 685 LocalContext env;
686 Local<String> source = String::NewExternal(res_heap); 686 Local<String> source = String::NewExternal(res_heap);
687 Local<Script> script = Script::Compile(source); 687 Local<Script> script = Script::Compile(source);
688 Local<Value> value = script->Run(); 688 Local<Value> value = script->Run();
689 CHECK(value->IsNumber()); 689 CHECK(value->IsNumber());
690 CHECK_EQ(7, value->Int32Value()); 690 CHECK_EQ(7, value->Int32Value());
691 i::Heap::CollectAllGarbage(false); 691 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
692 CHECK_EQ(0, TestAsciiResource::dispose_count); 692 CHECK_EQ(0, TestAsciiResource::dispose_count);
693 } 693 }
694 i::CompilationCache::Clear(); 694 i::CompilationCache::Clear();
695 i::Heap::CollectAllGarbage(false); 695 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
696 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls); 696 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
697 CHECK_EQ(1, TestAsciiResource::dispose_count); 697 CHECK_EQ(1, TestAsciiResource::dispose_count);
698 } 698 }
699 699
700 700
701 THREADED_TEST(StringConcat) { 701 THREADED_TEST(StringConcat) {
702 { 702 {
703 v8::HandleScope scope; 703 v8::HandleScope scope;
704 LocalContext env; 704 LocalContext env;
705 const char* one_byte_string_1 = "function a_times_t"; 705 const char* one_byte_string_1 = "function a_times_t";
(...skipping 26 matching lines...) Expand all
732 source = String::Concat(source, right); 732 source = String::Concat(source, right);
733 right = String::NewExternal( 733 right = String::NewExternal(
734 new TestResource(AsciiToTwoByteString(two_byte_extern_2))); 734 new TestResource(AsciiToTwoByteString(two_byte_extern_2)));
735 source = String::Concat(source, right); 735 source = String::Concat(source, right);
736 Local<Script> script = Script::Compile(source); 736 Local<Script> script = Script::Compile(source);
737 Local<Value> value = script->Run(); 737 Local<Value> value = script->Run();
738 CHECK(value->IsNumber()); 738 CHECK(value->IsNumber());
739 CHECK_EQ(68, value->Int32Value()); 739 CHECK_EQ(68, value->Int32Value());
740 } 740 }
741 i::CompilationCache::Clear(); 741 i::CompilationCache::Clear();
742 i::Heap::CollectAllGarbage(false); 742 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
743 i::Heap::CollectAllGarbage(false); 743 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
744 } 744 }
745 745
746 746
747 THREADED_TEST(GlobalProperties) { 747 THREADED_TEST(GlobalProperties) {
748 v8::HandleScope scope; 748 v8::HandleScope scope;
749 LocalContext env; 749 LocalContext env;
750 v8::Handle<v8::Object> global = env->Global(); 750 v8::Handle<v8::Object> global = env->Global();
751 global->Set(v8_str("pi"), v8_num(3.1415926)); 751 global->Set(v8_str("pi"), v8_num(3.1415926));
752 Local<Value> pi = global->Get(v8_str("pi")); 752 Local<Value> pi = global->Get(v8_str("pi"));
753 CHECK_EQ(3.1415926, pi->NumberValue()); 753 CHECK_EQ(3.1415926, pi->NumberValue());
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 1568
1569 char* data = new char[100]; 1569 char* data = new char[100];
1570 1570
1571 void* aligned = data; 1571 void* aligned = data;
1572 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(aligned) & 0x1)); 1572 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(aligned) & 0x1));
1573 void* unaligned = data + 1; 1573 void* unaligned = data + 1;
1574 CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1)); 1574 CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1));
1575 1575
1576 // Check reading and writing aligned pointers. 1576 // Check reading and writing aligned pointers.
1577 obj->SetPointerInInternalField(0, aligned); 1577 obj->SetPointerInInternalField(0, aligned);
1578 i::Heap::CollectAllGarbage(false); 1578 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1579 CHECK_EQ(aligned, obj->GetPointerFromInternalField(0)); 1579 CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
1580 1580
1581 // Check reading and writing unaligned pointers. 1581 // Check reading and writing unaligned pointers.
1582 obj->SetPointerInInternalField(0, unaligned); 1582 obj->SetPointerInInternalField(0, unaligned);
1583 i::Heap::CollectAllGarbage(false); 1583 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1584 CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0)); 1584 CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0));
1585 1585
1586 delete[] data; 1586 delete[] data;
1587 } 1587 }
1588 1588
1589 1589
1590 THREADED_TEST(InternalFieldsNativePointersAndExternal) { 1590 THREADED_TEST(InternalFieldsNativePointersAndExternal) {
1591 v8::HandleScope scope; 1591 v8::HandleScope scope;
1592 LocalContext env; 1592 LocalContext env;
1593 1593
1594 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(); 1594 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
1595 Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate(); 1595 Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
1596 instance_templ->SetInternalFieldCount(1); 1596 instance_templ->SetInternalFieldCount(1);
1597 Local<v8::Object> obj = templ->GetFunction()->NewInstance(); 1597 Local<v8::Object> obj = templ->GetFunction()->NewInstance();
1598 CHECK_EQ(1, obj->InternalFieldCount()); 1598 CHECK_EQ(1, obj->InternalFieldCount());
1599 CHECK(obj->GetPointerFromInternalField(0) == NULL); 1599 CHECK(obj->GetPointerFromInternalField(0) == NULL);
1600 1600
1601 char* data = new char[100]; 1601 char* data = new char[100];
1602 1602
1603 void* aligned = data; 1603 void* aligned = data;
1604 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(aligned) & 0x1)); 1604 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(aligned) & 0x1));
1605 void* unaligned = data + 1; 1605 void* unaligned = data + 1;
1606 CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1)); 1606 CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1));
1607 1607
1608 obj->SetPointerInInternalField(0, aligned); 1608 obj->SetPointerInInternalField(0, aligned);
1609 i::Heap::CollectAllGarbage(false); 1609 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1610 CHECK_EQ(aligned, v8::External::Unwrap(obj->GetInternalField(0))); 1610 CHECK_EQ(aligned, v8::External::Unwrap(obj->GetInternalField(0)));
1611 1611
1612 obj->SetPointerInInternalField(0, unaligned); 1612 obj->SetPointerInInternalField(0, unaligned);
1613 i::Heap::CollectAllGarbage(false); 1613 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1614 CHECK_EQ(unaligned, v8::External::Unwrap(obj->GetInternalField(0))); 1614 CHECK_EQ(unaligned, v8::External::Unwrap(obj->GetInternalField(0)));
1615 1615
1616 obj->SetInternalField(0, v8::External::Wrap(aligned)); 1616 obj->SetInternalField(0, v8::External::Wrap(aligned));
1617 i::Heap::CollectAllGarbage(false); 1617 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1618 CHECK_EQ(aligned, obj->GetPointerFromInternalField(0)); 1618 CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
1619 1619
1620 obj->SetInternalField(0, v8::External::Wrap(unaligned)); 1620 obj->SetInternalField(0, v8::External::Wrap(unaligned));
1621 i::Heap::CollectAllGarbage(false); 1621 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1622 CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0)); 1622 CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0));
1623 1623
1624 delete[] data; 1624 delete[] data;
1625 } 1625 }
1626 1626
1627 1627
1628 THREADED_TEST(IdentityHash) { 1628 THREADED_TEST(IdentityHash) {
1629 v8::HandleScope scope; 1629 v8::HandleScope scope;
1630 LocalContext env; 1630 LocalContext env;
1631 1631
1632 // Ensure that the test starts with an fresh heap to test whether the hash 1632 // Ensure that the test starts with an fresh heap to test whether the hash
1633 // code is based on the address. 1633 // code is based on the address.
1634 i::Heap::CollectAllGarbage(false); 1634 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1635 Local<v8::Object> obj = v8::Object::New(); 1635 Local<v8::Object> obj = v8::Object::New();
1636 int hash = obj->GetIdentityHash(); 1636 int hash = obj->GetIdentityHash();
1637 int hash1 = obj->GetIdentityHash(); 1637 int hash1 = obj->GetIdentityHash();
1638 CHECK_EQ(hash, hash1); 1638 CHECK_EQ(hash, hash1);
1639 int hash2 = v8::Object::New()->GetIdentityHash(); 1639 int hash2 = v8::Object::New()->GetIdentityHash();
1640 // Since the identity hash is essentially a random number two consecutive 1640 // Since the identity hash is essentially a random number two consecutive
1641 // objects should not be assigned the same hash code. If the test below fails 1641 // objects should not be assigned the same hash code. If the test below fails
1642 // the random number generator should be evaluated. 1642 // the random number generator should be evaluated.
1643 CHECK_NE(hash, hash2); 1643 CHECK_NE(hash, hash2);
1644 i::Heap::CollectAllGarbage(false); 1644 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1645 int hash3 = v8::Object::New()->GetIdentityHash(); 1645 int hash3 = v8::Object::New()->GetIdentityHash();
1646 // Make sure that the identity hash is not based on the initial address of 1646 // Make sure that the identity hash is not based on the initial address of
1647 // the object alone. If the test below fails the random number generator 1647 // the object alone. If the test below fails the random number generator
1648 // should be evaluated. 1648 // should be evaluated.
1649 CHECK_NE(hash, hash3); 1649 CHECK_NE(hash, hash3);
1650 int hash4 = obj->GetIdentityHash(); 1650 int hash4 = obj->GetIdentityHash();
1651 CHECK_EQ(hash, hash4); 1651 CHECK_EQ(hash, hash4);
1652 1652
1653 // Check identity hashes behaviour in the presence of JS accessors. 1653 // Check identity hashes behaviour in the presence of JS accessors.
1654 // Put a getter for 'v8::IdentityHash' on the Object's prototype: 1654 // Put a getter for 'v8::IdentityHash' on the Object's prototype:
(...skipping 16 matching lines...) Expand all
1671 1671
1672 THREADED_TEST(HiddenProperties) { 1672 THREADED_TEST(HiddenProperties) {
1673 v8::HandleScope scope; 1673 v8::HandleScope scope;
1674 LocalContext env; 1674 LocalContext env;
1675 1675
1676 v8::Local<v8::Object> obj = v8::Object::New(); 1676 v8::Local<v8::Object> obj = v8::Object::New();
1677 v8::Local<v8::String> key = v8_str("api-test::hidden-key"); 1677 v8::Local<v8::String> key = v8_str("api-test::hidden-key");
1678 v8::Local<v8::String> empty = v8_str(""); 1678 v8::Local<v8::String> empty = v8_str("");
1679 v8::Local<v8::String> prop_name = v8_str("prop_name"); 1679 v8::Local<v8::String> prop_name = v8_str("prop_name");
1680 1680
1681 i::Heap::CollectAllGarbage(false); 1681 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1682 1682
1683 // Make sure delete of a non-existent hidden value works 1683 // Make sure delete of a non-existent hidden value works
1684 CHECK(obj->DeleteHiddenValue(key)); 1684 CHECK(obj->DeleteHiddenValue(key));
1685 1685
1686 CHECK(obj->SetHiddenValue(key, v8::Integer::New(1503))); 1686 CHECK(obj->SetHiddenValue(key, v8::Integer::New(1503)));
1687 CHECK_EQ(1503, obj->GetHiddenValue(key)->Int32Value()); 1687 CHECK_EQ(1503, obj->GetHiddenValue(key)->Int32Value());
1688 CHECK(obj->SetHiddenValue(key, v8::Integer::New(2002))); 1688 CHECK(obj->SetHiddenValue(key, v8::Integer::New(2002)));
1689 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); 1689 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
1690 1690
1691 i::Heap::CollectAllGarbage(false); 1691 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1692 1692
1693 // Make sure we do not find the hidden property. 1693 // Make sure we do not find the hidden property.
1694 CHECK(!obj->Has(empty)); 1694 CHECK(!obj->Has(empty));
1695 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); 1695 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
1696 CHECK(obj->Get(empty)->IsUndefined()); 1696 CHECK(obj->Get(empty)->IsUndefined());
1697 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); 1697 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
1698 CHECK(obj->Set(empty, v8::Integer::New(2003))); 1698 CHECK(obj->Set(empty, v8::Integer::New(2003)));
1699 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); 1699 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
1700 CHECK_EQ(2003, obj->Get(empty)->Int32Value()); 1700 CHECK_EQ(2003, obj->Get(empty)->Int32Value());
1701 1701
1702 i::Heap::CollectAllGarbage(false); 1702 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1703 1703
1704 // Add another property and delete it afterwards to force the object in 1704 // Add another property and delete it afterwards to force the object in
1705 // slow case. 1705 // slow case.
1706 CHECK(obj->Set(prop_name, v8::Integer::New(2008))); 1706 CHECK(obj->Set(prop_name, v8::Integer::New(2008)));
1707 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); 1707 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
1708 CHECK_EQ(2008, obj->Get(prop_name)->Int32Value()); 1708 CHECK_EQ(2008, obj->Get(prop_name)->Int32Value());
1709 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); 1709 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
1710 CHECK(obj->Delete(prop_name)); 1710 CHECK(obj->Delete(prop_name));
1711 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); 1711 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value());
1712 1712
1713 i::Heap::CollectAllGarbage(false); 1713 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
1714 1714
1715 CHECK(obj->DeleteHiddenValue(key)); 1715 CHECK(obj->DeleteHiddenValue(key));
1716 CHECK(obj->GetHiddenValue(key).IsEmpty()); 1716 CHECK(obj->GetHiddenValue(key).IsEmpty());
1717 } 1717 }
1718 1718
1719 1719
1720 static bool interceptor_for_hidden_properties_called; 1720 static bool interceptor_for_hidden_properties_called;
1721 static v8::Handle<Value> InterceptorForHiddenProperties( 1721 static v8::Handle<Value> InterceptorForHiddenProperties(
1722 Local<String> name, const AccessorInfo& info) { 1722 Local<String> name, const AccessorInfo& info) {
1723 interceptor_for_hidden_properties_called = true; 1723 interceptor_for_hidden_properties_called = true;
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after
4235 object_b = v8::Persistent<v8::Object>::New(v8::Object::New()); 4235 object_b = v8::Persistent<v8::Object>::New(v8::Object::New());
4236 object_a = v8::Persistent<v8::Object>::New(v8::Object::New()); 4236 object_a = v8::Persistent<v8::Object>::New(v8::Object::New());
4237 } 4237 }
4238 4238
4239 bool object_a_disposed = false; 4239 bool object_a_disposed = false;
4240 object_a.MakeWeak(&object_a_disposed, &ForceScavenge); 4240 object_a.MakeWeak(&object_a_disposed, &ForceScavenge);
4241 bool released_in_scavenge = false; 4241 bool released_in_scavenge = false;
4242 object_b.MakeWeak(&released_in_scavenge, &CheckIsNotInvokedInScavenge); 4242 object_b.MakeWeak(&released_in_scavenge, &CheckIsNotInvokedInScavenge);
4243 4243
4244 while (!object_a_disposed) { 4244 while (!object_a_disposed) {
4245 i::Heap::CollectAllGarbage(false); 4245 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
4246 } 4246 }
4247 CHECK(!released_in_scavenge); 4247 CHECK(!released_in_scavenge);
4248 } 4248 }
4249 4249
4250 4250
4251 v8::Handle<Function> args_fun; 4251 v8::Handle<Function> args_fun;
4252 4252
4253 4253
4254 static v8::Handle<Value> ArgumentsTestCallback(const v8::Arguments& args) { 4254 static v8::Handle<Value> ArgumentsTestCallback(const v8::Arguments& args) {
4255 ApiTestFuzzer::Fuzz(); 4255 ApiTestFuzzer::Fuzz();
4256 CHECK_EQ(args_fun, args.Callee()); 4256 CHECK_EQ(args_fun, args.Callee());
4257 CHECK_EQ(3, args.Length()); 4257 CHECK_EQ(3, args.Length());
4258 CHECK_EQ(v8::Integer::New(1), args[0]); 4258 CHECK_EQ(v8::Integer::New(1), args[0]);
4259 CHECK_EQ(v8::Integer::New(2), args[1]); 4259 CHECK_EQ(v8::Integer::New(2), args[1]);
4260 CHECK_EQ(v8::Integer::New(3), args[2]); 4260 CHECK_EQ(v8::Integer::New(3), args[2]);
4261 CHECK_EQ(v8::Undefined(), args[3]); 4261 CHECK_EQ(v8::Undefined(), args[3]);
4262 v8::HandleScope scope; 4262 v8::HandleScope scope;
4263 i::Heap::CollectAllGarbage(false); 4263 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
4264 return v8::Undefined(); 4264 return v8::Undefined();
4265 } 4265 }
4266 4266
4267 4267
4268 THREADED_TEST(Arguments) { 4268 THREADED_TEST(Arguments) {
4269 v8::HandleScope scope; 4269 v8::HandleScope scope;
4270 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New(); 4270 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New();
4271 global->Set(v8_str("f"), v8::FunctionTemplate::New(ArgumentsTestCallback)); 4271 global->Set(v8_str("f"), v8::FunctionTemplate::New(ArgumentsTestCallback));
4272 LocalContext context(NULL, global); 4272 LocalContext context(NULL, global);
4273 args_fun = context->Global()->Get(v8_str("f")).As<Function>(); 4273 args_fun = context->Global()->Get(v8_str("f")).As<Function>();
(...skipping 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after
6876 "var p = new constructor();" 6876 "var p = new constructor();"
6877 "p.hasOwnProperty('ostehaps');"); 6877 "p.hasOwnProperty('ostehaps');");
6878 CHECK_EQ(false, value->BooleanValue()); 6878 CHECK_EQ(false, value->BooleanValue());
6879 } 6879 }
6880 6880
6881 6881
6882 static v8::Handle<Value> InterceptorHasOwnPropertyGetterGC( 6882 static v8::Handle<Value> InterceptorHasOwnPropertyGetterGC(
6883 Local<String> name, 6883 Local<String> name,
6884 const AccessorInfo& info) { 6884 const AccessorInfo& info) {
6885 ApiTestFuzzer::Fuzz(); 6885 ApiTestFuzzer::Fuzz();
6886 i::Heap::CollectAllGarbage(false); 6886 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
6887 return v8::Handle<Value>(); 6887 return v8::Handle<Value>();
6888 } 6888 }
6889 6889
6890 6890
6891 THREADED_TEST(InterceptorHasOwnPropertyCausingGC) { 6891 THREADED_TEST(InterceptorHasOwnPropertyCausingGC) {
6892 v8::HandleScope scope; 6892 v8::HandleScope scope;
6893 LocalContext context; 6893 LocalContext context;
6894 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); 6894 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
6895 Local<v8::ObjectTemplate> instance_templ = fun_templ->InstanceTemplate(); 6895 Local<v8::ObjectTemplate> instance_templ = fun_templ->InstanceTemplate();
6896 instance_templ->SetNamedPropertyHandler(InterceptorHasOwnPropertyGetterGC); 6896 instance_templ->SetNamedPropertyHandler(InterceptorHasOwnPropertyGetterGC);
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
7606 "};"); 7606 "};");
7607 CHECK_EQ(239 * 10, value->Int32Value()); 7607 CHECK_EQ(239 * 10, value->Int32Value());
7608 } 7608 }
7609 7609
7610 static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name, 7610 static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name,
7611 const AccessorInfo& info) { 7611 const AccessorInfo& info) {
7612 ApiTestFuzzer::Fuzz(); 7612 ApiTestFuzzer::Fuzz();
7613 int* call_count = reinterpret_cast<int*>(v8::External::Unwrap(info.Data())); 7613 int* call_count = reinterpret_cast<int*>(v8::External::Unwrap(info.Data()));
7614 ++(*call_count); 7614 ++(*call_count);
7615 if ((*call_count) % 20 == 0) { 7615 if ((*call_count) % 20 == 0) {
7616 i::Heap::CollectAllGarbage(true); 7616 i::Heap::CollectAllGarbage(i::Heap::kForceCompactionMask);
7617 } 7617 }
7618 return v8::Handle<Value>(); 7618 return v8::Handle<Value>();
7619 } 7619 }
7620 7620
7621 static v8::Handle<Value> FastApiCallback_TrivialSignature( 7621 static v8::Handle<Value> FastApiCallback_TrivialSignature(
7622 const v8::Arguments& args) { 7622 const v8::Arguments& args) {
7623 ApiTestFuzzer::Fuzz(); 7623 ApiTestFuzzer::Fuzz();
7624 CHECK_EQ(args.This(), args.Holder()); 7624 CHECK_EQ(args.This(), args.Holder());
7625 CHECK(args.Data()->Equals(v8_str("method_data"))); 7625 CHECK(args.Data()->Equals(v8_str("method_data")));
7626 return v8::Integer::New(args[0]->Int32Value() + 1); 7626 return v8::Integer::New(args[0]->Int32Value() + 1);
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
8822 Local<Script> script = v8_compile("(function () {" 8822 Local<Script> script = v8_compile("(function () {"
8823 " unlock_for_a_moment();" 8823 " unlock_for_a_moment();"
8824 " return 42;" 8824 " return 42;"
8825 "})();"); 8825 "})();");
8826 CHECK_EQ(42, script->Run()->Int32Value()); 8826 CHECK_EQ(42, script->Run()->Int32Value());
8827 } 8827 }
8828 } 8828 }
8829 8829
8830 8830
8831 static int GetGlobalObjectsCount() { 8831 static int GetGlobalObjectsCount() {
8832 i::Heap::EnsureHeapIsIterable();
8832 int count = 0; 8833 int count = 0;
8833 i::HeapIterator it; 8834 i::HeapIterator it;
8834 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) 8835 for (i::HeapObject* object = it.Next(); object != NULL; object = it.Next())
8835 if (object->IsJSGlobalObject()) count++; 8836 if (object->IsJSGlobalObject()) count++;
8836 return count; 8837 return count;
8837 } 8838 }
8838 8839
8839 8840
8840 static void CheckSurvivingGlobalObjectsCount(int expected) { 8841 static void CheckSurvivingGlobalObjectsCount(int expected) {
8841 // We need to collect all garbage twice to be sure that everything 8842 // We need to collect all garbage twice to be sure that everything
8842 // has been collected. This is because inline caches are cleared in 8843 // has been collected. This is because inline caches are cleared in
8843 // the first garbage collection but some of the maps have already 8844 // the first garbage collection but some of the maps have already
8844 // been marked at that point. Therefore some of the maps are not 8845 // been marked at that point. Therefore some of the maps are not
8845 // collected until the second garbage collection. 8846 // collected until the second garbage collection.
8846 i::Heap::CollectAllGarbage(false); 8847 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
8847 i::Heap::CollectAllGarbage(false); 8848 i::Heap::CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
8848 int count = GetGlobalObjectsCount(); 8849 int count = GetGlobalObjectsCount();
8849 #ifdef DEBUG 8850 #ifdef DEBUG
8850 if (count != expected) i::Heap::TracePathToGlobal(); 8851 if (count != expected) i::Heap::TracePathToGlobal();
8851 #endif 8852 #endif
8852 CHECK_EQ(expected, count); 8853 CHECK_EQ(expected, count);
8853 } 8854 }
8854 8855
8855 8856
8856 TEST(DontLeakGlobalObjects) { 8857 TEST(DontLeakGlobalObjects) {
8857 // Regression test for issues 1139850 and 1174891. 8858 // Regression test for issues 1139850 and 1174891.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
8906 some_object = v8::Persistent<v8::Object>::New(v8::Object::New()); 8907 some_object = v8::Persistent<v8::Object>::New(v8::Object::New());
8907 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New()); 8908 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
8908 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New()); 8909 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
8909 } 8910 }
8910 // Note: order is implementation dependent alas: currently 8911 // Note: order is implementation dependent alas: currently
8911 // global handle nodes are processed by PostGarbageCollectionProcessing 8912 // global handle nodes are processed by PostGarbageCollectionProcessing
8912 // in reverse allocation order, so if second allocated handle is deleted, 8913 // in reverse allocation order, so if second allocated handle is deleted,
8913 // weak callback of the first handle would be able to 'reallocate' it. 8914 // weak callback of the first handle would be able to 'reallocate' it.
8914 handle1.MakeWeak(NULL, NewPersistentHandleCallback); 8915 handle1.MakeWeak(NULL, NewPersistentHandleCallback);
8915 handle2.Dispose(); 8916 handle2.Dispose();
8916 i::Heap::CollectAllGarbage(false); 8917 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
8917 } 8918 }
8918 8919
8919 8920
8920 v8::Persistent<v8::Object> to_be_disposed; 8921 v8::Persistent<v8::Object> to_be_disposed;
8921 8922
8922 void DisposeAndForceGcCallback(v8::Persistent<v8::Value> handle, void*) { 8923 void DisposeAndForceGcCallback(v8::Persistent<v8::Value> handle, void*) {
8923 to_be_disposed.Dispose(); 8924 to_be_disposed.Dispose();
8924 i::Heap::CollectAllGarbage(false); 8925 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
8925 handle.Dispose(); 8926 handle.Dispose();
8926 } 8927 }
8927 8928
8928 8929
8929 THREADED_TEST(DoNotUseDeletedNodesInSecondLevelGc) { 8930 THREADED_TEST(DoNotUseDeletedNodesInSecondLevelGc) {
8930 LocalContext context; 8931 LocalContext context;
8931 8932
8932 v8::Persistent<v8::Object> handle1, handle2; 8933 v8::Persistent<v8::Object> handle1, handle2;
8933 { 8934 {
8934 v8::HandleScope scope; 8935 v8::HandleScope scope;
8935 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New()); 8936 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
8936 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New()); 8937 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
8937 } 8938 }
8938 handle1.MakeWeak(NULL, DisposeAndForceGcCallback); 8939 handle1.MakeWeak(NULL, DisposeAndForceGcCallback);
8939 to_be_disposed = handle2; 8940 to_be_disposed = handle2;
8940 i::Heap::CollectAllGarbage(false); 8941 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
8941 } 8942 }
8942 8943
8943 void DisposingCallback(v8::Persistent<v8::Value> handle, void*) { 8944 void DisposingCallback(v8::Persistent<v8::Value> handle, void*) {
8944 handle.Dispose(); 8945 handle.Dispose();
8945 } 8946 }
8946 8947
8947 void HandleCreatingCallback(v8::Persistent<v8::Value> handle, void*) { 8948 void HandleCreatingCallback(v8::Persistent<v8::Value> handle, void*) {
8948 v8::HandleScope scope; 8949 v8::HandleScope scope;
8949 v8::Persistent<v8::Object>::New(v8::Object::New()); 8950 v8::Persistent<v8::Object>::New(v8::Object::New());
8950 handle.Dispose(); 8951 handle.Dispose();
8951 } 8952 }
8952 8953
8953 8954
8954 THREADED_TEST(NoGlobalHandlesOrphaningDueToWeakCallback) { 8955 THREADED_TEST(NoGlobalHandlesOrphaningDueToWeakCallback) {
8955 LocalContext context; 8956 LocalContext context;
8956 8957
8957 v8::Persistent<v8::Object> handle1, handle2, handle3; 8958 v8::Persistent<v8::Object> handle1, handle2, handle3;
8958 { 8959 {
8959 v8::HandleScope scope; 8960 v8::HandleScope scope;
8960 handle3 = v8::Persistent<v8::Object>::New(v8::Object::New()); 8961 handle3 = v8::Persistent<v8::Object>::New(v8::Object::New());
8961 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New()); 8962 handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
8962 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New()); 8963 handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
8963 } 8964 }
8964 handle2.MakeWeak(NULL, DisposingCallback); 8965 handle2.MakeWeak(NULL, DisposingCallback);
8965 handle3.MakeWeak(NULL, HandleCreatingCallback); 8966 handle3.MakeWeak(NULL, HandleCreatingCallback);
8966 i::Heap::CollectAllGarbage(false); 8967 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
8967 } 8968 }
8968 8969
8969 8970
8970 THREADED_TEST(CheckForCrossContextObjectLiterals) { 8971 THREADED_TEST(CheckForCrossContextObjectLiterals) {
8971 v8::V8::Initialize(); 8972 v8::V8::Initialize();
8972 8973
8973 const int nof = 2; 8974 const int nof = 2;
8974 const char* sources[nof] = { 8975 const char* sources[nof] = {
8975 "try { [ 2, 3, 4 ].forEach(5); } catch(e) { e.toString(); }", 8976 "try { [ 2, 3, 4 ].forEach(5); } catch(e) { e.toString(); }",
8976 "Object()" 8977 "Object()"
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
9728 private: 9729 private:
9729 RegExpInterruptTest* test_; 9730 RegExpInterruptTest* test_;
9730 }; 9731 };
9731 9732
9732 void CollectGarbage() { 9733 void CollectGarbage() {
9733 block_->Wait(); 9734 block_->Wait();
9734 while (gc_during_regexp_ < kRequiredGCs) { 9735 while (gc_during_regexp_ < kRequiredGCs) {
9735 { 9736 {
9736 v8::Locker lock; 9737 v8::Locker lock;
9737 // TODO(lrn): Perhaps create some garbage before collecting. 9738 // TODO(lrn): Perhaps create some garbage before collecting.
9738 i::Heap::CollectAllGarbage(false); 9739 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
9739 gc_count_++; 9740 gc_count_++;
9740 } 9741 }
9741 i::OS::Sleep(1); 9742 i::OS::Sleep(1);
9742 } 9743 }
9743 gc_success_ = true; 9744 gc_success_ = true;
9744 } 9745 }
9745 9746
9746 void LongRunningRegExp() { 9747 void LongRunningRegExp() {
9747 block_->Signal(); // Enable garbage collection thread on next preemption. 9748 block_->Signal(); // Enable garbage collection thread on next preemption.
9748 int rounds = 0; 9749 int rounds = 0;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
9849 } 9850 }
9850 private: 9851 private:
9851 ApplyInterruptTest* test_; 9852 ApplyInterruptTest* test_;
9852 }; 9853 };
9853 9854
9854 void CollectGarbage() { 9855 void CollectGarbage() {
9855 block_->Wait(); 9856 block_->Wait();
9856 while (gc_during_apply_ < kRequiredGCs) { 9857 while (gc_during_apply_ < kRequiredGCs) {
9857 { 9858 {
9858 v8::Locker lock; 9859 v8::Locker lock;
9859 i::Heap::CollectAllGarbage(false); 9860 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
9860 gc_count_++; 9861 gc_count_++;
9861 } 9862 }
9862 i::OS::Sleep(1); 9863 i::OS::Sleep(1);
9863 } 9864 }
9864 gc_success_ = true; 9865 gc_success_ = true;
9865 } 9866 }
9866 9867
9867 void LongRunningApply() { 9868 void LongRunningApply() {
9868 block_->Signal(); 9869 block_->Signal();
9869 int rounds = 0; 9870 int rounds = 0;
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
10567 THREADED_TEST(PixelArray) { 10568 THREADED_TEST(PixelArray) {
10568 v8::HandleScope scope; 10569 v8::HandleScope scope;
10569 LocalContext context; 10570 LocalContext context;
10570 const int kElementCount = 260; 10571 const int kElementCount = 260;
10571 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); 10572 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
10572 i::Handle<i::ExternalPixelArray> pixels = 10573 i::Handle<i::ExternalPixelArray> pixels =
10573 i::Handle<i::ExternalPixelArray>::cast( 10574 i::Handle<i::ExternalPixelArray>::cast(
10574 i::Factory::NewExternalArray(kElementCount, 10575 i::Factory::NewExternalArray(kElementCount,
10575 v8::kExternalPixelArray, 10576 v8::kExternalPixelArray,
10576 pixel_data)); 10577 pixel_data));
10577 i::Heap::CollectAllGarbage(false); // Force GC to trigger verification. 10578 // Force GC to trigger verification.
10579 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
10578 for (int i = 0; i < kElementCount; i++) { 10580 for (int i = 0; i < kElementCount; i++) {
10579 pixels->set(i, i % 256); 10581 pixels->set(i, i % 256);
10580 } 10582 }
10581 i::Heap::CollectAllGarbage(false); // Force GC to trigger verification. 10583 // Force GC to trigger verification.
10584 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
10582 for (int i = 0; i < kElementCount; i++) { 10585 for (int i = 0; i < kElementCount; i++) {
10583 CHECK_EQ(i % 256, pixels->get(i)); 10586 CHECK_EQ(i % 256, pixels->get(i));
10584 CHECK_EQ(i % 256, pixel_data[i]); 10587 CHECK_EQ(i % 256, pixel_data[i]);
10585 } 10588 }
10586 10589
10587 v8::Handle<v8::Object> obj = v8::Object::New(); 10590 v8::Handle<v8::Object> obj = v8::Object::New();
10588 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); 10591 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
10589 // Set the elements to be the pixels. 10592 // Set the elements to be the pixels.
10590 // jsobj->set_elements(*pixels); 10593 // jsobj->set_elements(*pixels);
10591 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); 10594 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
11037 int64_t high) { 11040 int64_t high) {
11038 v8::HandleScope scope; 11041 v8::HandleScope scope;
11039 LocalContext context; 11042 LocalContext context;
11040 const int kElementCount = 40; 11043 const int kElementCount = 40;
11041 int element_size = ExternalArrayElementSize(array_type); 11044 int element_size = ExternalArrayElementSize(array_type);
11042 ElementType* array_data = 11045 ElementType* array_data =
11043 static_cast<ElementType*>(malloc(kElementCount * element_size)); 11046 static_cast<ElementType*>(malloc(kElementCount * element_size));
11044 i::Handle<ExternalArrayClass> array = 11047 i::Handle<ExternalArrayClass> array =
11045 i::Handle<ExternalArrayClass>::cast( 11048 i::Handle<ExternalArrayClass>::cast(
11046 i::Factory::NewExternalArray(kElementCount, array_type, array_data)); 11049 i::Factory::NewExternalArray(kElementCount, array_type, array_data));
11047 i::Heap::CollectAllGarbage(false); // Force GC to trigger verification. 11050 // Force GC to trigger verification.
11051 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
11048 for (int i = 0; i < kElementCount; i++) { 11052 for (int i = 0; i < kElementCount; i++) {
11049 array->set(i, static_cast<ElementType>(i)); 11053 array->set(i, static_cast<ElementType>(i));
11050 } 11054 }
11051 i::Heap::CollectAllGarbage(false); // Force GC to trigger verification. 11055 // Force GC to trigger verification.
11056 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
11052 for (int i = 0; i < kElementCount; i++) { 11057 for (int i = 0; i < kElementCount; i++) {
11053 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array->get(i))); 11058 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array->get(i)));
11054 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i])); 11059 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i]));
11055 } 11060 }
11056 11061
11057 v8::Handle<v8::Object> obj = v8::Object::New(); 11062 v8::Handle<v8::Object> obj = v8::Object::New();
11058 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); 11063 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
11059 // Set the elements to be the external array. 11064 // Set the elements to be the external array.
11060 obj->SetIndexedPropertiesToExternalArrayData(array_data, 11065 obj->SetIndexedPropertiesToExternalArrayData(array_data,
11061 array_type, 11066 array_type,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
11158 result = CompileRun("var tmp_array = ext_array;" 11163 result = CompileRun("var tmp_array = ext_array;"
11159 "var sum = 0;" 11164 "var sum = 0;"
11160 "for (var i = 0; i < 8; i++) {" 11165 "for (var i = 0; i < 8; i++) {"
11161 " tmp_array[i] = i;" 11166 " tmp_array[i] = i;"
11162 " sum += tmp_array[i];" 11167 " sum += tmp_array[i];"
11163 " if (i == 4) {" 11168 " if (i == 4) {"
11164 " tmp_array = {};" 11169 " tmp_array = {};"
11165 " }" 11170 " }"
11166 "}" 11171 "}"
11167 "sum;"); 11172 "sum;");
11168 i::Heap::CollectAllGarbage(false); // Force GC to trigger verification. 11173 // Force GC to trigger verification.
11174 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
11169 CHECK_EQ(28, result->Int32Value()); 11175 CHECK_EQ(28, result->Int32Value());
11170 11176
11171 // Make sure out-of-range loads do not throw. 11177 // Make sure out-of-range loads do not throw.
11172 i::OS::SNPrintF(test_buf, 11178 i::OS::SNPrintF(test_buf,
11173 "var caught_exception = false;" 11179 "var caught_exception = false;"
11174 "try {" 11180 "try {"
11175 " ext_array[%d];" 11181 " ext_array[%d];"
11176 "} catch (e) {" 11182 "} catch (e) {"
11177 " caught_exception = true;" 11183 " caught_exception = true;"
11178 "}" 11184 "}"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
12017 Local<v8::String> obj = v8::String::New(""); 12023 Local<v8::String> obj = v8::String::New("");
12018 context->SetData(obj); 12024 context->SetData(obj);
12019 CompileRun(source_simple); 12025 CompileRun(source_simple);
12020 context->Exit(); 12026 context->Exit();
12021 } 12027 }
12022 context.Dispose(); 12028 context.Dispose();
12023 for (gc_count = 1; gc_count < 10; gc_count++) { 12029 for (gc_count = 1; gc_count < 10; gc_count++) {
12024 other_context->Enter(); 12030 other_context->Enter();
12025 CompileRun(source_simple); 12031 CompileRun(source_simple);
12026 other_context->Exit(); 12032 other_context->Exit();
12027 i::Heap::CollectAllGarbage(false); 12033 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
12028 if (GetGlobalObjectsCount() == 1) break; 12034 if (GetGlobalObjectsCount() == 1) break;
12029 } 12035 }
12030 CHECK_GE(2, gc_count); 12036 CHECK_GE(2, gc_count);
12031 CHECK_EQ(1, GetGlobalObjectsCount()); 12037 CHECK_EQ(1, GetGlobalObjectsCount());
12032 12038
12033 // Eval in a function creates reference from the compilation cache to the 12039 // Eval in a function creates reference from the compilation cache to the
12034 // global object. 12040 // global object.
12035 const char* source_eval = "function f(){eval('1')}; f()"; 12041 const char* source_eval = "function f(){eval('1')}; f()";
12036 context = Context::New(); 12042 context = Context::New();
12037 { 12043 {
12038 v8::HandleScope scope; 12044 v8::HandleScope scope;
12039 12045
12040 context->Enter(); 12046 context->Enter();
12041 CompileRun(source_eval); 12047 CompileRun(source_eval);
12042 context->Exit(); 12048 context->Exit();
12043 } 12049 }
12044 context.Dispose(); 12050 context.Dispose();
12045 for (gc_count = 1; gc_count < 10; gc_count++) { 12051 for (gc_count = 1; gc_count < 10; gc_count++) {
12046 other_context->Enter(); 12052 other_context->Enter();
12047 CompileRun(source_eval); 12053 CompileRun(source_eval);
12048 other_context->Exit(); 12054 other_context->Exit();
12049 i::Heap::CollectAllGarbage(false); 12055 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
12050 if (GetGlobalObjectsCount() == 1) break; 12056 if (GetGlobalObjectsCount() == 1) break;
12051 } 12057 }
12052 CHECK_GE(2, gc_count); 12058 CHECK_GE(2, gc_count);
12053 CHECK_EQ(1, GetGlobalObjectsCount()); 12059 CHECK_EQ(1, GetGlobalObjectsCount());
12054 12060
12055 // Looking up the line number for an exception creates reference from the 12061 // Looking up the line number for an exception creates reference from the
12056 // compilation cache to the global object. 12062 // compilation cache to the global object.
12057 const char* source_exception = "function f(){throw 1;} f()"; 12063 const char* source_exception = "function f(){throw 1;} f()";
12058 context = Context::New(); 12064 context = Context::New();
12059 { 12065 {
12060 v8::HandleScope scope; 12066 v8::HandleScope scope;
12061 12067
12062 context->Enter(); 12068 context->Enter();
12063 v8::TryCatch try_catch; 12069 v8::TryCatch try_catch;
12064 CompileRun(source_exception); 12070 CompileRun(source_exception);
12065 CHECK(try_catch.HasCaught()); 12071 CHECK(try_catch.HasCaught());
12066 v8::Handle<v8::Message> message = try_catch.Message(); 12072 v8::Handle<v8::Message> message = try_catch.Message();
12067 CHECK(!message.IsEmpty()); 12073 CHECK(!message.IsEmpty());
12068 CHECK_EQ(1, message->GetLineNumber()); 12074 CHECK_EQ(1, message->GetLineNumber());
12069 context->Exit(); 12075 context->Exit();
12070 } 12076 }
12071 context.Dispose(); 12077 context.Dispose();
12072 for (gc_count = 1; gc_count < 10; gc_count++) { 12078 for (gc_count = 1; gc_count < 10; gc_count++) {
12073 other_context->Enter(); 12079 other_context->Enter();
12074 CompileRun(source_exception); 12080 CompileRun(source_exception);
12075 other_context->Exit(); 12081 other_context->Exit();
12076 i::Heap::CollectAllGarbage(false); 12082 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
12077 if (GetGlobalObjectsCount() == 1) break; 12083 if (GetGlobalObjectsCount() == 1) break;
12078 } 12084 }
12079 CHECK_GE(2, gc_count); 12085 CHECK_GE(2, gc_count);
12080 CHECK_EQ(1, GetGlobalObjectsCount()); 12086 CHECK_EQ(1, GetGlobalObjectsCount());
12081 12087
12082 other_context.Dispose(); 12088 other_context.Dispose();
12083 } 12089 }
12084 12090
12085 12091
12086 THREADED_TEST(ScriptOrigin) { 12092 THREADED_TEST(ScriptOrigin) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
12284 ++epilogue_call_count_second; 12290 ++epilogue_call_count_second;
12285 } 12291 }
12286 12292
12287 TEST(GCCallbacks) { 12293 TEST(GCCallbacks) {
12288 LocalContext context; 12294 LocalContext context;
12289 12295
12290 v8::V8::AddGCPrologueCallback(PrologueCallback); 12296 v8::V8::AddGCPrologueCallback(PrologueCallback);
12291 v8::V8::AddGCEpilogueCallback(EpilogueCallback); 12297 v8::V8::AddGCEpilogueCallback(EpilogueCallback);
12292 CHECK_EQ(0, prologue_call_count); 12298 CHECK_EQ(0, prologue_call_count);
12293 CHECK_EQ(0, epilogue_call_count); 12299 CHECK_EQ(0, epilogue_call_count);
12294 i::Heap::CollectAllGarbage(false); 12300 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
12295 CHECK_EQ(1, prologue_call_count); 12301 CHECK_EQ(1, prologue_call_count);
12296 CHECK_EQ(1, epilogue_call_count); 12302 CHECK_EQ(1, epilogue_call_count);
12297 v8::V8::AddGCPrologueCallback(PrologueCallbackSecond); 12303 v8::V8::AddGCPrologueCallback(PrologueCallbackSecond);
12298 v8::V8::AddGCEpilogueCallback(EpilogueCallbackSecond); 12304 v8::V8::AddGCEpilogueCallback(EpilogueCallbackSecond);
12299 i::Heap::CollectAllGarbage(false); 12305 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
12300 CHECK_EQ(2, prologue_call_count); 12306 CHECK_EQ(2, prologue_call_count);
12301 CHECK_EQ(2, epilogue_call_count); 12307 CHECK_EQ(2, epilogue_call_count);
12302 CHECK_EQ(1, prologue_call_count_second); 12308 CHECK_EQ(1, prologue_call_count_second);
12303 CHECK_EQ(1, epilogue_call_count_second); 12309 CHECK_EQ(1, epilogue_call_count_second);
12304 v8::V8::RemoveGCPrologueCallback(PrologueCallback); 12310 v8::V8::RemoveGCPrologueCallback(PrologueCallback);
12305 v8::V8::RemoveGCEpilogueCallback(EpilogueCallback); 12311 v8::V8::RemoveGCEpilogueCallback(EpilogueCallback);
12306 i::Heap::CollectAllGarbage(false); 12312 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
12307 CHECK_EQ(2, prologue_call_count); 12313 CHECK_EQ(2, prologue_call_count);
12308 CHECK_EQ(2, epilogue_call_count); 12314 CHECK_EQ(2, epilogue_call_count);
12309 CHECK_EQ(2, prologue_call_count_second); 12315 CHECK_EQ(2, prologue_call_count_second);
12310 CHECK_EQ(2, epilogue_call_count_second); 12316 CHECK_EQ(2, epilogue_call_count_second);
12311 v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond); 12317 v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond);
12312 v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond); 12318 v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond);
12313 i::Heap::CollectAllGarbage(false); 12319 i::Heap::CollectAllGarbage(i::Heap::kNoGCFlags);
12314 CHECK_EQ(2, prologue_call_count); 12320 CHECK_EQ(2, prologue_call_count);
12315 CHECK_EQ(2, epilogue_call_count); 12321 CHECK_EQ(2, epilogue_call_count);
12316 CHECK_EQ(2, prologue_call_count_second); 12322 CHECK_EQ(2, prologue_call_count_second);
12317 CHECK_EQ(2, epilogue_call_count_second); 12323 CHECK_EQ(2, epilogue_call_count_second);
12318 } 12324 }
12319 12325
12320 12326
12321 THREADED_TEST(AddToJSFunctionResultCache) { 12327 THREADED_TEST(AddToJSFunctionResultCache) {
12322 i::FLAG_allow_natives_syntax = true; 12328 i::FLAG_allow_natives_syntax = true;
12323 v8::HandleScope scope; 12329 v8::HandleScope scope;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
12513 12519
12514 reresult = CompileRun("str2.charCodeAt(2);"); 12520 reresult = CompileRun("str2.charCodeAt(2);");
12515 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value()); 12521 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value());
12516 } 12522 }
12517 12523
12518 12524
12519 // Failed access check callback that performs a GC on each invocation. 12525 // Failed access check callback that performs a GC on each invocation.
12520 void FailedAccessCheckCallbackGC(Local<v8::Object> target, 12526 void FailedAccessCheckCallbackGC(Local<v8::Object> target,
12521 v8::AccessType type, 12527 v8::AccessType type,
12522 Local<v8::Value> data) { 12528 Local<v8::Value> data) {
12523 i::Heap::CollectAllGarbage(true); 12529 i::Heap::CollectAllGarbage(i::Heap::kForceCompactionMask);
12524 } 12530 }
12525 12531
12526 12532
12527 TEST(GCInFailedAccessCheckCallback) { 12533 TEST(GCInFailedAccessCheckCallback) {
12528 // Install a failed access check callback that performs a GC on each 12534 // Install a failed access check callback that performs a GC on each
12529 // invocation. Then force the callback to be called from va 12535 // invocation. Then force the callback to be called from va
12530 12536
12531 v8::V8::Initialize(); 12537 v8::V8::Initialize();
12532 v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckCallbackGC); 12538 v8::V8::SetFailedAccessCheckCallbackFunction(&FailedAccessCheckCallbackGC);
12533 12539
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
12697 ExpectBoolean("delete cell", true); 12703 ExpectBoolean("delete cell", true);
12698 ExpectString("(function() {" 12704 ExpectString("(function() {"
12699 " try {" 12705 " try {"
12700 " return readCell();" 12706 " return readCell();"
12701 " } catch(e) {" 12707 " } catch(e) {"
12702 " return e.toString();" 12708 " return e.toString();"
12703 " }" 12709 " }"
12704 "})()", 12710 "})()",
12705 "ReferenceError: cell is not defined"); 12711 "ReferenceError: cell is not defined");
12706 CompileRun("cell = \"new_second\";"); 12712 CompileRun("cell = \"new_second\";");
12707 i::Heap::CollectAllGarbage(true); 12713 i::Heap::CollectAllGarbage(i::Heap::kForceCompactionMask);
12708 ExpectString("readCell()", "new_second"); 12714 ExpectString("readCell()", "new_second");
12709 ExpectString("readCell()", "new_second"); 12715 ExpectString("readCell()", "new_second");
12710 } 12716 }
12711 } 12717 }
12712 12718
12713 12719
12714 TEST(DontDeleteCellLoadICForceDelete) { 12720 TEST(DontDeleteCellLoadICForceDelete) {
12715 const char* function_code = 12721 const char* function_code =
12716 "function readCell() { while (true) { return cell; } }"; 12722 "function readCell() { while (true) { return cell; } }";
12717 12723
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
12928 v8::Handle<v8::Function> define_property = 12934 v8::Handle<v8::Function> define_property =
12929 CompileRun("(function() {" 12935 CompileRun("(function() {"
12930 " Object.defineProperty(" 12936 " Object.defineProperty("
12931 " this," 12937 " this,"
12932 " 1," 12938 " 1,"
12933 " { configurable: true, enumerable: true, value: 3 });" 12939 " { configurable: true, enumerable: true, value: 3 });"
12934 "})").As<Function>(); 12940 "})").As<Function>();
12935 context->DetachGlobal(); 12941 context->DetachGlobal();
12936 define_property->Call(proxy, 0, NULL); 12942 define_property->Call(proxy, 0, NULL);
12937 } 12943 }
OLDNEW
« src/spaces-inl.h ('K') | « test/cctest/test-accessors.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698