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

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: Ports. Created 6 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 | Annotate | Revision Log
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 24 matching lines...) Expand all
35 35
36 36
37 const int kMaxKeyedPolymorphism = 4; 37 const int kMaxKeyedPolymorphism = 4;
38 38
39 39
40 // IC_UTIL_LIST defines all utility functions called from generated 40 // IC_UTIL_LIST defines all utility functions called from generated
41 // inline caching code. The argument for the macro, ICU, is the function name. 41 // inline caching code. The argument for the macro, ICU, is the function name.
42 #define IC_UTIL_LIST(ICU) \ 42 #define IC_UTIL_LIST(ICU) \
43 ICU(LoadIC_Miss) \ 43 ICU(LoadIC_Miss) \
44 ICU(KeyedLoadIC_Miss) \ 44 ICU(KeyedLoadIC_Miss) \
45 ICU(CallIC_Miss) \
45 ICU(StoreIC_Miss) \ 46 ICU(StoreIC_Miss) \
46 ICU(StoreIC_ArrayLength) \ 47 ICU(StoreIC_ArrayLength) \
47 ICU(StoreIC_Slow) \ 48 ICU(StoreIC_Slow) \
48 ICU(SharedStoreIC_ExtendStorage) \ 49 ICU(SharedStoreIC_ExtendStorage) \
49 ICU(KeyedStoreIC_Miss) \ 50 ICU(KeyedStoreIC_Miss) \
50 ICU(KeyedStoreIC_Slow) \ 51 ICU(KeyedStoreIC_Slow) \
51 /* Utilities for IC stubs. */ \ 52 /* Utilities for IC stubs. */ \
52 ICU(StoreCallbackProperty) \ 53 ICU(StoreCallbackProperty) \
53 ICU(LoadPropertyWithInterceptorOnly) \ 54 ICU(LoadPropertyWithInterceptorOnly) \
54 ICU(LoadPropertyWithInterceptorForLoad) \ 55 ICU(LoadPropertyWithInterceptorForLoad) \
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 ConstantPoolArray* constant_pool); 121 ConstantPoolArray* constant_pool);
121 122
122 #ifdef DEBUG 123 #ifdef DEBUG
123 bool IsLoadStub() const { 124 bool IsLoadStub() const {
124 return target()->is_load_stub() || target()->is_keyed_load_stub(); 125 return target()->is_load_stub() || target()->is_keyed_load_stub();
125 } 126 }
126 127
127 bool IsStoreStub() const { 128 bool IsStoreStub() const {
128 return target()->is_store_stub() || target()->is_keyed_store_stub(); 129 return target()->is_store_stub() || target()->is_keyed_store_stub();
129 } 130 }
131
132 bool IsCallStub() const {
133 return target()->is_call_stub();
134 }
130 #endif 135 #endif
131 136
132 // Determines which map must be used for keeping the code stub. 137 // Determines which map must be used for keeping the code stub.
133 // These methods should not be called with undefined or null. 138 // These methods should not be called with undefined or null.
134 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object); 139 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object);
135 // TODO(verwaest): This currently returns a HeapObject rather than JSObject* 140 // TODO(verwaest): This currently returns a HeapObject rather than JSObject*
136 // since loading the IC for loading the length from strings are stored on 141 // since loading the IC for loading the length from strings are stored on
137 // the string map directly, rather than on the JSObject-typed prototype. 142 // the string map directly, rather than on the JSObject-typed prototype.
138 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate, 143 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate,
139 Object* object, 144 Object* object,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 348
344 Address address() const { return address_; } 349 Address address() const { return address_; }
345 350
346 IC::UtilityId id() const { return id_; } 351 IC::UtilityId id() const { return id_; }
347 private: 352 private:
348 Address address_; 353 Address address_;
349 IC::UtilityId id_; 354 IC::UtilityId id_;
350 }; 355 };
351 356
352 357
358 class CallIC: public IC {
359 public:
360 enum CallType { METHOD, FUNCTION };
361
362 class State V8_FINAL BASE_EMBEDDED {
363 public:
364 explicit State(ExtraICState extra_ic_state);
365
366 static State DefaultCallState(int argc, CallType call_type) {
367 return State(argc, call_type);
368 }
369
370 static State MegamorphicCallState(int argc, CallType call_type) {
371 return State(argc, call_type);
372 }
373
374 InlineCacheState GetICState() const { return ::v8::internal::GENERIC; }
375
376 ExtraICState GetExtraICState() const;
377
378 static void GenerateAheadOfTime(
379 Isolate*, void (*Generate)(Isolate*, const State&));
380
381 int arg_count() const { return argc_; }
382 CallType call_type() const { return call_type_; }
383
384 bool CallAsMethod() const { return call_type_ == METHOD; }
385
386 void Print(StringStream* stream) const;
387
388 bool operator==(const State& other_state) const {
389 return (argc_ == other_state.argc_ &&
390 call_type_ == other_state.call_type_);
391 }
392
393 bool operator!=(const State& other_state) const {
394 return !(*this == other_state);
395 }
396
397 private:
398 State(int argc,
399 CallType call_type)
400 : argc_(argc),
401 call_type_(call_type) {
402 }
403
404 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {};
405 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {};
406
407 const int argc_;
408 const CallType call_type_;
409 };
410
411 explicit CallIC(Isolate* isolate)
412 : IC(EXTRA_CALL_FRAME, isolate) {
413 }
414
415 void HandleMiss(Handle<Object> receiver,
416 Handle<Object> function,
417 Handle<FixedArray> vector,
418 Handle<Smi> slot);
419
420 // Code generator routines.
421 static Handle<Code> initialize_stub(Isolate* isolate,
422 int argc,
423 CallType call_type);
424
425 static void Clear(Isolate* isolate, Address address, Code* target,
426 ConstantPoolArray* constant_pool);
427 };
428
429
353 class LoadIC: public IC { 430 class LoadIC: public IC {
354 public: 431 public:
355 // ExtraICState bits 432 // ExtraICState bits
356 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {}; 433 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {};
357 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); 434 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
358 435
359 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { 436 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) {
360 return ContextualModeBits::encode(contextual_mode); 437 return ContextualModeBits::encode(contextual_mode);
361 } 438 }
362 439
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); 1053 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss);
977 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); 1054 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss);
978 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); 1055 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite);
979 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); 1056 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss);
980 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); 1057 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss);
981 1058
982 1059
983 } } // namespace v8::internal 1060 } } // namespace v8::internal
984 1061
985 #endif // V8_IC_H_ 1062 #endif // V8_IC_H_
OLDNEW
« src/ia32/code-stubs-ia32.cc ('K') | « 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