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

Side by Side Diff: src/objects-inl.h

Issue 11818025: Continues Latin-1 support. All tests pass with ENABLE_LATIN_1 flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM fix Created 7 years, 11 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
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 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 unsigned length) { 2544 unsigned length) {
2545 ASSERT(length == static_cast<unsigned>(string->length())); 2545 ASSERT(length == static_cast<unsigned>(string->length()));
2546 ASSERT(offset <= length); 2546 ASSERT(offset <= length);
2547 unsigned slice_offset = offset; 2547 unsigned slice_offset = offset;
2548 while (true) { 2548 while (true) {
2549 ASSERT(type == string->map()->instance_type()); 2549 ASSERT(type == string->map()->instance_type());
2550 2550
2551 switch (type & (kStringRepresentationMask | kStringEncodingMask)) { 2551 switch (type & (kStringRepresentationMask | kStringEncodingMask)) {
2552 case kSeqStringTag | kOneByteStringTag: 2552 case kSeqStringTag | kOneByteStringTag:
2553 visitor.VisitOneByteString( 2553 visitor.VisitOneByteString(
2554 reinterpret_cast<const uint8_t*>( 2554 SeqOneByteString::cast(string)->GetChars() + slice_offset,
2555 SeqOneByteString::cast(string)->GetChars()) + slice_offset, 2555 length - offset);
2556 length - offset);
2557 return; 2556 return;
2558 2557
2559 case kSeqStringTag | kTwoByteStringTag: 2558 case kSeqStringTag | kTwoByteStringTag:
2560 visitor.VisitTwoByteString( 2559 visitor.VisitTwoByteString(
2561 reinterpret_cast<const uint16_t*>( 2560 SeqTwoByteString::cast(string)->GetChars() + slice_offset,
2562 SeqTwoByteString::cast(string)->GetChars()) + slice_offset, 2561 length - offset);
2563 length - offset);
2564 return; 2562 return;
2565 2563
2566 case kExternalStringTag | kOneByteStringTag: 2564 case kExternalStringTag | kOneByteStringTag:
2567 visitor.VisitOneByteString( 2565 visitor.VisitOneByteString(
2568 reinterpret_cast<const uint8_t*>( 2566 ExternalAsciiString::cast(string)->GetChars() + slice_offset,
2569 ExternalAsciiString::cast(string)->GetChars()) + slice_offset, 2567 length - offset);
2570 length - offset);
2571 return; 2568 return;
2572 2569
2573 case kExternalStringTag | kTwoByteStringTag: 2570 case kExternalStringTag | kTwoByteStringTag:
2574 visitor.VisitTwoByteString( 2571 visitor.VisitTwoByteString(
2575 reinterpret_cast<const uint16_t*>( 2572 ExternalTwoByteString::cast(string)->GetChars() + slice_offset,
2576 ExternalTwoByteString::cast(string)->GetChars()) 2573 length - offset);
2577 + slice_offset,
2578 length - offset);
2579 return; 2574 return;
2580 2575
2581 case kSlicedStringTag | kOneByteStringTag: 2576 case kSlicedStringTag | kOneByteStringTag:
2582 case kSlicedStringTag | kTwoByteStringTag: { 2577 case kSlicedStringTag | kTwoByteStringTag: {
2583 SlicedString* slicedString = SlicedString::cast(string); 2578 SlicedString* slicedString = SlicedString::cast(string);
2584 slice_offset += slicedString->offset(); 2579 slice_offset += slicedString->offset();
2585 string = slicedString->parent(); 2580 string = slicedString->parent();
2586 type = string->map()->instance_type(); 2581 type = string->map()->instance_type();
2587 continue; 2582 continue;
2588 } 2583 }
(...skipping 25 matching lines...) Expand all
2614 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, 2609 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
2615 static_cast<byte>(value)); 2610 static_cast<byte>(value));
2616 } 2611 }
2617 2612
2618 2613
2619 Address SeqOneByteString::GetCharsAddress() { 2614 Address SeqOneByteString::GetCharsAddress() {
2620 return FIELD_ADDR(this, kHeaderSize); 2615 return FIELD_ADDR(this, kHeaderSize);
2621 } 2616 }
2622 2617
2623 2618
2624 char* SeqOneByteString::GetChars() { 2619 uint8_t* SeqOneByteString::GetChars() {
2625 return reinterpret_cast<char*>(GetCharsAddress());
2626 }
2627
2628
2629 uint8_t* SeqOneByteString::GetCharsU() {
2630 return reinterpret_cast<uint8_t*>(GetCharsAddress()); 2620 return reinterpret_cast<uint8_t*>(GetCharsAddress());
2631 } 2621 }
2632 2622
2633 2623
2634 Address SeqTwoByteString::GetCharsAddress() { 2624 Address SeqTwoByteString::GetCharsAddress() {
2635 return FIELD_ADDR(this, kHeaderSize); 2625 return FIELD_ADDR(this, kHeaderSize);
2636 } 2626 }
2637 2627
2638 2628
2639 uc16* SeqTwoByteString::GetChars() { 2629 uc16* SeqTwoByteString::GetChars() {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 2720
2731 2721
2732 void ExternalAsciiString::set_resource( 2722 void ExternalAsciiString::set_resource(
2733 const ExternalAsciiString::Resource* resource) { 2723 const ExternalAsciiString::Resource* resource) {
2734 *reinterpret_cast<const Resource**>( 2724 *reinterpret_cast<const Resource**>(
2735 FIELD_ADDR(this, kResourceOffset)) = resource; 2725 FIELD_ADDR(this, kResourceOffset)) = resource;
2736 if (resource != NULL) update_data_cache(); 2726 if (resource != NULL) update_data_cache();
2737 } 2727 }
2738 2728
2739 2729
2740 const char* ExternalAsciiString::GetChars() { 2730 const uint8_t* ExternalAsciiString::GetChars() {
2741 return resource()->data(); 2731 return reinterpret_cast<const uint8_t*>(resource()->data());
Yang 2013/01/09 15:39:30 I guess this cast would be unnecessary once we cha
2742 } 2732 }
2743 2733
2744 2734
2745 uint16_t ExternalAsciiString::ExternalAsciiStringGet(int index) { 2735 uint16_t ExternalAsciiString::ExternalAsciiStringGet(int index) {
2746 ASSERT(index >= 0 && index < length()); 2736 ASSERT(index >= 0 && index < length());
2747 return GetChars()[index]; 2737 return GetChars()[index];
2748 } 2738 }
2749 2739
2750 2740
2751 const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() { 2741 const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() {
(...skipping 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after
5793 #undef WRITE_UINT32_FIELD 5783 #undef WRITE_UINT32_FIELD
5794 #undef READ_SHORT_FIELD 5784 #undef READ_SHORT_FIELD
5795 #undef WRITE_SHORT_FIELD 5785 #undef WRITE_SHORT_FIELD
5796 #undef READ_BYTE_FIELD 5786 #undef READ_BYTE_FIELD
5797 #undef WRITE_BYTE_FIELD 5787 #undef WRITE_BYTE_FIELD
5798 5788
5799 5789
5800 } } // namespace v8::internal 5790 } } // namespace v8::internal
5801 5791
5802 #endif // V8_OBJECTS_INL_H_ 5792 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698