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

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

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: rebased Created 3 years, 11 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/runtime/runtime-strings.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 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/conversions-inl.h" 8 #include "src/conversions-inl.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 static_cast<int64_t>(pattern_len)) * 424 static_cast<int64_t>(pattern_len)) *
425 static_cast<int64_t>(matches) + 425 static_cast<int64_t>(matches) +
426 static_cast<int64_t>(subject_len); 426 static_cast<int64_t>(subject_len);
427 int result_len; 427 int result_len;
428 if (result_len_64 > static_cast<int64_t>(String::kMaxLength)) { 428 if (result_len_64 > static_cast<int64_t>(String::kMaxLength)) {
429 STATIC_ASSERT(String::kMaxLength < kMaxInt); 429 STATIC_ASSERT(String::kMaxLength < kMaxInt);
430 result_len = kMaxInt; // Provoke exception. 430 result_len = kMaxInt; // Provoke exception.
431 } else { 431 } else {
432 result_len = static_cast<int>(result_len_64); 432 result_len = static_cast<int>(result_len_64);
433 } 433 }
434 if (result_len == 0) {
435 return isolate->heap()->empty_string();
436 }
434 437
435 int subject_pos = 0; 438 int subject_pos = 0;
436 int result_pos = 0; 439 int result_pos = 0;
437 440
438 MaybeHandle<SeqString> maybe_res; 441 MaybeHandle<SeqString> maybe_res;
439 if (ResultSeqString::kHasOneByteEncoding) { 442 if (ResultSeqString::kHasOneByteEncoding) {
440 maybe_res = isolate->factory()->NewRawOneByteString(result_len); 443 maybe_res = isolate->factory()->NewRawOneByteString(result_len);
441 } else { 444 } else {
442 maybe_res = isolate->factory()->NewRawTwoByteString(result_len); 445 maybe_res = isolate->factory()->NewRawTwoByteString(result_len);
443 } 446 }
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 1681
1679 RUNTIME_FUNCTION(Runtime_IsRegExp) { 1682 RUNTIME_FUNCTION(Runtime_IsRegExp) {
1680 SealHandleScope shs(isolate); 1683 SealHandleScope shs(isolate);
1681 DCHECK_EQ(1, args.length()); 1684 DCHECK_EQ(1, args.length());
1682 CONVERT_ARG_CHECKED(Object, obj, 0); 1685 CONVERT_ARG_CHECKED(Object, obj, 0);
1683 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); 1686 return isolate->heap()->ToBoolean(obj->IsJSRegExp());
1684 } 1687 }
1685 1688
1686 } // namespace internal 1689 } // namespace internal
1687 } // namespace v8 1690 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/runtime/runtime-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698