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

Unified Diff: src/objects.cc

Issue 9408: Removed some unsafe uses of StringShape.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 694)
+++ src/objects.cc (working copy)
@@ -3717,21 +3717,6 @@
}
-Object* SlicedString::SlicedStringFlatten() {
- // The SlicedString constructor should ensure that there are no
- // SlicedStrings that are constructed directly on top of other
- // SlicedStrings.
- String* buf = String::cast(buffer());
- StringShape buf_shape(buf);
- ASSERT(!buf_shape.IsSliced());
- if (buf_shape.IsCons()) {
- Object* ok = buf->Flatten(buf_shape);
- if (ok->IsFailure()) return ok;
- }
- return this;
-}
-
-
template <typename sinkchar>
void String::WriteToFlat(String* src,
StringShape src_shape,
@@ -3975,8 +3960,7 @@
bool String::MarkAsUndetectable() {
- StringShape shape(this);
- if (shape.IsSymbol()) return false;
+ if (StringShape(this).IsSymbol()) return false;
Map* map = this->map();
if (map == Heap::short_string_map()) {
@@ -4134,7 +4118,8 @@
}
-Object* String::Slice(StringShape shape, int start, int end) {
+Object* String::Slice(int start, int end) {
+ StringShape shape(this);
if (start == 0 && end == length(shape)) return this;
if (shape.representation_tag() == kSlicedStringTag) {
// Translate slices of a SlicedString into slices of the
@@ -4142,11 +4127,10 @@
SlicedString* str = SlicedString::cast(this);
String* buf = str->buffer();
return Heap::AllocateSlicedString(buf,
- StringShape(buf),
str->start() + start,
str->start() + end);
}
- Object* result = Heap::AllocateSlicedString(this, shape, start, end);
+ Object* result = Heap::AllocateSlicedString(this, start, end);
if (result->IsFailure()) {
return result;
}
« no previous file with comments | « src/objects.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698