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

Side by Side Diff: src/objects-inl.h

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/objects.cc ('k') | src/ppc/code-stubs-ppc.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 709 }
710 710
711 bool HeapObject::IsJSCollection() const { return IsJSMap() || IsJSSet(); } 711 bool HeapObject::IsJSCollection() const { return IsJSMap() || IsJSSet(); }
712 712
713 bool HeapObject::IsDescriptorArray() const { return IsFixedArray(); } 713 bool HeapObject::IsDescriptorArray() const { return IsFixedArray(); }
714 714
715 bool HeapObject::IsFrameArray() const { return IsFixedArray(); } 715 bool HeapObject::IsFrameArray() const { return IsFixedArray(); }
716 716
717 bool HeapObject::IsArrayList() const { return IsFixedArray(); } 717 bool HeapObject::IsArrayList() const { return IsFixedArray(); }
718 718
719 bool HeapObject::IsRegExpMatchInfo() const { return IsFixedArray(); }
720
719 bool Object::IsLayoutDescriptor() const { 721 bool Object::IsLayoutDescriptor() const {
720 return IsSmi() || IsFixedTypedArrayBase(); 722 return IsSmi() || IsFixedTypedArrayBase();
721 } 723 }
722 724
723 bool HeapObject::IsTypeFeedbackVector() const { return IsFixedArray(); } 725 bool HeapObject::IsTypeFeedbackVector() const { return IsFixedArray(); }
724 726
725 bool HeapObject::IsTypeFeedbackMetadata() const { return IsFixedArray(); } 727 bool HeapObject::IsTypeFeedbackMetadata() const { return IsFixedArray(); }
726 728
727 bool HeapObject::IsLiteralsArray() const { return IsFixedArray(); } 729 bool HeapObject::IsLiteralsArray() const { return IsFixedArray(); }
728 730
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 FixedArray::cast(this)->set(kFirstIndex + index, obj, mode); 2530 FixedArray::cast(this)->set(kFirstIndex + index, obj, mode);
2529 } 2531 }
2530 2532
2531 2533
2532 void ArrayList::Clear(int index, Object* undefined) { 2534 void ArrayList::Clear(int index, Object* undefined) {
2533 DCHECK(undefined->IsUndefined(GetIsolate())); 2535 DCHECK(undefined->IsUndefined(GetIsolate()));
2534 FixedArray::cast(this) 2536 FixedArray::cast(this)
2535 ->set(kFirstIndex + index, undefined, SKIP_WRITE_BARRIER); 2537 ->set(kFirstIndex + index, undefined, SKIP_WRITE_BARRIER);
2536 } 2538 }
2537 2539
2540 int RegExpMatchInfo::NumberOfCaptureRegisters() {
2541 DCHECK_GE(length(), kLastMatchOverhead);
2542 Object* obj = get(kNumberOfCapturesIndex);
2543 return Smi::cast(obj)->value();
2544 }
2545
2546 void RegExpMatchInfo::SetNumberOfCaptureRegisters(int value) {
2547 DCHECK_GE(length(), kLastMatchOverhead);
2548 set(kNumberOfCapturesIndex, Smi::FromInt(value));
2549 }
2550
2551 String* RegExpMatchInfo::LastSubject() {
2552 DCHECK_GE(length(), kLastMatchOverhead);
2553 Object* obj = get(kLastSubjectIndex);
2554 return String::cast(obj);
2555 }
2556
2557 void RegExpMatchInfo::SetLastSubject(String* value) {
2558 DCHECK_GE(length(), kLastMatchOverhead);
2559 set(kLastSubjectIndex, value);
2560 }
2561
2562 Object* RegExpMatchInfo::LastInput() {
2563 DCHECK_GE(length(), kLastMatchOverhead);
2564 return get(kLastInputIndex);
2565 }
2566
2567 void RegExpMatchInfo::SetLastInput(Object* value) {
2568 DCHECK_GE(length(), kLastMatchOverhead);
2569 set(kLastInputIndex, value);
2570 }
2571
2572 int RegExpMatchInfo::Capture(int i) {
2573 DCHECK_LT(i, NumberOfCaptureRegisters());
2574 Object* obj = get(kFirstCaptureIndex + i);
2575 return Smi::cast(obj)->value();
2576 }
2577
2578 void RegExpMatchInfo::SetCapture(int i, int value) {
2579 DCHECK_LT(i, NumberOfCaptureRegisters());
2580 set(kFirstCaptureIndex + i, Smi::FromInt(value));
2581 }
2538 2582
2539 WriteBarrierMode HeapObject::GetWriteBarrierMode( 2583 WriteBarrierMode HeapObject::GetWriteBarrierMode(
2540 const DisallowHeapAllocation& promise) { 2584 const DisallowHeapAllocation& promise) {
2541 Heap* heap = GetHeap(); 2585 Heap* heap = GetHeap();
2542 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; 2586 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER;
2543 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; 2587 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER;
2544 return UPDATE_WRITE_BARRIER; 2588 return UPDATE_WRITE_BARRIER;
2545 } 2589 }
2546 2590
2547 2591
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 CAST_ACCESSOR(NameDictionary) 3351 CAST_ACCESSOR(NameDictionary)
3308 CAST_ACCESSOR(NormalizedMapCache) 3352 CAST_ACCESSOR(NormalizedMapCache)
3309 CAST_ACCESSOR(Object) 3353 CAST_ACCESSOR(Object)
3310 CAST_ACCESSOR(ObjectHashTable) 3354 CAST_ACCESSOR(ObjectHashTable)
3311 CAST_ACCESSOR(ObjectHashSet) 3355 CAST_ACCESSOR(ObjectHashSet)
3312 CAST_ACCESSOR(Oddball) 3356 CAST_ACCESSOR(Oddball)
3313 CAST_ACCESSOR(OrderedHashMap) 3357 CAST_ACCESSOR(OrderedHashMap)
3314 CAST_ACCESSOR(OrderedHashSet) 3358 CAST_ACCESSOR(OrderedHashSet)
3315 CAST_ACCESSOR(PropertyCell) 3359 CAST_ACCESSOR(PropertyCell)
3316 CAST_ACCESSOR(TemplateList) 3360 CAST_ACCESSOR(TemplateList)
3361 CAST_ACCESSOR(RegExpMatchInfo)
3317 CAST_ACCESSOR(ScopeInfo) 3362 CAST_ACCESSOR(ScopeInfo)
3318 CAST_ACCESSOR(SeededNumberDictionary) 3363 CAST_ACCESSOR(SeededNumberDictionary)
3319 CAST_ACCESSOR(SeqOneByteString) 3364 CAST_ACCESSOR(SeqOneByteString)
3320 CAST_ACCESSOR(SeqString) 3365 CAST_ACCESSOR(SeqString)
3321 CAST_ACCESSOR(SeqTwoByteString) 3366 CAST_ACCESSOR(SeqTwoByteString)
3322 CAST_ACCESSOR(SharedFunctionInfo) 3367 CAST_ACCESSOR(SharedFunctionInfo)
3323 CAST_ACCESSOR(Simd128Value) 3368 CAST_ACCESSOR(Simd128Value)
3324 CAST_ACCESSOR(SlicedString) 3369 CAST_ACCESSOR(SlicedString)
3325 CAST_ACCESSOR(Smi) 3370 CAST_ACCESSOR(Smi)
3326 CAST_ACCESSOR(String) 3371 CAST_ACCESSOR(String)
(...skipping 5026 matching lines...) Expand 10 before | Expand all | Expand 10 after
8353 #undef WRITE_INT64_FIELD 8398 #undef WRITE_INT64_FIELD
8354 #undef READ_BYTE_FIELD 8399 #undef READ_BYTE_FIELD
8355 #undef WRITE_BYTE_FIELD 8400 #undef WRITE_BYTE_FIELD
8356 #undef NOBARRIER_READ_BYTE_FIELD 8401 #undef NOBARRIER_READ_BYTE_FIELD
8357 #undef NOBARRIER_WRITE_BYTE_FIELD 8402 #undef NOBARRIER_WRITE_BYTE_FIELD
8358 8403
8359 } // namespace internal 8404 } // namespace internal
8360 } // namespace v8 8405 } // namespace v8
8361 8406
8362 #endif // V8_OBJECTS_INL_H_ 8407 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698