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

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

Issue 228093004: Implement handlified String::Flatten. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: even shorter Created 6 years, 8 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/objects-debug.cc ('k') | src/parser.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 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 3013 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 3024
3025 bool String::Equals(String* other) { 3025 bool String::Equals(String* other) {
3026 if (other == this) return true; 3026 if (other == this) return true;
3027 if (this->IsInternalizedString() && other->IsInternalizedString()) { 3027 if (this->IsInternalizedString() && other->IsInternalizedString()) {
3028 return false; 3028 return false;
3029 } 3029 }
3030 return SlowEquals(other); 3030 return SlowEquals(other);
3031 } 3031 }
3032 3032
3033 3033
3034 Handle<String> String::Flatten(Handle<String> string, PretenureFlag pretenure) {
3035 if (!string->IsConsString()) return string;
3036 Handle<ConsString> cons = Handle<ConsString>::cast(string);
3037 if (cons->IsFlat()) return handle(cons->first());
3038 return SlowFlatten(cons, pretenure);
3039 }
3040
3041
3034 MaybeObject* String::TryFlatten(PretenureFlag pretenure) { 3042 MaybeObject* String::TryFlatten(PretenureFlag pretenure) {
3035 if (!StringShape(this).IsCons()) return this; 3043 if (!StringShape(this).IsCons()) return this;
3036 ConsString* cons = ConsString::cast(this); 3044 ConsString* cons = ConsString::cast(this);
3037 if (cons->IsFlat()) return cons->first(); 3045 if (cons->IsFlat()) return cons->first();
3038 return SlowTryFlatten(pretenure); 3046 return SlowTryFlatten(pretenure);
3039 } 3047 }
3040 3048
3041 3049
3042 String* String::TryFlattenGetString(PretenureFlag pretenure) { 3050 String* String::TryFlattenGetString(PretenureFlag pretenure) {
3043 MaybeObject* flat = TryFlatten(pretenure); 3051 MaybeObject* flat = TryFlatten(pretenure);
(...skipping 3880 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 #undef READ_UINT32_FIELD 6932 #undef READ_UINT32_FIELD
6925 #undef WRITE_UINT32_FIELD 6933 #undef WRITE_UINT32_FIELD
6926 #undef READ_SHORT_FIELD 6934 #undef READ_SHORT_FIELD
6927 #undef WRITE_SHORT_FIELD 6935 #undef WRITE_SHORT_FIELD
6928 #undef READ_BYTE_FIELD 6936 #undef READ_BYTE_FIELD
6929 #undef WRITE_BYTE_FIELD 6937 #undef WRITE_BYTE_FIELD
6930 6938
6931 } } // namespace v8::internal 6939 } } // namespace v8::internal
6932 6940
6933 #endif // V8_OBJECTS_INL_H_ 6941 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698