| OLD | NEW |
| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 bool Object::IsExternalFloatArray() { | 392 bool Object::IsExternalFloatArray() { |
| 393 return Object::IsHeapObject() && | 393 return Object::IsHeapObject() && |
| 394 HeapObject::cast(this)->map()->instance_type() == | 394 HeapObject::cast(this)->map()->instance_type() == |
| 395 EXTERNAL_FLOAT_ARRAY_TYPE; | 395 EXTERNAL_FLOAT_ARRAY_TYPE; |
| 396 } | 396 } |
| 397 | 397 |
| 398 | 398 |
| 399 bool Object::IsFailure() { | 399 bool MaybeObject::IsFailure() { |
| 400 return HAS_FAILURE_TAG(this); | 400 return HAS_FAILURE_TAG(this); |
| 401 } | 401 } |
| 402 | 402 |
| 403 | 403 |
| 404 bool Object::IsRetryAfterGC() { | 404 bool MaybeObject::IsRetryAfterGC() { |
| 405 return HAS_FAILURE_TAG(this) | 405 return HAS_FAILURE_TAG(this) |
| 406 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; | 406 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 bool Object::IsOutOfMemoryFailure() { | 410 bool MaybeObject::IsOutOfMemory() { |
| 411 return HAS_FAILURE_TAG(this) | 411 return HAS_FAILURE_TAG(this) |
| 412 && Failure::cast(this)->IsOutOfMemoryException(); | 412 && Failure::cast(this)->IsOutOfMemoryException(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 | 415 |
| 416 bool Object::IsException() { | 416 bool MaybeObject::IsException() { |
| 417 return this == Failure::Exception(); | 417 return this == Failure::Exception(); |
| 418 } | 418 } |
| 419 | 419 |
| 420 | 420 |
| 421 bool MaybeObject::IsTheHole() { |
| 422 return this == Heap::the_hole_value(); |
| 423 } |
| 424 |
| 425 |
| 426 Failure* Failure::cast(MaybeObject* obj) { |
| 427 ASSERT(HAS_FAILURE_TAG(obj)); |
| 428 return reinterpret_cast<Failure*>(obj); |
| 429 } |
| 430 |
| 431 |
| 421 bool Object::IsJSObject() { | 432 bool Object::IsJSObject() { |
| 422 return IsHeapObject() | 433 return IsHeapObject() |
| 423 && HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE; | 434 && HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE; |
| 424 } | 435 } |
| 425 | 436 |
| 426 | 437 |
| 427 bool Object::IsJSContextExtensionObject() { | 438 bool Object::IsJSContextExtensionObject() { |
| 428 return IsHeapObject() | 439 return IsHeapObject() |
| 429 && (HeapObject::cast(this)->map()->instance_type() == | 440 && (HeapObject::cast(this)->map()->instance_type() == |
| 430 JS_CONTEXT_EXTENSION_OBJECT_TYPE); | 441 JS_CONTEXT_EXTENSION_OBJECT_TYPE); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 681 } |
| 671 STRUCT_LIST(MAKE_STRUCT_PREDICATE) | 682 STRUCT_LIST(MAKE_STRUCT_PREDICATE) |
| 672 #undef MAKE_STRUCT_PREDICATE | 683 #undef MAKE_STRUCT_PREDICATE |
| 673 | 684 |
| 674 | 685 |
| 675 bool Object::IsUndefined() { | 686 bool Object::IsUndefined() { |
| 676 return this == Heap::undefined_value(); | 687 return this == Heap::undefined_value(); |
| 677 } | 688 } |
| 678 | 689 |
| 679 | 690 |
| 680 bool Object::IsTheHole() { | |
| 681 return this == Heap::the_hole_value(); | |
| 682 } | |
| 683 | |
| 684 | |
| 685 bool Object::IsNull() { | 691 bool Object::IsNull() { |
| 686 return this == Heap::null_value(); | 692 return this == Heap::null_value(); |
| 687 } | 693 } |
| 688 | 694 |
| 689 | 695 |
| 690 bool Object::IsTrue() { | 696 bool Object::IsTrue() { |
| 691 return this == Heap::true_value(); | 697 return this == Heap::true_value(); |
| 692 } | 698 } |
| 693 | 699 |
| 694 | 700 |
| 695 bool Object::IsFalse() { | 701 bool Object::IsFalse() { |
| 696 return this == Heap::false_value(); | 702 return this == Heap::false_value(); |
| 697 } | 703 } |
| 698 | 704 |
| 699 | 705 |
| 700 double Object::Number() { | 706 double Object::Number() { |
| 701 ASSERT(IsNumber()); | 707 ASSERT(IsNumber()); |
| 702 return IsSmi() | 708 return IsSmi() |
| 703 ? static_cast<double>(reinterpret_cast<Smi*>(this)->value()) | 709 ? static_cast<double>(reinterpret_cast<Smi*>(this)->value()) |
| 704 : reinterpret_cast<HeapNumber*>(this)->value(); | 710 : reinterpret_cast<HeapNumber*>(this)->value(); |
| 705 } | 711 } |
| 706 | 712 |
| 707 | 713 |
| 708 | 714 |
| 709 Object* Object::ToSmi() { | 715 MaybeObject* Object::ToSmi() { |
| 710 if (IsSmi()) return this; | 716 if (IsSmi()) return this; |
| 711 if (IsHeapNumber()) { | 717 if (IsHeapNumber()) { |
| 712 double value = HeapNumber::cast(this)->value(); | 718 double value = HeapNumber::cast(this)->value(); |
| 713 int int_value = FastD2I(value); | 719 int int_value = FastD2I(value); |
| 714 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { | 720 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { |
| 715 return Smi::FromInt(int_value); | 721 return Smi::FromInt(int_value); |
| 716 } | 722 } |
| 717 } | 723 } |
| 718 return Failure::Exception(); | 724 return Failure::Exception(); |
| 719 } | 725 } |
| 720 | 726 |
| 721 | 727 |
| 722 bool Object::HasSpecificClassOf(String* name) { | 728 bool Object::HasSpecificClassOf(String* name) { |
| 723 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); | 729 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); |
| 724 } | 730 } |
| 725 | 731 |
| 726 | 732 |
| 727 Object* Object::GetElement(uint32_t index) { | 733 MaybeObject* Object::GetElement(uint32_t index) { |
| 728 return GetElementWithReceiver(this, index); | 734 return GetElementWithReceiver(this, index); |
| 729 } | 735 } |
| 730 | 736 |
| 731 | 737 |
| 732 Object* Object::GetProperty(String* key) { | 738 Object* Object::GetElementNoExceptionThrown(uint32_t index) { |
| 739 MaybeObject* maybe = GetElementWithReceiver(this, index); |
| 740 ASSERT(!maybe->IsFailure()); |
| 741 Object* result = NULL; // Initialization to please compiler. |
| 742 maybe->ToObject(&result); |
| 743 return result; |
| 744 } |
| 745 |
| 746 |
| 747 MaybeObject* Object::GetProperty(String* key) { |
| 733 PropertyAttributes attributes; | 748 PropertyAttributes attributes; |
| 734 return GetPropertyWithReceiver(this, key, &attributes); | 749 return GetPropertyWithReceiver(this, key, &attributes); |
| 735 } | 750 } |
| 736 | 751 |
| 737 | 752 |
| 738 Object* Object::GetProperty(String* key, PropertyAttributes* attributes) { | 753 MaybeObject* Object::GetProperty(String* key, PropertyAttributes* attributes) { |
| 739 return GetPropertyWithReceiver(this, key, attributes); | 754 return GetPropertyWithReceiver(this, key, attributes); |
| 740 } | 755 } |
| 741 | 756 |
| 742 | 757 |
| 743 #define FIELD_ADDR(p, offset) \ | 758 #define FIELD_ADDR(p, offset) \ |
| 744 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 759 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
| 745 | 760 |
| 746 #define READ_FIELD(p, offset) \ | 761 #define READ_FIELD(p, offset) \ |
| 747 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) | 762 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) |
| 748 | 763 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 } | 1197 } |
| 1183 | 1198 |
| 1184 | 1199 |
| 1185 void JSObject::initialize_elements() { | 1200 void JSObject::initialize_elements() { |
| 1186 ASSERT(map()->has_fast_elements()); | 1201 ASSERT(map()->has_fast_elements()); |
| 1187 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); | 1202 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); |
| 1188 WRITE_FIELD(this, kElementsOffset, Heap::empty_fixed_array()); | 1203 WRITE_FIELD(this, kElementsOffset, Heap::empty_fixed_array()); |
| 1189 } | 1204 } |
| 1190 | 1205 |
| 1191 | 1206 |
| 1192 Object* JSObject::ResetElements() { | 1207 MaybeObject* JSObject::ResetElements() { |
| 1193 Object* obj = map()->GetFastElementsMap(); | 1208 Object* obj; |
| 1194 if (obj->IsFailure()) return obj; | 1209 { MaybeObject* maybe_obj = map()->GetFastElementsMap(); |
| 1210 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1211 } |
| 1195 set_map(Map::cast(obj)); | 1212 set_map(Map::cast(obj)); |
| 1196 initialize_elements(); | 1213 initialize_elements(); |
| 1197 return this; | 1214 return this; |
| 1198 } | 1215 } |
| 1199 | 1216 |
| 1200 | 1217 |
| 1201 ACCESSORS(Oddball, to_string, String, kToStringOffset) | 1218 ACCESSORS(Oddball, to_string, String, kToStringOffset) |
| 1202 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) | 1219 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) |
| 1203 | 1220 |
| 1204 | 1221 |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 CAST_ACCESSOR(String) | 1691 CAST_ACCESSOR(String) |
| 1675 CAST_ACCESSOR(SeqString) | 1692 CAST_ACCESSOR(SeqString) |
| 1676 CAST_ACCESSOR(SeqAsciiString) | 1693 CAST_ACCESSOR(SeqAsciiString) |
| 1677 CAST_ACCESSOR(SeqTwoByteString) | 1694 CAST_ACCESSOR(SeqTwoByteString) |
| 1678 CAST_ACCESSOR(ConsString) | 1695 CAST_ACCESSOR(ConsString) |
| 1679 CAST_ACCESSOR(ExternalString) | 1696 CAST_ACCESSOR(ExternalString) |
| 1680 CAST_ACCESSOR(ExternalAsciiString) | 1697 CAST_ACCESSOR(ExternalAsciiString) |
| 1681 CAST_ACCESSOR(ExternalTwoByteString) | 1698 CAST_ACCESSOR(ExternalTwoByteString) |
| 1682 CAST_ACCESSOR(JSObject) | 1699 CAST_ACCESSOR(JSObject) |
| 1683 CAST_ACCESSOR(Smi) | 1700 CAST_ACCESSOR(Smi) |
| 1684 CAST_ACCESSOR(Failure) | |
| 1685 CAST_ACCESSOR(HeapObject) | 1701 CAST_ACCESSOR(HeapObject) |
| 1686 CAST_ACCESSOR(HeapNumber) | 1702 CAST_ACCESSOR(HeapNumber) |
| 1687 CAST_ACCESSOR(Oddball) | 1703 CAST_ACCESSOR(Oddball) |
| 1688 CAST_ACCESSOR(JSGlobalPropertyCell) | 1704 CAST_ACCESSOR(JSGlobalPropertyCell) |
| 1689 CAST_ACCESSOR(SharedFunctionInfo) | 1705 CAST_ACCESSOR(SharedFunctionInfo) |
| 1690 CAST_ACCESSOR(Map) | 1706 CAST_ACCESSOR(Map) |
| 1691 CAST_ACCESSOR(JSFunction) | 1707 CAST_ACCESSOR(JSFunction) |
| 1692 CAST_ACCESSOR(GlobalObject) | 1708 CAST_ACCESSOR(GlobalObject) |
| 1693 CAST_ACCESSOR(JSGlobalProxy) | 1709 CAST_ACCESSOR(JSGlobalProxy) |
| 1694 CAST_ACCESSOR(JSGlobalObject) | 1710 CAST_ACCESSOR(JSGlobalObject) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 | 1763 |
| 1748 bool String::Equals(String* other) { | 1764 bool String::Equals(String* other) { |
| 1749 if (other == this) return true; | 1765 if (other == this) return true; |
| 1750 if (StringShape(this).IsSymbol() && StringShape(other).IsSymbol()) { | 1766 if (StringShape(this).IsSymbol() && StringShape(other).IsSymbol()) { |
| 1751 return false; | 1767 return false; |
| 1752 } | 1768 } |
| 1753 return SlowEquals(other); | 1769 return SlowEquals(other); |
| 1754 } | 1770 } |
| 1755 | 1771 |
| 1756 | 1772 |
| 1757 Object* String::TryFlatten(PretenureFlag pretenure) { | 1773 MaybeObject* String::TryFlatten(PretenureFlag pretenure) { |
| 1758 if (!StringShape(this).IsCons()) return this; | 1774 if (!StringShape(this).IsCons()) return this; |
| 1759 ConsString* cons = ConsString::cast(this); | 1775 ConsString* cons = ConsString::cast(this); |
| 1760 if (cons->second()->length() == 0) return cons->first(); | 1776 if (cons->second()->length() == 0) return cons->first(); |
| 1761 return SlowTryFlatten(pretenure); | 1777 return SlowTryFlatten(pretenure); |
| 1762 } | 1778 } |
| 1763 | 1779 |
| 1764 | 1780 |
| 1765 String* String::TryFlattenGetString(PretenureFlag pretenure) { | 1781 String* String::TryFlattenGetString(PretenureFlag pretenure) { |
| 1766 Object* flat = TryFlatten(pretenure); | 1782 MaybeObject* flat = TryFlatten(pretenure); |
| 1767 return flat->IsFailure() ? this : String::cast(flat); | 1783 Object* successfully_flattened; |
| 1784 if (flat->ToObject(&successfully_flattened)) { |
| 1785 return String::cast(successfully_flattened); |
| 1786 } |
| 1787 return this; |
| 1768 } | 1788 } |
| 1769 | 1789 |
| 1770 | 1790 |
| 1771 uint16_t String::Get(int index) { | 1791 uint16_t String::Get(int index) { |
| 1772 ASSERT(index >= 0 && index < length()); | 1792 ASSERT(index >= 0 && index < length()); |
| 1773 switch (StringShape(this).full_representation_tag()) { | 1793 switch (StringShape(this).full_representation_tag()) { |
| 1774 case kSeqStringTag | kAsciiStringTag: | 1794 case kSeqStringTag | kAsciiStringTag: |
| 1775 return SeqAsciiString::cast(this)->SeqAsciiStringGet(index); | 1795 return SeqAsciiString::cast(this)->SeqAsciiStringGet(index); |
| 1776 case kSeqStringTag | kTwoByteStringTag: | 1796 case kSeqStringTag | kTwoByteStringTag: |
| 1777 return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index); | 1797 return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index); |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2468 } | 2488 } |
| 2469 | 2489 |
| 2470 | 2490 |
| 2471 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 2491 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
| 2472 ASSERT(value->IsNull() || value->IsJSObject()); | 2492 ASSERT(value->IsNull() || value->IsJSObject()); |
| 2473 WRITE_FIELD(this, kPrototypeOffset, value); | 2493 WRITE_FIELD(this, kPrototypeOffset, value); |
| 2474 CONDITIONAL_WRITE_BARRIER(this, kPrototypeOffset, mode); | 2494 CONDITIONAL_WRITE_BARRIER(this, kPrototypeOffset, mode); |
| 2475 } | 2495 } |
| 2476 | 2496 |
| 2477 | 2497 |
| 2478 Object* Map::GetFastElementsMap() { | 2498 MaybeObject* Map::GetFastElementsMap() { |
| 2479 if (has_fast_elements()) return this; | 2499 if (has_fast_elements()) return this; |
| 2480 Object* obj = CopyDropTransitions(); | 2500 Object* obj; |
| 2481 if (obj->IsFailure()) return obj; | 2501 { MaybeObject* maybe_obj = CopyDropTransitions(); |
| 2502 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2503 } |
| 2482 Map* new_map = Map::cast(obj); | 2504 Map* new_map = Map::cast(obj); |
| 2483 new_map->set_has_fast_elements(true); | 2505 new_map->set_has_fast_elements(true); |
| 2484 Counters::map_slow_to_fast_elements.Increment(); | 2506 Counters::map_slow_to_fast_elements.Increment(); |
| 2485 return new_map; | 2507 return new_map; |
| 2486 } | 2508 } |
| 2487 | 2509 |
| 2488 | 2510 |
| 2489 Object* Map::GetSlowElementsMap() { | 2511 MaybeObject* Map::GetSlowElementsMap() { |
| 2490 if (!has_fast_elements()) return this; | 2512 if (!has_fast_elements()) return this; |
| 2491 Object* obj = CopyDropTransitions(); | 2513 Object* obj; |
| 2492 if (obj->IsFailure()) return obj; | 2514 { MaybeObject* maybe_obj = CopyDropTransitions(); |
| 2515 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2516 } |
| 2493 Map* new_map = Map::cast(obj); | 2517 Map* new_map = Map::cast(obj); |
| 2494 new_map->set_has_fast_elements(false); | 2518 new_map->set_has_fast_elements(false); |
| 2495 Counters::map_fast_to_slow_elements.Increment(); | 2519 Counters::map_fast_to_slow_elements.Increment(); |
| 2496 return new_map; | 2520 return new_map; |
| 2497 } | 2521 } |
| 2498 | 2522 |
| 2499 | 2523 |
| 2500 ACCESSORS(Map, instance_descriptors, DescriptorArray, | 2524 ACCESSORS(Map, instance_descriptors, DescriptorArray, |
| 2501 kInstanceDescriptorsOffset) | 2525 kInstanceDescriptorsOffset) |
| 2502 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 2526 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3182 } | 3206 } |
| 3183 | 3207 |
| 3184 | 3208 |
| 3185 bool JSObject::AllowsSetElementsLength() { | 3209 bool JSObject::AllowsSetElementsLength() { |
| 3186 bool result = elements()->IsFixedArray(); | 3210 bool result = elements()->IsFixedArray(); |
| 3187 ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements())); | 3211 ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements())); |
| 3188 return result; | 3212 return result; |
| 3189 } | 3213 } |
| 3190 | 3214 |
| 3191 | 3215 |
| 3192 Object* JSObject::EnsureWritableFastElements() { | 3216 MaybeObject* JSObject::EnsureWritableFastElements() { |
| 3193 ASSERT(HasFastElements()); | 3217 ASSERT(HasFastElements()); |
| 3194 FixedArray* elems = FixedArray::cast(elements()); | 3218 FixedArray* elems = FixedArray::cast(elements()); |
| 3195 if (elems->map() != Heap::fixed_cow_array_map()) return elems; | 3219 if (elems->map() != Heap::fixed_cow_array_map()) return elems; |
| 3196 Object* writable_elems = Heap::CopyFixedArrayWithMap(elems, | 3220 Object* writable_elems; |
| 3197 Heap::fixed_array_map()); | 3221 { MaybeObject* maybe_writable_elems = |
| 3198 if (writable_elems->IsFailure()) return writable_elems; | 3222 Heap::CopyFixedArrayWithMap(elems, Heap::fixed_array_map()); |
| 3223 if (!maybe_writable_elems->ToObject(&writable_elems)) { |
| 3224 return maybe_writable_elems; |
| 3225 } |
| 3226 } |
| 3199 set_elements(FixedArray::cast(writable_elems)); | 3227 set_elements(FixedArray::cast(writable_elems)); |
| 3200 Counters::cow_arrays_converted.Increment(); | 3228 Counters::cow_arrays_converted.Increment(); |
| 3201 return writable_elems; | 3229 return writable_elems; |
| 3202 } | 3230 } |
| 3203 | 3231 |
| 3204 | 3232 |
| 3205 StringDictionary* JSObject::property_dictionary() { | 3233 StringDictionary* JSObject::property_dictionary() { |
| 3206 ASSERT(!HasFastProperties()); | 3234 ASSERT(!HasFastProperties()); |
| 3207 return StringDictionary::cast(properties()); | 3235 return StringDictionary::cast(properties()); |
| 3208 } | 3236 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 ASSERT(!IsJSGlobalProxy()); | 3361 ASSERT(!IsJSGlobalProxy()); |
| 3334 return GetPropertyAttributePostInterceptor(this, | 3362 return GetPropertyAttributePostInterceptor(this, |
| 3335 Heap::hidden_symbol(), | 3363 Heap::hidden_symbol(), |
| 3336 false) != ABSENT; | 3364 false) != ABSENT; |
| 3337 } | 3365 } |
| 3338 | 3366 |
| 3339 | 3367 |
| 3340 Object* JSObject::GetHiddenPropertiesObject() { | 3368 Object* JSObject::GetHiddenPropertiesObject() { |
| 3341 ASSERT(!IsJSGlobalProxy()); | 3369 ASSERT(!IsJSGlobalProxy()); |
| 3342 PropertyAttributes attributes; | 3370 PropertyAttributes attributes; |
| 3343 return GetLocalPropertyPostInterceptor(this, | 3371 // You can't install a getter on a property indexed by the hidden symbol, |
| 3344 Heap::hidden_symbol(), | 3372 // so we can be sure that GetLocalPropertyPostInterceptor returns a real |
| 3345 &attributes); | 3373 // object. |
| 3374 Object* result = |
| 3375 GetLocalPropertyPostInterceptor(this, |
| 3376 Heap::hidden_symbol(), |
| 3377 &attributes)->ToObjectUnchecked(); |
| 3378 return result; |
| 3346 } | 3379 } |
| 3347 | 3380 |
| 3348 | 3381 |
| 3349 Object* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) { | 3382 MaybeObject* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) { |
| 3350 ASSERT(!IsJSGlobalProxy()); | 3383 ASSERT(!IsJSGlobalProxy()); |
| 3351 return SetPropertyPostInterceptor(Heap::hidden_symbol(), | 3384 return SetPropertyPostInterceptor(Heap::hidden_symbol(), |
| 3352 hidden_obj, | 3385 hidden_obj, |
| 3353 DONT_ENUM); | 3386 DONT_ENUM); |
| 3354 } | 3387 } |
| 3355 | 3388 |
| 3356 | 3389 |
| 3357 bool JSObject::HasElement(uint32_t index) { | 3390 bool JSObject::HasElement(uint32_t index) { |
| 3358 return HasElementWithReceiver(this, index); | 3391 return HasElementWithReceiver(this, index); |
| 3359 } | 3392 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3446 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); | 3479 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); |
| 3447 } | 3480 } |
| 3448 | 3481 |
| 3449 | 3482 |
| 3450 void JSArray::SetContent(FixedArray* storage) { | 3483 void JSArray::SetContent(FixedArray* storage) { |
| 3451 set_length(Smi::FromInt(storage->length())); | 3484 set_length(Smi::FromInt(storage->length())); |
| 3452 set_elements(storage); | 3485 set_elements(storage); |
| 3453 } | 3486 } |
| 3454 | 3487 |
| 3455 | 3488 |
| 3456 Object* FixedArray::Copy() { | 3489 MaybeObject* FixedArray::Copy() { |
| 3457 if (length() == 0) return this; | 3490 if (length() == 0) return this; |
| 3458 return Heap::CopyFixedArray(this); | 3491 return Heap::CopyFixedArray(this); |
| 3459 } | 3492 } |
| 3460 | 3493 |
| 3461 | 3494 |
| 3462 int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { | 3495 int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { |
| 3463 return map->instance_size(); | 3496 return map->instance_size(); |
| 3464 } | 3497 } |
| 3465 | 3498 |
| 3466 | 3499 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3544 #undef WRITE_INT_FIELD | 3577 #undef WRITE_INT_FIELD |
| 3545 #undef READ_SHORT_FIELD | 3578 #undef READ_SHORT_FIELD |
| 3546 #undef WRITE_SHORT_FIELD | 3579 #undef WRITE_SHORT_FIELD |
| 3547 #undef READ_BYTE_FIELD | 3580 #undef READ_BYTE_FIELD |
| 3548 #undef WRITE_BYTE_FIELD | 3581 #undef WRITE_BYTE_FIELD |
| 3549 | 3582 |
| 3550 | 3583 |
| 3551 } } // namespace v8::internal | 3584 } } // namespace v8::internal |
| 3552 | 3585 |
| 3553 #endif // V8_OBJECTS_INL_H_ | 3586 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |