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

Side by Side Diff: src/code-stubs.h

Issue 9310117: Implement KeyedStoreICs to grow arrays on out-of-bound stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits Created 8 years, 10 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 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
11 // with the distribution. 11 // with the distribution.
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 private: 978 private:
979 ElementsKind elements_kind_; 979 ElementsKind elements_kind_;
980 980
981 DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub); 981 DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub);
982 }; 982 };
983 983
984 984
985 class KeyedStoreElementStub : public CodeStub { 985 class KeyedStoreElementStub : public CodeStub {
986 public: 986 public:
987 KeyedStoreElementStub(bool is_js_array, 987 KeyedStoreElementStub(bool is_js_array,
988 ElementsKind elements_kind) 988 ElementsKind elements_kind,
989 KeyedAccessGrowMode grow_mode)
989 : is_js_array_(is_js_array), 990 : is_js_array_(is_js_array),
Jakob Kummerow 2012/02/09 14:51:25 nit: 4-space indent
danno 2012/02/10 12:25:34 Done.
990 elements_kind_(elements_kind) { } 991 elements_kind_(elements_kind),
992 grow_mode_(grow_mode) { }
991 993
992 Major MajorKey() { return KeyedStoreElement; } 994 Major MajorKey() { return KeyedStoreElement; }
993 int MinorKey() { 995 int MinorKey() {
994 return (is_js_array_ ? 0 : kElementsKindCount) + elements_kind_; 996 int multiplier = is_js_array_ ? 1 : 0;
Vyacheslav Egorov (Chromium) 2012/02/10 00:19:18 is there any particular reason why you don't want
danno 2012/02/10 12:25:34 Done.
997 multiplier += (grow_mode_ == ALLOW_JSARRAY_GROWTH) ? 2 : 0;
998 return (multiplier * kElementsKindCount) + elements_kind_;
995 } 999 }
996 1000
997 void Generate(MacroAssembler* masm); 1001 void Generate(MacroAssembler* masm);
998 1002
999 private: 1003 private:
1000 bool is_js_array_; 1004 bool is_js_array_;
1001 ElementsKind elements_kind_; 1005 ElementsKind elements_kind_;
1006 KeyedAccessGrowMode grow_mode_;
1002 1007
1003 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); 1008 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub);
1004 }; 1009 };
1005 1010
1006 1011
1007 class ToBooleanStub: public CodeStub { 1012 class ToBooleanStub: public CodeStub {
1008 public: 1013 public:
1009 enum Type { 1014 enum Type {
1010 UNDEFINED, 1015 UNDEFINED,
1011 BOOLEAN, 1016 BOOLEAN,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 Register tos_; 1074 Register tos_;
1070 Types types_; 1075 Types types_;
1071 }; 1076 };
1072 1077
1073 1078
1074 class ElementsTransitionAndStoreStub : public CodeStub { 1079 class ElementsTransitionAndStoreStub : public CodeStub {
1075 public: 1080 public:
1076 ElementsTransitionAndStoreStub(ElementsKind from, 1081 ElementsTransitionAndStoreStub(ElementsKind from,
1077 ElementsKind to, 1082 ElementsKind to,
1078 bool is_jsarray, 1083 bool is_jsarray,
1079 StrictModeFlag strict_mode) 1084 StrictModeFlag strict_mode,
1085 KeyedAccessGrowMode grow_mode)
1080 : from_(from), 1086 : from_(from),
1081 to_(to), 1087 to_(to),
1082 is_jsarray_(is_jsarray), 1088 is_jsarray_(is_jsarray),
1083 strict_mode_(strict_mode) {} 1089 strict_mode_(strict_mode),
1090 grow_mode_(grow_mode) {}
1084 1091
1085 private: 1092 private:
1086 class FromBits: public BitField<ElementsKind, 0, 8> {}; 1093 class FromBits: public BitField<ElementsKind, 0, 8> {};
1087 class ToBits: public BitField<ElementsKind, 8, 8> {}; 1094 class ToBits: public BitField<ElementsKind, 8, 8> {};
1088 class IsJSArrayBits: public BitField<bool, 16, 8> {}; 1095 class IsJSArrayBits: public BitField<bool, 16, 8> {};
1089 class StrictModeBits: public BitField<StrictModeFlag, 24, 8> {}; 1096 class StrictModeBits: public BitField<StrictModeFlag, 24, 8> {};
1090 1097
1091 Major MajorKey() { return ElementsTransitionAndStore; } 1098 Major MajorKey() { return ElementsTransitionAndStore; }
1092 int MinorKey() { 1099 int MinorKey() {
1093 return FromBits::encode(from_) | 1100 return FromBits::encode(from_) |
1094 ToBits::encode(to_) | 1101 ToBits::encode(to_) |
1095 IsJSArrayBits::encode(is_jsarray_) | 1102 IsJSArrayBits::encode(is_jsarray_) |
1096 StrictModeBits::encode(strict_mode_); 1103 StrictModeBits::encode(strict_mode_);
Vyacheslav Egorov (Chromium) 2012/02/10 00:19:18 i think grow_mode_ should be embedded into MinorKe
danno 2012/02/10 12:25:34 Done.
1097 } 1104 }
1098 1105
1099 void Generate(MacroAssembler* masm); 1106 void Generate(MacroAssembler* masm);
1100 1107
1101 ElementsKind from_; 1108 ElementsKind from_;
1102 ElementsKind to_; 1109 ElementsKind to_;
1103 bool is_jsarray_; 1110 bool is_jsarray_;
1104 StrictModeFlag strict_mode_; 1111 StrictModeFlag strict_mode_;
1112 KeyedAccessGrowMode grow_mode_;
1105 1113
1106 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); 1114 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub);
1107 }; 1115 };
1108 1116
1109 1117
1110 class StoreArrayLiteralElementStub : public CodeStub { 1118 class StoreArrayLiteralElementStub : public CodeStub {
1111 public: 1119 public:
1112 explicit StoreArrayLiteralElementStub() {} 1120 explicit StoreArrayLiteralElementStub() {}
1113 1121
1114 private: 1122 private:
1115 Major MajorKey() { return StoreArrayLiteralElement; } 1123 Major MajorKey() { return StoreArrayLiteralElement; }
1116 int MinorKey() { return 0; } 1124 int MinorKey() { return 0; }
1117 1125
1118 void Generate(MacroAssembler* masm); 1126 void Generate(MacroAssembler* masm);
1119 1127
1120 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 1128 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
1121 }; 1129 };
1122 1130
1123 } } // namespace v8::internal 1131 } } // namespace v8::internal
1124 1132
1125 #endif // V8_CODE_STUBS_H_ 1133 #endif // V8_CODE_STUBS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698