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

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

Issue 2900683002: [compiler] Delay allocation of code-embedded heap numbers. (Closed)
Patch Set: Fix rebase. Created 3 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
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-assembler-arm.cc » ('j') | 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 Handle<Object> value = factory->NewNumber(1.000123); 183 Handle<Object> value = factory->NewNumber(1.000123);
184 CHECK(heap->InNewSpace(*value)); 184 CHECK(heap->InNewSpace(*value));
185 185
186 i::byte buffer[i::Assembler::kMinimalBufferSize]; 186 i::byte buffer[i::Assembler::kMinimalBufferSize];
187 MacroAssembler masm(isolate, buffer, sizeof(buffer), 187 MacroAssembler masm(isolate, buffer, sizeof(buffer),
188 v8::internal::CodeObjectRequired::kYes); 188 v8::internal::CodeObjectRequired::kYes);
189 // Add a new-space reference to the code. 189 // Add a new-space reference to the code.
190 masm.Push(value); 190 masm.Push(value);
191 191
192 CodeDesc desc; 192 CodeDesc desc;
193 masm.GetCode(&desc); 193 masm.GetCode(isolate, &desc);
194 Handle<Code> code = isolate->factory()->NewCode( 194 Handle<Code> code = isolate->factory()->NewCode(
195 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 195 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
196 196
197 Code* tmp = nullptr; 197 Code* tmp = nullptr;
198 heap->CopyCode(*code).To(&tmp); 198 heap->CopyCode(*code).To(&tmp);
199 Handle<Code> copy(tmp); 199 Handle<Code> copy(tmp);
200 200
201 CheckEmbeddedObjectsAreEqual(code, copy); 201 CheckEmbeddedObjectsAreEqual(code, copy);
202 CcTest::CollectAllAvailableGarbage(); 202 CcTest::CollectAllAvailableGarbage();
203 CheckEmbeddedObjectsAreEqual(code, copy); 203 CheckEmbeddedObjectsAreEqual(code, copy);
204 } 204 }
205 205
206 static void CheckFindCodeObject(Isolate* isolate) { 206 static void CheckFindCodeObject(Isolate* isolate) {
207 // Test FindCodeObject 207 // Test FindCodeObject
208 #define __ assm. 208 #define __ assm.
209 209
210 Assembler assm(isolate, NULL, 0); 210 Assembler assm(isolate, NULL, 0);
211 211
212 __ nop(); // supported on all architectures 212 __ nop(); // supported on all architectures
213 213
214 CodeDesc desc; 214 CodeDesc desc;
215 assm.GetCode(&desc); 215 assm.GetCode(isolate, &desc);
216 Handle<Code> code = isolate->factory()->NewCode( 216 Handle<Code> code = isolate->factory()->NewCode(
217 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 217 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
218 CHECK(code->IsCode()); 218 CHECK(code->IsCode());
219 219
220 HeapObject* obj = HeapObject::cast(*code); 220 HeapObject* obj = HeapObject::cast(*code);
221 Address obj_addr = obj->address(); 221 Address obj_addr = obj->address();
222 222
223 for (int i = 0; i < obj->Size(); i += kPointerSize) { 223 for (int i = 0; i < obj->Size(); i += kPointerSize) {
224 Object* found = isolate->FindCodeObject(obj_addr + i); 224 Object* found = isolate->FindCodeObject(obj_addr + i);
225 CHECK_EQ(*code, found); 225 CHECK_EQ(*code, found);
(...skipping 4104 matching lines...) Expand 10 before | Expand all | Expand 10 after
4330 } 4330 }
4331 4331
4332 4332
4333 static Handle<Code> DummyOptimizedCode(Isolate* isolate) { 4333 static Handle<Code> DummyOptimizedCode(Isolate* isolate) {
4334 i::byte buffer[i::Assembler::kMinimalBufferSize]; 4334 i::byte buffer[i::Assembler::kMinimalBufferSize];
4335 MacroAssembler masm(isolate, buffer, sizeof(buffer), 4335 MacroAssembler masm(isolate, buffer, sizeof(buffer),
4336 v8::internal::CodeObjectRequired::kYes); 4336 v8::internal::CodeObjectRequired::kYes);
4337 CodeDesc desc; 4337 CodeDesc desc;
4338 masm.Push(isolate->factory()->undefined_value()); 4338 masm.Push(isolate->factory()->undefined_value());
4339 masm.Drop(1); 4339 masm.Drop(1);
4340 masm.GetCode(&desc); 4340 masm.GetCode(isolate, &desc);
4341 Handle<Object> undefined(isolate->heap()->undefined_value(), isolate); 4341 Handle<Object> undefined(isolate->heap()->undefined_value(), isolate);
4342 Handle<Code> code = isolate->factory()->NewCode( 4342 Handle<Code> code = isolate->factory()->NewCode(
4343 desc, Code::ComputeFlags(Code::OPTIMIZED_FUNCTION), undefined); 4343 desc, Code::ComputeFlags(Code::OPTIMIZED_FUNCTION), undefined);
4344 CHECK(code->IsCode()); 4344 CHECK(code->IsCode());
4345 return code; 4345 return code;
4346 } 4346 }
4347 4347
4348 4348
4349 TEST(NextCodeLinkIsWeak2) { 4349 TEST(NextCodeLinkIsWeak2) {
4350 FLAG_allow_natives_syntax = true; 4350 FLAG_allow_natives_syntax = true;
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
6381 CcTest::CollectAllGarbage(); 6381 CcTest::CollectAllGarbage();
6382 MarkCompactCollector* collector = heap->mark_compact_collector(); 6382 MarkCompactCollector* collector = heap->mark_compact_collector();
6383 if (collector->sweeping_in_progress()) { 6383 if (collector->sweeping_in_progress()) {
6384 collector->EnsureSweepingCompleted(); 6384 collector->EnsureSweepingCompleted();
6385 } 6385 }
6386 CHECK(object->map()->IsMap()); 6386 CHECK(object->map()->IsMap());
6387 } 6387 }
6388 6388
6389 } // namespace internal 6389 } // namespace internal
6390 } // namespace v8 6390 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698