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

Side by Side Diff: src/type-feedback-vector.h

Issue 1029093002: v8:3539 - hold constructor feedback in weak cells (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_ 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_
6 #define V8_TYPE_FEEDBACK_VECTOR_H_ 6 #define V8_TYPE_FEEDBACK_VECTOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "src/checks.h" 10 #include "src/checks.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 Code::Kind GetKind(FeedbackVectorICSlot slot) const; 188 Code::Kind GetKind(FeedbackVectorICSlot slot) const;
189 189
190 template <typename Spec> 190 template <typename Spec>
191 static Handle<TypeFeedbackVector> Allocate(Isolate* isolate, 191 static Handle<TypeFeedbackVector> Allocate(Isolate* isolate,
192 const Spec* spec); 192 const Spec* spec);
193 193
194 static Handle<TypeFeedbackVector> Copy(Isolate* isolate, 194 static Handle<TypeFeedbackVector> Copy(Isolate* isolate,
195 Handle<TypeFeedbackVector> vector); 195 Handle<TypeFeedbackVector> vector);
196 196
197 // Clears the vector slots and the vector ic slots. 197 // Clears the vector slots and the vector ic slots.
198 void ClearSlots(SharedFunctionInfo* shared); 198 void ClearSlots(SharedFunctionInfo* shared) { ClearSlotsImpl(shared, true); }
199 void ClearSlotsAtGCTime(SharedFunctionInfo* shared) {
200 ClearSlotsImpl(shared, false);
201 }
202
199 void ClearICSlots(SharedFunctionInfo* shared) { 203 void ClearICSlots(SharedFunctionInfo* shared) {
200 ClearICSlotsImpl(shared, true); 204 ClearICSlotsImpl(shared, true);
201 } 205 }
202 void ClearICSlotsAtGCTime(SharedFunctionInfo* shared) { 206 void ClearICSlotsAtGCTime(SharedFunctionInfo* shared) {
203 ClearICSlotsImpl(shared, false); 207 ClearICSlotsImpl(shared, false);
204 } 208 }
205 209
206 // The object that indicates an uninitialized cache. 210 // The object that indicates an uninitialized cache.
207 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); 211 static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
208 212
(...skipping 21 matching lines...) Expand all
230 }; 234 };
231 235
232 static const int kVectorICKindBits = 2; 236 static const int kVectorICKindBits = 2;
233 static VectorICKind FromCodeKind(Code::Kind kind); 237 static VectorICKind FromCodeKind(Code::Kind kind);
234 static Code::Kind FromVectorICKind(VectorICKind kind); 238 static Code::Kind FromVectorICKind(VectorICKind kind);
235 void SetKind(FeedbackVectorICSlot slot, Code::Kind kind); 239 void SetKind(FeedbackVectorICSlot slot, Code::Kind kind);
236 240
237 typedef BitSetComputer<VectorICKind, kVectorICKindBits, kSmiValueSize, 241 typedef BitSetComputer<VectorICKind, kVectorICKindBits, kSmiValueSize,
238 uint32_t> VectorICComputer; 242 uint32_t> VectorICComputer;
239 243
244 void ClearSlotsImpl(SharedFunctionInfo* shared, bool force_clear);
240 void ClearICSlotsImpl(SharedFunctionInfo* shared, bool force_clear); 245 void ClearICSlotsImpl(SharedFunctionInfo* shared, bool force_clear);
241 246
242 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackVector); 247 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackVector);
243 }; 248 };
244 249
245 250
251 // The following asserts protect an optimization in type feedback vector
252 // code that looks into the contents of a slot assuming to find a String,
253 // a Symbol, an AllocationSite, a WeakCell, or a FixedArray.
254 STATIC_ASSERT(WeakCell::kSize >= 2 * kPointerSize);
255 STATIC_ASSERT(WeakCell::kValueOffset == AllocationSite::kTransitionInfoOffset);
256 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset);
257 STATIC_ASSERT(WeakCell::kValueOffset == Name::kHashFieldSlot);
258 // Verify that an empty hash field looks like a tagged object, but can't
259 // possibly be confused with a pointer.
260 STATIC_ASSERT((Name::kEmptyHashField & kHeapObjectTag) == kHeapObjectTag);
261 STATIC_ASSERT(Name::kEmptyHashField == 0x3);
262 // Verify that a set hash field will not look like a tagged object.
263 STATIC_ASSERT(Name::kHashNotComputedMask == kHeapObjectTag);
264
265
246 // A FeedbackNexus is the combination of a TypeFeedbackVector and a slot. 266 // A FeedbackNexus is the combination of a TypeFeedbackVector and a slot.
247 // Derived classes customize the update and retrieval of feedback. 267 // Derived classes customize the update and retrieval of feedback.
248 class FeedbackNexus { 268 class FeedbackNexus {
249 public: 269 public:
250 FeedbackNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) 270 FeedbackNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot)
251 : vector_handle_(vector), vector_(NULL), slot_(slot) {} 271 : vector_handle_(vector), vector_(NULL), slot_(slot) {}
252 FeedbackNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) 272 FeedbackNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
253 : vector_(vector), slot_(slot) {} 273 : vector_(vector), slot_(slot) {}
254 virtual ~FeedbackNexus() {} 274 virtual ~FeedbackNexus() {}
255 275
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 void ConfigurePolymorphic(Handle<Name> name, MapHandleList* maps, 416 void ConfigurePolymorphic(Handle<Name> name, MapHandleList* maps,
397 CodeHandleList* handlers); 417 CodeHandleList* handlers);
398 418
399 InlineCacheState StateFromFeedback() const OVERRIDE; 419 InlineCacheState StateFromFeedback() const OVERRIDE;
400 Name* FindFirstName() const OVERRIDE; 420 Name* FindFirstName() const OVERRIDE;
401 }; 421 };
402 } 422 }
403 } // namespace v8::internal 423 } // namespace v8::internal
404 424
405 #endif // V8_TRANSITIONS_H_ 425 #endif // V8_TRANSITIONS_H_
OLDNEW
« src/arm/code-stubs-arm.cc ('K') | « src/objects.cc ('k') | src/type-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698