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

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

Issue 12427: Merge regexp2000 back into bleeding_edge (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag); 272 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag);
273 } 273 }
274 274
275 275
276 bool StringShape::IsExternalTwoByte() { 276 bool StringShape::IsExternalTwoByte() {
277 return (type_ & (kStringRepresentationMask | kStringEncodingMask)) == 277 return (type_ & (kStringRepresentationMask | kStringEncodingMask)) ==
278 (kExternalStringTag | kTwoByteStringTag); 278 (kExternalStringTag | kTwoByteStringTag);
279 } 279 }
280 280
281 281
282 uc32 FlatStringReader::Get(int index) {
283 ASSERT(0 <= index && index <= length_);
284 if (is_ascii_) {
285 return static_cast<const byte*>(start_)[index];
286 } else {
287 return static_cast<const uc16*>(start_)[index];
288 }
289 }
290
291
282 bool Object::IsNumber() { 292 bool Object::IsNumber() {
283 return IsSmi() || IsHeapNumber(); 293 return IsSmi() || IsHeapNumber();
284 } 294 }
285 295
286 296
287 bool Object::IsByteArray() { 297 bool Object::IsByteArray() {
288 return Object::IsHeapObject() 298 return Object::IsHeapObject()
289 && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE; 299 && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE;
290 } 300 }
291 301
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 return true; 1145 return true;
1136 } 1146 }
1137 1147
1138 1148
1139 Object* FixedArray::get(int index) { 1149 Object* FixedArray::get(int index) {
1140 ASSERT(index >= 0 && index < this->length()); 1150 ASSERT(index >= 0 && index < this->length());
1141 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 1151 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
1142 } 1152 }
1143 1153
1144 1154
1155 void FixedArray::set(int index, Smi* value) {
1156 ASSERT(reinterpret_cast<Object*>(value)->IsSmi());
1157 int offset = kHeaderSize + index * kPointerSize;
1158 WRITE_FIELD(this, offset, value);
1159 }
1160
1161
1145 void FixedArray::set(int index, Object* value) { 1162 void FixedArray::set(int index, Object* value) {
1146 ASSERT(index >= 0 && index < this->length()); 1163 ASSERT(index >= 0 && index < this->length());
1147 int offset = kHeaderSize + index * kPointerSize; 1164 int offset = kHeaderSize + index * kPointerSize;
1148 WRITE_FIELD(this, offset, value); 1165 WRITE_FIELD(this, offset, value);
1149 WRITE_BARRIER(this, offset); 1166 WRITE_BARRIER(this, offset);
1150 } 1167 }
1151 1168
1152 1169
1153 WriteBarrierMode HeapObject::GetWriteBarrierMode() { 1170 WriteBarrierMode HeapObject::GetWriteBarrierMode() {
1154 if (Heap::InNewSpace(this)) return SKIP_WRITE_BARRIER; 1171 if (Heap::InNewSpace(this)) return SKIP_WRITE_BARRIER;
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 return ((1 << kIsAccessCheckNeeded) & bit_field()) != 0; 1757 return ((1 << kIsAccessCheckNeeded) & bit_field()) != 0;
1741 } 1758 }
1742 1759
1743 1760
1744 Code::Flags Code::flags() { 1761 Code::Flags Code::flags() {
1745 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); 1762 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset));
1746 } 1763 }
1747 1764
1748 1765
1749 void Code::set_flags(Code::Flags flags) { 1766 void Code::set_flags(Code::Flags flags) {
1767 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= (kFlagsKindMask >> kFlagsKindShift)+1);
1750 // Make sure that all call stubs have an arguments count. 1768 // Make sure that all call stubs have an arguments count.
1751 ASSERT(ExtractKindFromFlags(flags) != CALL_IC || 1769 ASSERT(ExtractKindFromFlags(flags) != CALL_IC ||
1752 ExtractArgumentsCountFromFlags(flags) >= 0); 1770 ExtractArgumentsCountFromFlags(flags) >= 0);
1753 WRITE_INT_FIELD(this, kFlagsOffset, flags); 1771 WRITE_INT_FIELD(this, kFlagsOffset, flags);
1754 } 1772 }
1755 1773
1756 1774
1757 Code::Kind Code::kind() { 1775 Code::Kind Code::kind() {
1758 return ExtractKindFromFlags(flags()); 1776 return ExtractKindFromFlags(flags());
1759 } 1777 }
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 2224
2207 2225
2208 JSRegExp::Type JSRegExp::TypeTag() { 2226 JSRegExp::Type JSRegExp::TypeTag() {
2209 Object* data = this->data(); 2227 Object* data = this->data();
2210 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; 2228 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
2211 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); 2229 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
2212 return static_cast<JSRegExp::Type>(smi->value()); 2230 return static_cast<JSRegExp::Type>(smi->value());
2213 } 2231 }
2214 2232
2215 2233
2234 JSRegExp::Flags JSRegExp::GetFlags() {
2235 ASSERT(this->data()->IsFixedArray());
2236 Object* data = this->data();
2237 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kFlagsIndex));
2238 return Flags(smi->value());
2239 }
2240
2241
2242 String* JSRegExp::Pattern() {
2243 ASSERT(this->data()->IsFixedArray());
2244 Object* data = this->data();
2245 String* pattern= String::cast(FixedArray::cast(data)->get(kSourceIndex));
2246 return pattern;
2247 }
2248
2249
2216 Object* JSRegExp::DataAt(int index) { 2250 Object* JSRegExp::DataAt(int index) {
2217 ASSERT(TypeTag() != NOT_COMPILED); 2251 ASSERT(TypeTag() != NOT_COMPILED);
2218 return FixedArray::cast(data())->get(index); 2252 return FixedArray::cast(data())->get(index);
2219 } 2253 }
2220 2254
2221 2255
2222 bool JSObject::HasFastElements() { 2256 bool JSObject::HasFastElements() {
2223 return !elements()->IsDictionary(); 2257 return !elements()->IsDictionary();
2224 } 2258 }
2225 2259
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 #undef WRITE_INT_FIELD 2468 #undef WRITE_INT_FIELD
2435 #undef READ_SHORT_FIELD 2469 #undef READ_SHORT_FIELD
2436 #undef WRITE_SHORT_FIELD 2470 #undef WRITE_SHORT_FIELD
2437 #undef READ_BYTE_FIELD 2471 #undef READ_BYTE_FIELD
2438 #undef WRITE_BYTE_FIELD 2472 #undef WRITE_BYTE_FIELD
2439 2473
2440 2474
2441 } } // namespace v8::internal 2475 } } // namespace v8::internal
2442 2476
2443 #endif // V8_OBJECTS_INL_H_ 2477 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698