Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IC_H_ | 5 #ifndef V8_IC_H_ | 
| 6 #define V8_IC_H_ | 6 #define V8_IC_H_ | 
| 7 | 7 | 
| 8 #include "src/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" | 
| 9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" | 
| 10 #include "src/messages.h" | 10 #include "src/messages.h" | 
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 bool is_vector_set() { return vector_set_; } | 99 bool is_vector_set() { return vector_set_; } | 
| 100 | 100 | 
| 101 bool UseVector() const { | 101 bool UseVector() const { | 
| 102 bool use = ICUseVector(kind()); | 102 bool use = ICUseVector(kind()); | 
| 103 // If we are supposed to use the nexus, verify the nexus is non-null. | 103 // If we are supposed to use the nexus, verify the nexus is non-null. | 
| 104 DCHECK(!use || nexus_ != nullptr); | 104 DCHECK(!use || nexus_ != nullptr); | 
| 105 return use; | 105 return use; | 
| 106 } | 106 } | 
| 107 | 107 | 
| 108 // Configure for most states. | 108 // Configure for most states. | 
| 109 void ConfigureVectorState(IC::State new_state); | 109 void ConfigureVectorState(IC::State new_state, Handle<Object> key); | 
| 110 // Configure the vector for MONOMORPHIC. | 110 // Configure the vector for MONOMORPHIC. | 
| 111 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, | 111 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, | 
| 112 Handle<Code> handler); | 112 Handle<Code> handler); | 
| 113 // Configure the vector for POLYMORPHIC. | 113 // Configure the vector for POLYMORPHIC. | 
| 114 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, | 114 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, | 
| 115 CodeHandleList* handlers); | 115 CodeHandleList* handlers); | 
| 116 // Configure the vector for POLYMORPHIC with transitions (only for element | 116 // Configure the vector for POLYMORPHIC with transitions (only for element | 
| 117 // keyed stores). | 117 // keyed stores). | 
| 118 void ConfigureVectorState(MapHandleList* maps, | 118 void ConfigureVectorState(MapHandleList* maps, | 
| 119 MapHandleList* transitioned_maps, | 119 MapHandleList* transitioned_maps, | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 static Handle<Code> initialize_stub_in_optimized_code( | 260 static Handle<Code> initialize_stub_in_optimized_code( | 
| 261 Isolate* isolate, int argc, ConvertReceiverMode mode, | 261 Isolate* isolate, int argc, ConvertReceiverMode mode, | 
| 262 TailCallMode tail_call_mode); | 262 TailCallMode tail_call_mode); | 
| 263 | 263 | 
| 264 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); | 264 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); | 
| 265 }; | 265 }; | 
| 266 | 266 | 
| 267 | 267 | 
| 268 class LoadIC : public IC { | 268 class LoadIC : public IC { | 
| 269 public: | 269 public: | 
| 270 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode) { | |
| 
 
Jakob Kummerow
2016/04/21 12:08:38
All the deletions in this file were dead code anyw
 
 | |
| 271 return LoadICState(typeof_mode).GetExtraICState(); | |
| 272 } | |
| 273 | |
| 274 TypeofMode typeof_mode() const { | 270 TypeofMode typeof_mode() const { | 
| 275 return LoadICState::GetTypeofMode(extra_ic_state()); | 271 return LoadICState::GetTypeofMode(extra_ic_state()); | 
| 276 } | 272 } | 
| 277 | 273 | 
| 278 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) | 274 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) | 
| 279 : IC(depth, isolate, nexus) { | 275 : IC(depth, isolate, nexus) { | 
| 280 DCHECK(nexus != NULL); | 276 DCHECK(nexus != NULL); | 
| 281 DCHECK(IsLoadStub()); | 277 DCHECK(IsLoadStub()); | 
| 282 } | 278 } | 
| 283 | 279 | 
| (...skipping 29 matching lines...) Expand all Loading... | |
| 313 | 309 | 
| 314 private: | 310 private: | 
| 315 Handle<Code> SimpleFieldLoad(FieldIndex index); | 311 Handle<Code> SimpleFieldLoad(FieldIndex index); | 
| 316 | 312 | 
| 317 friend class IC; | 313 friend class IC; | 
| 318 }; | 314 }; | 
| 319 | 315 | 
| 320 | 316 | 
| 321 class KeyedLoadIC : public LoadIC { | 317 class KeyedLoadIC : public LoadIC { | 
| 322 public: | 318 public: | 
| 323 // ExtraICState bits (building on IC) | |
| 324 class IcCheckTypeField | |
| 325 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {}; | |
| 326 | |
| 327 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode, | |
| 328 IcCheckType key_type) { | |
| 329 return LoadICState(typeof_mode).GetExtraICState() | | |
| 330 IcCheckTypeField::encode(key_type); | |
| 331 } | |
| 332 | |
| 333 static IcCheckType GetKeyType(ExtraICState extra_state) { | |
| 334 return IcCheckTypeField::decode(extra_state); | |
| 335 } | |
| 336 | |
| 337 KeyedLoadIC(FrameDepth depth, Isolate* isolate, | 319 KeyedLoadIC(FrameDepth depth, Isolate* isolate, | 
| 338 KeyedLoadICNexus* nexus = NULL) | 320 KeyedLoadICNexus* nexus = NULL) | 
| 339 : LoadIC(depth, isolate, nexus) { | 321 : LoadIC(depth, isolate, nexus) { | 
| 340 DCHECK(nexus != NULL); | 322 DCHECK(nexus != NULL); | 
| 341 } | 323 } | 
| 342 | 324 | 
| 343 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, | 325 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, | 
| 344 Handle<Object> key); | 326 Handle<Object> key); | 
| 345 | 327 | 
| 346 // Code generator routines. | 328 // Code generator routines. | 
| (...skipping 12 matching lines...) Expand all Loading... | |
| 359 // receiver is HeapObject because it could be a String or a JSObject | 341 // receiver is HeapObject because it could be a String or a JSObject | 
| 360 void UpdateLoadElement(Handle<HeapObject> receiver); | 342 void UpdateLoadElement(Handle<HeapObject> receiver); | 
| 361 | 343 | 
| 362 private: | 344 private: | 
| 363 friend class IC; | 345 friend class IC; | 
| 364 }; | 346 }; | 
| 365 | 347 | 
| 366 | 348 | 
| 367 class StoreIC : public IC { | 349 class StoreIC : public IC { | 
| 368 public: | 350 public: | 
| 369 static ExtraICState ComputeExtraICState(LanguageMode flag) { | |
| 370 return StoreICState(flag).GetExtraICState(); | |
| 371 } | |
| 372 | |
| 373 StoreIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) | 351 StoreIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) | 
| 374 : IC(depth, isolate, nexus) { | 352 : IC(depth, isolate, nexus) { | 
| 375 DCHECK(IsStoreStub()); | 353 DCHECK(IsStoreStub()); | 
| 376 } | 354 } | 
| 377 | 355 | 
| 378 LanguageMode language_mode() const { | 356 LanguageMode language_mode() const { | 
| 379 return StoreICState::GetLanguageMode(extra_ic_state()); | 357 return StoreICState::GetLanguageMode(extra_ic_state()); | 
| 380 } | 358 } | 
| 381 | 359 | 
| 382 // Code generators for stub routines. Only called once at startup. | 360 // Code generators for stub routines. Only called once at startup. | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 | 395 | 
| 418 | 396 | 
| 419 enum KeyedStoreCheckMap { kDontCheckMap, kCheckMap }; | 397 enum KeyedStoreCheckMap { kDontCheckMap, kCheckMap }; | 
| 420 | 398 | 
| 421 | 399 | 
| 422 enum KeyedStoreIncrementLength { kDontIncrementLength, kIncrementLength }; | 400 enum KeyedStoreIncrementLength { kDontIncrementLength, kIncrementLength }; | 
| 423 | 401 | 
| 424 | 402 | 
| 425 class KeyedStoreIC : public StoreIC { | 403 class KeyedStoreIC : public StoreIC { | 
| 426 public: | 404 public: | 
| 427 // ExtraICState bits (building on IC) | |
| 428 // ExtraICState bits | |
| 429 // When more language modes are added, these BitFields need to move too. | |
| 430 STATIC_ASSERT(i::LANGUAGE_END == 3); | |
| 431 class ExtraICStateKeyedAccessStoreMode | |
| 432 : public BitField<KeyedAccessStoreMode, 3, 3> {}; // NOLINT | |
| 433 | |
| 434 class IcCheckTypeField : public BitField<IcCheckType, 6, 1> {}; | |
| 435 | |
| 436 static ExtraICState ComputeExtraICState(LanguageMode flag, | |
| 437 KeyedAccessStoreMode mode) { | |
| 438 return StoreICState(flag).GetExtraICState() | | |
| 439 ExtraICStateKeyedAccessStoreMode::encode(mode) | | |
| 440 IcCheckTypeField::encode(ELEMENT); | |
| 441 } | |
| 442 | |
| 443 KeyedAccessStoreMode GetKeyedAccessStoreMode() { | 405 KeyedAccessStoreMode GetKeyedAccessStoreMode() { | 
| 444 return casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode(); | 406 return casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode(); | 
| 445 } | 407 } | 
| 446 | 408 | 
| 447 KeyedStoreIC(FrameDepth depth, Isolate* isolate, | 409 KeyedStoreIC(FrameDepth depth, Isolate* isolate, | 
| 448 KeyedStoreICNexus* nexus = NULL) | 410 KeyedStoreICNexus* nexus = NULL) | 
| 449 : StoreIC(depth, isolate, nexus) {} | 411 : StoreIC(depth, isolate, nexus) {} | 
| 450 | 412 | 
| 451 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, | 413 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, | 
| 452 Handle<Object> name, | 414 Handle<Object> name, | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 | 491 | 
| 530 // Helper for BinaryOpIC and CompareIC. | 492 // Helper for BinaryOpIC and CompareIC. | 
| 531 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 493 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 
| 532 void PatchInlinedSmiCode(Isolate* isolate, Address address, | 494 void PatchInlinedSmiCode(Isolate* isolate, Address address, | 
| 533 InlinedSmiCheck check); | 495 InlinedSmiCheck check); | 
| 534 | 496 | 
| 535 } // namespace internal | 497 } // namespace internal | 
| 536 } // namespace v8 | 498 } // namespace v8 | 
| 537 | 499 | 
| 538 #endif // V8_IC_H_ | 500 #endif // V8_IC_H_ | 
| OLD | NEW |