OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 return Smi::FromInt(value_); | 60 return Smi::FromInt(value_); |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 PropertyDetails PropertyDetails::AsDeleted() { | 64 PropertyDetails PropertyDetails::AsDeleted() { |
65 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); | 65 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); |
66 return PropertyDetails(smi); | 66 return PropertyDetails(smi); |
67 } | 67 } |
68 | 68 |
69 | 69 |
| 70 #define TYPE_CHECKER(type, instancetype) \ |
| 71 bool Object::Is##type() { \ |
| 72 return Object::IsHeapObject() && \ |
| 73 HeapObject::cast(this)->map()->instance_type() == instancetype; \ |
| 74 } |
| 75 |
| 76 |
70 #define CAST_ACCESSOR(type) \ | 77 #define CAST_ACCESSOR(type) \ |
71 type* type::cast(Object* object) { \ | 78 type* type::cast(Object* object) { \ |
72 ASSERT(object->Is##type()); \ | 79 ASSERT(object->Is##type()); \ |
73 return reinterpret_cast<type*>(object); \ | 80 return reinterpret_cast<type*>(object); \ |
74 } | 81 } |
75 | 82 |
76 | 83 |
77 #define INT_ACCESSORS(holder, name, offset) \ | 84 #define INT_ACCESSORS(holder, name, offset) \ |
78 int holder::name() { return READ_INT_FIELD(this, offset); } \ | 85 int holder::name() { return READ_INT_FIELD(this, offset); } \ |
79 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } | 86 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return Internals::HasHeapObjectTag(this); | 147 return Internals::HasHeapObjectTag(this); |
141 } | 148 } |
142 | 149 |
143 | 150 |
144 bool Object::NonFailureIsHeapObject() { | 151 bool Object::NonFailureIsHeapObject() { |
145 ASSERT(!this->IsFailure()); | 152 ASSERT(!this->IsFailure()); |
146 return (reinterpret_cast<intptr_t>(this) & kSmiTagMask) != 0; | 153 return (reinterpret_cast<intptr_t>(this) & kSmiTagMask) != 0; |
147 } | 154 } |
148 | 155 |
149 | 156 |
150 bool Object::IsHeapNumber() { | 157 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) |
151 return Object::IsHeapObject() | |
152 && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE; | |
153 } | |
154 | 158 |
155 | 159 |
156 bool Object::IsString() { | 160 bool Object::IsString() { |
157 return Object::IsHeapObject() | 161 return Object::IsHeapObject() |
158 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; | 162 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; |
159 } | 163 } |
160 | 164 |
161 | 165 |
162 bool Object::IsSpecObject() { | 166 bool Object::IsSpecObject() { |
163 return Object::IsHeapObject() | 167 return Object::IsHeapObject() |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 return static_cast<const uc16*>(start_)[index]; | 400 return static_cast<const uc16*>(start_)[index]; |
397 } | 401 } |
398 } | 402 } |
399 | 403 |
400 | 404 |
401 bool Object::IsNumber() { | 405 bool Object::IsNumber() { |
402 return IsSmi() || IsHeapNumber(); | 406 return IsSmi() || IsHeapNumber(); |
403 } | 407 } |
404 | 408 |
405 | 409 |
406 bool Object::IsByteArray() { | 410 TYPE_CHECKER(ByteArray, BYTE_ARRAY_TYPE) |
407 return Object::IsHeapObject() | 411 TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE) |
408 && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE; | |
409 } | |
410 | |
411 | |
412 bool Object::IsFreeSpace() { | |
413 return Object::IsHeapObject() | |
414 && HeapObject::cast(this)->map()->instance_type() == FREE_SPACE_TYPE; | |
415 } | |
416 | 412 |
417 | 413 |
418 bool Object::IsFiller() { | 414 bool Object::IsFiller() { |
419 if (!Object::IsHeapObject()) return false; | 415 if (!Object::IsHeapObject()) return false; |
420 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type(); | 416 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type(); |
421 return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE; | 417 return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE; |
422 } | 418 } |
423 | 419 |
424 | 420 |
425 bool Object::IsExternalPixelArray() { | 421 TYPE_CHECKER(ExternalPixelArray, EXTERNAL_PIXEL_ARRAY_TYPE) |
426 return Object::IsHeapObject() && | |
427 HeapObject::cast(this)->map()->instance_type() == | |
428 EXTERNAL_PIXEL_ARRAY_TYPE; | |
429 } | |
430 | 422 |
431 | 423 |
432 bool Object::IsExternalArray() { | 424 bool Object::IsExternalArray() { |
433 if (!Object::IsHeapObject()) | 425 if (!Object::IsHeapObject()) |
434 return false; | 426 return false; |
435 InstanceType instance_type = | 427 InstanceType instance_type = |
436 HeapObject::cast(this)->map()->instance_type(); | 428 HeapObject::cast(this)->map()->instance_type(); |
437 return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE && | 429 return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE && |
438 instance_type <= LAST_EXTERNAL_ARRAY_TYPE); | 430 instance_type <= LAST_EXTERNAL_ARRAY_TYPE); |
439 } | 431 } |
440 | 432 |
441 | 433 |
442 bool Object::IsExternalByteArray() { | 434 TYPE_CHECKER(ExternalByteArray, EXTERNAL_BYTE_ARRAY_TYPE) |
443 return Object::IsHeapObject() && | 435 TYPE_CHECKER(ExternalUnsignedByteArray, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) |
444 HeapObject::cast(this)->map()->instance_type() == | 436 TYPE_CHECKER(ExternalShortArray, EXTERNAL_SHORT_ARRAY_TYPE) |
445 EXTERNAL_BYTE_ARRAY_TYPE; | 437 TYPE_CHECKER(ExternalUnsignedShortArray, EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) |
446 } | 438 TYPE_CHECKER(ExternalIntArray, EXTERNAL_INT_ARRAY_TYPE) |
447 | 439 TYPE_CHECKER(ExternalUnsignedIntArray, EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) |
448 | 440 TYPE_CHECKER(ExternalFloatArray, EXTERNAL_FLOAT_ARRAY_TYPE) |
449 bool Object::IsExternalUnsignedByteArray() { | 441 TYPE_CHECKER(ExternalDoubleArray, EXTERNAL_DOUBLE_ARRAY_TYPE) |
450 return Object::IsHeapObject() && | |
451 HeapObject::cast(this)->map()->instance_type() == | |
452 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE; | |
453 } | |
454 | |
455 | |
456 bool Object::IsExternalShortArray() { | |
457 return Object::IsHeapObject() && | |
458 HeapObject::cast(this)->map()->instance_type() == | |
459 EXTERNAL_SHORT_ARRAY_TYPE; | |
460 } | |
461 | |
462 | |
463 bool Object::IsExternalUnsignedShortArray() { | |
464 return Object::IsHeapObject() && | |
465 HeapObject::cast(this)->map()->instance_type() == | |
466 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE; | |
467 } | |
468 | |
469 | |
470 bool Object::IsExternalIntArray() { | |
471 return Object::IsHeapObject() && | |
472 HeapObject::cast(this)->map()->instance_type() == | |
473 EXTERNAL_INT_ARRAY_TYPE; | |
474 } | |
475 | |
476 | |
477 bool Object::IsExternalUnsignedIntArray() { | |
478 return Object::IsHeapObject() && | |
479 HeapObject::cast(this)->map()->instance_type() == | |
480 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE; | |
481 } | |
482 | |
483 | |
484 bool Object::IsExternalFloatArray() { | |
485 return Object::IsHeapObject() && | |
486 HeapObject::cast(this)->map()->instance_type() == | |
487 EXTERNAL_FLOAT_ARRAY_TYPE; | |
488 } | |
489 | |
490 | |
491 bool Object::IsExternalDoubleArray() { | |
492 return Object::IsHeapObject() && | |
493 HeapObject::cast(this)->map()->instance_type() == | |
494 EXTERNAL_DOUBLE_ARRAY_TYPE; | |
495 } | |
496 | 442 |
497 | 443 |
498 bool MaybeObject::IsFailure() { | 444 bool MaybeObject::IsFailure() { |
499 return HAS_FAILURE_TAG(this); | 445 return HAS_FAILURE_TAG(this); |
500 } | 446 } |
501 | 447 |
502 | 448 |
503 bool MaybeObject::IsRetryAfterGC() { | 449 bool MaybeObject::IsRetryAfterGC() { |
504 return HAS_FAILURE_TAG(this) | 450 return HAS_FAILURE_TAG(this) |
505 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; | 451 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } | 488 } |
543 | 489 |
544 | 490 |
545 bool Object::IsJSProxy() { | 491 bool Object::IsJSProxy() { |
546 if (!Object::IsHeapObject()) return false; | 492 if (!Object::IsHeapObject()) return false; |
547 InstanceType type = HeapObject::cast(this)->map()->instance_type(); | 493 InstanceType type = HeapObject::cast(this)->map()->instance_type(); |
548 return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE; | 494 return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE; |
549 } | 495 } |
550 | 496 |
551 | 497 |
552 bool Object::IsJSFunctionProxy() { | 498 TYPE_CHECKER(JSFunctionProxy, JS_FUNCTION_PROXY_TYPE) |
553 return Object::IsHeapObject() && | 499 TYPE_CHECKER(JSSet, JS_SET_TYPE) |
554 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE; | 500 TYPE_CHECKER(JSMap, JS_MAP_TYPE) |
555 } | 501 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) |
556 | 502 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE) |
557 | 503 TYPE_CHECKER(Map, MAP_TYPE) |
558 bool Object::IsJSWeakMap() { | 504 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE) |
559 return Object::IsJSObject() && | 505 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE) |
560 HeapObject::cast(this)->map()->instance_type() == JS_WEAK_MAP_TYPE; | |
561 } | |
562 | |
563 | |
564 bool Object::IsJSContextExtensionObject() { | |
565 return IsHeapObject() | |
566 && (HeapObject::cast(this)->map()->instance_type() == | |
567 JS_CONTEXT_EXTENSION_OBJECT_TYPE); | |
568 } | |
569 | |
570 | |
571 bool Object::IsMap() { | |
572 return Object::IsHeapObject() | |
573 && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE; | |
574 } | |
575 | |
576 | |
577 bool Object::IsFixedArray() { | |
578 return Object::IsHeapObject() | |
579 && HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE; | |
580 } | |
581 | |
582 | |
583 bool Object::IsFixedDoubleArray() { | |
584 return Object::IsHeapObject() | |
585 && HeapObject::cast(this)->map()->instance_type() == | |
586 FIXED_DOUBLE_ARRAY_TYPE; | |
587 } | |
588 | 506 |
589 | 507 |
590 bool Object::IsDescriptorArray() { | 508 bool Object::IsDescriptorArray() { |
591 return IsFixedArray(); | 509 return IsFixedArray(); |
592 } | 510 } |
593 | 511 |
594 | 512 |
595 bool Object::IsDeoptimizationInputData() { | 513 bool Object::IsDeoptimizationInputData() { |
596 // Must be a fixed array. | 514 // Must be a fixed array. |
597 if (!IsFixedArray()) return false; | 515 if (!IsFixedArray()) return false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 } | 558 } |
641 | 559 |
642 | 560 |
643 bool Object::IsSerializedScopeInfo() { | 561 bool Object::IsSerializedScopeInfo() { |
644 return Object::IsHeapObject() && | 562 return Object::IsHeapObject() && |
645 HeapObject::cast(this)->map() == | 563 HeapObject::cast(this)->map() == |
646 HeapObject::cast(this)->GetHeap()->serialized_scope_info_map(); | 564 HeapObject::cast(this)->GetHeap()->serialized_scope_info_map(); |
647 } | 565 } |
648 | 566 |
649 | 567 |
650 bool Object::IsJSFunction() { | 568 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) |
651 return Object::IsHeapObject() | |
652 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE; | |
653 } | |
654 | 569 |
655 | 570 |
656 template <> inline bool Is<JSFunction>(Object* obj) { | 571 template <> inline bool Is<JSFunction>(Object* obj) { |
657 return obj->IsJSFunction(); | 572 return obj->IsJSFunction(); |
658 } | 573 } |
659 | 574 |
660 | 575 |
661 bool Object::IsCode() { | 576 TYPE_CHECKER(Code, CODE_TYPE) |
662 return Object::IsHeapObject() | 577 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
663 && HeapObject::cast(this)->map()->instance_type() == CODE_TYPE; | 578 TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE) |
664 } | 579 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
665 | 580 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
666 | 581 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
667 bool Object::IsOddball() { | |
668 return Object::IsHeapObject() | |
669 && HeapObject::cast(this)->map()->instance_type() == ODDBALL_TYPE; | |
670 } | |
671 | |
672 | |
673 bool Object::IsJSGlobalPropertyCell() { | |
674 return Object::IsHeapObject() | |
675 && HeapObject::cast(this)->map()->instance_type() | |
676 == JS_GLOBAL_PROPERTY_CELL_TYPE; | |
677 } | |
678 | |
679 | |
680 bool Object::IsSharedFunctionInfo() { | |
681 return Object::IsHeapObject() && | |
682 (HeapObject::cast(this)->map()->instance_type() == | |
683 SHARED_FUNCTION_INFO_TYPE); | |
684 } | |
685 | |
686 | |
687 bool Object::IsJSValue() { | |
688 return Object::IsHeapObject() | |
689 && HeapObject::cast(this)->map()->instance_type() == JS_VALUE_TYPE; | |
690 } | |
691 | |
692 | |
693 bool Object::IsJSMessageObject() { | |
694 return Object::IsHeapObject() | |
695 && (HeapObject::cast(this)->map()->instance_type() == | |
696 JS_MESSAGE_OBJECT_TYPE); | |
697 } | |
698 | 582 |
699 | 583 |
700 bool Object::IsStringWrapper() { | 584 bool Object::IsStringWrapper() { |
701 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 585 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
702 } | 586 } |
703 | 587 |
704 | 588 |
705 bool Object::IsForeign() { | 589 TYPE_CHECKER(Foreign, FOREIGN_TYPE) |
706 return Object::IsHeapObject() | |
707 && HeapObject::cast(this)->map()->instance_type() == FOREIGN_TYPE; | |
708 } | |
709 | 590 |
710 | 591 |
711 bool Object::IsBoolean() { | 592 bool Object::IsBoolean() { |
712 return IsOddball() && | 593 return IsOddball() && |
713 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); | 594 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); |
714 } | 595 } |
715 | 596 |
716 | 597 |
717 bool Object::IsJSArray() { | 598 TYPE_CHECKER(JSArray, JS_ARRAY_TYPE) |
718 return Object::IsHeapObject() | 599 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE) |
719 && HeapObject::cast(this)->map()->instance_type() == JS_ARRAY_TYPE; | |
720 } | |
721 | |
722 | |
723 bool Object::IsJSRegExp() { | |
724 return Object::IsHeapObject() | |
725 && HeapObject::cast(this)->map()->instance_type() == JS_REGEXP_TYPE; | |
726 } | |
727 | 600 |
728 | 601 |
729 template <> inline bool Is<JSArray>(Object* obj) { | 602 template <> inline bool Is<JSArray>(Object* obj) { |
730 return obj->IsJSArray(); | 603 return obj->IsJSArray(); |
731 } | 604 } |
732 | 605 |
733 | 606 |
734 bool Object::IsHashTable() { | 607 bool Object::IsHashTable() { |
735 return Object::IsHeapObject() && | 608 return Object::IsHeapObject() && |
736 HeapObject::cast(this)->map() == | 609 HeapObject::cast(this)->map() == |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 | 687 |
815 bool Object::IsGlobalObject() { | 688 bool Object::IsGlobalObject() { |
816 if (!IsHeapObject()) return false; | 689 if (!IsHeapObject()) return false; |
817 | 690 |
818 InstanceType type = HeapObject::cast(this)->map()->instance_type(); | 691 InstanceType type = HeapObject::cast(this)->map()->instance_type(); |
819 return type == JS_GLOBAL_OBJECT_TYPE || | 692 return type == JS_GLOBAL_OBJECT_TYPE || |
820 type == JS_BUILTINS_OBJECT_TYPE; | 693 type == JS_BUILTINS_OBJECT_TYPE; |
821 } | 694 } |
822 | 695 |
823 | 696 |
824 bool Object::IsJSGlobalObject() { | 697 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) |
825 return IsHeapObject() && | 698 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE) |
826 (HeapObject::cast(this)->map()->instance_type() == | |
827 JS_GLOBAL_OBJECT_TYPE); | |
828 } | |
829 | |
830 | |
831 bool Object::IsJSBuiltinsObject() { | |
832 return IsHeapObject() && | |
833 (HeapObject::cast(this)->map()->instance_type() == | |
834 JS_BUILTINS_OBJECT_TYPE); | |
835 } | |
836 | 699 |
837 | 700 |
838 bool Object::IsUndetectableObject() { | 701 bool Object::IsUndetectableObject() { |
839 return IsHeapObject() | 702 return IsHeapObject() |
840 && HeapObject::cast(this)->map()->is_undetectable(); | 703 && HeapObject::cast(this)->map()->is_undetectable(); |
841 } | 704 } |
842 | 705 |
843 | 706 |
844 bool Object::IsAccessCheckNeeded() { | 707 bool Object::IsAccessCheckNeeded() { |
845 return IsHeapObject() | 708 return IsHeapObject() |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 CAST_ACCESSOR(JSFunction) | 2001 CAST_ACCESSOR(JSFunction) |
2139 CAST_ACCESSOR(GlobalObject) | 2002 CAST_ACCESSOR(GlobalObject) |
2140 CAST_ACCESSOR(JSGlobalProxy) | 2003 CAST_ACCESSOR(JSGlobalProxy) |
2141 CAST_ACCESSOR(JSGlobalObject) | 2004 CAST_ACCESSOR(JSGlobalObject) |
2142 CAST_ACCESSOR(JSBuiltinsObject) | 2005 CAST_ACCESSOR(JSBuiltinsObject) |
2143 CAST_ACCESSOR(Code) | 2006 CAST_ACCESSOR(Code) |
2144 CAST_ACCESSOR(JSArray) | 2007 CAST_ACCESSOR(JSArray) |
2145 CAST_ACCESSOR(JSRegExp) | 2008 CAST_ACCESSOR(JSRegExp) |
2146 CAST_ACCESSOR(JSProxy) | 2009 CAST_ACCESSOR(JSProxy) |
2147 CAST_ACCESSOR(JSFunctionProxy) | 2010 CAST_ACCESSOR(JSFunctionProxy) |
| 2011 CAST_ACCESSOR(JSSet) |
| 2012 CAST_ACCESSOR(JSMap) |
2148 CAST_ACCESSOR(JSWeakMap) | 2013 CAST_ACCESSOR(JSWeakMap) |
2149 CAST_ACCESSOR(Foreign) | 2014 CAST_ACCESSOR(Foreign) |
2150 CAST_ACCESSOR(ByteArray) | 2015 CAST_ACCESSOR(ByteArray) |
2151 CAST_ACCESSOR(FreeSpace) | 2016 CAST_ACCESSOR(FreeSpace) |
2152 CAST_ACCESSOR(ExternalArray) | 2017 CAST_ACCESSOR(ExternalArray) |
2153 CAST_ACCESSOR(ExternalByteArray) | 2018 CAST_ACCESSOR(ExternalByteArray) |
2154 CAST_ACCESSOR(ExternalUnsignedByteArray) | 2019 CAST_ACCESSOR(ExternalUnsignedByteArray) |
2155 CAST_ACCESSOR(ExternalShortArray) | 2020 CAST_ACCESSOR(ExternalShortArray) |
2156 CAST_ACCESSOR(ExternalUnsignedShortArray) | 2021 CAST_ACCESSOR(ExternalUnsignedShortArray) |
2157 CAST_ACCESSOR(ExternalIntArray) | 2022 CAST_ACCESSOR(ExternalIntArray) |
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3910 | 3775 |
3911 | 3776 |
3912 void JSProxy::InitializeBody(int object_size, Object* value) { | 3777 void JSProxy::InitializeBody(int object_size, Object* value) { |
3913 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); | 3778 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); |
3914 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 3779 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
3915 WRITE_FIELD(this, offset, value); | 3780 WRITE_FIELD(this, offset, value); |
3916 } | 3781 } |
3917 } | 3782 } |
3918 | 3783 |
3919 | 3784 |
| 3785 ACCESSORS(JSSet, table, Object, kTableOffset) |
| 3786 ACCESSORS(JSMap, table, Object, kTableOffset) |
3920 ACCESSORS(JSWeakMap, table, Object, kTableOffset) | 3787 ACCESSORS(JSWeakMap, table, Object, kTableOffset) |
3921 ACCESSORS(JSWeakMap, next, Object, kNextOffset) | 3788 ACCESSORS(JSWeakMap, next, Object, kNextOffset) |
3922 | 3789 |
3923 | 3790 |
3924 ObjectHashTable* JSWeakMap::unchecked_table() { | 3791 ObjectHashTable* JSWeakMap::unchecked_table() { |
3925 return reinterpret_cast<ObjectHashTable*>(READ_FIELD(this, kTableOffset)); | 3792 return reinterpret_cast<ObjectHashTable*>(READ_FIELD(this, kTableOffset)); |
3926 } | 3793 } |
3927 | 3794 |
3928 | 3795 |
3929 Address Foreign::address() { | 3796 Address Foreign::address() { |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4375 if (IsJSGlobalProxy()) { | 4242 if (IsJSGlobalProxy()) { |
4376 Object* proto = GetPrototype(); | 4243 Object* proto = GetPrototype(); |
4377 if (proto->IsNull()) return GetHeap()->undefined_value(); | 4244 if (proto->IsNull()) return GetHeap()->undefined_value(); |
4378 ASSERT(proto->IsJSGlobalObject()); | 4245 ASSERT(proto->IsJSGlobalObject()); |
4379 return proto; | 4246 return proto; |
4380 } | 4247 } |
4381 return this; | 4248 return this; |
4382 } | 4249 } |
4383 | 4250 |
4384 | 4251 |
| 4252 bool JSReceiver::HasIdentityHash() { |
| 4253 return !GetIdentityHash(OMIT_CREATION)->ToObjectChecked()->IsUndefined(); |
| 4254 } |
| 4255 |
| 4256 |
4385 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { | 4257 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { |
4386 return IsJSProxy() | 4258 return IsJSProxy() |
4387 ? JSProxy::cast(this)->GetIdentityHash(flag) | 4259 ? JSProxy::cast(this)->GetIdentityHash(flag) |
4388 : JSObject::cast(this)->GetIdentityHash(flag); | 4260 : JSObject::cast(this)->GetIdentityHash(flag); |
4389 } | 4261 } |
4390 | 4262 |
4391 | 4263 |
4392 bool JSReceiver::HasElement(uint32_t index) { | 4264 bool JSReceiver::HasElement(uint32_t index) { |
4393 if (IsJSProxy()) { | 4265 if (IsJSProxy()) { |
4394 return JSProxy::cast(this)->HasElementWithHandler(index); | 4266 return JSProxy::cast(this)->HasElementWithHandler(index); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4498 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { | 4370 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { |
4499 return String::cast(other)->Hash(); | 4371 return String::cast(other)->Hash(); |
4500 } | 4372 } |
4501 | 4373 |
4502 | 4374 |
4503 MaybeObject* StringDictionaryShape::AsObject(String* key) { | 4375 MaybeObject* StringDictionaryShape::AsObject(String* key) { |
4504 return key; | 4376 return key; |
4505 } | 4377 } |
4506 | 4378 |
4507 | 4379 |
4508 bool ObjectHashTableShape::IsMatch(JSReceiver* key, Object* other) { | 4380 template <int entrysize> |
4509 return key == JSReceiver::cast(other); | 4381 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { |
| 4382 return key->SameValue(other); |
4510 } | 4383 } |
4511 | 4384 |
4512 | 4385 |
4513 uint32_t ObjectHashTableShape::Hash(JSReceiver* key) { | 4386 template <int entrysize> |
4514 MaybeObject* maybe_hash = key->GetIdentityHash(OMIT_CREATION); | 4387 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { |
4515 ASSERT(!maybe_hash->IsFailure()); | 4388 ASSERT(!key->IsUndefined() && !key->IsNull()); |
4516 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); | 4389 return key->GetHash(); |
4517 } | 4390 } |
4518 | 4391 |
4519 | 4392 |
4520 uint32_t ObjectHashTableShape::HashForObject(JSReceiver* key, Object* other) { | 4393 template <int entrysize> |
4521 MaybeObject* maybe_hash = | 4394 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, |
4522 JSReceiver::cast(other)->GetIdentityHash(OMIT_CREATION); | 4395 Object* other) { |
4523 ASSERT(!maybe_hash->IsFailure()); | 4396 ASSERT(!other->IsUndefined() && !other->IsNull()); |
4524 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); | 4397 return other->GetHash(); |
4525 } | 4398 } |
4526 | 4399 |
4527 | 4400 |
4528 MaybeObject* ObjectHashTableShape::AsObject(JSReceiver* key) { | 4401 template <int entrysize> |
| 4402 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Object* key) { |
4529 return key; | 4403 return key; |
4530 } | 4404 } |
4531 | 4405 |
4532 | 4406 |
4533 void ObjectHashTable::RemoveEntry(int entry) { | 4407 void ObjectHashTable::RemoveEntry(int entry) { |
4534 RemoveEntry(entry, GetHeap()); | 4408 RemoveEntry(entry, GetHeap()); |
4535 } | 4409 } |
4536 | 4410 |
4537 | 4411 |
4538 void Map::ClearCodeCache(Heap* heap) { | 4412 void Map::ClearCodeCache(Heap* heap) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4689 #undef WRITE_INT_FIELD | 4563 #undef WRITE_INT_FIELD |
4690 #undef READ_SHORT_FIELD | 4564 #undef READ_SHORT_FIELD |
4691 #undef WRITE_SHORT_FIELD | 4565 #undef WRITE_SHORT_FIELD |
4692 #undef READ_BYTE_FIELD | 4566 #undef READ_BYTE_FIELD |
4693 #undef WRITE_BYTE_FIELD | 4567 #undef WRITE_BYTE_FIELD |
4694 | 4568 |
4695 | 4569 |
4696 } } // namespace v8::internal | 4570 } } // namespace v8::internal |
4697 | 4571 |
4698 #endif // V8_OBJECTS_INL_H_ | 4572 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |