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

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

Issue 19785004: Move FindCodeObject from Heap to Isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | « src/isolate.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 Object* code = heap->CreateCode( 120 Object* code = heap->CreateCode(
121 desc, 121 desc,
122 Code::ComputeFlags(Code::STUB), 122 Code::ComputeFlags(Code::STUB),
123 Handle<Code>())->ToObjectChecked(); 123 Handle<Code>())->ToObjectChecked();
124 CHECK(code->IsCode()); 124 CHECK(code->IsCode());
125 125
126 HeapObject* obj = HeapObject::cast(code); 126 HeapObject* obj = HeapObject::cast(code);
127 Address obj_addr = obj->address(); 127 Address obj_addr = obj->address();
128 128
129 for (int i = 0; i < obj->Size(); i += kPointerSize) { 129 for (int i = 0; i < obj->Size(); i += kPointerSize) {
130 Object* found = heap->FindCodeObject(obj_addr + i); 130 Object* found = isolate->FindCodeObject(obj_addr + i);
131 CHECK_EQ(code, found); 131 CHECK_EQ(code, found);
132 } 132 }
133 133
134 Object* copy = heap->CreateCode( 134 Object* copy = heap->CreateCode(
135 desc, 135 desc,
136 Code::ComputeFlags(Code::STUB), 136 Code::ComputeFlags(Code::STUB),
137 Handle<Code>())->ToObjectChecked(); 137 Handle<Code>())->ToObjectChecked();
138 CHECK(copy->IsCode()); 138 CHECK(copy->IsCode());
139 HeapObject* obj_copy = HeapObject::cast(copy); 139 HeapObject* obj_copy = HeapObject::cast(copy);
140 Object* not_right = heap->FindCodeObject(obj_copy->address() + 140 Object* not_right = isolate->FindCodeObject(obj_copy->address() +
141 obj_copy->Size() / 2); 141 obj_copy->Size() / 2);
142 CHECK(not_right != code); 142 CHECK(not_right != code);
143 } 143 }
144 144
145 145
146 TEST(HeapObjects) { 146 TEST(HeapObjects) {
147 CcTest::InitializeVM(); 147 CcTest::InitializeVM();
148 Isolate* isolate = Isolate::Current(); 148 Isolate* isolate = Isolate::Current();
149 Factory* factory = isolate->factory(); 149 Factory* factory = isolate->factory();
150 Heap* heap = isolate->heap(); 150 Heap* heap = isolate->heap();
151 151
(...skipping 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 " var a = new Array(n);" 3348 " var a = new Array(n);"
3349 " for (var i = 0; i < n; i += 100) a[i] = i;" 3349 " for (var i = 0; i < n; i += 100) a[i] = i;"
3350 "};" 3350 "};"
3351 "f(10 * 1024 * 1024);"); 3351 "f(10 * 1024 * 1024);");
3352 IncrementalMarking* marking = HEAP->incremental_marking(); 3352 IncrementalMarking* marking = HEAP->incremental_marking();
3353 if (marking->IsStopped()) marking->Start(); 3353 if (marking->IsStopped()) marking->Start();
3354 // This big step should be sufficient to mark the whole array. 3354 // This big step should be sufficient to mark the whole array.
3355 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 3355 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
3356 ASSERT(marking->IsComplete()); 3356 ASSERT(marking->IsComplete());
3357 } 3357 }
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698