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

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

Issue 7540025: Merge regexp codeflushing (r8532+r8560) to the 3.3 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.3/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-visiting.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after
3712 3712
3713 3713
3714 JSRegExp::Type JSRegExp::TypeTag() { 3714 JSRegExp::Type JSRegExp::TypeTag() {
3715 Object* data = this->data(); 3715 Object* data = this->data();
3716 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; 3716 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
3717 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); 3717 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
3718 return static_cast<JSRegExp::Type>(smi->value()); 3718 return static_cast<JSRegExp::Type>(smi->value());
3719 } 3719 }
3720 3720
3721 3721
3722 JSRegExp::Type JSRegExp::TypeTagUnchecked() {
3723 Smi* smi = Smi::cast(DataAtUnchecked(kTagIndex));
3724 return static_cast<JSRegExp::Type>(smi->value());
3725 }
3726
3727
3722 int JSRegExp::CaptureCount() { 3728 int JSRegExp::CaptureCount() {
3723 switch (TypeTag()) { 3729 switch (TypeTag()) {
3724 case ATOM: 3730 case ATOM:
3725 return 0; 3731 return 0;
3726 case IRREGEXP: 3732 case IRREGEXP:
3727 return Smi::cast(DataAt(kIrregexpCaptureCountIndex))->value(); 3733 return Smi::cast(DataAt(kIrregexpCaptureCountIndex))->value();
3728 default: 3734 default:
3729 UNREACHABLE(); 3735 UNREACHABLE();
3730 return -1; 3736 return -1;
3731 } 3737 }
(...skipping 15 matching lines...) Expand all
3747 return pattern; 3753 return pattern;
3748 } 3754 }
3749 3755
3750 3756
3751 Object* JSRegExp::DataAt(int index) { 3757 Object* JSRegExp::DataAt(int index) {
3752 ASSERT(TypeTag() != NOT_COMPILED); 3758 ASSERT(TypeTag() != NOT_COMPILED);
3753 return FixedArray::cast(data())->get(index); 3759 return FixedArray::cast(data())->get(index);
3754 } 3760 }
3755 3761
3756 3762
3763 Object* JSRegExp::DataAtUnchecked(int index) {
3764 FixedArray* fa = reinterpret_cast<FixedArray*>(data());
3765 int offset = FixedArray::kHeaderSize + index * kPointerSize;
3766 return READ_FIELD(fa, offset);
3767 }
3768
3769
3757 void JSRegExp::SetDataAt(int index, Object* value) { 3770 void JSRegExp::SetDataAt(int index, Object* value) {
3758 ASSERT(TypeTag() != NOT_COMPILED); 3771 ASSERT(TypeTag() != NOT_COMPILED);
3759 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. 3772 ASSERT(index >= kDataIndex); // Only implementation data can be set this way.
3760 FixedArray::cast(data())->set(index, value); 3773 FixedArray::cast(data())->set(index, value);
3761 } 3774 }
3762 3775
3763 3776
3777 void JSRegExp::SetDataAtUnchecked(int index, Object* value, Heap* heap) {
3778 ASSERT(index >= kDataIndex); // Only implementation data can be set this way.
3779 FixedArray* fa = reinterpret_cast<FixedArray*>(data());
3780 if (value->IsSmi()) {
3781 fa->set_unchecked(index, Smi::cast(value));
3782 } else {
3783 fa->set_unchecked(heap, index, value, SKIP_WRITE_BARRIER);
3784 }
3785 }
3786
3787
3764 JSObject::ElementsKind JSObject::GetElementsKind() { 3788 JSObject::ElementsKind JSObject::GetElementsKind() {
3765 if (map()->has_fast_elements()) { 3789 if (map()->has_fast_elements()) {
3766 ASSERT(elements()->map() == GetHeap()->fixed_array_map() || 3790 ASSERT(elements()->map() == GetHeap()->fixed_array_map() ||
3767 elements()->map() == GetHeap()->fixed_cow_array_map()); 3791 elements()->map() == GetHeap()->fixed_cow_array_map());
3768 return FAST_ELEMENTS; 3792 return FAST_ELEMENTS;
3769 } 3793 }
3770 HeapObject* array = elements(); 3794 HeapObject* array = elements();
3771 if (array->IsFixedArray()) { 3795 if (array->IsFixedArray()) {
3772 // FAST_ELEMENTS or DICTIONARY_ELEMENTS are both stored in a 3796 // FAST_ELEMENTS or DICTIONARY_ELEMENTS are both stored in a
3773 // FixedArray, but FAST_ELEMENTS is already handled above. 3797 // FixedArray, but FAST_ELEMENTS is already handled above.
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
4314 #undef WRITE_INT_FIELD 4338 #undef WRITE_INT_FIELD
4315 #undef READ_SHORT_FIELD 4339 #undef READ_SHORT_FIELD
4316 #undef WRITE_SHORT_FIELD 4340 #undef WRITE_SHORT_FIELD
4317 #undef READ_BYTE_FIELD 4341 #undef READ_BYTE_FIELD
4318 #undef WRITE_BYTE_FIELD 4342 #undef WRITE_BYTE_FIELD
4319 4343
4320 4344
4321 } } // namespace v8::internal 4345 } } // namespace v8::internal
4322 4346
4323 #endif // V8_OBJECTS_INL_H_ 4347 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698