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

Side by Side Diff: src/ic.h

Issue 183803022: Pass a Code object to Assembler::(set_)target_address_at for use by ool constant pool. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 State state() const { return state_; } 94 State state() const { return state_; }
95 inline Address address() const; 95 inline Address address() const;
96 96
97 // Compute the current IC state based on the target stub, receiver and name. 97 // Compute the current IC state based on the target stub, receiver and name.
98 void UpdateState(Handle<Object> receiver, Handle<Object> name); 98 void UpdateState(Handle<Object> receiver, Handle<Object> name);
99 void MarkMonomorphicPrototypeFailure() { 99 void MarkMonomorphicPrototypeFailure() {
100 state_ = MONOMORPHIC_PROTOTYPE_FAILURE; 100 state_ = MONOMORPHIC_PROTOTYPE_FAILURE;
101 } 101 }
102 102
103 // Clear the inline cache to initial state. 103 // Clear the inline cache to initial state.
104 static void Clear(Isolate* isolate, Address address); 104 static void Clear(Isolate* isolate,
105 Address address,
106 ConstantPoolArray* constant_pool);
105 107
106 #ifdef DEBUG 108 #ifdef DEBUG
107 bool IsLoadStub() const { 109 bool IsLoadStub() const {
108 return target()->is_load_stub() || target()->is_keyed_load_stub(); 110 return target()->is_load_stub() || target()->is_keyed_load_stub();
109 } 111 }
110 112
111 bool IsStoreStub() const { 113 bool IsStoreStub() const {
112 return target()->is_store_stub() || target()->is_keyed_store_stub(); 114 return target()->is_store_stub() || target()->is_keyed_store_stub();
113 } 115 }
114 #endif 116 #endif
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 150
149 protected: 151 protected:
150 // Get the call-site target; used for determining the state. 152 // Get the call-site target; used for determining the state.
151 Handle<Code> target() const { return target_; } 153 Handle<Code> target() const { return target_; }
152 154
153 Address fp() const { return fp_; } 155 Address fp() const { return fp_; }
154 Address pc() const { return *pc_address_; } 156 Address pc() const { return *pc_address_; }
155 Isolate* isolate() const { return isolate_; } 157 Isolate* isolate() const { return isolate_; }
156 158
157 #ifdef ENABLE_DEBUGGER_SUPPORT 159 #ifdef ENABLE_DEBUGGER_SUPPORT
158 // Computes the address in the original code when the code running is 160 // Get the shared function info of the caller.
159 // containing break points (calls to DebugBreakXXX builtins). 161 SharedFunctionInfo* GetSharedFunctionInfo() const;
160 Address OriginalCodeAddress() const; 162 // Get the code object of the caller.
163 Code* GetCode() const;
164 // Get the original (non-breakpointed) code object of the caller.
165 Code* GetOriginalCode() const;
161 #endif 166 #endif
162 167
163 // Set the call-site target. 168 // Set the call-site target.
164 void set_target(Code* code) { 169 void set_target(Code* code) {
165 SetTargetAtAddress(address(), code); 170 SetTargetAtAddress(address(), code, constant_pool());
166 target_set_ = true; 171 target_set_ = true;
167 } 172 }
168 173
169 bool is_target_set() { return target_set_; } 174 bool is_target_set() { return target_set_; }
170 175
171 #ifdef DEBUG 176 #ifdef DEBUG
172 char TransitionMarkFromState(IC::State state); 177 char TransitionMarkFromState(IC::State state);
173 178
174 void TraceIC(const char* type, Handle<Object> name); 179 void TraceIC(const char* type, Handle<Object> name);
175 #endif 180 #endif
176 181
177 Failure* TypeError(const char* type, 182 Failure* TypeError(const char* type,
178 Handle<Object> object, 183 Handle<Object> object,
179 Handle<Object> key); 184 Handle<Object> key);
180 Failure* ReferenceError(const char* type, Handle<String> name); 185 Failure* ReferenceError(const char* type, Handle<String> name);
181 186
182 // Access the target code for the given IC address. 187 // Access the target code for the given IC address.
183 static inline Code* GetTargetAtAddress(Address address); 188 static inline Code* GetTargetAtAddress(Address address,
184 static inline void SetTargetAtAddress(Address address, Code* target); 189 ConstantPoolArray* constant_pool);
190 static inline void SetTargetAtAddress(Address address,
191 Code* target,
192 ConstantPoolArray* constant_pool);
185 static void PostPatching(Address address, Code* target, Code* old_target); 193 static void PostPatching(Address address, Code* target, Code* old_target);
186 194
187 // Compute the handler either by compiling or by retrieving a cached version. 195 // Compute the handler either by compiling or by retrieving a cached version.
188 Handle<Code> ComputeHandler(LookupResult* lookup, 196 Handle<Code> ComputeHandler(LookupResult* lookup,
189 Handle<Object> object, 197 Handle<Object> object,
190 Handle<String> name, 198 Handle<String> name,
191 Handle<Object> value = Handle<Code>::null()); 199 Handle<Object> value = Handle<Code>::null());
192 virtual Handle<Code> CompileHandler(LookupResult* lookup, 200 virtual Handle<Code> CompileHandler(LookupResult* lookup,
193 Handle<Object> object, 201 Handle<Object> object,
194 Handle<String> name, 202 Handle<String> name,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, 241 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
234 Handle<String> name); 242 Handle<String> name);
235 void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name); 243 void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name);
236 244
237 ExtraICState extra_ic_state() const { return extra_ic_state_; } 245 ExtraICState extra_ic_state() const { return extra_ic_state_; }
238 void set_extra_ic_state(ExtraICState state) { 246 void set_extra_ic_state(ExtraICState state) {
239 extra_ic_state_ = state; 247 extra_ic_state_ = state;
240 } 248 }
241 249
242 private: 250 private:
243 Code* raw_target() const { return GetTargetAtAddress(address()); } 251 Code* raw_target() const {
252 return GetTargetAtAddress(address(), constant_pool());
253 }
254 inline ConstantPoolArray* constant_pool() const;
255 inline ConstantPoolArray* raw_constant_pool() const;
244 256
245 // Frame pointer for the frame that uses (calls) the IC. 257 // Frame pointer for the frame that uses (calls) the IC.
246 Address fp_; 258 Address fp_;
247 259
248 // All access to the program counter of an IC structure is indirect 260 // All access to the program counter of an IC structure is indirect
249 // to make the code GC safe. This feature is crucial since 261 // to make the code GC safe. This feature is crucial since
250 // GetProperty and SetProperty are called and they in turn might 262 // GetProperty and SetProperty are called and they in turn might
251 // invoke the garbage collector. 263 // invoke the garbage collector.
252 Address* pc_address_; 264 Address* pc_address_;
253 265
254 Isolate* isolate_; 266 Isolate* isolate_;
255 267
268 // The constant pool of the code which originally called the IC (which might
269 // be for the breakpointed copy of the original code).
270 Handle<ConstantPoolArray> raw_constant_pool_;
271
256 // The original code target that missed. 272 // The original code target that missed.
257 Handle<Code> target_; 273 Handle<Code> target_;
258 State state_; 274 State state_;
259 bool target_set_; 275 bool target_set_;
260 276
261 ExtraICState extra_ic_state_; 277 ExtraICState extra_ic_state_;
262 278
263 DISALLOW_IMPLICIT_CONSTRUCTORS(IC); 279 DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
264 }; 280 };
265 281
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 382
367 virtual Handle<Code> pre_monomorphic_stub() { 383 virtual Handle<Code> pre_monomorphic_stub() {
368 return pre_monomorphic_stub(isolate(), extra_ic_state()); 384 return pre_monomorphic_stub(isolate(), extra_ic_state());
369 } 385 }
370 386
371 Handle<Code> SimpleFieldLoad(int offset, 387 Handle<Code> SimpleFieldLoad(int offset,
372 bool inobject = true, 388 bool inobject = true,
373 Representation representation = 389 Representation representation =
374 Representation::Tagged()); 390 Representation::Tagged());
375 391
376 static void Clear(Isolate* isolate, Address address, Code* target); 392 static void Clear(Isolate* isolate,
393 Address address,
394 Code* target,
395 ConstantPoolArray* constant_pool);
377 396
378 friend class IC; 397 friend class IC;
379 }; 398 };
380 399
381 400
382 class KeyedLoadIC: public LoadIC { 401 class KeyedLoadIC: public LoadIC {
383 public: 402 public:
384 explicit KeyedLoadIC(FrameDepth depth, Isolate* isolate) 403 explicit KeyedLoadIC(FrameDepth depth, Isolate* isolate)
385 : LoadIC(depth, isolate) { 404 : LoadIC(depth, isolate) {
386 ASSERT(target()->is_keyed_load_stub()); 405 ASSERT(target()->is_keyed_load_stub());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 Handle<Code> indexed_interceptor_stub() { 455 Handle<Code> indexed_interceptor_stub() {
437 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); 456 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
438 } 457 }
439 Handle<Code> non_strict_arguments_stub() { 458 Handle<Code> non_strict_arguments_stub() {
440 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); 459 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments();
441 } 460 }
442 Handle<Code> string_stub() { 461 Handle<Code> string_stub() {
443 return isolate()->builtins()->KeyedLoadIC_String(); 462 return isolate()->builtins()->KeyedLoadIC_String();
444 } 463 }
445 464
446 static void Clear(Isolate* isolate, Address address, Code* target); 465 static void Clear(Isolate* isolate,
466 Address address,
467 Code* target,
468 ConstantPoolArray* constant_pool);
447 469
448 friend class IC; 470 friend class IC;
449 }; 471 };
450 472
451 473
452 class StoreIC: public IC { 474 class StoreIC: public IC {
453 public: 475 public:
454 class StrictModeState: public BitField<StrictModeFlag, 1, 1> {}; 476 class StrictModeState: public BitField<StrictModeFlag, 1, 1> {};
455 static ExtraICState ComputeExtraICState(StrictModeFlag flag) { 477 static ExtraICState ComputeExtraICState(StrictModeFlag flag) {
456 return StrictModeState::encode(flag); 478 return StrictModeState::encode(flag);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 InlineCacheHolderFlag cache_holder); 549 InlineCacheHolderFlag cache_holder);
528 550
529 private: 551 private:
530 void set_target(Code* code) { 552 void set_target(Code* code) {
531 // Strict mode must be preserved across IC patching. 553 // Strict mode must be preserved across IC patching.
532 ASSERT(GetStrictMode(code->extra_ic_state()) == 554 ASSERT(GetStrictMode(code->extra_ic_state()) ==
533 GetStrictMode(target()->extra_ic_state())); 555 GetStrictMode(target()->extra_ic_state()));
534 IC::set_target(code); 556 IC::set_target(code);
535 } 557 }
536 558
537 static void Clear(Isolate* isolate, Address address, Code* target); 559 static void Clear(Isolate* isolate,
560 Address address,
561 Code* target,
562 ConstantPoolArray* constant_pool);
538 563
539 friend class IC; 564 friend class IC;
540 }; 565 };
541 566
542 567
543 enum KeyedStoreCheckMap { 568 enum KeyedStoreCheckMap {
544 kDontCheckMap, 569 kDontCheckMap,
545 kCheckMap 570 kCheckMap
546 }; 571 };
547 572
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 659 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
635 } else { 660 } else {
636 return isolate()->builtins()->KeyedStoreIC_Generic(); 661 return isolate()->builtins()->KeyedStoreIC_Generic();
637 } 662 }
638 } 663 }
639 664
640 Handle<Code> non_strict_arguments_stub() { 665 Handle<Code> non_strict_arguments_stub() {
641 return isolate()->builtins()->KeyedStoreIC_NonStrictArguments(); 666 return isolate()->builtins()->KeyedStoreIC_NonStrictArguments();
642 } 667 }
643 668
644 static void Clear(Isolate* isolate, Address address, Code* target); 669 static void Clear(Isolate* isolate,
670 Address address,
671 Code* target,
672 ConstantPoolArray* constant_pool);
645 673
646 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver, 674 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver,
647 Handle<Object> key, 675 Handle<Object> key,
648 Handle<Object> value); 676 Handle<Object> value);
649 677
650 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, 678 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver,
651 KeyedAccessStoreMode store_mode); 679 KeyedAccessStoreMode store_mode);
652 680
653 friend class IC; 681 friend class IC;
654 }; 682 };
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 State old_right, 869 State old_right,
842 bool has_inlined_smi_code, 870 bool has_inlined_smi_code,
843 Handle<Object> x, 871 Handle<Object> x,
844 Handle<Object> y); 872 Handle<Object> y);
845 873
846 bool strict() const { return op_ == Token::EQ_STRICT; } 874 bool strict() const { return op_ == Token::EQ_STRICT; }
847 Condition GetCondition() const { return ComputeCondition(op_); } 875 Condition GetCondition() const { return ComputeCondition(op_); }
848 876
849 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op); 877 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op);
850 878
851 static void Clear(Isolate* isolate, Address address, Code* target); 879 static void Clear(Isolate* isolate,
880 Address address,
881 Code* target,
882 ConstantPoolArray* constant_pool);
852 883
853 Token::Value op_; 884 Token::Value op_;
854 885
855 friend class IC; 886 friend class IC;
856 }; 887 };
857 888
858 889
859 class CompareNilIC: public IC { 890 class CompareNilIC: public IC {
860 public: 891 public:
861 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} 892 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {}
862 893
863 MUST_USE_RESULT MaybeObject* CompareNil(Handle<Object> object); 894 MUST_USE_RESULT MaybeObject* CompareNil(Handle<Object> object);
864 895
865 static Handle<Code> GetUninitialized(); 896 static Handle<Code> GetUninitialized();
866 897
867 static void Clear(Address address, Code* target); 898 static void Clear(Address address,
899 Code* target,
900 ConstantPoolArray* constant_pool);
868 901
869 static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil, 902 static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil,
870 Handle<Object> object); 903 Handle<Object> object);
871 }; 904 };
872 905
873 906
874 class ToBooleanIC: public IC { 907 class ToBooleanIC: public IC {
875 public: 908 public:
876 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } 909 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
877 910
(...skipping 12 matching lines...) Expand all
890 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 923 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
891 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 924 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
892 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); 925 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite);
893 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 926 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
894 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 927 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
895 928
896 929
897 } } // namespace v8::internal 930 } } // namespace v8::internal
898 931
899 #endif // V8_IC_H_ 932 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698