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

Side by Side Diff: src/runtime/runtime-strings.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/regexp/jsregexp-inl.h" 8 #include "src/regexp/jsregexp-inl.h"
9 #include "src/string-builder.h" 9 #include "src/string-builder.h"
10 #include "src/string-search.h" 10 #include "src/string-search.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 Object* first = fixed_array->get(0); 255 Object* first = fixed_array->get(0);
256 if (first->IsString()) return first; 256 if (first->IsString()) return first;
257 } 257 }
258 length = StringBuilderConcatLength(special_length, fixed_array, 258 length = StringBuilderConcatLength(special_length, fixed_array,
259 array_length, &one_byte); 259 array_length, &one_byte);
260 } 260 }
261 261
262 if (length == -1) { 262 if (length == -1) {
263 return isolate->Throw(isolate->heap()->illegal_argument_string()); 263 return isolate->Throw(isolate->heap()->illegal_argument_string());
264 } 264 }
265 if (length == 0) {
266 return isolate->heap()->empty_string();
267 }
265 268
266 if (one_byte) { 269 if (one_byte) {
267 Handle<SeqOneByteString> answer; 270 Handle<SeqOneByteString> answer;
268 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 271 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
269 isolate, answer, isolate->factory()->NewRawOneByteString(length)); 272 isolate, answer, isolate->factory()->NewRawOneByteString(length));
270 StringBuilderConcatHelper(*special, answer->GetChars(), 273 StringBuilderConcatHelper(*special, answer->GetChars(),
271 FixedArray::cast(array->elements()), 274 FixedArray::cast(array->elements()),
272 array_length); 275 array_length);
273 return *answer; 276 return *answer;
274 } else { 277 } else {
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 SealHandleScope shs(isolate); 1002 SealHandleScope shs(isolate);
1000 DCHECK(args.length() == 2); 1003 DCHECK(args.length() == 2);
1001 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 1004 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
1002 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 1005 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
1003 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 1006 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
1004 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1007 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1005 } 1008 }
1006 1009
1007 } // namespace internal 1010 } // namespace internal
1008 } // namespace v8 1011 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698