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

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

Issue 8568013: Introduce read buffer for external strings when using charAt (ia32). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 9 years, 1 month 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/lithium-codegen-ia32.cc ('k') | src/mips/macro-assembler-mips.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 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 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0); 2571 ASSERT(strcmp(Marking::kWhiteBitPattern, "00") == 0);
2572 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0); 2572 ASSERT(strcmp(Marking::kBlackBitPattern, "10") == 0);
2573 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0); 2573 ASSERT(strcmp(Marking::kGreyBitPattern, "11") == 0);
2574 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0); 2574 ASSERT(strcmp(Marking::kImpossibleBitPattern, "01") == 0);
2575 2575
2576 Label done; 2576 Label done;
2577 2577
2578 // Since both black and grey have a 1 in the first position and white does 2578 // Since both black and grey have a 1 in the first position and white does
2579 // not have a 1 there we only need to check one bit. 2579 // not have a 1 there we only need to check one bit.
2580 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize)); 2580 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize));
2581 j(not_zero, &done, Label::kNear);
2582 2581
2583 if (FLAG_debug_code) { 2582 if (FLAG_debug_code) {
2583 j(not_zero, &done);
2584 // Check for impossible bit pattern. 2584 // Check for impossible bit pattern.
2585 Label ok; 2585 Label ok;
2586 push(mask_scratch); 2586 push(mask_scratch);
2587 // shl. May overflow making the check conservative. 2587 // shl. May overflow making the check conservative.
2588 add(mask_scratch, mask_scratch); 2588 add(mask_scratch, mask_scratch);
2589 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize)); 2589 test(mask_scratch, Operand(bitmap_scratch, MemoryChunk::kHeaderSize));
2590 j(zero, &ok, Label::kNear); 2590 j(zero, &ok, Label::kNear);
2591 int3(); 2591 int3();
2592 bind(&ok); 2592 bind(&ok);
2593 pop(mask_scratch); 2593 pop(mask_scratch);
2594 } else {
2595 j(not_zero, &done, Label::kNear);
2594 } 2596 }
2595 2597
2596 // Value is white. We check whether it is data that doesn't need scanning. 2598 // Value is white. We check whether it is data that doesn't need scanning.
2597 // Currently only checks for HeapNumber and non-cons strings. 2599 // Currently only checks for HeapNumber and non-cons strings.
2598 Register map = ecx; // Holds map while checking type. 2600 Register map = ecx; // Holds map while checking type.
2599 Register length = ecx; // Holds length of object after checking type. 2601 Register length = ecx; // Holds length of object after checking type.
2600 Label not_heap_number; 2602 Label not_heap_number;
2601 Label is_data_object; 2603 Label is_data_object;
2602 2604
2603 // Check for heap-number 2605 // Check for heap-number
(...skipping 10 matching lines...) Expand all
2614 // If it's a string and it's not a cons string then it's an object containing 2616 // If it's a string and it's not a cons string then it's an object containing
2615 // no GC pointers. 2617 // no GC pointers.
2616 Register instance_type = ecx; 2618 Register instance_type = ecx;
2617 movzx_b(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); 2619 movzx_b(instance_type, FieldOperand(map, Map::kInstanceTypeOffset));
2618 test_b(instance_type, kIsIndirectStringMask | kIsNotStringMask); 2620 test_b(instance_type, kIsIndirectStringMask | kIsNotStringMask);
2619 j(not_zero, value_is_white_and_not_data); 2621 j(not_zero, value_is_white_and_not_data);
2620 // It's a non-indirect (non-cons and non-slice) string. 2622 // It's a non-indirect (non-cons and non-slice) string.
2621 // If it's external, the length is just ExternalString::kSize. 2623 // If it's external, the length is just ExternalString::kSize.
2622 // Otherwise it's String::kHeaderSize + string->length() * (1 or 2). 2624 // Otherwise it's String::kHeaderSize + string->length() * (1 or 2).
2623 Label not_external; 2625 Label not_external;
2624 // External strings are the only ones with the kExternalStringTag bit 2626 // External strings are the only ones with the kExternalStringTag bit set.
2625 // set.
2626 ASSERT_EQ(0, kSeqStringTag & kExternalStringTag); 2627 ASSERT_EQ(0, kSeqStringTag & kExternalStringTag);
2627 ASSERT_EQ(0, kConsStringTag & kExternalStringTag); 2628 ASSERT_EQ(0, kConsStringTag & kExternalStringTag);
2628 test_b(instance_type, kExternalStringTag); 2629 test_b(instance_type, kExternalStringTag);
2629 j(zero, &not_external, Label::kNear); 2630 j(zero, &not_external, Label::kNear);
2630 mov(length, Immediate(ExternalString::kSize)); 2631 mov(length, Immediate(ExternalString::kSize));
2632 test_b(instance_type, kBufferedStringTag);
2633 j(zero, &is_data_object, Label::kNear);
2634 mov(length, Immediate(ExternalString::kExtendedSize));
2631 jmp(&is_data_object, Label::kNear); 2635 jmp(&is_data_object, Label::kNear);
2632 2636
2633 bind(&not_external); 2637 bind(&not_external);
2634 // Sequential string, either ASCII or UC16. 2638 // Sequential string, either ASCII or UC16.
2635 ASSERT(kAsciiStringTag == 0x04); 2639 ASSERT(kAsciiStringTag == 0x04);
2636 and_(length, Immediate(kStringEncodingMask)); 2640 and_(length, Immediate(kStringEncodingMask));
2637 xor_(length, Immediate(kStringEncodingMask)); 2641 xor_(length, Immediate(kStringEncodingMask));
2638 add(length, Immediate(0x04)); 2642 add(length, Immediate(0x04));
2639 // Value now either 4 (if ASCII) or 8 (if UC16), i.e., char-size shifted 2643 // Value now either 4 (if ASCII) or 8 (if UC16), i.e., char-size shifted
2640 // by 2. If we multiply the string length as smi by this, it still 2644 // by 2. If we multiply the string length as smi by this, it still
(...skipping 19 matching lines...) Expand all
2660 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); 2664 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset));
2661 Check(less_equal, "Live Bytes Count overflow chunk size"); 2665 Check(less_equal, "Live Bytes Count overflow chunk size");
2662 } 2666 }
2663 2667
2664 bind(&done); 2668 bind(&done);
2665 } 2669 }
2666 2670
2667 } } // namespace v8::internal 2671 } } // namespace v8::internal
2668 2672
2669 #endif // V8_TARGET_ARCH_IA32 2673 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698