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