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

Side by Side Diff: src/stub-cache.cc

Issue 121893003: Correctly handle instances without elements in polymorphic keyed load/store. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test for optimized code Created 6 years, 11 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 | « no previous file | test/mjsunit/regress/regress-331416.js » ('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 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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 1661
1662 1662
1663 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps, 1663 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps,
1664 CodeHandleList* handlers) { 1664 CodeHandleList* handlers) {
1665 for (int i = 0; i < receiver_maps->length(); ++i) { 1665 for (int i = 0; i < receiver_maps->length(); ++i) {
1666 Handle<Map> receiver_map = receiver_maps->at(i); 1666 Handle<Map> receiver_map = receiver_maps->at(i);
1667 Handle<Code> cached_stub; 1667 Handle<Code> cached_stub;
1668 1668
1669 if ((receiver_map->instance_type() & kNotStringTag) == 0) { 1669 if ((receiver_map->instance_type() & kNotStringTag) == 0) {
1670 cached_stub = isolate()->builtins()->KeyedLoadIC_String(); 1670 cached_stub = isolate()->builtins()->KeyedLoadIC_String();
1671 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
1672 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow();
1671 } else { 1673 } else {
1672 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1674 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1673 ElementsKind elements_kind = receiver_map->elements_kind(); 1675 ElementsKind elements_kind = receiver_map->elements_kind();
1674 1676
1675 if (IsFastElementsKind(elements_kind) || 1677 if (IsFastElementsKind(elements_kind) ||
1676 IsExternalArrayElementsKind(elements_kind)) { 1678 IsExternalArrayElementsKind(elements_kind)) {
1677 cached_stub = 1679 cached_stub =
1678 KeyedLoadFastElementStub(is_js_array, 1680 KeyedLoadFastElementStub(is_js_array,
1679 elements_kind).GetCode(isolate()); 1681 elements_kind).GetCode(isolate());
1680 } else { 1682 } else {
(...skipping 24 matching lines...) Expand all
1705 // to be. Not all the elements are in place yet, pessimistic elements 1707 // to be. Not all the elements are in place yet, pessimistic elements
1706 // transitions are still important for performance. 1708 // transitions are still important for performance.
1707 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1709 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1708 ElementsKind elements_kind = receiver_map->elements_kind(); 1710 ElementsKind elements_kind = receiver_map->elements_kind();
1709 if (!transitioned_map.is_null()) { 1711 if (!transitioned_map.is_null()) {
1710 cached_stub = ElementsTransitionAndStoreStub( 1712 cached_stub = ElementsTransitionAndStoreStub(
1711 elements_kind, 1713 elements_kind,
1712 transitioned_map->elements_kind(), 1714 transitioned_map->elements_kind(),
1713 is_js_array, 1715 is_js_array,
1714 store_mode()).GetCode(isolate()); 1716 store_mode()).GetCode(isolate());
1717 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
1718 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow();
1715 } else { 1719 } else {
1716 if (receiver_map->has_fast_elements() || 1720 if (receiver_map->has_fast_elements() ||
1717 receiver_map->has_external_array_elements()) { 1721 receiver_map->has_external_array_elements()) {
1718 cached_stub = KeyedStoreFastElementStub( 1722 cached_stub = KeyedStoreFastElementStub(
1719 is_js_array, 1723 is_js_array,
1720 elements_kind, 1724 elements_kind,
1721 store_mode()).GetCode(isolate()); 1725 store_mode()).GetCode(isolate());
1722 } else { 1726 } else {
1723 cached_stub = KeyedStoreElementStub( 1727 cached_stub = KeyedStoreElementStub(
1724 is_js_array, 1728 is_js_array,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 Handle<FunctionTemplateInfo>( 1905 Handle<FunctionTemplateInfo>(
1902 FunctionTemplateInfo::cast(signature->receiver())); 1906 FunctionTemplateInfo::cast(signature->receiver()));
1903 } 1907 }
1904 } 1908 }
1905 1909
1906 is_simple_api_call_ = true; 1910 is_simple_api_call_ = true;
1907 } 1911 }
1908 1912
1909 1913
1910 } } // namespace v8::internal 1914 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-331416.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698