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

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: remove unrelated changes 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
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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 1693 Code* generic_stub) {
Jakob Kummerow 2011/07/07 13:55:38 I think you no longer need |generic_stub|.
danno 2011/07/08 11:00:24 Done.
1699 if ((receiver_map->instance_type() & kNotStringTag) == 0) { 1694 if ((receiver_map->instance_type() & kNotStringTag) == 0) {
1700 ASSERT(string_stub() != NULL); 1695 ASSERT(string_stub() != NULL);
1701 return string_stub(); 1696 return string_stub();
1702 } else if (receiver_map->has_external_array_elements()) { 1697 } else {
1703 return GetExternalArrayStubWithoutMapCheck(receiver_map->elements_kind()); 1698 ASSERT(receiver_map->has_dictionary_elements() ||
1704 } else if (receiver_map->has_fast_elements()) { 1699 receiver_map->has_fast_elements() ||
1700 receiver_map->has_fast_double_elements() ||
1701 receiver_map->has_external_array_elements());
1705 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1702 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1706 return GetFastElementStubWithoutMapCheck(is_js_array); 1703 return GetElementStubWithoutMapCheck(is_js_array,
1707 } else { 1704 receiver_map->elements_kind());
1708 return generic_stub;
1709 } 1705 }
1710 } 1706 }
1711 1707
1712 1708
1713 MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver, 1709 MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver,
1714 bool is_store, 1710 bool is_store,
1715 StrictModeFlag strict_mode, 1711 StrictModeFlag strict_mode,
1716 Code* generic_stub) { 1712 Code* generic_stub) {
1717 Code* result = NULL; 1713 Code* result = NULL;
1718 if (receiver->HasFastElements() || 1714 if (receiver->HasFastElements() ||
1719 receiver->HasExternalArrayElements() || 1715 receiver->HasExternalArrayElements() ||
1716 receiver->HasFastDoubleElements() ||
1720 receiver->HasDictionaryElements()) { 1717 receiver->HasDictionaryElements()) {
1721 MaybeObject* maybe_stub = 1718 MaybeObject* maybe_stub =
1722 isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement( 1719 isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement(
1723 receiver, is_store, strict_mode); 1720 receiver, is_store, strict_mode);
1724 if (!maybe_stub->To(&result)) return maybe_stub; 1721 if (!maybe_stub->To(&result)) return maybe_stub;
1725 } else { 1722 } else {
1726 result = generic_stub; 1723 result = generic_stub;
1727 } 1724 }
1728 return result; 1725 return result;
1729 } 1726 }
1730 1727
1731 1728
1732 MaybeObject* KeyedStoreIC::GetFastElementStubWithoutMapCheck( 1729 MaybeObject* KeyedStoreIC::GetElementStubWithoutMapCheck(
1733 bool is_js_array) { 1730 bool is_js_array,
1734 return KeyedStoreFastElementStub(is_js_array).TryGetCode(); 1731 JSObject::ElementsKind elements_kind) {
1732 return KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode();
1735 } 1733 }
1736 1734
1737 1735
1738 MaybeObject* KeyedStoreIC::GetExternalArrayStubWithoutMapCheck(
1739 JSObject::ElementsKind elements_kind) {
1740 return KeyedStoreExternalArrayStub(elements_kind).TryGetCode();
1741 }
1742
1743
1744 MaybeObject* KeyedStoreIC::ConstructMegamorphicStub( 1736 MaybeObject* KeyedStoreIC::ConstructMegamorphicStub(
1745 MapList* receiver_maps, 1737 MapList* receiver_maps,
1746 CodeList* targets, 1738 CodeList* targets,
1747 StrictModeFlag strict_mode) { 1739 StrictModeFlag strict_mode) {
1748 Object* object; 1740 Object* object;
1749 KeyedStoreStubCompiler compiler(strict_mode); 1741 KeyedStoreStubCompiler compiler(strict_mode);
1750 MaybeObject* maybe_code = compiler.CompileStoreMegamorphic(receiver_maps, 1742 MaybeObject* maybe_code = compiler.CompileStoreMegamorphic(receiver_maps,
1751 targets); 1743 targets);
1752 if (!maybe_code->ToObject(&object)) return maybe_code; 1744 if (!maybe_code->ToObject(&object)) return maybe_code;
1753 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); 1745 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 #undef ADDR 2514 #undef ADDR
2523 }; 2515 };
2524 2516
2525 2517
2526 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2518 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2527 return IC_utilities[id]; 2519 return IC_utilities[id];
2528 } 2520 }
2529 2521
2530 2522
2531 } } // namespace v8::internal 2523 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698