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

Side by Side Diff: src/objects.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 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS, 161 LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS,
162 FIRST_ELEMENTS_KIND = FAST_SMI_ONLY_ELEMENTS, 162 FIRST_ELEMENTS_KIND = FAST_SMI_ONLY_ELEMENTS,
163 LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS 163 LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS
164 }; 164 };
165 165
166 enum CompareMapMode { 166 enum CompareMapMode {
167 REQUIRE_EXACT_MAP, 167 REQUIRE_EXACT_MAP,
168 ALLOW_ELEMENT_TRANSITION_MAPS 168 ALLOW_ELEMENT_TRANSITION_MAPS
169 }; 169 };
170 170
171 enum KeyedAccessGrowMode {
172 ALLOW_JSARRAY_GROWTH,
173 DO_NOT_ALLOW_JSARRAY_GROWTH
174 };
175
171 const int kElementsKindCount = LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1; 176 const int kElementsKindCount = LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1;
172 177
173 void PrintElementsKind(FILE* out, ElementsKind kind); 178 void PrintElementsKind(FILE* out, ElementsKind kind);
174 179
175 inline bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, 180 inline bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
176 ElementsKind to_kind); 181 ElementsKind to_kind);
177 182
178 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. 183 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER.
179 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; 184 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER };
180 185
(...skipping 4028 matching lines...) Expand 10 before | Expand all | Expand 10 after
4209 // Get the safepoint entry for the given pc. 4214 // Get the safepoint entry for the given pc.
4210 SafepointEntry GetSafepointEntry(Address pc); 4215 SafepointEntry GetSafepointEntry(Address pc);
4211 4216
4212 // Mark this code object as not having a stack check table. Assumes kind 4217 // Mark this code object as not having a stack check table. Assumes kind
4213 // is FUNCTION. 4218 // is FUNCTION.
4214 void SetNoStackCheckTable(); 4219 void SetNoStackCheckTable();
4215 4220
4216 // Find the first map in an IC stub. 4221 // Find the first map in an IC stub.
4217 Map* FindFirstMap(); 4222 Map* FindFirstMap();
4218 4223
4224 static const int kExtraICStateGrowModeShift = 1;
4225
4226 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) {
Vyacheslav Egorov (Chromium) 2012/02/10 00:19:18 Consider using BitField to encode and decode extra
danno 2012/02/10 12:25:34 Done.
4227 return (extra_ic_state & 1)
4228 ? kStrictMode
4229 : kNonStrictMode;
4230 }
4231
4232 static inline KeyedAccessGrowMode GetKeyedAccessGrowMode(
4233 ExtraICState extra_ic_state) {
4234 return ((static_cast<int>(extra_ic_state) >>
4235 kExtraICStateGrowModeShift) != 0)
4236 ? ALLOW_JSARRAY_GROWTH
4237 : DO_NOT_ALLOW_JSARRAY_GROWTH;
4238 }
4239
4240 static inline ExtraICState ComputeExtraICState(
4241 KeyedAccessGrowMode grow_mode,
4242 StrictModeFlag strict_mode) {
4243 int value = (grow_mode == ALLOW_JSARRAY_GROWTH)
4244 ? (1 << kExtraICStateGrowModeShift) : 0;
4245 ASSERT(static_cast<int>(strict_mode) <= 1);
4246 ASSERT((value & strict_mode) == 0);
4247 value |= strict_mode;
4248 ASSERT(value <= ExtraICStateField::kMax);
4249 return static_cast<ExtraICState>(value);
4250 }
4251
4219 // Flags operations. 4252 // Flags operations.
4220 static inline Flags ComputeFlags( 4253 static inline Flags ComputeFlags(
4221 Kind kind, 4254 Kind kind,
4222 InlineCacheState ic_state = UNINITIALIZED, 4255 InlineCacheState ic_state = UNINITIALIZED,
4223 ExtraICState extra_ic_state = kNoExtraICState, 4256 ExtraICState extra_ic_state = kNoExtraICState,
4224 PropertyType type = NORMAL, 4257 PropertyType type = NORMAL,
4225 int argc = -1, 4258 int argc = -1,
4226 InlineCacheHolderFlag holder = OWN_MAP); 4259 InlineCacheHolderFlag holder = OWN_MAP);
4227 4260
4228 static inline Flags ComputeMonomorphicFlags( 4261 static inline Flags ComputeMonomorphicFlags(
(...skipping 4031 matching lines...) Expand 10 before | Expand all | Expand 10 after
8260 } else { 8293 } else {
8261 value &= ~(1 << bit_position); 8294 value &= ~(1 << bit_position);
8262 } 8295 }
8263 return value; 8296 return value;
8264 } 8297 }
8265 }; 8298 };
8266 8299
8267 } } // namespace v8::internal 8300 } } // namespace v8::internal
8268 8301
8269 #endif // V8_OBJECTS_H_ 8302 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698