| OLD | NEW |
| 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 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 Register scratch3, | 1380 Register scratch3, |
| 1381 Label* gc_required) { | 1381 Label* gc_required) { |
| 1382 // Calculate the number of bytes needed for the characters in the string while | 1382 // Calculate the number of bytes needed for the characters in the string while |
| 1383 // observing object alignment. | 1383 // observing object alignment. |
| 1384 ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0); | 1384 ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0); |
| 1385 mov(scratch1, length); | 1385 mov(scratch1, length); |
| 1386 ASSERT(kCharSize == 1); | 1386 ASSERT(kCharSize == 1); |
| 1387 add(scratch1, Immediate(kObjectAlignmentMask)); | 1387 add(scratch1, Immediate(kObjectAlignmentMask)); |
| 1388 and_(scratch1, Immediate(~kObjectAlignmentMask)); | 1388 and_(scratch1, Immediate(~kObjectAlignmentMask)); |
| 1389 | 1389 |
| 1390 // Allocate ascii string in new space. | 1390 // Allocate ASCII string in new space. |
| 1391 AllocateInNewSpace(SeqAsciiString::kHeaderSize, | 1391 AllocateInNewSpace(SeqAsciiString::kHeaderSize, |
| 1392 times_1, | 1392 times_1, |
| 1393 scratch1, | 1393 scratch1, |
| 1394 result, | 1394 result, |
| 1395 scratch2, | 1395 scratch2, |
| 1396 scratch3, | 1396 scratch3, |
| 1397 gc_required, | 1397 gc_required, |
| 1398 TAG_OBJECT); | 1398 TAG_OBJECT); |
| 1399 | 1399 |
| 1400 // Set the map, length and hash field. | 1400 // Set the map, length and hash field. |
| 1401 mov(FieldOperand(result, HeapObject::kMapOffset), | 1401 mov(FieldOperand(result, HeapObject::kMapOffset), |
| 1402 Immediate(isolate()->factory()->ascii_string_map())); | 1402 Immediate(isolate()->factory()->ascii_string_map())); |
| 1403 mov(scratch1, length); | 1403 mov(scratch1, length); |
| 1404 SmiTag(scratch1); | 1404 SmiTag(scratch1); |
| 1405 mov(FieldOperand(result, String::kLengthOffset), scratch1); | 1405 mov(FieldOperand(result, String::kLengthOffset), scratch1); |
| 1406 mov(FieldOperand(result, String::kHashFieldOffset), | 1406 mov(FieldOperand(result, String::kHashFieldOffset), |
| 1407 Immediate(String::kEmptyHashField)); | 1407 Immediate(String::kEmptyHashField)); |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 | 1410 |
| 1411 void MacroAssembler::AllocateAsciiString(Register result, | 1411 void MacroAssembler::AllocateAsciiString(Register result, |
| 1412 int length, | 1412 int length, |
| 1413 Register scratch1, | 1413 Register scratch1, |
| 1414 Register scratch2, | 1414 Register scratch2, |
| 1415 Label* gc_required) { | 1415 Label* gc_required) { |
| 1416 ASSERT(length > 0); | 1416 ASSERT(length > 0); |
| 1417 | 1417 |
| 1418 // Allocate ascii string in new space. | 1418 // Allocate ASCII string in new space. |
| 1419 AllocateInNewSpace(SeqAsciiString::SizeFor(length), | 1419 AllocateInNewSpace(SeqAsciiString::SizeFor(length), |
| 1420 result, | 1420 result, |
| 1421 scratch1, | 1421 scratch1, |
| 1422 scratch2, | 1422 scratch2, |
| 1423 gc_required, | 1423 gc_required, |
| 1424 TAG_OBJECT); | 1424 TAG_OBJECT); |
| 1425 | 1425 |
| 1426 // Set the map, length and hash field. | 1426 // Set the map, length and hash field. |
| 1427 mov(FieldOperand(result, HeapObject::kMapOffset), | 1427 mov(FieldOperand(result, HeapObject::kMapOffset), |
| 1428 Immediate(isolate()->factory()->ascii_string_map())); | 1428 Immediate(isolate()->factory()->ascii_string_map())); |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2457 mov(scratch1, object1); | 2457 mov(scratch1, object1); |
| 2458 and_(scratch1, object2); | 2458 and_(scratch1, object2); |
| 2459 JumpIfSmi(scratch1, failure); | 2459 JumpIfSmi(scratch1, failure); |
| 2460 | 2460 |
| 2461 // Load instance type for both strings. | 2461 // Load instance type for both strings. |
| 2462 mov(scratch1, FieldOperand(object1, HeapObject::kMapOffset)); | 2462 mov(scratch1, FieldOperand(object1, HeapObject::kMapOffset)); |
| 2463 mov(scratch2, FieldOperand(object2, HeapObject::kMapOffset)); | 2463 mov(scratch2, FieldOperand(object2, HeapObject::kMapOffset)); |
| 2464 movzx_b(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); | 2464 movzx_b(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); |
| 2465 movzx_b(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); | 2465 movzx_b(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); |
| 2466 | 2466 |
| 2467 // Check that both are flat ascii strings. | 2467 // Check that both are flat ASCII strings. |
| 2468 const int kFlatAsciiStringMask = | 2468 const int kFlatAsciiStringMask = |
| 2469 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 2469 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
| 2470 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2470 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 2471 // Interleave bits from both instance types and compare them in one check. | 2471 // Interleave bits from both instance types and compare them in one check. |
| 2472 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); | 2472 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); |
| 2473 and_(scratch1, kFlatAsciiStringMask); | 2473 and_(scratch1, kFlatAsciiStringMask); |
| 2474 and_(scratch2, kFlatAsciiStringMask); | 2474 and_(scratch2, kFlatAsciiStringMask); |
| 2475 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); | 2475 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); |
| 2476 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3)); | 2476 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3)); |
| 2477 j(not_equal, failure); | 2477 j(not_equal, failure); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2739 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); | 2739 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); |
| 2740 Check(less_equal, "Live Bytes Count overflow chunk size"); | 2740 Check(less_equal, "Live Bytes Count overflow chunk size"); |
| 2741 } | 2741 } |
| 2742 | 2742 |
| 2743 bind(&done); | 2743 bind(&done); |
| 2744 } | 2744 } |
| 2745 | 2745 |
| 2746 } } // namespace v8::internal | 2746 } } // namespace v8::internal |
| 2747 | 2747 |
| 2748 #endif // V8_TARGET_ARCH_IA32 | 2748 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |