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

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

Issue 118374: Introduce an API to force the deletion of a property ignoring... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « test/cctest/test-api.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "execution.h" 7 #include "execution.h"
8 #include "factory.h" 8 #include "factory.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 #include "global-handles.h" 10 #include "global-handles.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 String* second = String::cast(Heap::LookupAsciiSymbol("second")); 546 String* second = String::cast(Heap::LookupAsciiSymbol("second"));
547 547
548 // check for empty 548 // check for empty
549 CHECK(!obj->HasLocalProperty(first)); 549 CHECK(!obj->HasLocalProperty(first));
550 550
551 // add first 551 // add first
552 obj->SetProperty(first, Smi::FromInt(1), NONE); 552 obj->SetProperty(first, Smi::FromInt(1), NONE);
553 CHECK(obj->HasLocalProperty(first)); 553 CHECK(obj->HasLocalProperty(first));
554 554
555 // delete first 555 // delete first
556 CHECK(obj->DeleteProperty(first)); 556 CHECK(obj->DeleteProperty(first, JSObject::NORMAL_DELETION));
557 CHECK(!obj->HasLocalProperty(first)); 557 CHECK(!obj->HasLocalProperty(first));
558 558
559 // add first and then second 559 // add first and then second
560 obj->SetProperty(first, Smi::FromInt(1), NONE); 560 obj->SetProperty(first, Smi::FromInt(1), NONE);
561 obj->SetProperty(second, Smi::FromInt(2), NONE); 561 obj->SetProperty(second, Smi::FromInt(2), NONE);
562 CHECK(obj->HasLocalProperty(first)); 562 CHECK(obj->HasLocalProperty(first));
563 CHECK(obj->HasLocalProperty(second)); 563 CHECK(obj->HasLocalProperty(second));
564 564
565 // delete first and then second 565 // delete first and then second
566 CHECK(obj->DeleteProperty(first)); 566 CHECK(obj->DeleteProperty(first, JSObject::NORMAL_DELETION));
567 CHECK(obj->HasLocalProperty(second)); 567 CHECK(obj->HasLocalProperty(second));
568 CHECK(obj->DeleteProperty(second)); 568 CHECK(obj->DeleteProperty(second, JSObject::NORMAL_DELETION));
569 CHECK(!obj->HasLocalProperty(first)); 569 CHECK(!obj->HasLocalProperty(first));
570 CHECK(!obj->HasLocalProperty(second)); 570 CHECK(!obj->HasLocalProperty(second));
571 571
572 // add first and then second 572 // add first and then second
573 obj->SetProperty(first, Smi::FromInt(1), NONE); 573 obj->SetProperty(first, Smi::FromInt(1), NONE);
574 obj->SetProperty(second, Smi::FromInt(2), NONE); 574 obj->SetProperty(second, Smi::FromInt(2), NONE);
575 CHECK(obj->HasLocalProperty(first)); 575 CHECK(obj->HasLocalProperty(first));
576 CHECK(obj->HasLocalProperty(second)); 576 CHECK(obj->HasLocalProperty(second));
577 577
578 // delete second and then first 578 // delete second and then first
579 CHECK(obj->DeleteProperty(second)); 579 CHECK(obj->DeleteProperty(second, JSObject::NORMAL_DELETION));
580 CHECK(obj->HasLocalProperty(first)); 580 CHECK(obj->HasLocalProperty(first));
581 CHECK(obj->DeleteProperty(first)); 581 CHECK(obj->DeleteProperty(first, JSObject::NORMAL_DELETION));
582 CHECK(!obj->HasLocalProperty(first)); 582 CHECK(!obj->HasLocalProperty(first));
583 CHECK(!obj->HasLocalProperty(second)); 583 CHECK(!obj->HasLocalProperty(second));
584 584
585 // check string and symbol match 585 // check string and symbol match
586 static const char* string1 = "fisk"; 586 static const char* string1 = "fisk";
587 String* s1 = 587 String* s1 =
588 String::cast(Heap::AllocateStringFromAscii(CStrVector(string1))); 588 String::cast(Heap::AllocateStringFromAscii(CStrVector(string1)));
589 obj->SetProperty(s1, Smi::FromInt(1), NONE); 589 obj->SetProperty(s1, Smi::FromInt(1), NONE);
590 CHECK(obj->HasLocalProperty(String::cast(Heap::LookupAsciiSymbol(string1)))); 590 CHECK(obj->HasLocalProperty(String::cast(Heap::LookupAsciiSymbol(string1))));
591 591
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 objs[next_objs_index++] = 789 objs[next_objs_index++] =
790 Factory::NewStringFromAscii(CStrVector(str), TENURED); 790 Factory::NewStringFromAscii(CStrVector(str), TENURED);
791 delete[] str; 791 delete[] str;
792 792
793 // Add a Map object to look for. 793 // Add a Map object to look for.
794 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); 794 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map());
795 795
796 CHECK_EQ(objs_count, next_objs_index); 796 CHECK_EQ(objs_count, next_objs_index);
797 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); 797 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count));
798 } 798 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698