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

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

Issue 12390057: Added back some utf8 optimizations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments, rebased Created 7 years, 9 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
« src/api.cc ('K') | « src/objects.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 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 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 continue; 2641 continue;
2642 2642
2643 default: 2643 default:
2644 UNREACHABLE(); 2644 UNREACHABLE();
2645 return; 2645 return;
2646 } 2646 }
2647 } 2647 }
2648 } 2648 }
2649 2649
2650 2650
2651 // TODO(dcarney): Remove this class after conversion to VisitFlat.
2652 class ConsStringCaptureOp {
2653 public:
2654 inline ConsStringCaptureOp() : cons_string_(NULL) {}
2655 inline String* Operate(String* string, unsigned*, int32_t*, unsigned*) {
2656 cons_string_ = ConsString::cast(string);
2657 return NULL;
2658 }
2659 ConsString* cons_string_;
2660 };
2661
2662
2663 template<class Visitor>
2664 ConsString* String::VisitFlat(Visitor* visitor,
2665 String* string,
2666 int offset,
2667 int length,
2668 int32_t type) {
2669 ASSERT(length >= 0 && length == string->length());
2670 ASSERT(offset >= 0 && offset <= length);
2671 ConsStringCaptureOp op;
2672 Visit(string, offset, *visitor, op, type, static_cast<unsigned>(length));
2673 return op.cons_string_;
2674 }
2675
2676
2651 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { 2677 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) {
2652 ASSERT(index >= 0 && index < length()); 2678 ASSERT(index >= 0 && index < length());
2653 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); 2679 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
2654 } 2680 }
2655 2681
2656 2682
2657 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { 2683 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) {
2658 ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode); 2684 ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode);
2659 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, 2685 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
2660 static_cast<byte>(value)); 2686 static_cast<byte>(value));
(...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
5953 #undef WRITE_UINT32_FIELD 5979 #undef WRITE_UINT32_FIELD
5954 #undef READ_SHORT_FIELD 5980 #undef READ_SHORT_FIELD
5955 #undef WRITE_SHORT_FIELD 5981 #undef WRITE_SHORT_FIELD
5956 #undef READ_BYTE_FIELD 5982 #undef READ_BYTE_FIELD
5957 #undef WRITE_BYTE_FIELD 5983 #undef WRITE_BYTE_FIELD
5958 5984
5959 5985
5960 } } // namespace v8::internal 5986 } } // namespace v8::internal
5961 5987
5962 #endif // V8_OBJECTS_INL_H_ 5988 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/api.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698