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

Side by Side Diff: src/factory.cc

Issue 2415103002: [regexp] Turn last match info into a simple FixedArray (Closed)
Patch Set: Don't check instance type before map check 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/factory.h ('k') | src/ia32/code-stubs-ia32.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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized); 2487 store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized);
2488 store->set(JSRegExp::kIrregexpLatin1CodeSavedIndex, uninitialized); 2488 store->set(JSRegExp::kIrregexpLatin1CodeSavedIndex, uninitialized);
2489 store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized); 2489 store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized);
2490 store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::kZero); 2490 store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::kZero);
2491 store->set(JSRegExp::kIrregexpCaptureCountIndex, 2491 store->set(JSRegExp::kIrregexpCaptureCountIndex,
2492 Smi::FromInt(capture_count)); 2492 Smi::FromInt(capture_count));
2493 store->set(JSRegExp::kIrregexpCaptureNameMapIndex, uninitialized); 2493 store->set(JSRegExp::kIrregexpCaptureNameMapIndex, uninitialized);
2494 regexp->set_data(*store); 2494 regexp->set_data(*store);
2495 } 2495 }
2496 2496
2497 Handle<RegExpMatchInfo> Factory::NewRegExpMatchInfo() {
2498 // Initially, the last match info consists of all fixed fields plus space for
2499 // the match itself (i.e., 2 capture indices).
2500 static const int kInitialSize = RegExpMatchInfo::kFirstCaptureIndex +
2501 RegExpMatchInfo::kInitialCaptureIndices;
2502
2503 Handle<FixedArray> elems = NewFixedArray(kInitialSize);
2504 Handle<RegExpMatchInfo> result = Handle<RegExpMatchInfo>::cast(elems);
2505
2506 result->SetNumberOfCaptureRegisters(RegExpMatchInfo::kInitialCaptureIndices);
2507 result->SetLastSubject(*empty_string());
2508 result->SetLastInput(*undefined_value());
2509 result->SetCapture(0, 0);
2510 result->SetCapture(1, 0);
2511
2512 return result;
2513 }
2497 2514
2498 Handle<Object> Factory::GlobalConstantFor(Handle<Name> name) { 2515 Handle<Object> Factory::GlobalConstantFor(Handle<Name> name) {
2499 if (Name::Equals(name, undefined_string())) return undefined_value(); 2516 if (Name::Equals(name, undefined_string())) return undefined_value();
2500 if (Name::Equals(name, nan_string())) return nan_value(); 2517 if (Name::Equals(name, nan_string())) return nan_value();
2501 if (Name::Equals(name, infinity_string())) return infinity_value(); 2518 if (Name::Equals(name, infinity_string())) return infinity_value();
2502 return Handle<Object>::null(); 2519 return Handle<Object>::null();
2503 } 2520 }
2504 2521
2505 2522
2506 Handle<Object> Factory::ToBoolean(bool value) { 2523 Handle<Object> Factory::ToBoolean(bool value) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); 2669 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map));
2653 iterator->set_initial_next(*next); 2670 iterator->set_initial_next(*next);
2654 iterator->set_array(*array); 2671 iterator->set_array(*array);
2655 iterator->set_index(0); 2672 iterator->set_index(0);
2656 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); 2673 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next);
2657 return iterator; 2674 return iterator;
2658 } 2675 }
2659 2676
2660 } // namespace internal 2677 } // namespace internal
2661 } // namespace v8 2678 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698