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

Side by Side Diff: src/objects.cc

Issue 11293168: Rename kAsciiStringTag to kOneByteStringTag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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/objects.h ('k') | src/objects-inl.h » ('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 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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 switch (type & kStringRepresentationMask) { 1333 switch (type & kStringRepresentationMask) {
1334 case kSeqStringTag: 1334 case kSeqStringTag:
1335 break; 1335 break;
1336 case kConsStringTag: 1336 case kConsStringTag:
1337 ConsString::BodyDescriptor::IterateBody(this, v); 1337 ConsString::BodyDescriptor::IterateBody(this, v);
1338 break; 1338 break;
1339 case kSlicedStringTag: 1339 case kSlicedStringTag:
1340 SlicedString::BodyDescriptor::IterateBody(this, v); 1340 SlicedString::BodyDescriptor::IterateBody(this, v);
1341 break; 1341 break;
1342 case kExternalStringTag: 1342 case kExternalStringTag:
1343 if ((type & kStringEncodingMask) == kAsciiStringTag) { 1343 if ((type & kStringEncodingMask) == kOneByteStringTag) {
1344 reinterpret_cast<ExternalAsciiString*>(this)-> 1344 reinterpret_cast<ExternalAsciiString*>(this)->
1345 ExternalAsciiStringIterateBody(v); 1345 ExternalAsciiStringIterateBody(v);
1346 } else { 1346 } else {
1347 reinterpret_cast<ExternalTwoByteString*>(this)-> 1347 reinterpret_cast<ExternalTwoByteString*>(this)->
1348 ExternalTwoByteStringIterateBody(v); 1348 ExternalTwoByteStringIterateBody(v);
1349 } 1349 }
1350 break; 1350 break;
1351 } 1351 }
1352 return; 1352 return;
1353 } 1353 }
(...skipping 5003 matching lines...) Expand 10 before | Expand all | Expand 10 after
6357 shape = StringShape(string); 6357 shape = StringShape(string);
6358 } 6358 }
6359 if (shape.representation_tag() == kSlicedStringTag) { 6359 if (shape.representation_tag() == kSlicedStringTag) {
6360 SlicedString* slice = SlicedString::cast(string); 6360 SlicedString* slice = SlicedString::cast(string);
6361 offset = slice->offset(); 6361 offset = slice->offset();
6362 string = slice->parent(); 6362 string = slice->parent();
6363 shape = StringShape(string); 6363 shape = StringShape(string);
6364 ASSERT(shape.representation_tag() != kConsStringTag && 6364 ASSERT(shape.representation_tag() != kConsStringTag &&
6365 shape.representation_tag() != kSlicedStringTag); 6365 shape.representation_tag() != kSlicedStringTag);
6366 } 6366 }
6367 if (shape.encoding_tag() == kAsciiStringTag) { 6367 if (shape.encoding_tag() == kOneByteStringTag) {
6368 const char* start; 6368 const char* start;
6369 if (shape.representation_tag() == kSeqStringTag) { 6369 if (shape.representation_tag() == kSeqStringTag) {
6370 start = SeqAsciiString::cast(string)->GetChars(); 6370 start = SeqAsciiString::cast(string)->GetChars();
6371 } else { 6371 } else {
6372 start = ExternalAsciiString::cast(string)->GetChars(); 6372 start = ExternalAsciiString::cast(string)->GetChars();
6373 } 6373 }
6374 return FlatContent(Vector<const char>(start + offset, length)); 6374 return FlatContent(Vector<const char>(start + offset, length));
6375 } else { 6375 } else {
6376 ASSERT(shape.encoding_tag() == kTwoByteStringTag); 6376 ASSERT(shape.encoding_tag() == kTwoByteStringTag);
6377 const uc16* start; 6377 const uc16* start;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
7046 void String::WriteToFlat(String* src, 7046 void String::WriteToFlat(String* src,
7047 sinkchar* sink, 7047 sinkchar* sink,
7048 int f, 7048 int f,
7049 int t) { 7049 int t) {
7050 String* source = src; 7050 String* source = src;
7051 int from = f; 7051 int from = f;
7052 int to = t; 7052 int to = t;
7053 while (true) { 7053 while (true) {
7054 ASSERT(0 <= from && from <= to && to <= source->length()); 7054 ASSERT(0 <= from && from <= to && to <= source->length());
7055 switch (StringShape(source).full_representation_tag()) { 7055 switch (StringShape(source).full_representation_tag()) {
7056 case kAsciiStringTag | kExternalStringTag: { 7056 case kOneByteStringTag | kExternalStringTag: {
7057 CopyChars(sink, 7057 CopyChars(sink,
7058 ExternalAsciiString::cast(source)->GetChars() + from, 7058 ExternalAsciiString::cast(source)->GetChars() + from,
7059 to - from); 7059 to - from);
7060 return; 7060 return;
7061 } 7061 }
7062 case kTwoByteStringTag | kExternalStringTag: { 7062 case kTwoByteStringTag | kExternalStringTag: {
7063 const uc16* data = 7063 const uc16* data =
7064 ExternalTwoByteString::cast(source)->GetChars(); 7064 ExternalTwoByteString::cast(source)->GetChars();
7065 CopyChars(sink, 7065 CopyChars(sink,
7066 data + from, 7066 data + from,
7067 to - from); 7067 to - from);
7068 return; 7068 return;
7069 } 7069 }
7070 case kAsciiStringTag | kSeqStringTag: { 7070 case kOneByteStringTag | kSeqStringTag: {
7071 CopyChars(sink, 7071 CopyChars(sink,
7072 SeqAsciiString::cast(source)->GetChars() + from, 7072 SeqAsciiString::cast(source)->GetChars() + from,
7073 to - from); 7073 to - from);
7074 return; 7074 return;
7075 } 7075 }
7076 case kTwoByteStringTag | kSeqStringTag: { 7076 case kTwoByteStringTag | kSeqStringTag: {
7077 CopyChars(sink, 7077 CopyChars(sink,
7078 SeqTwoByteString::cast(source)->GetChars() + from, 7078 SeqTwoByteString::cast(source)->GetChars() + from,
7079 to - from); 7079 to - from);
7080 return; 7080 return;
7081 } 7081 }
7082 case kAsciiStringTag | kConsStringTag: 7082 case kOneByteStringTag | kConsStringTag:
7083 case kTwoByteStringTag | kConsStringTag: { 7083 case kTwoByteStringTag | kConsStringTag: {
7084 ConsString* cons_string = ConsString::cast(source); 7084 ConsString* cons_string = ConsString::cast(source);
7085 String* first = cons_string->first(); 7085 String* first = cons_string->first();
7086 int boundary = first->length(); 7086 int boundary = first->length();
7087 if (to - boundary >= boundary - from) { 7087 if (to - boundary >= boundary - from) {
7088 // Right hand side is longer. Recurse over left. 7088 // Right hand side is longer. Recurse over left.
7089 if (from < boundary) { 7089 if (from < boundary) {
7090 WriteToFlat(first, sink, from, boundary); 7090 WriteToFlat(first, sink, from, boundary);
7091 sink += boundary - from; 7091 sink += boundary - from;
7092 from = 0; 7092 from = 0;
(...skipping 20 matching lines...) Expand all
7113 sink + boundary - from, 7113 sink + boundary - from,
7114 0, 7114 0,
7115 to - boundary); 7115 to - boundary);
7116 } 7116 }
7117 to = boundary; 7117 to = boundary;
7118 } 7118 }
7119 source = first; 7119 source = first;
7120 } 7120 }
7121 break; 7121 break;
7122 } 7122 }
7123 case kAsciiStringTag | kSlicedStringTag: 7123 case kOneByteStringTag | kSlicedStringTag:
7124 case kTwoByteStringTag | kSlicedStringTag: { 7124 case kTwoByteStringTag | kSlicedStringTag: {
7125 SlicedString* slice = SlicedString::cast(source); 7125 SlicedString* slice = SlicedString::cast(source);
7126 unsigned offset = slice->offset(); 7126 unsigned offset = slice->offset();
7127 WriteToFlat(slice->parent(), sink, from + offset, to + offset); 7127 WriteToFlat(slice->parent(), sink, from + offset, to + offset);
7128 return; 7128 return;
7129 } 7129 }
7130 } 7130 }
7131 } 7131 }
7132 } 7132 }
7133 7133
(...skipping 6494 matching lines...) Expand 10 before | Expand all | Expand 10 after
13628 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13628 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13629 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13629 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13630 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13630 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13631 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13631 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13632 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13632 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13633 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13633 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13634 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13634 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13635 } 13635 }
13636 13636
13637 } } // namespace v8::internal 13637 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698