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

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

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 int pattern_length = pattern->length(); 699 int pattern_length = pattern->length();
700 CHECK(pattern_length > 0); 700 CHECK(pattern_length > 0);
701 701
702 if (limit == 0xffffffffu) { 702 if (limit == 0xffffffffu) {
703 FixedArray* last_match_cache_unused; 703 FixedArray* last_match_cache_unused;
704 Handle<Object> cached_answer( 704 Handle<Object> cached_answer(
705 RegExpResultsCache::Lookup(isolate->heap(), *subject, *pattern, 705 RegExpResultsCache::Lookup(isolate->heap(), *subject, *pattern,
706 &last_match_cache_unused, 706 &last_match_cache_unused,
707 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS), 707 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS),
708 isolate); 708 isolate);
709 if (*cached_answer != Smi::kZero) { 709 if (*cached_answer != Smi::FromInt(0)) {
710 // The cache FixedArray is a COW-array and can therefore be reused. 710 // The cache FixedArray is a COW-array and can therefore be reused.
711 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements( 711 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(
712 Handle<FixedArray>::cast(cached_answer)); 712 Handle<FixedArray>::cast(cached_answer));
713 return *result; 713 return *result;
714 } 714 }
715 } 715 }
716 716
717 // The limit can be very large (0xffffffffu), but since the pattern 717 // The limit can be very large (0xffffffffu), but since the pattern
718 // isn't empty, we can never create more parts than ~half the length 718 // isn't empty, we can never create more parts than ~half the length
719 // of the subject. 719 // of the subject.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 1020
1021 1021
1022 RUNTIME_FUNCTION(Runtime_IsRegExp) { 1022 RUNTIME_FUNCTION(Runtime_IsRegExp) {
1023 SealHandleScope shs(isolate); 1023 SealHandleScope shs(isolate);
1024 DCHECK(args.length() == 1); 1024 DCHECK(args.length() == 1);
1025 CONVERT_ARG_CHECKED(Object, obj, 0); 1025 CONVERT_ARG_CHECKED(Object, obj, 0);
1026 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); 1026 return isolate->heap()->ToBoolean(obj->IsJSRegExp());
1027 } 1027 }
1028 } // namespace internal 1028 } // namespace internal
1029 } // namespace v8 1029 } // 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