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

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

Issue 203583007: Support weak heap references in the ConstantPool to support IsWeakObjectInOptimizedCode objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« src/objects-visiting-inl.h ('K') | « src/objects-visiting-inl.h ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 2
3 // Test constant pool array code. 3 // Test constant pool array code.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "factory.h" 7 #include "factory.h"
8 #include "objects.h" 8 #include "objects.h"
9 #include "cctest.h" 9 #include "cctest.h"
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 22
23 TEST(ConstantPool) { 23 TEST(ConstantPool) {
24 LocalContext context; 24 LocalContext context;
25 Isolate* isolate = CcTest::i_isolate(); 25 Isolate* isolate = CcTest::i_isolate();
26 Heap* heap = isolate->heap(); 26 Heap* heap = isolate->heap();
27 Factory* factory = isolate->factory(); 27 Factory* factory = isolate->factory();
28 v8::HandleScope scope(context->GetIsolate()); 28 v8::HandleScope scope(context->GetIsolate());
29 29
30 // Check construction. 30 // Check construction.
31 Handle<ConstantPoolArray> array = factory->NewConstantPoolArray(3, 1, 2, 1); 31 Handle<ConstantPoolArray> array =
32 factory->NewConstantPoolArray(3, 1, 2, 0, 1);
32 CHECK_EQ(array->count_of_int64_entries(), 3); 33 CHECK_EQ(array->count_of_int64_entries(), 3);
33 CHECK_EQ(array->count_of_code_ptr_entries(), 1); 34 CHECK_EQ(array->count_of_code_ptr_entries(), 1);
34 CHECK_EQ(array->count_of_heap_ptr_entries(), 2); 35 CHECK_EQ(array->count_of_heap_ptr_entries(), 2);
36 CHECK_EQ(array->count_of_weak_ptr_entries(), 0);
35 CHECK_EQ(array->count_of_int32_entries(), 1); 37 CHECK_EQ(array->count_of_int32_entries(), 1);
36 CHECK_EQ(array->length(), 7); 38 CHECK_EQ(array->length(), 7);
37 CHECK_EQ(array->first_int64_index(), 0); 39 CHECK_EQ(array->first_int64_index(), 0);
38 CHECK_EQ(array->first_code_ptr_index(), 3); 40 CHECK_EQ(array->first_code_ptr_index(), 3);
39 CHECK_EQ(array->first_heap_ptr_index(), 4); 41 CHECK_EQ(array->first_heap_ptr_index(), 4);
40 CHECK_EQ(array->first_int32_index(), 6); 42 CHECK_EQ(array->first_int32_index(), 6);
41 43
42 // Check getters and setters. 44 // Check getters and setters.
43 int64_t big_number = V8_2PART_UINT64_C(0x12345678, 9ABCDEF0); 45 int64_t big_number = V8_2PART_UINT64_C(0x12345678, 9ABCDEF0);
44 Handle<Object> object = factory->NewHeapNumber(4.0); 46 Handle<Object> object = factory->NewHeapNumber(4.0);
(...skipping 14 matching lines...) Expand all
59 CHECK_EQ(array->get_int32_entry(6), 50); 61 CHECK_EQ(array->get_int32_entry(6), 50);
60 62
61 // Check pointers are updated on GC. 63 // Check pointers are updated on GC.
62 Object* old_ptr = array->get_heap_ptr_entry(5); 64 Object* old_ptr = array->get_heap_ptr_entry(5);
63 CHECK_EQ(*object, old_ptr); 65 CHECK_EQ(*object, old_ptr);
64 heap->CollectGarbage(NEW_SPACE); 66 heap->CollectGarbage(NEW_SPACE);
65 Object* new_ptr = array->get_heap_ptr_entry(5); 67 Object* new_ptr = array->get_heap_ptr_entry(5);
66 CHECK_NE(*object, old_ptr); 68 CHECK_NE(*object, old_ptr);
67 CHECK_EQ(*object, new_ptr); 69 CHECK_EQ(*object, new_ptr);
68 } 70 }
OLDNEW
« src/objects-visiting-inl.h ('K') | « src/objects-visiting-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698