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

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

Issue 173348: Api inlining. Made some core functionality available in the api and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return false; 124 return false;
125 } 125 }
126 126
127 127
128 bool Object::IsSmi() { 128 bool Object::IsSmi() {
129 return HAS_SMI_TAG(this); 129 return HAS_SMI_TAG(this);
130 } 130 }
131 131
132 132
133 bool Object::IsHeapObject() { 133 bool Object::IsHeapObject() {
134 return HAS_HEAP_OBJECT_TAG(this); 134 return Internals::HasHeapObjectTag(this);
135 } 135 }
136 136
137 137
138 bool Object::IsHeapNumber() { 138 bool Object::IsHeapNumber() {
139 return Object::IsHeapObject() 139 return Object::IsHeapObject()
140 && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE; 140 && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE;
141 } 141 }
142 142
143 143
144 bool Object::IsString() { 144 bool Object::IsString() {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 uint32_t tag = (type_ & kStringRepresentationMask); 293 uint32_t tag = (type_ & kStringRepresentationMask);
294 return static_cast<StringRepresentationTag>(tag); 294 return static_cast<StringRepresentationTag>(tag);
295 } 295 }
296 296
297 297
298 uint32_t StringShape::full_representation_tag() { 298 uint32_t StringShape::full_representation_tag() {
299 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); 299 return (type_ & (kStringRepresentationMask | kStringEncodingMask));
300 } 300 }
301 301
302 302
303 STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) ==
304 Internals::kFullStringRepresentationMask);
Mads Ager (chromium) 2009/08/26 06:22:20 Align with '(kStringRepresentationMask ...'
305
306
303 uint32_t StringShape::size_tag() { 307 uint32_t StringShape::size_tag() {
304 return (type_ & kStringSizeMask); 308 return (type_ & kStringSizeMask);
305 } 309 }
306 310
307 311
308 bool StringShape::IsSequentialAscii() { 312 bool StringShape::IsSequentialAscii() {
309 return full_representation_tag() == (kSeqStringTag | kAsciiStringTag); 313 return full_representation_tag() == (kSeqStringTag | kAsciiStringTag);
310 } 314 }
311 315
312 316
313 bool StringShape::IsSequentialTwoByte() { 317 bool StringShape::IsSequentialTwoByte() {
314 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); 318 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
315 } 319 }
316 320
317 321
318 bool StringShape::IsExternalAscii() { 322 bool StringShape::IsExternalAscii() {
319 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag); 323 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag);
320 } 324 }
321 325
322 326
323 bool StringShape::IsExternalTwoByte() { 327 bool StringShape::IsExternalTwoByte() {
324 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); 328 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
325 } 329 }
326 330
327 331
332 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) ==
333 Internals::kExternalTwoByteRepresentationTag);
Mads Ager (chromium) 2009/08/26 06:22:20 Align with '(kExternalStringTag ...'
334
335
328 uc32 FlatStringReader::Get(int index) { 336 uc32 FlatStringReader::Get(int index) {
329 ASSERT(0 <= index && index <= length_); 337 ASSERT(0 <= index && index <= length_);
330 if (is_ascii_) { 338 if (is_ascii_) {
331 return static_cast<const byte*>(start_)[index]; 339 return static_cast<const byte*>(start_)[index];
332 } else { 340 } else {
333 return static_cast<const uc16*>(start_)[index]; 341 return static_cast<const uc16*>(start_)[index];
334 } 342 }
335 } 343 }
336 344
337 345
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 #define WRITE_BYTE_FIELD(p, offset, value) \ 731 #define WRITE_BYTE_FIELD(p, offset, value) \
724 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) 732 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value)
725 733
726 734
727 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { 735 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) {
728 return &READ_FIELD(obj, byte_offset); 736 return &READ_FIELD(obj, byte_offset);
729 } 737 }
730 738
731 739
732 int Smi::value() { 740 int Smi::value() {
733 return static_cast<int>(reinterpret_cast<intptr_t>(this)) >> kSmiTagSize; 741 return Internals::SmiValue(this);
734 } 742 }
735 743
736 744
737 Smi* Smi::FromInt(int value) { 745 Smi* Smi::FromInt(int value) {
738 ASSERT(Smi::IsValid(value)); 746 ASSERT(Smi::IsValid(value));
739 intptr_t tagged_value = 747 intptr_t tagged_value =
740 (static_cast<intptr_t>(value) << kSmiTagSize) | kSmiTag; 748 (static_cast<intptr_t>(value) << kSmiTagSize) | kSmiTag;
741 return reinterpret_cast<Smi*>(tagged_value); 749 return reinterpret_cast<Smi*>(tagged_value);
742 } 750 }
743 751
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 #undef WRITE_INT_FIELD 2888 #undef WRITE_INT_FIELD
2881 #undef READ_SHORT_FIELD 2889 #undef READ_SHORT_FIELD
2882 #undef WRITE_SHORT_FIELD 2890 #undef WRITE_SHORT_FIELD
2883 #undef READ_BYTE_FIELD 2891 #undef READ_BYTE_FIELD
2884 #undef WRITE_BYTE_FIELD 2892 #undef WRITE_BYTE_FIELD
2885 2893
2886 2894
2887 } } // namespace v8::internal 2895 } } // namespace v8::internal
2888 2896
2889 #endif // V8_OBJECTS_INL_H_ 2897 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698