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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 7113012: Call a stub for the write barrier on ARM. This is a step (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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 | « src/ia32/macro-assembler-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 } 2287 }
2288 j(cc, condition_met, condition_met_near); 2288 j(cc, condition_met, condition_met_near);
2289 } 2289 }
2290 2290
2291 2291
2292 void MacroAssembler::IsBlack(Register object, 2292 void MacroAssembler::IsBlack(Register object,
2293 Register scratch0, 2293 Register scratch0,
2294 Register scratch1, 2294 Register scratch1,
2295 Label* is_black, 2295 Label* is_black,
2296 Label::Distance is_black_near) { 2296 Label::Distance is_black_near) {
2297 HasColour(object, scratch0, scratch1, 2297 HasColor(object, scratch0, scratch1,
2298 is_black, is_black_near, 2298 is_black, is_black_near,
2299 1, 0); // kBlackBitPattern. 2299 1, 0); // kBlackBitPattern.
2300 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); 2300 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0);
2301 } 2301 }
2302 2302
2303 2303
2304 void MacroAssembler::HasColour(Register object, 2304 void MacroAssembler::HasColor(Register object,
2305 Register bitmap_scratch, 2305 Register bitmap_scratch,
2306 Register mask_scratch, 2306 Register mask_scratch,
2307 Label* has_colour, 2307 Label* has_color,
2308 Label::Distance has_colour_distance, 2308 Label::Distance has_color_distance,
2309 int first_bit, 2309 int first_bit,
2310 int second_bit) { 2310 int second_bit) {
2311 ASSERT(!Aliasing(object, bitmap_scratch, mask_scratch, ecx)); 2311 ASSERT(!Aliasing(object, bitmap_scratch, mask_scratch, ecx));
2312 2312
2313 MarkBits(object, bitmap_scratch, mask_scratch); 2313 GetMarkBits(object, bitmap_scratch, mask_scratch);
2314 2314
2315 Label other_colour, word_boundary; 2315 Label other_color, word_boundary;
2316 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize)); 2316 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize));
2317 j(first_bit == 1 ? zero : not_zero, &other_colour, Label::kNear); 2317 j(first_bit == 1 ? zero : not_zero, &other_color, Label::kNear);
2318 add(mask_scratch, Operand(mask_scratch)); // Shift left 1 by adding. 2318 add(mask_scratch, Operand(mask_scratch)); // Shift left 1 by adding.
2319 j(zero, &word_boundary, Label::kNear); 2319 j(zero, &word_boundary, Label::kNear);
2320 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize)); 2320 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize));
2321 j(second_bit == 1 ? not_zero : zero, has_colour, has_colour_distance); 2321 j(second_bit == 1 ? not_zero : zero, has_color, has_color_distance);
2322 jmp(&other_colour, Label::kNear); 2322 jmp(&other_color, Label::kNear);
2323 2323
2324 bind(&word_boundary); 2324 bind(&word_boundary);
2325 test_b(Operand(bitmap_scratch, MemoryChunk::kHeaderSize + kPointerSize), 1); 2325 test_b(Operand(bitmap_scratch, MemoryChunk::kHeaderSize + kPointerSize), 1);
2326 2326
2327 j(second_bit == 1 ? not_zero : zero, has_colour, has_colour_distance); 2327 j(second_bit == 1 ? not_zero : zero, has_color, has_color_distance);
2328 bind(&other_colour); 2328 bind(&other_color);
2329 } 2329 }
2330 2330
2331 2331
2332 void MacroAssembler::IsDataObject(Register value, 2332 void MacroAssembler::IsDataObject(Register value,
2333 Register scratch, 2333 Register scratch,
2334 Label* not_data_object, 2334 Label* not_data_object,
2335 Label::Distance not_data_object_distance) { 2335 Label::Distance not_data_object_distance) {
2336 Label is_data_object; 2336 Label is_data_object;
2337 mov(scratch, FieldOperand(value, HeapObject::kMapOffset)); 2337 mov(scratch, FieldOperand(value, HeapObject::kMapOffset));
2338 cmp(scratch, FACTORY->heap_number_map()); 2338 cmp(scratch, FACTORY->heap_number_map());
2339 j(equal, &is_data_object, Label::kNear); 2339 j(equal, &is_data_object, Label::kNear);
2340 ASSERT(kConsStringTag == 1 && kIsConsStringMask == 1); 2340 ASSERT(kConsStringTag == 1 && kIsConsStringMask == 1);
2341 ASSERT(kNotStringTag == 0x80 && kIsNotStringMask == 0x80); 2341 ASSERT(kNotStringTag == 0x80 && kIsNotStringMask == 0x80);
2342 // If it's a string and it's not a cons string then it's an object that 2342 // If it's a string and it's not a cons string then it's an object that
2343 // doesn't need scanning. 2343 // doesn't need scanning.
2344 test_b(FieldOperand(scratch, Map::kInstanceTypeOffset), 2344 test_b(FieldOperand(scratch, Map::kInstanceTypeOffset),
2345 kIsConsStringMask | kIsNotStringMask); 2345 kIsConsStringMask | kIsNotStringMask);
2346 // Jump if we need to mark it grey and push it. 2346 // Jump if we need to mark it grey and push it.
2347 j(not_zero, not_data_object, not_data_object_distance); 2347 j(not_zero, not_data_object, not_data_object_distance);
2348 bind(&is_data_object); 2348 bind(&is_data_object);
2349 } 2349 }
2350 2350
2351 2351
2352 void MacroAssembler::MarkBits(Register addr_reg, 2352 void MacroAssembler::GetMarkBits(Register addr_reg,
2353 Register bitmap_reg, 2353 Register bitmap_reg,
2354 Register mask_reg) { 2354 Register mask_reg) {
2355 ASSERT(!Aliasing(addr_reg, bitmap_reg, mask_reg, ecx)); 2355 ASSERT(!Aliasing(addr_reg, bitmap_reg, mask_reg, ecx));
2356 mov(bitmap_reg, Operand(addr_reg)); 2356 mov(bitmap_reg, Operand(addr_reg));
2357 and_(bitmap_reg, ~Page::kPageAlignmentMask); 2357 and_(bitmap_reg, ~Page::kPageAlignmentMask);
2358 mov(ecx, Operand(addr_reg)); 2358 mov(ecx, Operand(addr_reg));
2359 shr(ecx, Bitmap::kBitsPerCellLog2); 2359 shr(ecx, Bitmap::kBitsPerCellLog2);
2360 and_(ecx, 2360 and_(ecx,
2361 (Page::kPageAlignmentMask >> Bitmap::kBitsPerCellLog2) & 2361 (Page::kPageAlignmentMask >> Bitmap::kBitsPerCellLog2) &
2362 ~(kPointerSize - 1)); 2362 ~(kPointerSize - 1));
2363 2363
2364 add(bitmap_reg, Operand(ecx)); 2364 add(bitmap_reg, Operand(ecx));
2365 mov(ecx, Operand(addr_reg)); 2365 mov(ecx, Operand(addr_reg));
2366 shr(ecx, kPointerSizeLog2); 2366 shr(ecx, kPointerSizeLog2);
2367 and_(ecx, (1 << Bitmap::kBitsPerCellLog2) - 1); 2367 and_(ecx, (1 << Bitmap::kBitsPerCellLog2) - 1);
2368 mov(mask_reg, Immediate(1)); 2368 mov(mask_reg, Immediate(1));
2369 shl_cl(mask_reg); 2369 shl_cl(mask_reg);
2370 } 2370 }
2371 2371
2372 2372
2373 void MacroAssembler::EnsureNotWhite( 2373 void MacroAssembler::EnsureNotWhite(
2374 Register value, 2374 Register value,
2375 Register bitmap_scratch, 2375 Register bitmap_scratch,
2376 Register mask_scratch, 2376 Register mask_scratch,
2377 Label* value_is_white_and_not_data, 2377 Label* value_is_white_and_not_data,
2378 Label::Distance distance) { 2378 Label::Distance distance) {
2379 ASSERT(!Aliasing(value, bitmap_scratch, mask_scratch, ecx)); 2379 ASSERT(!Aliasing(value, bitmap_scratch, mask_scratch, ecx));
2380 MarkBits(value, bitmap_scratch, mask_scratch); 2380 GetMarkBits(value, bitmap_scratch, mask_scratch);
2381 2381
2382 // If the value is black or grey we don't need to do anything. 2382 // If the value is black or grey we don't need to do anything.
2383 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0); 2383 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0);
2384 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); 2384 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0);
2385 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0); 2385 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0);
2386 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0); 2386 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0);
2387 2387
2388 Label done; 2388 Label done;
2389 2389
2390 // Since both black and grey have a 1 in the first position and white does 2390 // Since both black and grey have a 1 in the first position and white does
(...skipping 19 matching lines...) Expand all
2410 2410
2411 // Value is a data object, and it is white. Mark it black. Since we know 2411 // Value is a data object, and it is white. Mark it black. Since we know
2412 // that the object is white we can make it black by flipping one bit. 2412 // that the object is white we can make it black by flipping one bit.
2413 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); 2413 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch);
2414 bind(&done); 2414 bind(&done);
2415 } 2415 }
2416 2416
2417 } } // namespace v8::internal 2417 } } // namespace v8::internal
2418 2418
2419 #endif // V8_TARGET_ARCH_IA32 2419 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698