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

Side by Side Diff: src/ic.cc

Issue 7227010: Create and use shared stub for for DictionaryValue-based elements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: more arm fixes Created 9 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
« no previous file with comments | « src/ic.h ('k') | src/mips/ic-mips.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 1090
1091 isolate()->stub_cache()->Set(*name, map, Code::cast(code)); 1091 isolate()->stub_cache()->Set(*name, map, Code::cast(code));
1092 } 1092 }
1093 1093
1094 #ifdef DEBUG 1094 #ifdef DEBUG
1095 TraceIC("LoadIC", name, state, target()); 1095 TraceIC("LoadIC", name, state, target());
1096 #endif 1096 #endif
1097 } 1097 }
1098 1098
1099 1099
1100 MaybeObject* KeyedLoadIC::GetFastElementStubWithoutMapCheck( 1100 MaybeObject* KeyedLoadIC::GetElementStubWithoutMapCheck(
1101 bool is_js_array) { 1101 bool is_js_array,
1102 return KeyedLoadFastElementStub().TryGetCode(); 1102 JSObject::ElementsKind elements_kind) {
1103 return KeyedLoadElementStub(elements_kind).TryGetCode();
1103 } 1104 }
1104 1105
1105 1106
1106 MaybeObject* KeyedLoadIC::GetExternalArrayStubWithoutMapCheck(
1107 JSObject::ElementsKind elements_kind) {
1108 return KeyedLoadExternalArrayStub(elements_kind).TryGetCode();
1109 }
1110
1111
1112 MaybeObject* KeyedLoadIC::ConstructMegamorphicStub( 1107 MaybeObject* KeyedLoadIC::ConstructMegamorphicStub(
1113 MapList* receiver_maps, 1108 MapList* receiver_maps,
1114 CodeList* targets, 1109 CodeList* targets,
1115 StrictModeFlag strict_mode) { 1110 StrictModeFlag strict_mode) {
1116 Object* object; 1111 Object* object;
1117 KeyedLoadStubCompiler compiler; 1112 KeyedLoadStubCompiler compiler;
1118 MaybeObject* maybe_code = compiler.CompileLoadMegamorphic(receiver_maps, 1113 MaybeObject* maybe_code = compiler.CompileLoadMegamorphic(receiver_maps,
1119 targets); 1114 targets);
1120 if (!maybe_code->ToObject(&object)) return maybe_code; 1115 if (!maybe_code->ToObject(&object)) return maybe_code;
1121 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); 1116 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment();
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 // If there is a cached stub, use it. 1663 // If there is a cached stub, use it.
1669 if (!maybe_cached_stub->IsUndefined()) { 1664 if (!maybe_cached_stub->IsUndefined()) {
1670 ASSERT(maybe_cached_stub->IsCode()); 1665 ASSERT(maybe_cached_stub->IsCode());
1671 return Code::cast(maybe_cached_stub); 1666 return Code::cast(maybe_cached_stub);
1672 } 1667 }
1673 // Collect MONOMORPHIC stubs for all target_receiver_maps. 1668 // Collect MONOMORPHIC stubs for all target_receiver_maps.
1674 CodeList handler_ics(target_receiver_maps.length()); 1669 CodeList handler_ics(target_receiver_maps.length());
1675 for (int i = 0; i < target_receiver_maps.length(); ++i) { 1670 for (int i = 0; i < target_receiver_maps.length(); ++i) {
1676 Map* receiver_map(target_receiver_maps.at(i)); 1671 Map* receiver_map(target_receiver_maps.at(i));
1677 MaybeObject* maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck( 1672 MaybeObject* maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck(
1678 receiver_map, strict_mode, generic_stub); 1673 receiver_map, strict_mode);
1679 Code* cached_stub; 1674 Code* cached_stub;
1680 if (!maybe_cached_stub->To(&cached_stub)) return maybe_cached_stub; 1675 if (!maybe_cached_stub->To(&cached_stub)) return maybe_cached_stub;
1681 handler_ics.Add(cached_stub); 1676 handler_ics.Add(cached_stub);
1682 } 1677 }
1683 // Build the MEGAMORPHIC stub. 1678 // Build the MEGAMORPHIC stub.
1684 Code* stub; 1679 Code* stub;
1685 MaybeObject* maybe_stub = ConstructMegamorphicStub(&target_receiver_maps, 1680 MaybeObject* maybe_stub = ConstructMegamorphicStub(&target_receiver_maps,
1686 &handler_ics, 1681 &handler_ics,
1687 strict_mode); 1682 strict_mode);
1688 if (!maybe_stub->To(&stub)) return maybe_stub; 1683 if (!maybe_stub->To(&stub)) return maybe_stub;
1689 MaybeObject* maybe_update = cache->Update(&target_receiver_maps, flags, stub); 1684 MaybeObject* maybe_update = cache->Update(&target_receiver_maps, flags, stub);
1690 if (maybe_update->IsFailure()) return maybe_update; 1685 if (maybe_update->IsFailure()) return maybe_update;
1691 return stub; 1686 return stub;
1692 } 1687 }
1693 1688
1694 1689
1695 MaybeObject* KeyedIC::ComputeMonomorphicStubWithoutMapCheck( 1690 MaybeObject* KeyedIC::ComputeMonomorphicStubWithoutMapCheck(
1696 Map* receiver_map, 1691 Map* receiver_map,
1697 StrictModeFlag strict_mode, 1692 StrictModeFlag strict_mode) {
1698 Code* generic_stub) {
1699 if ((receiver_map->instance_type() & kNotStringTag) == 0) { 1693 if ((receiver_map->instance_type() & kNotStringTag) == 0) {
1700 ASSERT(string_stub() != NULL); 1694 ASSERT(string_stub() != NULL);
1701 return string_stub(); 1695 return string_stub();
1702 } else if (receiver_map->has_external_array_elements()) { 1696 } else {
1703 return GetExternalArrayStubWithoutMapCheck(receiver_map->elements_kind()); 1697 ASSERT(receiver_map->has_dictionary_elements() ||
1704 } else if (receiver_map->has_fast_elements()) { 1698 receiver_map->has_fast_elements() ||
1699 receiver_map->has_fast_double_elements() ||
1700 receiver_map->has_external_array_elements());
1705 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1701 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1706 return GetFastElementStubWithoutMapCheck(is_js_array); 1702 return GetElementStubWithoutMapCheck(is_js_array,
1707 } else { 1703 receiver_map->elements_kind());
1708 return generic_stub;
1709 } 1704 }
1710 } 1705 }
1711 1706
1712 1707
1713 MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver, 1708 MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver,
1714 bool is_store, 1709 bool is_store,
1715 StrictModeFlag strict_mode, 1710 StrictModeFlag strict_mode,
1716 Code* generic_stub) { 1711 Code* generic_stub) {
1717 Code* result = NULL; 1712 Code* result = NULL;
1718 if (receiver->HasFastElements() || 1713 if (receiver->HasFastElements() ||
1719 receiver->HasExternalArrayElements() || 1714 receiver->HasExternalArrayElements() ||
1715 receiver->HasFastDoubleElements() ||
1720 receiver->HasDictionaryElements()) { 1716 receiver->HasDictionaryElements()) {
1721 MaybeObject* maybe_stub = 1717 MaybeObject* maybe_stub =
1722 isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement( 1718 isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement(
1723 receiver, is_store, strict_mode); 1719 receiver, is_store, strict_mode);
1724 if (!maybe_stub->To(&result)) return maybe_stub; 1720 if (!maybe_stub->To(&result)) return maybe_stub;
1725 } else { 1721 } else {
1726 result = generic_stub; 1722 result = generic_stub;
1727 } 1723 }
1728 return result; 1724 return result;
1729 } 1725 }
1730 1726
1731 1727
1732 MaybeObject* KeyedStoreIC::GetFastElementStubWithoutMapCheck( 1728 MaybeObject* KeyedStoreIC::GetElementStubWithoutMapCheck(
1733 bool is_js_array) { 1729 bool is_js_array,
1734 return KeyedStoreFastElementStub(is_js_array).TryGetCode(); 1730 JSObject::ElementsKind elements_kind) {
1731 return KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode();
1735 } 1732 }
1736 1733
1737 1734
1738 MaybeObject* KeyedStoreIC::GetExternalArrayStubWithoutMapCheck(
1739 JSObject::ElementsKind elements_kind) {
1740 return KeyedStoreExternalArrayStub(elements_kind).TryGetCode();
1741 }
1742
1743
1744 MaybeObject* KeyedStoreIC::ConstructMegamorphicStub( 1735 MaybeObject* KeyedStoreIC::ConstructMegamorphicStub(
1745 MapList* receiver_maps, 1736 MapList* receiver_maps,
1746 CodeList* targets, 1737 CodeList* targets,
1747 StrictModeFlag strict_mode) { 1738 StrictModeFlag strict_mode) {
1748 Object* object; 1739 Object* object;
1749 KeyedStoreStubCompiler compiler(strict_mode); 1740 KeyedStoreStubCompiler compiler(strict_mode);
1750 MaybeObject* maybe_code = compiler.CompileStoreMegamorphic(receiver_maps, 1741 MaybeObject* maybe_code = compiler.CompileStoreMegamorphic(receiver_maps,
1751 targets); 1742 targets);
1752 if (!maybe_code->ToObject(&object)) return maybe_code; 1743 if (!maybe_code->ToObject(&object)) return maybe_code;
1753 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); 1744 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 #undef ADDR 2513 #undef ADDR
2523 }; 2514 };
2524 2515
2525 2516
2526 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2517 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2527 return IC_utilities[id]; 2518 return IC_utilities[id];
2528 } 2519 }
2529 2520
2530 2521
2531 } } // namespace v8::internal 2522 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698