| 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" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 // | 15 // |
| 16 // IC is the base class for LoadIC, StoreIC, KeyedLoadIC, and KeyedStoreIC. | 16 // IC is the base class for LoadIC, StoreIC, KeyedLoadIC, and KeyedStoreIC. |
| 17 // | 17 // |
| 18 class IC { | 18 class IC { |
| 19 public: | 19 public: |
| 20 // Alias the inline cache state type to make the IC code more readable. | 20 // Alias the inline cache state type to make the IC code more readable. |
| 21 typedef InlineCacheState State; | 21 typedef InlineCacheState State; |
| 22 | 22 |
| 23 // The IC code is either invoked with no extra frames on the stack | 23 // The IC code is either invoked with no extra frames on the stack |
| 24 // or with a single extra frame for supporting calls. | 24 // or with a single extra frame for supporting calls. |
| 25 enum FrameDepth { NO_EXTRA_FRAME = 0, EXTRA_CALL_FRAME = 1 }; | 25 enum FrameDepth { NO_EXTRA_FRAME = 0, EXTRA_CALL_FRAME = 1 }; |
| 26 | 26 |
| 27 // Construct the IC structure with the given number of extra | 27 // Construct the IC structure with the given number of extra |
| 28 // JavaScript frames on the stack. | 28 // JavaScript frames on the stack. |
| 29 IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL, | 29 IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL); |
| 30 bool for_queries_only = false); | |
| 31 virtual ~IC() {} | 30 virtual ~IC() {} |
| 32 | 31 |
| 33 State state() const { return state_; } | 32 State state() const { return state_; } |
| 34 inline Address address() const; | 33 inline Address address() const; |
| 35 | 34 |
| 36 // Compute the current IC state based on the target stub, receiver and name. | 35 // Compute the current IC state based on the target stub, receiver and name. |
| 37 void UpdateState(Handle<Object> receiver, Handle<Object> name); | 36 void UpdateState(Handle<Object> receiver, Handle<Object> name); |
| 38 | 37 |
| 39 bool IsNameCompatibleWithPrototypeFailure(Handle<Object> name); | 38 bool IsNameCompatibleWithPrototypeFailure(Handle<Object> name); |
| 40 void MarkPrototypeFailure(Handle<Object> name) { | 39 void MarkPrototypeFailure(Handle<Object> name) { |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 LanguageMode language_mode() const { | 312 LanguageMode language_mode() const { |
| 314 return LoadICState::GetLanguageMode(extra_ic_state()); | 313 return LoadICState::GetLanguageMode(extra_ic_state()); |
| 315 } | 314 } |
| 316 | 315 |
| 317 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) | 316 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) |
| 318 : IC(depth, isolate, nexus) { | 317 : IC(depth, isolate, nexus) { |
| 319 DCHECK(nexus != NULL); | 318 DCHECK(nexus != NULL); |
| 320 DCHECK(IsLoadStub()); | 319 DCHECK(IsLoadStub()); |
| 321 } | 320 } |
| 322 | 321 |
| 323 // TODO(mvstanton): The for_queries_only is because we have a case where we | |
| 324 // construct an IC only to gather the contextual mode, and we don't have | |
| 325 // vector/slot information. for_queries_only is a temporary hack to enable the | |
| 326 // strong DCHECK protection around vector/slot. | |
| 327 LoadIC(FrameDepth depth, Isolate* isolate, bool for_queries_only) | |
| 328 : IC(depth, isolate, NULL, for_queries_only) { | |
| 329 DCHECK(IsLoadStub()); | |
| 330 } | |
| 331 | |
| 332 bool ShouldThrowReferenceError(Handle<Object> receiver) { | 322 bool ShouldThrowReferenceError(Handle<Object> receiver) { |
| 333 return receiver->IsGlobalObject() && typeof_mode() == NOT_INSIDE_TYPEOF; | 323 return receiver->IsGlobalObject() && typeof_mode() == NOT_INSIDE_TYPEOF; |
| 334 } | 324 } |
| 335 | 325 |
| 336 // Code generator routines. | 326 // Code generator routines. |
| 337 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 327 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
| 338 static void GenerateMiss(MacroAssembler* masm); | 328 static void GenerateMiss(MacroAssembler* masm); |
| 339 static void GenerateRuntimeGetProperty(MacroAssembler* masm, | 329 static void GenerateRuntimeGetProperty(MacroAssembler* masm, |
| 340 LanguageMode language_mode); | 330 LanguageMode language_mode); |
| 341 static void GenerateNormal(MacroAssembler* masm, LanguageMode language_mode); | 331 static void GenerateNormal(MacroAssembler* masm, LanguageMode language_mode); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 674 |
| 685 | 675 |
| 686 // Helper for BinaryOpIC and CompareIC. | 676 // Helper for BinaryOpIC and CompareIC. |
| 687 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 677 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 688 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 678 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
| 689 | 679 |
| 690 } | 680 } |
| 691 } // namespace v8::internal | 681 } // namespace v8::internal |
| 692 | 682 |
| 693 #endif // V8_IC_H_ | 683 #endif // V8_IC_H_ |
| OLD | NEW |