| OLD | NEW |
| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 RememberedSetAction remembered_set_action, | 280 RememberedSetAction remembered_set_action, |
| 281 SmiCheck smi_check) { | 281 SmiCheck smi_check) { |
| 282 ASSERT(!object.is(value)); | 282 ASSERT(!object.is(value)); |
| 283 ASSERT(!object.is(address)); | 283 ASSERT(!object.is(address)); |
| 284 ASSERT(!value.is(address)); | 284 ASSERT(!value.is(address)); |
| 285 if (emit_debug_code()) { | 285 if (emit_debug_code()) { |
| 286 AbortIfSmi(object); | 286 AbortIfSmi(object); |
| 287 } | 287 } |
| 288 | 288 |
| 289 if (remembered_set_action == OMIT_REMEMBERED_SET && | 289 if (remembered_set_action == OMIT_REMEMBERED_SET && |
| 290 FLAG_incremental_marking == false) { | 290 !FLAG_incremental_marking) { |
| 291 return; | 291 return; |
| 292 } | 292 } |
| 293 | 293 |
| 294 if (FLAG_debug_code) { | 294 if (FLAG_debug_code) { |
| 295 Label ok; | 295 Label ok; |
| 296 cmp(value, Operand(address, 0)); | 296 cmp(value, Operand(address, 0)); |
| 297 j(equal, &ok, Label::kNear); | 297 j(equal, &ok, Label::kNear); |
| 298 int3(); | 298 int3(); |
| 299 bind(&ok); | 299 bind(&ok); |
| 300 } | 300 } |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 | 2226 |
| 2227 call(Operand(function)); | 2227 call(Operand(function)); |
| 2228 if (OS::ActivationFrameAlignment() != 0) { | 2228 if (OS::ActivationFrameAlignment() != 0) { |
| 2229 mov(esp, Operand(esp, num_arguments * kPointerSize)); | 2229 mov(esp, Operand(esp, num_arguments * kPointerSize)); |
| 2230 } else { | 2230 } else { |
| 2231 add(Operand(esp), Immediate(num_arguments * kPointerSize)); | 2231 add(Operand(esp), Immediate(num_arguments * kPointerSize)); |
| 2232 } | 2232 } |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 | 2235 |
| 2236 bool Aliasing(Register r1, Register r2, Register r3, Register r4) { | 2236 bool AreAliased(Register r1, Register r2, Register r3, Register r4) { |
| 2237 if (r1.is(r2)) return true; | 2237 if (r1.is(r2)) return true; |
| 2238 if (r1.is(r3)) return true; | 2238 if (r1.is(r3)) return true; |
| 2239 if (r1.is(r4)) return true; | 2239 if (r1.is(r4)) return true; |
| 2240 if (r2.is(r3)) return true; | 2240 if (r2.is(r3)) return true; |
| 2241 if (r2.is(r4)) return true; | 2241 if (r2.is(r4)) return true; |
| 2242 if (r3.is(r4)) return true; | 2242 if (r3.is(r4)) return true; |
| 2243 return false; | 2243 return false; |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 | 2246 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2264 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2264 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 2265 } | 2265 } |
| 2266 | 2266 |
| 2267 | 2267 |
| 2268 void MacroAssembler::CheckPageFlag( | 2268 void MacroAssembler::CheckPageFlag( |
| 2269 Register object, | 2269 Register object, |
| 2270 Register scratch, | 2270 Register scratch, |
| 2271 MemoryChunk::MemoryChunkFlags flag, | 2271 MemoryChunk::MemoryChunkFlags flag, |
| 2272 Condition cc, | 2272 Condition cc, |
| 2273 Label* condition_met, | 2273 Label* condition_met, |
| 2274 Label::Distance condition_met_near) { | 2274 Label::Distance condition_met_distance) { |
| 2275 ASSERT(cc == zero || cc == not_zero); | 2275 ASSERT(cc == zero || cc == not_zero); |
| 2276 if (scratch.is(object)) { | 2276 if (scratch.is(object)) { |
| 2277 and_(scratch, Immediate(~Page::kPageAlignmentMask)); | 2277 and_(scratch, Immediate(~Page::kPageAlignmentMask)); |
| 2278 } else { | 2278 } else { |
| 2279 mov(scratch, Immediate(~Page::kPageAlignmentMask)); | 2279 mov(scratch, Immediate(~Page::kPageAlignmentMask)); |
| 2280 and_(scratch, Operand(object)); | 2280 and_(scratch, Operand(object)); |
| 2281 } | 2281 } |
| 2282 if (flag < kBitsPerByte) { | 2282 if (flag < kBitsPerByte) { |
| 2283 test_b(Operand(scratch, MemoryChunk::kFlagsOffset), | 2283 test_b(Operand(scratch, MemoryChunk::kFlagsOffset), |
| 2284 static_cast<uint8_t>(1u << flag)); | 2284 static_cast<uint8_t>(1u << flag)); |
| 2285 } else { | 2285 } else { |
| 2286 test(Operand(scratch, MemoryChunk::kFlagsOffset), Immediate(1 << flag)); | 2286 test(Operand(scratch, MemoryChunk::kFlagsOffset), Immediate(1 << flag)); |
| 2287 } | 2287 } |
| 2288 j(cc, condition_met, condition_met_near); | 2288 j(cc, condition_met, condition_met_distance); |
| 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 HasColor(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::HasColor(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_color, | 2307 Label* has_color, |
| 2308 Label::Distance has_color_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(!AreAliased(object, bitmap_scratch, mask_scratch, ecx)); |
| 2312 | 2312 |
| 2313 GetMarkBits(object, bitmap_scratch, mask_scratch); | 2313 GetMarkBits(object, bitmap_scratch, mask_scratch); |
| 2314 | 2314 |
| 2315 Label other_color, 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_color, 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_color, has_color_distance); | 2321 j(second_bit == 1 ? not_zero : zero, has_color, has_color_distance); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 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::GetMarkBits(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(!AreAliased(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(!AreAliased(value, bitmap_scratch, mask_scratch, ecx)); |
| 2380 GetMarkBits(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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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 |
| OLD | NEW |