Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 bool Object::NonFailureIsHeapObject() { | 182 bool Object::NonFailureIsHeapObject() { |
| 183 ASSERT(!this->IsFailure()); | 183 ASSERT(!this->IsFailure()); |
| 184 return (reinterpret_cast<intptr_t>(this) & kSmiTagMask) != 0; | 184 return (reinterpret_cast<intptr_t>(this) & kSmiTagMask) != 0; |
| 185 } | 185 } |
| 186 | 186 |
| 187 | 187 |
| 188 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) | 188 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) |
| 189 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 189 TYPE_CHECKER(Symbol, SYMBOL_TYPE) |
| 190 | 190 |
| 191 | 191 |
| 192 bool Object::IsPrivate() { | |
| 193 return IsSymbol() && Symbol::cast(this)->name()->IsBox(); | |
| 194 } | |
| 195 | |
| 196 | |
| 192 bool Object::IsString() { | 197 bool Object::IsString() { |
| 193 return Object::IsHeapObject() | 198 return Object::IsHeapObject() |
| 194 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; | 199 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; |
| 195 } | 200 } |
| 196 | 201 |
| 197 | 202 |
| 198 bool Object::IsName() { | 203 bool Object::IsName() { |
| 199 return IsString() || IsSymbol(); | 204 return IsString() || IsSymbol(); |
| 200 } | 205 } |
| 201 | 206 |
| (...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2595 CAST_ACCESSOR(String) | 2600 CAST_ACCESSOR(String) |
| 2596 CAST_ACCESSOR(SeqString) | 2601 CAST_ACCESSOR(SeqString) |
| 2597 CAST_ACCESSOR(SeqOneByteString) | 2602 CAST_ACCESSOR(SeqOneByteString) |
| 2598 CAST_ACCESSOR(SeqTwoByteString) | 2603 CAST_ACCESSOR(SeqTwoByteString) |
| 2599 CAST_ACCESSOR(SlicedString) | 2604 CAST_ACCESSOR(SlicedString) |
| 2600 CAST_ACCESSOR(ConsString) | 2605 CAST_ACCESSOR(ConsString) |
| 2601 CAST_ACCESSOR(ExternalString) | 2606 CAST_ACCESSOR(ExternalString) |
| 2602 CAST_ACCESSOR(ExternalAsciiString) | 2607 CAST_ACCESSOR(ExternalAsciiString) |
| 2603 CAST_ACCESSOR(ExternalTwoByteString) | 2608 CAST_ACCESSOR(ExternalTwoByteString) |
| 2604 CAST_ACCESSOR(Symbol) | 2609 CAST_ACCESSOR(Symbol) |
| 2610 CAST_ACCESSOR(Private) | |
| 2605 CAST_ACCESSOR(Name) | 2611 CAST_ACCESSOR(Name) |
| 2606 CAST_ACCESSOR(JSReceiver) | 2612 CAST_ACCESSOR(JSReceiver) |
| 2607 CAST_ACCESSOR(JSObject) | 2613 CAST_ACCESSOR(JSObject) |
| 2608 CAST_ACCESSOR(Smi) | 2614 CAST_ACCESSOR(Smi) |
| 2609 CAST_ACCESSOR(HeapObject) | 2615 CAST_ACCESSOR(HeapObject) |
| 2610 CAST_ACCESSOR(HeapNumber) | 2616 CAST_ACCESSOR(HeapNumber) |
| 2611 CAST_ACCESSOR(Oddball) | 2617 CAST_ACCESSOR(Oddball) |
| 2612 CAST_ACCESSOR(Cell) | 2618 CAST_ACCESSOR(Cell) |
| 2613 CAST_ACCESSOR(PropertyCell) | 2619 CAST_ACCESSOR(PropertyCell) |
| 2614 CAST_ACCESSOR(SharedFunctionInfo) | 2620 CAST_ACCESSOR(SharedFunctionInfo) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2685 this->IsSymbol() || other->IsSymbol()) { | 2691 this->IsSymbol() || other->IsSymbol()) { |
| 2686 return false; | 2692 return false; |
| 2687 } | 2693 } |
| 2688 return String::cast(this)->SlowEquals(String::cast(other)); | 2694 return String::cast(this)->SlowEquals(String::cast(other)); |
| 2689 } | 2695 } |
| 2690 | 2696 |
| 2691 | 2697 |
| 2692 ACCESSORS(Symbol, name, Object, kNameOffset) | 2698 ACCESSORS(Symbol, name, Object, kNameOffset) |
| 2693 | 2699 |
| 2694 | 2700 |
| 2701 Object* Private::name() { | |
| 2702 ASSERT(IsPrivate()); | |
| 2703 return Box::cast(Symbol::name())->value(); | |
|
Yang
2013/10/29 12:47:26
could we assert in those accessors that the value
rossberg
2013/10/29 15:08:19
Yeah, that is nasty. I decided to remove the whole
| |
| 2704 } | |
| 2705 | |
| 2706 | |
| 2707 void Private::set_name(Object* value, WriteBarrierMode mode) { | |
| 2708 ASSERT(IsPrivate()); | |
| 2709 return Box::cast(Symbol::name())->set_value(value, mode); | |
| 2710 } | |
| 2711 | |
| 2712 | |
| 2695 bool String::Equals(String* other) { | 2713 bool String::Equals(String* other) { |
| 2696 if (other == this) return true; | 2714 if (other == this) return true; |
| 2697 if (this->IsInternalizedString() && other->IsInternalizedString()) { | 2715 if (this->IsInternalizedString() && other->IsInternalizedString()) { |
| 2698 return false; | 2716 return false; |
| 2699 } | 2717 } |
| 2700 return SlowEquals(other); | 2718 return SlowEquals(other); |
| 2701 } | 2719 } |
| 2702 | 2720 |
| 2703 | 2721 |
| 2704 MaybeObject* String::TryFlatten(PretenureFlag pretenure) { | 2722 MaybeObject* String::TryFlatten(PretenureFlag pretenure) { |
| (...skipping 3693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6398 #undef WRITE_UINT32_FIELD | 6416 #undef WRITE_UINT32_FIELD |
| 6399 #undef READ_SHORT_FIELD | 6417 #undef READ_SHORT_FIELD |
| 6400 #undef WRITE_SHORT_FIELD | 6418 #undef WRITE_SHORT_FIELD |
| 6401 #undef READ_BYTE_FIELD | 6419 #undef READ_BYTE_FIELD |
| 6402 #undef WRITE_BYTE_FIELD | 6420 #undef WRITE_BYTE_FIELD |
| 6403 | 6421 |
| 6404 | 6422 |
| 6405 } } // namespace v8::internal | 6423 } } // namespace v8::internal |
| 6406 | 6424 |
| 6407 #endif // V8_OBJECTS_INL_H_ | 6425 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |