OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 687 |
688 // Get the property. | 688 // Get the property. |
689 return object->GetProperty(*object, &lookup, *name, &attr); | 689 return object->GetProperty(*object, &lookup, *name, &attr); |
690 } | 690 } |
691 | 691 |
692 | 692 |
693 void LoadIC::UpdateCaches(LookupResult* lookup, | 693 void LoadIC::UpdateCaches(LookupResult* lookup, |
694 State state, | 694 State state, |
695 Handle<Object> object, | 695 Handle<Object> object, |
696 Handle<String> name) { | 696 Handle<String> name) { |
697 // Bail out if the result is not cachable. | 697 // Bail out if we didn't find a result. |
698 if (!lookup->IsCacheable()) return; | 698 if (!lookup->IsProperty() || !lookup->IsCacheable()) return; |
699 | 699 |
700 // Loading properties from values is not common, so don't try to | 700 // Loading properties from values is not common, so don't try to |
701 // deal with non-JS objects here. | 701 // deal with non-JS objects here. |
702 if (!object->IsJSObject()) return; | 702 if (!object->IsJSObject()) return; |
703 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 703 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
704 | 704 |
705 // Compute the code stub for this load. | 705 // Compute the code stub for this load. |
706 Object* code = NULL; | 706 Object* code = NULL; |
707 if (state == UNINITIALIZED) { | 707 if (state == UNINITIALIZED) { |
708 // This is the first time we execute this inline cache. | 708 // This is the first time we execute this inline cache. |
709 // Set the target to the pre monomorphic stub to delay | 709 // Set the target to the pre monomorphic stub to delay |
710 // setting the monomorphic state. | 710 // setting the monomorphic state. |
711 code = pre_monomorphic_stub(); | 711 code = pre_monomorphic_stub(); |
712 } else if (!lookup->IsProperty()) { | |
713 // Nonexistent property. The result is undefined. | |
714 code = StubCache::ComputeLoadNonexistent(*name, *receiver); | |
715 } else { | 712 } else { |
716 // Compute monomorphic stub. | 713 // Compute monomorphic stub. |
717 switch (lookup->type()) { | 714 switch (lookup->type()) { |
718 case FIELD: { | 715 case FIELD: { |
719 code = StubCache::ComputeLoadField(*name, *receiver, | 716 code = StubCache::ComputeLoadField(*name, *receiver, |
720 lookup->holder(), | 717 lookup->holder(), |
721 lookup->GetFieldIndex()); | 718 lookup->GetFieldIndex()); |
722 break; | 719 break; |
723 } | 720 } |
724 case CONSTANT_FUNCTION: { | 721 case CONSTANT_FUNCTION: { |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 #undef ADDR | 1495 #undef ADDR |
1499 }; | 1496 }; |
1500 | 1497 |
1501 | 1498 |
1502 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1499 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
1503 return IC_utilities[id]; | 1500 return IC_utilities[id]; |
1504 } | 1501 } |
1505 | 1502 |
1506 | 1503 |
1507 } } // namespace v8::internal | 1504 } } // namespace v8::internal |
OLD | NEW |