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

Side by Side Diff: src/ic.cc

Issue 7112010: Plumbing changes to merge various element kind implementaions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 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
« no previous file with comments | « src/ic.h ('k') | src/lithium.h » ('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 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 } 1063 }
1064 1064
1065 #ifdef DEBUG 1065 #ifdef DEBUG
1066 TraceIC("LoadIC", name, state, target()); 1066 TraceIC("LoadIC", name, state, target());
1067 #endif 1067 #endif
1068 } 1068 }
1069 1069
1070 1070
1071 String* KeyedLoadIC::GetStubNameForCache(IC::State ic_state) { 1071 String* KeyedLoadIC::GetStubNameForCache(IC::State ic_state) {
1072 if (ic_state == MONOMORPHIC) { 1072 if (ic_state == MONOMORPHIC) {
1073 return isolate()->heap()->KeyedLoadSpecializedMonomorphic_symbol(); 1073 return isolate()->heap()->KeyedLoadElementMonomorphic_symbol();
1074 } else { 1074 } else {
1075 ASSERT(ic_state == MEGAMORPHIC); 1075 ASSERT(ic_state == MEGAMORPHIC);
1076 return isolate()->heap()->KeyedLoadSpecializedPolymorphic_symbol(); 1076 return isolate()->heap()->KeyedLoadElementPolymorphic_symbol();
1077 } 1077 }
1078 } 1078 }
1079 1079
1080 1080
1081 MaybeObject* KeyedLoadIC::GetFastElementStubWithoutMapCheck( 1081 MaybeObject* KeyedLoadIC::GetFastElementStubWithoutMapCheck(
1082 bool is_js_array) { 1082 bool is_js_array) {
1083 return KeyedLoadFastElementStub().TryGetCode(); 1083 return KeyedLoadFastElementStub().TryGetCode();
1084 } 1084 }
1085 1085
1086 1086
1087 MaybeObject* KeyedLoadIC::GetExternalArrayStubWithoutMapCheck( 1087 MaybeObject* KeyedLoadIC::GetExternalArrayStubWithoutMapCheck(
1088 ExternalArrayType array_type) { 1088 JSObject::ElementsKind elements_kind) {
1089 return KeyedLoadExternalArrayStub(array_type).TryGetCode(); 1089 return KeyedLoadExternalArrayStub(elements_kind).TryGetCode();
1090 } 1090 }
1091 1091
1092 1092
1093 MaybeObject* KeyedLoadIC::ConstructMegamorphicStub( 1093 MaybeObject* KeyedLoadIC::ConstructMegamorphicStub(
1094 MapList* receiver_maps, 1094 MapList* receiver_maps,
1095 CodeList* targets, 1095 CodeList* targets,
1096 StrictModeFlag strict_mode) { 1096 StrictModeFlag strict_mode) {
1097 Object* object; 1097 Object* object;
1098 KeyedLoadStubCompiler compiler; 1098 KeyedLoadStubCompiler compiler;
1099 MaybeObject* maybe_code = compiler.CompileLoadMegamorphic(receiver_maps, 1099 MaybeObject* maybe_code = compiler.CompileLoadMegamorphic(receiver_maps,
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 Code::Flags flags = Code::ComputeMonomorphicFlags(kind, 1690 Code::Flags flags = Code::ComputeMonomorphicFlags(kind,
1691 NORMAL, 1691 NORMAL,
1692 strict_mode); 1692 strict_mode);
1693 String* monomorphic_name = GetStubNameForCache(MONOMORPHIC); 1693 String* monomorphic_name = GetStubNameForCache(MONOMORPHIC);
1694 Object* maybe_default_stub = receiver_map->FindInCodeCache(monomorphic_name, 1694 Object* maybe_default_stub = receiver_map->FindInCodeCache(monomorphic_name,
1695 flags); 1695 flags);
1696 if (maybe_default_stub->IsUndefined()) { 1696 if (maybe_default_stub->IsUndefined()) {
1697 return generic_stub; 1697 return generic_stub;
1698 } 1698 }
1699 Code* default_stub = Code::cast(maybe_default_stub); 1699 Code* default_stub = Code::cast(maybe_default_stub);
1700 return GetExternalArrayStubWithoutMapCheck( 1700 Map* first_map = default_stub->FindFirstMap();
1701 default_stub->external_array_type()); 1701 return GetExternalArrayStubWithoutMapCheck(first_map->elements_kind());
1702 } else if (receiver_map->has_fast_elements()) { 1702 } else if (receiver_map->has_fast_elements()) {
1703 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1703 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1704 return GetFastElementStubWithoutMapCheck(is_js_array); 1704 return GetFastElementStubWithoutMapCheck(is_js_array);
1705 } else { 1705 } else {
1706 return generic_stub; 1706 return generic_stub;
1707 } 1707 }
1708 } 1708 }
1709 1709
1710 1710
1711 MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver, 1711 MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver,
1712 bool is_store, 1712 bool is_store,
1713 StrictModeFlag strict_mode, 1713 StrictModeFlag strict_mode,
1714 Code* generic_stub) { 1714 Code* generic_stub) {
1715 Code* result = NULL; 1715 Code* result = NULL;
1716 if (receiver->HasExternalArrayElements()) { 1716 if (receiver->HasFastElements() ||
1717 receiver->HasExternalArrayElements()) {
1717 MaybeObject* maybe_stub = 1718 MaybeObject* maybe_stub =
1718 isolate()->stub_cache()->ComputeKeyedLoadOrStoreExternalArray( 1719 isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement(
1719 receiver, is_store, strict_mode);
1720 if (!maybe_stub->To(&result)) return maybe_stub;
1721 } else if (receiver->map()->has_fast_elements()) {
1722 MaybeObject* maybe_stub =
1723 isolate()->stub_cache()->ComputeKeyedLoadOrStoreFastElement(
1724 receiver, is_store, strict_mode); 1720 receiver, is_store, strict_mode);
1725 if (!maybe_stub->To(&result)) return maybe_stub; 1721 if (!maybe_stub->To(&result)) return maybe_stub;
1726 } else { 1722 } else {
1727 result = generic_stub; 1723 result = generic_stub;
1728 } 1724 }
1729 return result; 1725 return result;
1730 } 1726 }
1731 1727
1732 1728
1733 String* KeyedStoreIC::GetStubNameForCache(IC::State ic_state) { 1729 String* KeyedStoreIC::GetStubNameForCache(IC::State ic_state) {
1734 if (ic_state == MONOMORPHIC) { 1730 if (ic_state == MONOMORPHIC) {
1735 return isolate()->heap()->KeyedStoreSpecializedMonomorphic_symbol(); 1731 return isolate()->heap()->KeyedStoreElementMonomorphic_symbol();
1736 } else { 1732 } else {
1737 ASSERT(ic_state == MEGAMORPHIC); 1733 ASSERT(ic_state == MEGAMORPHIC);
1738 return isolate()->heap()->KeyedStoreSpecializedPolymorphic_symbol(); 1734 return isolate()->heap()->KeyedStoreElementPolymorphic_symbol();
1739 } 1735 }
1740 } 1736 }
1741 1737
1742 1738
1743 MaybeObject* KeyedStoreIC::GetFastElementStubWithoutMapCheck( 1739 MaybeObject* KeyedStoreIC::GetFastElementStubWithoutMapCheck(
1744 bool is_js_array) { 1740 bool is_js_array) {
1745 return KeyedStoreFastElementStub(is_js_array).TryGetCode(); 1741 return KeyedStoreFastElementStub(is_js_array).TryGetCode();
1746 } 1742 }
1747 1743
1748 1744
1749 MaybeObject* KeyedStoreIC::GetExternalArrayStubWithoutMapCheck( 1745 MaybeObject* KeyedStoreIC::GetExternalArrayStubWithoutMapCheck(
1750 ExternalArrayType array_type) { 1746 JSObject::ElementsKind elements_kind) {
1751 return KeyedStoreExternalArrayStub(array_type).TryGetCode(); 1747 return KeyedStoreExternalArrayStub(elements_kind).TryGetCode();
1752 } 1748 }
1753 1749
1754 1750
1755 MaybeObject* KeyedStoreIC::ConstructMegamorphicStub( 1751 MaybeObject* KeyedStoreIC::ConstructMegamorphicStub(
1756 MapList* receiver_maps, 1752 MapList* receiver_maps,
1757 CodeList* targets, 1753 CodeList* targets,
1758 StrictModeFlag strict_mode) { 1754 StrictModeFlag strict_mode) {
1759 Object* object; 1755 Object* object;
1760 KeyedStoreStubCompiler compiler(strict_mode); 1756 KeyedStoreStubCompiler compiler(strict_mode);
1761 MaybeObject* maybe_code = compiler.CompileStoreMegamorphic(receiver_maps, 1757 MaybeObject* maybe_code = compiler.CompileStoreMegamorphic(receiver_maps,
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 #undef ADDR 2532 #undef ADDR
2537 }; 2533 };
2538 2534
2539 2535
2540 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2536 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2541 return IC_utilities[id]; 2537 return IC_utilities[id];
2542 } 2538 }
2543 2539
2544 2540
2545 } } // namespace v8::internal 2541 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698