Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: src/objects-inl.h

Issue 21095005: Mark maps as unstable if their instances potentially transition away. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-omit-checks.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after
3556 set_bit_field3(IsShared::update(bit_field3(), value)); 3556 set_bit_field3(IsShared::update(bit_field3(), value));
3557 } 3557 }
3558 3558
3559 3559
3560 bool Map::is_shared() { 3560 bool Map::is_shared() {
3561 return IsShared::decode(bit_field3()); 3561 return IsShared::decode(bit_field3());
3562 } 3562 }
3563 3563
3564 3564
3565 void Map::set_dictionary_map(bool value) { 3565 void Map::set_dictionary_map(bool value) {
3566 if (value) mark_unstable();
3566 set_bit_field3(DictionaryMap::update(bit_field3(), value)); 3567 set_bit_field3(DictionaryMap::update(bit_field3(), value));
3567 } 3568 }
3568 3569
3569 3570
3570 bool Map::is_dictionary_map() { 3571 bool Map::is_dictionary_map() {
3571 return DictionaryMap::decode(bit_field3()); 3572 return DictionaryMap::decode(bit_field3());
3572 } 3573 }
3573 3574
3574 3575
3575 Code::Flags Code::flags() { 3576 Code::Flags Code::flags() {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3619 void Map::freeze() { 3620 void Map::freeze() {
3620 set_bit_field3(IsFrozen::update(bit_field3(), true)); 3621 set_bit_field3(IsFrozen::update(bit_field3(), true));
3621 } 3622 }
3622 3623
3623 3624
3624 bool Map::is_frozen() { 3625 bool Map::is_frozen() {
3625 return IsFrozen::decode(bit_field3()); 3626 return IsFrozen::decode(bit_field3());
3626 } 3627 }
3627 3628
3628 3629
3630 void Map::mark_unstable() {
3631 set_bit_field3(IsUnstable::update(bit_field3(), true));
3632 }
3633
3634
3635 bool Map::is_stable() {
3636 return !IsUnstable::decode(bit_field3());
3637 }
3638
3639
3629 bool Map::has_code_cache() { 3640 bool Map::has_code_cache() {
3630 return code_cache() != GetIsolate()->heap()->empty_fixed_array(); 3641 return code_cache() != GetIsolate()->heap()->empty_fixed_array();
3631 } 3642 }
3632 3643
3633 3644
3634 bool Map::CanBeDeprecated() { 3645 bool Map::CanBeDeprecated() {
3635 int descriptor = LastAdded(); 3646 int descriptor = LastAdded();
3636 for (int i = 0; i <= descriptor; i++) { 3647 for (int i = 0; i <= descriptor; i++) {
3637 PropertyDetails details = instance_descriptors()->GetDetails(i); 3648 PropertyDetails details = instance_descriptors()->GetDetails(i);
3638 if (FLAG_track_fields && details.representation().IsNone()) { 3649 if (FLAG_track_fields && details.representation().IsNone()) {
(...skipping 11 matching lines...) Expand all
3650 } 3661 }
3651 if (FLAG_track_fields && details.type() == CONSTANT) { 3662 if (FLAG_track_fields && details.type() == CONSTANT) {
3652 return true; 3663 return true;
3653 } 3664 }
3654 } 3665 }
3655 return false; 3666 return false;
3656 } 3667 }
3657 3668
3658 3669
3659 void Map::NotifyLeafMapLayoutChange() { 3670 void Map::NotifyLeafMapLayoutChange() {
3660 dependent_code()->DeoptimizeDependentCodeGroup( 3671 if (is_stable()) {
3661 GetIsolate(), 3672 mark_unstable();
3662 DependentCode::kPrototypeCheckGroup); 3673 dependent_code()->DeoptimizeDependentCodeGroup(
3674 GetIsolate(),
3675 DependentCode::kPrototypeCheckGroup);
3676 }
3663 } 3677 }
3664 3678
3665 3679
3666 bool Map::CanOmitPrototypeChecks() { 3680 bool Map::CanOmitPrototypeChecks() {
3667 return !HasTransitionArray() && !is_dictionary_map() && 3681 return is_stable() && FLAG_omit_prototype_checks_for_leaf_maps;
3668 FLAG_omit_prototype_checks_for_leaf_maps;
3669 } 3682 }
3670 3683
3671 3684
3672 bool Map::CanOmitMapChecks() { 3685 bool Map::CanOmitMapChecks() {
3673 return !HasTransitionArray() && !is_dictionary_map() && 3686 return is_stable() && FLAG_omit_map_checks_for_leaf_maps;
3674 FLAG_omit_map_checks_for_leaf_maps;
3675 } 3687 }
3676 3688
3677 3689
3678 int DependentCode::number_of_entries(DependencyGroup group) { 3690 int DependentCode::number_of_entries(DependencyGroup group) {
3679 if (length() == 0) return 0; 3691 if (length() == 0) return 0;
3680 return Smi::cast(get(group))->value(); 3692 return Smi::cast(get(group))->value();
3681 } 3693 }
3682 3694
3683 3695
3684 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { 3696 void DependentCode::set_number_of_entries(DependencyGroup group, int value) {
(...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after
6207 #undef WRITE_UINT32_FIELD 6219 #undef WRITE_UINT32_FIELD
6208 #undef READ_SHORT_FIELD 6220 #undef READ_SHORT_FIELD
6209 #undef WRITE_SHORT_FIELD 6221 #undef WRITE_SHORT_FIELD
6210 #undef READ_BYTE_FIELD 6222 #undef READ_BYTE_FIELD
6211 #undef WRITE_BYTE_FIELD 6223 #undef WRITE_BYTE_FIELD
6212 6224
6213 6225
6214 } } // namespace v8::internal 6226 } } // namespace v8::internal
6215 6227
6216 #endif // V8_OBJECTS_INL_H_ 6228 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-omit-checks.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698