OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 static void CheckFindCodeObject() { | 70 static void CheckFindCodeObject() { |
71 // Test FindCodeObject | 71 // Test FindCodeObject |
72 #define __ assm. | 72 #define __ assm. |
73 | 73 |
74 Assembler assm(NULL, 0); | 74 Assembler assm(NULL, 0); |
75 | 75 |
76 __ nop(); // supported on all architectures | 76 __ nop(); // supported on all architectures |
77 | 77 |
78 CodeDesc desc; | 78 CodeDesc desc; |
79 assm.GetCode(&desc); | 79 assm.GetCode(&desc); |
80 Object* code = Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB)); | 80 Object* code = Heap::CreateCode(desc, |
| 81 NULL, |
| 82 Code::ComputeFlags(Code::STUB), |
| 83 Handle<Object>(Heap::undefined_value())); |
81 CHECK(code->IsCode()); | 84 CHECK(code->IsCode()); |
82 | 85 |
83 HeapObject* obj = HeapObject::cast(code); | 86 HeapObject* obj = HeapObject::cast(code); |
84 Address obj_addr = obj->address(); | 87 Address obj_addr = obj->address(); |
85 | 88 |
86 for (int i = 0; i < obj->Size(); i += kPointerSize) { | 89 for (int i = 0; i < obj->Size(); i += kPointerSize) { |
87 Object* found = Heap::FindCodeObject(obj_addr + i); | 90 Object* found = Heap::FindCodeObject(obj_addr + i); |
88 CHECK_EQ(code, found); | 91 CHECK_EQ(code, found); |
89 } | 92 } |
90 | 93 |
91 Object* copy = Heap::CreateCode(desc, NULL, Code::ComputeFlags(Code::STUB)); | 94 Object* copy = Heap::CreateCode(desc, |
| 95 NULL, |
| 96 Code::ComputeFlags(Code::STUB), |
| 97 Handle<Object>(Heap::undefined_value())); |
92 CHECK(copy->IsCode()); | 98 CHECK(copy->IsCode()); |
93 HeapObject* obj_copy = HeapObject::cast(copy); | 99 HeapObject* obj_copy = HeapObject::cast(copy); |
94 Object* not_right = Heap::FindCodeObject(obj_copy->address() + | 100 Object* not_right = Heap::FindCodeObject(obj_copy->address() + |
95 obj_copy->Size() / 2); | 101 obj_copy->Size() / 2); |
96 CHECK(not_right != code); | 102 CHECK(not_right != code); |
97 } | 103 } |
98 | 104 |
99 | 105 |
100 TEST(HeapObjects) { | 106 TEST(HeapObjects) { |
101 InitializeVM(); | 107 InitializeVM(); |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 objs[next_objs_index++] = | 777 objs[next_objs_index++] = |
772 Factory::NewStringFromAscii(CStrVector(str), TENURED); | 778 Factory::NewStringFromAscii(CStrVector(str), TENURED); |
773 delete[] str; | 779 delete[] str; |
774 | 780 |
775 // Add a Map object to look for. | 781 // Add a Map object to look for. |
776 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); | 782 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); |
777 | 783 |
778 CHECK_EQ(objs_count, next_objs_index); | 784 CHECK_EQ(objs_count, next_objs_index); |
779 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); | 785 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); |
780 } | 786 } |
OLD | NEW |