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

Side by Side Diff: src/ic.h

Issue 247373002: CallICStub with a "never patch" approach until customization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE + code size multiplier. Created 6 years, 7 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/lithium-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 // 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 "macro-assembler.h" 8 #include "macro-assembler.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 13
14 const int kMaxKeyedPolymorphism = 4; 14 const int kMaxKeyedPolymorphism = 4;
15 15
16 16
17 // IC_UTIL_LIST defines all utility functions called from generated 17 // IC_UTIL_LIST defines all utility functions called from generated
18 // inline caching code. The argument for the macro, ICU, is the function name. 18 // inline caching code. The argument for the macro, ICU, is the function name.
19 #define IC_UTIL_LIST(ICU) \ 19 #define IC_UTIL_LIST(ICU) \
20 ICU(LoadIC_Miss) \ 20 ICU(LoadIC_Miss) \
21 ICU(KeyedLoadIC_Miss) \ 21 ICU(KeyedLoadIC_Miss) \
22 ICU(CallIC_Miss) \
22 ICU(StoreIC_Miss) \ 23 ICU(StoreIC_Miss) \
23 ICU(StoreIC_ArrayLength) \ 24 ICU(StoreIC_ArrayLength) \
24 ICU(StoreIC_Slow) \ 25 ICU(StoreIC_Slow) \
25 ICU(SharedStoreIC_ExtendStorage) \ 26 ICU(SharedStoreIC_ExtendStorage) \
26 ICU(KeyedStoreIC_Miss) \ 27 ICU(KeyedStoreIC_Miss) \
27 ICU(KeyedStoreIC_Slow) \ 28 ICU(KeyedStoreIC_Slow) \
28 /* Utilities for IC stubs. */ \ 29 /* Utilities for IC stubs. */ \
29 ICU(StoreCallbackProperty) \ 30 ICU(StoreCallbackProperty) \
30 ICU(LoadPropertyWithInterceptorOnly) \ 31 ICU(LoadPropertyWithInterceptorOnly) \
31 ICU(LoadPropertyWithInterceptorForLoad) \ 32 ICU(LoadPropertyWithInterceptorForLoad) \
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 ConstantPoolArray* constant_pool); 98 ConstantPoolArray* constant_pool);
98 99
99 #ifdef DEBUG 100 #ifdef DEBUG
100 bool IsLoadStub() const { 101 bool IsLoadStub() const {
101 return target()->is_load_stub() || target()->is_keyed_load_stub(); 102 return target()->is_load_stub() || target()->is_keyed_load_stub();
102 } 103 }
103 104
104 bool IsStoreStub() const { 105 bool IsStoreStub() const {
105 return target()->is_store_stub() || target()->is_keyed_store_stub(); 106 return target()->is_store_stub() || target()->is_keyed_store_stub();
106 } 107 }
108
109 bool IsCallStub() const {
110 return target()->is_call_stub();
111 }
107 #endif 112 #endif
108 113
109 // Determines which map must be used for keeping the code stub. 114 // Determines which map must be used for keeping the code stub.
110 // These methods should not be called with undefined or null. 115 // These methods should not be called with undefined or null.
111 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object); 116 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object);
112 // TODO(verwaest): This currently returns a HeapObject rather than JSObject* 117 // TODO(verwaest): This currently returns a HeapObject rather than JSObject*
113 // since loading the IC for loading the length from strings are stored on 118 // since loading the IC for loading the length from strings are stored on
114 // the string map directly, rather than on the JSObject-typed prototype. 119 // the string map directly, rather than on the JSObject-typed prototype.
115 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate, 120 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate,
116 Object* object, 121 Object* object,
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 323
319 Address address() const { return address_; } 324 Address address() const { return address_; }
320 325
321 IC::UtilityId id() const { return id_; } 326 IC::UtilityId id() const { return id_; }
322 private: 327 private:
323 Address address_; 328 Address address_;
324 IC::UtilityId id_; 329 IC::UtilityId id_;
325 }; 330 };
326 331
327 332
333 class CallIC: public IC {
334 public:
335 enum CallType { METHOD, FUNCTION };
336
337 class State V8_FINAL BASE_EMBEDDED {
338 public:
339 explicit State(ExtraICState extra_ic_state);
340
341 static State DefaultCallState(int argc, CallType call_type) {
342 return State(argc, call_type);
343 }
344
345 static State MegamorphicCallState(int argc, CallType call_type) {
346 return State(argc, call_type);
347 }
348
349 InlineCacheState GetICState() const { return ::v8::internal::GENERIC; }
350
351 ExtraICState GetExtraICState() const;
352
353 static void GenerateAheadOfTime(
354 Isolate*, void (*Generate)(Isolate*, const State&));
355
356 int arg_count() const { return argc_; }
357 CallType call_type() const { return call_type_; }
358
359 bool CallAsMethod() const { return call_type_ == METHOD; }
360
361 void Print(StringStream* stream) const;
362
363 bool operator==(const State& other_state) const {
364 return (argc_ == other_state.argc_ &&
365 call_type_ == other_state.call_type_);
366 }
367
368 bool operator!=(const State& other_state) const {
369 return !(*this == other_state);
370 }
371
372 private:
373 State(int argc,
374 CallType call_type)
375 : argc_(argc),
376 call_type_(call_type) {
377 }
378
379 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {};
380 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {};
381
382 const int argc_;
383 const CallType call_type_;
384 };
385
386 explicit CallIC(Isolate* isolate)
387 : IC(EXTRA_CALL_FRAME, isolate) {
388 }
389
390 void HandleMiss(Handle<Object> receiver,
391 Handle<Object> function,
392 Handle<FixedArray> vector,
393 Handle<Smi> slot);
394
395 // Code generator routines.
396 static Handle<Code> initialize_stub(Isolate* isolate,
397 int argc,
398 CallType call_type);
399
400 static void Clear(Isolate* isolate, Address address, Code* target,
401 ConstantPoolArray* constant_pool);
402 };
403
404
328 class LoadIC: public IC { 405 class LoadIC: public IC {
329 public: 406 public:
330 // ExtraICState bits 407 // ExtraICState bits
331 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {}; 408 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {};
332 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); 409 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
333 410
334 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { 411 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) {
335 return ContextualModeBits::encode(contextual_mode); 412 return ContextualModeBits::encode(contextual_mode);
336 } 413 }
337 414
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); 1031 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss);
955 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); 1032 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss);
956 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); 1033 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite);
957 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); 1034 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss);
958 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); 1035 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss);
959 1036
960 1037
961 } } // namespace v8::internal 1038 } } // namespace v8::internal
962 1039
963 #endif // V8_IC_H_ 1040 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698