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

Side by Side Diff: src/ic.cc

Issue 1539034: Add inline caches for loading non-existing properties. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 8 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
OLDNEW
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
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 we didn't find a result. 697 // Bail out if the result is not cachable.
698 if (!lookup->IsProperty() || !lookup->IsCacheable()) return; 698 if (!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 // Non-existing property. The result is undefined.
714 code = StubCache::ComputeLoadNonExisting(*name, *receiver);
712 } else { 715 } else {
713 // Compute monomorphic stub. 716 // Compute monomorphic stub.
714 switch (lookup->type()) { 717 switch (lookup->type()) {
715 case FIELD: { 718 case FIELD: {
716 code = StubCache::ComputeLoadField(*name, *receiver, 719 code = StubCache::ComputeLoadField(*name, *receiver,
717 lookup->holder(), 720 lookup->holder(),
718 lookup->GetFieldIndex()); 721 lookup->GetFieldIndex());
719 break; 722 break;
720 } 723 }
721 case CONSTANT_FUNCTION: { 724 case CONSTANT_FUNCTION: {
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 #undef ADDR 1498 #undef ADDR
1496 }; 1499 };
1497 1500
1498 1501
1499 Address IC::AddressFromUtilityId(IC::UtilityId id) { 1502 Address IC::AddressFromUtilityId(IC::UtilityId id) {
1500 return IC_utilities[id]; 1503 return IC_utilities[id];
1501 } 1504 }
1502 1505
1503 1506
1504 } } // namespace v8::internal 1507 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/stub-cache.h » ('j') | src/stub-cache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698