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

Side by Side Diff: src/objects.cc

Issue 756983003: Force inline Stirng::GetCharVector<>. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
« 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 8280 matching lines...) Expand 10 before | Expand all | Expand 10 after
8291 if (shape.representation_tag() == kSeqStringTag) { 8291 if (shape.representation_tag() == kSeqStringTag) {
8292 start = SeqTwoByteString::cast(string)->GetChars(); 8292 start = SeqTwoByteString::cast(string)->GetChars();
8293 } else { 8293 } else {
8294 start = ExternalTwoByteString::cast(string)->GetChars(); 8294 start = ExternalTwoByteString::cast(string)->GetChars();
8295 } 8295 }
8296 return FlatContent(start + offset, length); 8296 return FlatContent(start + offset, length);
8297 } 8297 }
8298 } 8298 }
8299 8299
8300 8300
8301 template <>
8302 Vector<const uint8_t> String::GetCharVector() {
8303 String::FlatContent flat = GetFlatContent();
8304 DCHECK(flat.IsOneByte());
8305 return flat.ToOneByteVector();
8306 }
8307
8308
8309 template <>
8310 Vector<const uc16> String::GetCharVector() {
8311 String::FlatContent flat = GetFlatContent();
8312 DCHECK(flat.IsTwoByte());
8313 return flat.ToUC16Vector();
8314 }
8315
8316
8317 SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls, 8301 SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
8318 RobustnessFlag robust_flag, 8302 RobustnessFlag robust_flag,
8319 int offset, 8303 int offset,
8320 int length, 8304 int length,
8321 int* length_return) { 8305 int* length_return) {
8322 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { 8306 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) {
8323 return SmartArrayPointer<char>(NULL); 8307 return SmartArrayPointer<char>(NULL);
8324 } 8308 }
8325 // Negative length means the to the end of the string. 8309 // Negative length means the to the end of the string.
8326 if (length < 0) length = kMaxInt - offset; 8310 if (length < 0) length = kMaxInt - offset;
(...skipping 8512 matching lines...) Expand 10 before | Expand all | Expand 10 after
16839 Handle<DependentCode> codes = 16823 Handle<DependentCode> codes =
16840 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16824 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16841 DependentCode::kPropertyCellChangedGroup, 16825 DependentCode::kPropertyCellChangedGroup,
16842 info->object_wrapper()); 16826 info->object_wrapper());
16843 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16827 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16844 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16828 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16845 cell, info->zone()); 16829 cell, info->zone());
16846 } 16830 }
16847 16831
16848 } } // namespace v8::internal 16832 } } // 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