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

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: Addressing comments Created 8 years, 5 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 1430
1431 1431
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 ASSERT(lookup->IsFound());
1441
1440 // These are not cacheable, so we never see such LookupResults here. 1442 // These are not cacheable, so we never see such LookupResults here.
1441 ASSERT(lookup->type() != HANDLER); 1443 ASSERT(lookup->type() != HANDLER);
1442 // We get only called for properties or transitions, see StoreICableLookup.
1443 ASSERT(lookup->type() != NULL_DESCRIPTOR);
1444 1444
1445 // If the property has a non-field type allowing map transitions 1445 // 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 1446 // where there is extra room in the object, we leave the IC in its
1447 // current state. 1447 // current state.
1448 PropertyType type = lookup->type(); 1448 PropertyType type = lookup->type();
1449 1449
1450 // Compute the code stub for this store; used for rewriting to 1450 // Compute the code stub for this store; used for rewriting to
1451 // monomorphic state and making sure that the code stub is in the 1451 // monomorphic state and making sure that the code stub is in the
1452 // stub cache. 1452 // stub cache.
1453 Handle<JSObject> holder(lookup->holder()); 1453 Handle<JSObject> holder(lookup->holder());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 break; 1505 break;
1506 } 1506 }
1507 case INTERCEPTOR: 1507 case INTERCEPTOR:
1508 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); 1508 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined());
1509 code = isolate()->stub_cache()->ComputeStoreInterceptor( 1509 code = isolate()->stub_cache()->ComputeStoreInterceptor(
1510 name, receiver, strict_mode); 1510 name, receiver, strict_mode);
1511 break; 1511 break;
1512 case CONSTANT_FUNCTION: 1512 case CONSTANT_FUNCTION:
1513 case CONSTANT_TRANSITION: 1513 case CONSTANT_TRANSITION:
1514 return; 1514 return;
1515 case NONEXISTENT:
1515 case HANDLER: 1516 case HANDLER:
1516 case NULL_DESCRIPTOR:
1517 UNREACHABLE(); 1517 UNREACHABLE();
1518 return; 1518 return;
1519 } 1519 }
1520 1520
1521 // Patch the call site depending on the state of the cache. 1521 // Patch the call site depending on the state of the cache.
1522 if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) { 1522 if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) {
1523 set_target(*code); 1523 set_target(*code);
1524 } else if (state == MONOMORPHIC) { 1524 } else if (state == MONOMORPHIC) {
1525 // Only move to megamorphic if the target changes. 1525 // Only move to megamorphic if the target changes.
1526 if (target() != *code) { 1526 if (target() != *code) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 1932
1933 1933
1934 void KeyedStoreIC::UpdateCaches(LookupResult* lookup, 1934 void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1935 State state, 1935 State state,
1936 StrictModeFlag strict_mode, 1936 StrictModeFlag strict_mode,
1937 Handle<JSObject> receiver, 1937 Handle<JSObject> receiver,
1938 Handle<String> name, 1938 Handle<String> name,
1939 Handle<Object> value) { 1939 Handle<Object> value) {
1940 ASSERT(!receiver->IsJSGlobalProxy()); 1940 ASSERT(!receiver->IsJSGlobalProxy());
1941 ASSERT(StoreICableLookup(lookup)); 1941 ASSERT(StoreICableLookup(lookup));
1942 ASSERT(lookup->IsFound());
Michael Starzinger 2012/06/25 12:48:38 Add an empty line so that it looks consistent with
1942 // These are not cacheable, so we never see such LookupResults here. 1943 // These are not cacheable, so we never see such LookupResults here.
1943 ASSERT(lookup->type() != HANDLER); 1944 ASSERT(lookup->type() != HANDLER);
1944 // We get only called for properties or transitions, see StoreICableLookup.
1945 ASSERT(lookup->type() != NULL_DESCRIPTOR);
1946 1945
1947 // If the property has a non-field type allowing map transitions 1946 // 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 1947 // where there is extra room in the object, we leave the IC in its
1949 // current state. 1948 // current state.
1950 PropertyType type = lookup->type(); 1949 PropertyType type = lookup->type();
1951 1950
1952 // Compute the code stub for this store; used for rewriting to 1951 // Compute the code stub for this store; used for rewriting to
1953 // monomorphic state and making sure that the code stub is in the 1952 // monomorphic state and making sure that the code stub is in the
1954 // stub cache. 1953 // stub cache.
1955 Handle<Code> code; 1954 Handle<Code> code;
(...skipping 18 matching lines...) Expand all
1974 case CALLBACKS: 1973 case CALLBACKS:
1975 case INTERCEPTOR: 1974 case INTERCEPTOR:
1976 case CONSTANT_TRANSITION: 1975 case CONSTANT_TRANSITION:
1977 // Always rewrite to the generic case so that we do not 1976 // Always rewrite to the generic case so that we do not
1978 // repeatedly try to rewrite. 1977 // repeatedly try to rewrite.
1979 code = (strict_mode == kStrictMode) 1978 code = (strict_mode == kStrictMode)
1980 ? generic_stub_strict() 1979 ? generic_stub_strict()
1981 : generic_stub(); 1980 : generic_stub();
1982 break; 1981 break;
1983 case HANDLER: 1982 case HANDLER:
1984 case NULL_DESCRIPTOR: 1983 case NONEXISTENT:
1985 UNREACHABLE(); 1984 UNREACHABLE();
1986 return; 1985 return;
1987 } 1986 }
1988 1987
1989 ASSERT(!code.is_null()); 1988 ASSERT(!code.is_null());
1990 1989
1991 // Patch the call site depending on the state of the cache. Make 1990 // Patch the call site depending on the state of the cache. Make
1992 // sure to always rewrite from monomorphic to megamorphic. 1991 // sure to always rewrite from monomorphic to megamorphic.
1993 ASSERT(state != MONOMORPHIC_PROTOTYPE_FAILURE); 1992 ASSERT(state != MONOMORPHIC_PROTOTYPE_FAILURE);
1994 if (state == UNINITIALIZED || state == PREMONOMORPHIC) { 1993 if (state == UNINITIALIZED || state == PREMONOMORPHIC) {
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 #undef ADDR 2671 #undef ADDR
2673 }; 2672 };
2674 2673
2675 2674
2676 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2675 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2677 return IC_utilities[id]; 2676 return IC_utilities[id];
2678 } 2677 }
2679 2678
2680 2679
2681 } } // namespace v8::internal 2680 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/mark-compact.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698