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

Side by Side Diff: src/ic.cc

Issue 10575032: In-place shrinking of descriptor arrays with non-live transitions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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 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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 } else if (state == MONOMORPHIC) { 1294 } else if (state == MONOMORPHIC) {
1295 set_target(*megamorphic_stub()); 1295 set_target(*megamorphic_stub());
1296 } 1296 }
1297 1297
1298 TRACE_IC("KeyedLoadIC", name, state, target()); 1298 TRACE_IC("KeyedLoadIC", name, state, target());
1299 } 1299 }
1300 1300
1301 1301
1302 static bool StoreICableLookup(LookupResult* lookup) { 1302 static bool StoreICableLookup(LookupResult* lookup) {
1303 // Bail out if we didn't find a result. 1303 // Bail out if we didn't find a result.
1304 if (!lookup->IsFound() || lookup->type() == NULL_DESCRIPTOR) return false; 1304 if (!lookup->IsFound()) return false;
1305 1305
1306 // Bail out if inline caching is not allowed. 1306 // Bail out if inline caching is not allowed.
1307 if (!lookup->IsCacheable()) return false; 1307 if (!lookup->IsCacheable()) return false;
1308 1308
1309 // If the property is read-only, we leave the IC in its current state. 1309 // If the property is read-only, we leave the IC in its current state.
1310 if (lookup->IsReadOnly()) return false; 1310 if (lookup->IsReadOnly()) return false;
1311 1311
1312 return true; 1312 return true;
1313 } 1313 }
1314 1314
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 void StoreIC::UpdateCaches(LookupResult* lookup, 1432 void StoreIC::UpdateCaches(LookupResult* lookup,
1433 State state, 1433 State state,
1434 StrictModeFlag strict_mode, 1434 StrictModeFlag strict_mode,
1435 Handle<JSObject> receiver, 1435 Handle<JSObject> receiver,
1436 Handle<String> name, 1436 Handle<String> name,
1437 Handle<Object> value) { 1437 Handle<Object> value) {
1438 ASSERT(!receiver->IsJSGlobalProxy()); 1438 ASSERT(!receiver->IsJSGlobalProxy());
1439 ASSERT(StoreICableLookup(lookup)); 1439 ASSERT(StoreICableLookup(lookup));
1440 // These are not cacheable, so we never see such LookupResults here. 1440 // These are not cacheable, so we never see such LookupResults here.
1441 ASSERT(lookup->type() != HANDLER); 1441 ASSERT(lookup->type() != HANDLER);
1442 // We get only called for properties or transitions, see StoreICableLookup.
1443 ASSERT(lookup->type() != NULL_DESCRIPTOR);
Michael Starzinger 2012/06/25 11:21:57 We should actually keep this and assert against NO
Toon Verwaest 2012/06/25 12:20:48 As discussed offline, replaced with IsFound(). On
1444 1442
1445 // If the property has a non-field type allowing map transitions 1443 // If the property has a non-field type allowing map transitions
1446 // where there is extra room in the object, we leave the IC in its 1444 // where there is extra room in the object, we leave the IC in its
1447 // current state. 1445 // current state.
1448 PropertyType type = lookup->type(); 1446 PropertyType type = lookup->type();
1449 1447
1450 // Compute the code stub for this store; used for rewriting to 1448 // Compute the code stub for this store; used for rewriting to
1451 // monomorphic state and making sure that the code stub is in the 1449 // monomorphic state and making sure that the code stub is in the
1452 // stub cache. 1450 // stub cache.
1453 Handle<JSObject> holder(lookup->holder()); 1451 Handle<JSObject> holder(lookup->holder());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 break; 1503 break;
1506 } 1504 }
1507 case INTERCEPTOR: 1505 case INTERCEPTOR:
1508 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); 1506 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined());
1509 code = isolate()->stub_cache()->ComputeStoreInterceptor( 1507 code = isolate()->stub_cache()->ComputeStoreInterceptor(
1510 name, receiver, strict_mode); 1508 name, receiver, strict_mode);
1511 break; 1509 break;
1512 case CONSTANT_FUNCTION: 1510 case CONSTANT_FUNCTION:
1513 case CONSTANT_TRANSITION: 1511 case CONSTANT_TRANSITION:
1514 return; 1512 return;
1513 case NONEXISTENT:
1515 case HANDLER: 1514 case HANDLER:
1516 case NULL_DESCRIPTOR:
1517 UNREACHABLE(); 1515 UNREACHABLE();
1518 return; 1516 return;
1519 } 1517 }
1520 1518
1521 // Patch the call site depending on the state of the cache. 1519 // Patch the call site depending on the state of the cache.
1522 if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) { 1520 if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) {
1523 set_target(*code); 1521 set_target(*code);
1524 } else if (state == MONOMORPHIC) { 1522 } else if (state == MONOMORPHIC) {
1525 // Only move to megamorphic if the target changes. 1523 // Only move to megamorphic if the target changes.
1526 if (target() != *code) { 1524 if (target() != *code) {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 void KeyedStoreIC::UpdateCaches(LookupResult* lookup, 1932 void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1935 State state, 1933 State state,
1936 StrictModeFlag strict_mode, 1934 StrictModeFlag strict_mode,
1937 Handle<JSObject> receiver, 1935 Handle<JSObject> receiver,
1938 Handle<String> name, 1936 Handle<String> name,
1939 Handle<Object> value) { 1937 Handle<Object> value) {
1940 ASSERT(!receiver->IsJSGlobalProxy()); 1938 ASSERT(!receiver->IsJSGlobalProxy());
1941 ASSERT(StoreICableLookup(lookup)); 1939 ASSERT(StoreICableLookup(lookup));
1942 // These are not cacheable, so we never see such LookupResults here. 1940 // These are not cacheable, so we never see such LookupResults here.
1943 ASSERT(lookup->type() != HANDLER); 1941 ASSERT(lookup->type() != HANDLER);
1944 // We get only called for properties or transitions, see StoreICableLookup.
1945 ASSERT(lookup->type() != NULL_DESCRIPTOR);
Michael Starzinger 2012/06/25 11:21:57 Likewise.
Toon Verwaest 2012/06/25 12:20:48 Done.
1946 1942
1947 // If the property has a non-field type allowing map transitions 1943 // If the property has a non-field type allowing map transitions
1948 // where there is extra room in the object, we leave the IC in its 1944 // where there is extra room in the object, we leave the IC in its
1949 // current state. 1945 // current state.
1950 PropertyType type = lookup->type(); 1946 PropertyType type = lookup->type();
1951 1947
1952 // Compute the code stub for this store; used for rewriting to 1948 // Compute the code stub for this store; used for rewriting to
1953 // monomorphic state and making sure that the code stub is in the 1949 // monomorphic state and making sure that the code stub is in the
1954 // stub cache. 1950 // stub cache.
1955 Handle<Code> code; 1951 Handle<Code> code;
(...skipping 18 matching lines...) Expand all
1974 case CALLBACKS: 1970 case CALLBACKS:
1975 case INTERCEPTOR: 1971 case INTERCEPTOR:
1976 case CONSTANT_TRANSITION: 1972 case CONSTANT_TRANSITION:
1977 // Always rewrite to the generic case so that we do not 1973 // Always rewrite to the generic case so that we do not
1978 // repeatedly try to rewrite. 1974 // repeatedly try to rewrite.
1979 code = (strict_mode == kStrictMode) 1975 code = (strict_mode == kStrictMode)
1980 ? generic_stub_strict() 1976 ? generic_stub_strict()
1981 : generic_stub(); 1977 : generic_stub();
1982 break; 1978 break;
1983 case HANDLER: 1979 case HANDLER:
1984 case NULL_DESCRIPTOR: 1980 case NONEXISTENT:
1985 UNREACHABLE(); 1981 UNREACHABLE();
1986 return; 1982 return;
1987 } 1983 }
1988 1984
1989 ASSERT(!code.is_null()); 1985 ASSERT(!code.is_null());
1990 1986
1991 // Patch the call site depending on the state of the cache. Make 1987 // Patch the call site depending on the state of the cache. Make
1992 // sure to always rewrite from monomorphic to megamorphic. 1988 // sure to always rewrite from monomorphic to megamorphic.
1993 ASSERT(state != MONOMORPHIC_PROTOTYPE_FAILURE); 1989 ASSERT(state != MONOMORPHIC_PROTOTYPE_FAILURE);
1994 if (state == UNINITIALIZED || state == PREMONOMORPHIC) { 1990 if (state == UNINITIALIZED || state == PREMONOMORPHIC) {
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 #undef ADDR 2668 #undef ADDR
2673 }; 2669 };
2674 2670
2675 2671
2676 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2672 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2677 return IC_utilities[id]; 2673 return IC_utilities[id];
2678 } 2674 }
2679 2675
2680 2676
2681 } } // namespace v8::internal 2677 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/mark-compact.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698