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 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 DependentCode::kPrototypeCheckGroup); | 3652 DependentCode::kPrototypeCheckGroup); |
3653 } | 3653 } |
3654 | 3654 |
3655 | 3655 |
3656 bool Map::CanOmitPrototypeChecks() { | 3656 bool Map::CanOmitPrototypeChecks() { |
3657 return !HasTransitionArray() && !is_dictionary_map() && | 3657 return !HasTransitionArray() && !is_dictionary_map() && |
3658 FLAG_omit_prototype_checks_for_leaf_maps; | 3658 FLAG_omit_prototype_checks_for_leaf_maps; |
3659 } | 3659 } |
3660 | 3660 |
3661 | 3661 |
| 3662 void Map::AddDependentCode(DependentCode::DependencyGroup group, |
| 3663 Handle<Code> code) { |
| 3664 Handle<DependentCode> codes = |
| 3665 DependentCode::Insert(Handle<DependentCode>(dependent_code()), |
| 3666 group, code); |
| 3667 if (*codes != dependent_code()) { |
| 3668 set_dependent_code(*codes); |
| 3669 } |
| 3670 } |
| 3671 |
| 3672 |
3662 int DependentCode::number_of_entries(DependencyGroup group) { | 3673 int DependentCode::number_of_entries(DependencyGroup group) { |
3663 if (length() == 0) return 0; | 3674 if (length() == 0) return 0; |
3664 return Smi::cast(get(group))->value(); | 3675 return Smi::cast(get(group))->value(); |
3665 } | 3676 } |
3666 | 3677 |
3667 | 3678 |
3668 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { | 3679 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { |
3669 set(group, Smi::FromInt(value)); | 3680 set(group, Smi::FromInt(value)); |
3670 } | 3681 } |
3671 | 3682 |
3672 | 3683 |
3673 bool DependentCode::is_code_at(int i) { | |
3674 return get(kCodesStartIndex + i)->IsCode(); | |
3675 } | |
3676 | |
3677 Code* DependentCode::code_at(int i) { | 3684 Code* DependentCode::code_at(int i) { |
3678 return Code::cast(get(kCodesStartIndex + i)); | 3685 return Code::cast(get(kCodesStartIndex + i)); |
3679 } | 3686 } |
3680 | 3687 |
3681 | 3688 |
3682 CompilationInfo* DependentCode::compilation_info_at(int i) { | 3689 void DependentCode::set_code_at(int i, Code* value) { |
3683 return reinterpret_cast<CompilationInfo*>( | 3690 set(kCodesStartIndex + i, value); |
3684 Foreign::cast(get(kCodesStartIndex + i))->foreign_address()); | |
3685 } | 3691 } |
3686 | 3692 |
3687 | 3693 |
3688 void DependentCode::set_object_at(int i, Object* object) { | 3694 Object** DependentCode::code_slot_at(int i) { |
3689 set(kCodesStartIndex + i, object); | |
3690 } | |
3691 | |
3692 | |
3693 Object* DependentCode::object_at(int i) { | |
3694 return get(kCodesStartIndex + i); | |
3695 } | |
3696 | |
3697 | |
3698 Object** DependentCode::slot_at(int i) { | |
3699 return HeapObject::RawField( | 3695 return HeapObject::RawField( |
3700 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i)); | 3696 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i)); |
3701 } | 3697 } |
3702 | 3698 |
3703 | 3699 |
3704 void DependentCode::clear_at(int i) { | 3700 void DependentCode::clear_code_at(int i) { |
3705 set_undefined(kCodesStartIndex + i); | 3701 set_undefined(kCodesStartIndex + i); |
3706 } | 3702 } |
3707 | 3703 |
3708 | 3704 |
3709 void DependentCode::copy(int from, int to) { | |
3710 set(kCodesStartIndex + to, get(kCodesStartIndex + from)); | |
3711 } | |
3712 | |
3713 | |
3714 void DependentCode::ExtendGroup(DependencyGroup group) { | 3705 void DependentCode::ExtendGroup(DependencyGroup group) { |
3715 GroupStartIndexes starts(this); | 3706 GroupStartIndexes starts(this); |
3716 for (int g = kGroupCount - 1; g > group; g--) { | 3707 for (int g = kGroupCount - 1; g > group; g--) { |
3717 if (starts.at(g) < starts.at(g + 1)) { | 3708 if (starts.at(g) < starts.at(g + 1)) { |
3718 copy(starts.at(g), starts.at(g + 1)); | 3709 set_code_at(starts.at(g + 1), code_at(starts.at(g))); |
3719 } | 3710 } |
3720 } | 3711 } |
3721 } | 3712 } |
3722 | 3713 |
3723 | 3714 |
3724 void Code::set_flags(Code::Flags flags) { | 3715 void Code::set_flags(Code::Flags flags) { |
3725 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); | 3716 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); |
3726 // Make sure that all call stubs have an arguments count. | 3717 // Make sure that all call stubs have an arguments count. |
3727 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && | 3718 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && |
3728 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || | 3719 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || |
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6240 #undef WRITE_UINT32_FIELD | 6231 #undef WRITE_UINT32_FIELD |
6241 #undef READ_SHORT_FIELD | 6232 #undef READ_SHORT_FIELD |
6242 #undef WRITE_SHORT_FIELD | 6233 #undef WRITE_SHORT_FIELD |
6243 #undef READ_BYTE_FIELD | 6234 #undef READ_BYTE_FIELD |
6244 #undef WRITE_BYTE_FIELD | 6235 #undef WRITE_BYTE_FIELD |
6245 | 6236 |
6246 | 6237 |
6247 } } // namespace v8::internal | 6238 } } // namespace v8::internal |
6248 | 6239 |
6249 #endif // V8_OBJECTS_INL_H_ | 6240 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |