| 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 return AllocationSite::GetMode(GetElementsKind()) == | 1325 return AllocationSite::GetMode(GetElementsKind()) == |
| 1326 TRACK_ALLOCATION_SITE; | 1326 TRACK_ALLOCATION_SITE; |
| 1327 } | 1327 } |
| 1328 return false; | 1328 return false; |
| 1329 } | 1329 } |
| 1330 | 1330 |
| 1331 | 1331 |
| 1332 void AllocationSite::Initialize() { | 1332 void AllocationSite::Initialize() { |
| 1333 set_transition_info(Smi::FromInt(0)); |
| 1333 SetElementsKind(GetInitialFastElementsKind()); | 1334 SetElementsKind(GetInitialFastElementsKind()); |
| 1334 set_nested_site(Smi::FromInt(0)); | 1335 set_nested_site(Smi::FromInt(0)); |
| 1335 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), | 1336 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), |
| 1336 SKIP_WRITE_BARRIER); | 1337 SKIP_WRITE_BARRIER); |
| 1337 } | 1338 } |
| 1338 | 1339 |
| 1339 | 1340 |
| 1340 // Heuristic: We only need to create allocation site info if the boilerplate | 1341 // Heuristic: We only need to create allocation site info if the boilerplate |
| 1341 // elements kind is the initial elements kind. | 1342 // elements kind is the initial elements kind. |
| 1342 AllocationSiteMode AllocationSite::GetMode( | 1343 AllocationSiteMode AllocationSite::GetMode( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1360 | 1361 |
| 1361 return DONT_TRACK_ALLOCATION_SITE; | 1362 return DONT_TRACK_ALLOCATION_SITE; |
| 1362 } | 1363 } |
| 1363 | 1364 |
| 1364 | 1365 |
| 1365 inline bool AllocationSite::CanTrack(InstanceType type) { | 1366 inline bool AllocationSite::CanTrack(InstanceType type) { |
| 1366 return type == JS_ARRAY_TYPE; | 1367 return type == JS_ARRAY_TYPE; |
| 1367 } | 1368 } |
| 1368 | 1369 |
| 1369 | 1370 |
| 1371 inline DependentCode::DependencyGroup AllocationSite::ToDependencyGroup( |
| 1372 Reason reason) { |
| 1373 switch (reason) { |
| 1374 case TENURING: |
| 1375 return DependentCode::kAllocationSiteTenuringChangedGroup; |
| 1376 break; |
| 1377 case TRANSITIONS: |
| 1378 return DependentCode::kAllocationSiteTransitionChangedGroup; |
| 1379 break; |
| 1380 } |
| 1381 UNREACHABLE(); |
| 1382 return DependentCode::kAllocationSiteTransitionChangedGroup; |
| 1383 } |
| 1384 |
| 1385 |
| 1370 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { | 1386 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { |
| 1371 object->ValidateElements(); | 1387 object->ValidateElements(); |
| 1372 ElementsKind elements_kind = object->map()->elements_kind(); | 1388 ElementsKind elements_kind = object->map()->elements_kind(); |
| 1373 if (!IsFastObjectElementsKind(elements_kind)) { | 1389 if (!IsFastObjectElementsKind(elements_kind)) { |
| 1374 if (IsFastHoleyElementsKind(elements_kind)) { | 1390 if (IsFastHoleyElementsKind(elements_kind)) { |
| 1375 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); | 1391 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); |
| 1376 } else { | 1392 } else { |
| 1377 TransitionElementsKind(object, FAST_ELEMENTS); | 1393 TransitionElementsKind(object, FAST_ELEMENTS); |
| 1378 } | 1394 } |
| 1379 } | 1395 } |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 if (other == this) return true; | 2701 if (other == this) return true; |
| 2686 if ((this->IsInternalizedString() && other->IsInternalizedString()) || | 2702 if ((this->IsInternalizedString() && other->IsInternalizedString()) || |
| 2687 this->IsSymbol() || other->IsSymbol()) { | 2703 this->IsSymbol() || other->IsSymbol()) { |
| 2688 return false; | 2704 return false; |
| 2689 } | 2705 } |
| 2690 return String::cast(this)->SlowEquals(String::cast(other)); | 2706 return String::cast(this)->SlowEquals(String::cast(other)); |
| 2691 } | 2707 } |
| 2692 | 2708 |
| 2693 | 2709 |
| 2694 ACCESSORS(Symbol, name, Object, kNameOffset) | 2710 ACCESSORS(Symbol, name, Object, kNameOffset) |
| 2711 ACCESSORS(Symbol, flags, Smi, kFlagsOffset) |
| 2712 BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit) |
| 2695 | 2713 |
| 2696 | 2714 |
| 2697 bool String::Equals(String* other) { | 2715 bool String::Equals(String* other) { |
| 2698 if (other == this) return true; | 2716 if (other == this) return true; |
| 2699 if (this->IsInternalizedString() && other->IsInternalizedString()) { | 2717 if (this->IsInternalizedString() && other->IsInternalizedString()) { |
| 2700 return false; | 2718 return false; |
| 2701 } | 2719 } |
| 2702 return SlowEquals(other); | 2720 return SlowEquals(other); |
| 2703 } | 2721 } |
| 2704 | 2722 |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3642 void Map::set_owns_descriptors(bool is_shared) { | 3660 void Map::set_owns_descriptors(bool is_shared) { |
| 3643 set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared)); | 3661 set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared)); |
| 3644 } | 3662 } |
| 3645 | 3663 |
| 3646 | 3664 |
| 3647 bool Map::owns_descriptors() { | 3665 bool Map::owns_descriptors() { |
| 3648 return OwnsDescriptors::decode(bit_field3()); | 3666 return OwnsDescriptors::decode(bit_field3()); |
| 3649 } | 3667 } |
| 3650 | 3668 |
| 3651 | 3669 |
| 3652 void Map::set_is_observed(bool is_observed) { | 3670 void Map::set_has_instance_call_handler() { |
| 3653 ASSERT(instance_type() < FIRST_JS_OBJECT_TYPE || | 3671 set_bit_field3(HasInstanceCallHandler::update(bit_field3(), true)); |
| 3654 instance_type() > LAST_JS_OBJECT_TYPE || | |
| 3655 has_slow_elements_kind() || has_external_array_elements()); | |
| 3656 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); | |
| 3657 } | 3672 } |
| 3658 | 3673 |
| 3659 | 3674 |
| 3660 bool Map::is_observed() { | 3675 bool Map::has_instance_call_handler() { |
| 3661 return IsObserved::decode(bit_field3()); | 3676 return HasInstanceCallHandler::decode(bit_field3()); |
| 3662 } | 3677 } |
| 3663 | 3678 |
| 3664 | 3679 |
| 3665 void Map::deprecate() { | 3680 void Map::deprecate() { |
| 3666 set_bit_field3(Deprecated::update(bit_field3(), true)); | 3681 set_bit_field3(Deprecated::update(bit_field3(), true)); |
| 3667 } | 3682 } |
| 3668 | 3683 |
| 3669 | 3684 |
| 3670 bool Map::is_deprecated() { | 3685 bool Map::is_deprecated() { |
| 3671 if (!FLAG_track_fields) return false; | 3686 if (!FLAG_track_fields) return false; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3879 | 3894 |
| 3880 int Code::major_key() { | 3895 int Code::major_key() { |
| 3881 ASSERT(kind() == STUB || | 3896 ASSERT(kind() == STUB || |
| 3882 kind() == HANDLER || | 3897 kind() == HANDLER || |
| 3883 kind() == BINARY_OP_IC || | 3898 kind() == BINARY_OP_IC || |
| 3884 kind() == COMPARE_IC || | 3899 kind() == COMPARE_IC || |
| 3885 kind() == COMPARE_NIL_IC || | 3900 kind() == COMPARE_NIL_IC || |
| 3886 kind() == STORE_IC || | 3901 kind() == STORE_IC || |
| 3887 kind() == LOAD_IC || | 3902 kind() == LOAD_IC || |
| 3888 kind() == KEYED_LOAD_IC || | 3903 kind() == KEYED_LOAD_IC || |
| 3904 kind() == KEYED_CALL_IC || |
| 3889 kind() == TO_BOOLEAN_IC); | 3905 kind() == TO_BOOLEAN_IC); |
| 3890 return StubMajorKeyField::decode( | 3906 return StubMajorKeyField::decode( |
| 3891 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 3907 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); |
| 3892 } | 3908 } |
| 3893 | 3909 |
| 3894 | 3910 |
| 3895 void Code::set_major_key(int major) { | 3911 void Code::set_major_key(int major) { |
| 3896 ASSERT(kind() == STUB || | 3912 ASSERT(kind() == STUB || |
| 3897 kind() == HANDLER || | 3913 kind() == HANDLER || |
| 3898 kind() == BINARY_OP_IC || | 3914 kind() == BINARY_OP_IC || |
| 3899 kind() == COMPARE_IC || | 3915 kind() == COMPARE_IC || |
| 3900 kind() == COMPARE_NIL_IC || | 3916 kind() == COMPARE_NIL_IC || |
| 3901 kind() == LOAD_IC || | 3917 kind() == LOAD_IC || |
| 3902 kind() == KEYED_LOAD_IC || | 3918 kind() == KEYED_LOAD_IC || |
| 3903 kind() == STORE_IC || | 3919 kind() == STORE_IC || |
| 3904 kind() == KEYED_STORE_IC || | 3920 kind() == KEYED_STORE_IC || |
| 3921 kind() == KEYED_CALL_IC || |
| 3905 kind() == TO_BOOLEAN_IC); | 3922 kind() == TO_BOOLEAN_IC); |
| 3906 ASSERT(0 <= major && major < 256); | 3923 ASSERT(0 <= major && major < 256); |
| 3907 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 3924 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| 3908 int updated = StubMajorKeyField::update(previous, major); | 3925 int updated = StubMajorKeyField::update(previous, major); |
| 3909 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 3926 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
| 3910 } | 3927 } |
| 3911 | 3928 |
| 3912 | 3929 |
| 3913 bool Code::is_pregenerated() { | 3930 bool Code::is_pregenerated() { |
| 3914 return (kind() == STUB && IsPregeneratedField::decode(flags())); | 3931 return (kind() == STUB && IsPregeneratedField::decode(flags())); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4160 | CacheHolderField::encode(holder); | 4177 | CacheHolderField::encode(holder); |
| 4161 if (!Code::needs_extended_extra_ic_state(kind)) { | 4178 if (!Code::needs_extended_extra_ic_state(kind)) { |
| 4162 bits |= (argc << kArgumentsCountShift); | 4179 bits |= (argc << kArgumentsCountShift); |
| 4163 } | 4180 } |
| 4164 return static_cast<Flags>(bits); | 4181 return static_cast<Flags>(bits); |
| 4165 } | 4182 } |
| 4166 | 4183 |
| 4167 | 4184 |
| 4168 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 4185 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
| 4169 ExtraICState extra_ic_state, | 4186 ExtraICState extra_ic_state, |
| 4187 InlineCacheHolderFlag holder, |
| 4170 StubType type, | 4188 StubType type, |
| 4171 int argc, | 4189 int argc) { |
| 4172 InlineCacheHolderFlag holder) { | |
| 4173 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); | 4190 return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, argc, holder); |
| 4174 } | 4191 } |
| 4175 | 4192 |
| 4176 | 4193 |
| 4177 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 4194 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
| 4178 return KindField::decode(flags); | 4195 return KindField::decode(flags); |
| 4179 } | 4196 } |
| 4180 | 4197 |
| 4181 | 4198 |
| 4182 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 4199 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4800 } | 4817 } |
| 4801 | 4818 |
| 4802 | 4819 |
| 4803 bool SharedFunctionInfo::is_classic_mode() { | 4820 bool SharedFunctionInfo::is_classic_mode() { |
| 4804 return !BooleanBit::get(compiler_hints(), kStrictModeFunction); | 4821 return !BooleanBit::get(compiler_hints(), kStrictModeFunction); |
| 4805 } | 4822 } |
| 4806 | 4823 |
| 4807 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode, | 4824 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode, |
| 4808 kExtendedModeFunction) | 4825 kExtendedModeFunction) |
| 4809 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) | 4826 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) |
| 4827 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, inline_builtin, |
| 4828 kInlineBuiltin) |
| 4810 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, | 4829 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, |
| 4811 name_should_print_as_anonymous, | 4830 name_should_print_as_anonymous, |
| 4812 kNameShouldPrintAsAnonymous) | 4831 kNameShouldPrintAsAnonymous) |
| 4813 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) | 4832 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) |
| 4814 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 4833 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
| 4815 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) | 4834 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) |
| 4816 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, | 4835 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, |
| 4817 kDontOptimize) | 4836 kDontOptimize) |
| 4818 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline) | 4837 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline) |
| 4819 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache) | 4838 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4860 | (start_position_and_type() & ~kStartPositionMask)); | 4879 | (start_position_and_type() & ~kStartPositionMask)); |
| 4861 } | 4880 } |
| 4862 | 4881 |
| 4863 | 4882 |
| 4864 Code* SharedFunctionInfo::code() { | 4883 Code* SharedFunctionInfo::code() { |
| 4865 return Code::cast(READ_FIELD(this, kCodeOffset)); | 4884 return Code::cast(READ_FIELD(this, kCodeOffset)); |
| 4866 } | 4885 } |
| 4867 | 4886 |
| 4868 | 4887 |
| 4869 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 4888 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
| 4889 ASSERT(value->kind() != Code::OPTIMIZED_FUNCTION); |
| 4870 WRITE_FIELD(this, kCodeOffset, value); | 4890 WRITE_FIELD(this, kCodeOffset, value); |
| 4871 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); | 4891 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); |
| 4872 } | 4892 } |
| 4873 | 4893 |
| 4874 | 4894 |
| 4875 void SharedFunctionInfo::ReplaceCode(Code* value) { | 4895 void SharedFunctionInfo::ReplaceCode(Code* value) { |
| 4876 // If the GC metadata field is already used then the function was | 4896 // If the GC metadata field is already used then the function was |
| 4877 // enqueued as a code flushing candidate and we remove it now. | 4897 // enqueued as a code flushing candidate and we remove it now. |
| 4878 if (code()->gc_metadata() != NULL) { | 4898 if (code()->gc_metadata() != NULL) { |
| 4879 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); | 4899 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6410 #undef WRITE_UINT32_FIELD | 6430 #undef WRITE_UINT32_FIELD |
| 6411 #undef READ_SHORT_FIELD | 6431 #undef READ_SHORT_FIELD |
| 6412 #undef WRITE_SHORT_FIELD | 6432 #undef WRITE_SHORT_FIELD |
| 6413 #undef READ_BYTE_FIELD | 6433 #undef READ_BYTE_FIELD |
| 6414 #undef WRITE_BYTE_FIELD | 6434 #undef WRITE_BYTE_FIELD |
| 6415 | 6435 |
| 6416 | 6436 |
| 6417 } } // namespace v8::internal | 6437 } } // namespace v8::internal |
| 6418 | 6438 |
| 6419 #endif // V8_OBJECTS_INL_H_ | 6439 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |