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

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

Issue 8312015: Changes around ascii-check for strings wrt external strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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
« no previous file with comments | « src/extensions/externalize-string-extension.cc ('k') | test/mjsunit/string-slices.js » ('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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 bool String::IsAsciiRepresentationUnderneath() { 283 bool String::IsAsciiRepresentationUnderneath() {
284 uint32_t type = map()->instance_type(); 284 uint32_t type = map()->instance_type();
285 STATIC_ASSERT(kIsIndirectStringTag != 0); 285 STATIC_ASSERT(kIsIndirectStringTag != 0);
286 STATIC_ASSERT((kIsIndirectStringMask & kStringEncodingMask) == 0); 286 STATIC_ASSERT((kIsIndirectStringMask & kStringEncodingMask) == 0);
287 ASSERT(IsFlat()); 287 ASSERT(IsFlat());
288 switch (type & (kIsIndirectStringMask | kStringEncodingMask)) { 288 switch (type & (kIsIndirectStringMask | kStringEncodingMask)) {
289 case kAsciiStringTag: 289 case kAsciiStringTag:
290 return true; 290 return true;
291 case kTwoByteStringTag: 291 case kTwoByteStringTag:
292 return false; 292 return false;
293 default: // Cons or sliced string. Need to go deeper. 293 default:
294 return GetUnderlying()->IsAsciiRepresentation(); 294 // Cons or sliced string. Need to go deeper.
295 // Consider slice of cons of externalized.
296 return GetUnderlying()->IsAsciiRepresentationUnderneath();
Erik Corry 2011/10/17 12:05:15 Is it possible to make an arbitraryly deep nesting
295 } 297 }
296 } 298 }
297 299
298 300
299 bool String::IsTwoByteRepresentationUnderneath() { 301 bool String::IsTwoByteRepresentationUnderneath() {
300 uint32_t type = map()->instance_type(); 302 uint32_t type = map()->instance_type();
301 STATIC_ASSERT(kIsIndirectStringTag != 0); 303 STATIC_ASSERT(kIsIndirectStringTag != 0);
302 STATIC_ASSERT((kIsIndirectStringMask & kStringEncodingMask) == 0); 304 STATIC_ASSERT((kIsIndirectStringMask & kStringEncodingMask) == 0);
303 ASSERT(IsFlat()); 305 ASSERT(IsFlat());
304 switch (type & (kIsIndirectStringMask | kStringEncodingMask)) { 306 switch (type & (kIsIndirectStringMask | kStringEncodingMask)) {
(...skipping 4332 matching lines...) Expand 10 before | Expand all | Expand 10 after
4637 #undef WRITE_INT_FIELD 4639 #undef WRITE_INT_FIELD
4638 #undef READ_SHORT_FIELD 4640 #undef READ_SHORT_FIELD
4639 #undef WRITE_SHORT_FIELD 4641 #undef WRITE_SHORT_FIELD
4640 #undef READ_BYTE_FIELD 4642 #undef READ_BYTE_FIELD
4641 #undef WRITE_BYTE_FIELD 4643 #undef WRITE_BYTE_FIELD
4642 4644
4643 4645
4644 } } // namespace v8::internal 4646 } } // namespace v8::internal
4645 4647
4646 #endif // V8_OBJECTS_INL_H_ 4648 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/extensions/externalize-string-extension.cc ('k') | test/mjsunit/string-slices.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698