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

Side by Side Diff: src/ic.h

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 22 matching lines...) Expand all
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 37
38 // IC_UTIL_LIST defines all utility functions called from generated 38 // IC_UTIL_LIST defines all utility functions called from generated
39 // inline caching code. The argument for the macro, ICU, is the function name. 39 // inline caching code. The argument for the macro, ICU, is the function name.
40 #define IC_UTIL_LIST(ICU) \ 40 #define IC_UTIL_LIST(ICU) \
41 ICU(LoadIC_Miss) \ 41 ICU(LoadIC_Miss) \
42 ICU(KeyedLoadIC_Miss) \ 42 ICU(KeyedLoadIC_Miss) \
43 ICU(KeyedLoadIC_MissForceGeneric) \
44 ICU(CallIC_Miss) \ 43 ICU(CallIC_Miss) \
45 ICU(KeyedCallIC_Miss) \ 44 ICU(KeyedCallIC_Miss) \
46 ICU(StoreIC_Miss) \ 45 ICU(StoreIC_Miss) \
47 ICU(StoreIC_ArrayLength) \ 46 ICU(StoreIC_ArrayLength) \
48 ICU(StoreIC_Slow) \ 47 ICU(StoreIC_Slow) \
49 ICU(SharedStoreIC_ExtendStorage) \ 48 ICU(SharedStoreIC_ExtendStorage) \
50 ICU(KeyedStoreIC_Miss) \ 49 ICU(KeyedStoreIC_Miss) \
51 ICU(KeyedStoreIC_MissForceGeneric) \
52 ICU(KeyedStoreIC_Slow) \ 50 ICU(KeyedStoreIC_Slow) \
53 /* Utilities for IC stubs. */ \ 51 /* Utilities for IC stubs. */ \
54 ICU(StoreCallbackProperty) \ 52 ICU(StoreCallbackProperty) \
55 ICU(LoadPropertyWithInterceptorOnly) \ 53 ICU(LoadPropertyWithInterceptorOnly) \
56 ICU(LoadPropertyWithInterceptorForLoad) \ 54 ICU(LoadPropertyWithInterceptorForLoad) \
57 ICU(LoadPropertyWithInterceptorForCall) \ 55 ICU(LoadPropertyWithInterceptorForCall) \
58 ICU(KeyedLoadPropertyWithInterceptor) \ 56 ICU(KeyedLoadPropertyWithInterceptor) \
59 ICU(StoreInterceptorProperty) \ 57 ICU(StoreInterceptorProperty) \
60 ICU(CompareIC_Miss) \ 58 ICU(CompareIC_Miss) \
61 ICU(BinaryOpIC_Miss) \ 59 ICU(BinaryOpIC_Miss) \
(...skipping 25 matching lines...) Expand all
87 enum FrameDepth { 85 enum FrameDepth {
88 NO_EXTRA_FRAME = 0, 86 NO_EXTRA_FRAME = 0,
89 EXTRA_CALL_FRAME = 1 87 EXTRA_CALL_FRAME = 1
90 }; 88 };
91 89
92 // Construct the IC structure with the given number of extra 90 // Construct the IC structure with the given number of extra
93 // JavaScript frames on the stack. 91 // JavaScript frames on the stack.
94 IC(FrameDepth depth, Isolate* isolate); 92 IC(FrameDepth depth, Isolate* isolate);
95 virtual ~IC() {} 93 virtual ~IC() {}
96 94
97 // Get the call-site target; used for determining the state.
98 Handle<Code> target() const { return target_; }
99 Code* raw_target() const { return GetTargetAtAddress(address()); }
100
101 State state() const { return state_; } 95 State state() const { return state_; }
102 inline Address address() const; 96 inline Address address() const;
103 97
104 // Compute the current IC state based on the target stub, receiver and name. 98 // Compute the current IC state based on the target stub, receiver and name.
105 void UpdateState(Handle<Object> receiver, Handle<Object> name); 99 void UpdateState(Handle<Object> receiver, Handle<Object> name);
106 void MarkMonomorphicPrototypeFailure() { 100 void MarkMonomorphicPrototypeFailure() {
107 state_ = MONOMORPHIC_PROTOTYPE_FAILURE; 101 state_ = MONOMORPHIC_PROTOTYPE_FAILURE;
108 } 102 }
109 103
110 // Clear the inline cache to initial state. 104 // Clear the inline cache to initial state.
(...skipping 12 matching lines...) Expand all
123 } else { 117 } else {
124 ASSERT(!SlowIsUndeclaredGlobal()); 118 ASSERT(!SlowIsUndeclaredGlobal());
125 return false; 119 return false;
126 } 120 }
127 } 121 }
128 122
129 bool SlowIsUndeclaredGlobal() { 123 bool SlowIsUndeclaredGlobal() {
130 return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT; 124 return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT;
131 } 125 }
132 126
127 #ifdef DEBUG
128 bool IsLoadStub() {
129 return target()->is_load_stub() || target()->is_keyed_load_stub();
130 }
131
132 bool IsStoreStub() {
133 return target()->is_store_stub() || target()->is_keyed_store_stub();
134 }
135
136 bool IsCallStub() {
137 return target()->is_call_stub() || target()->is_keyed_call_stub();
138 }
139 #endif
140
133 // Determines which map must be used for keeping the code stub. 141 // Determines which map must be used for keeping the code stub.
134 // These methods should not be called with undefined or null. 142 // These methods should not be called with undefined or null.
135 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, 143 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object);
136 JSObject* holder); 144 // TODO(verwaest): This currently returns a HeapObject rather than JSObject*
137 static inline JSObject* GetCodeCacheHolder(Isolate* isolate, 145 // since loading the IC for loading the length from strings are stored on
138 Object* object, 146 // the string map directly, rather than on the JSObject-typed prototype.
139 InlineCacheHolderFlag holder); 147 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate,
148 Object* object,
149 InlineCacheHolderFlag holder);
150
151 static inline InlineCacheHolderFlag GetCodeCacheFlag(Type* type);
152 static inline Handle<Map> GetCodeCacheHolder(InlineCacheHolderFlag flag,
153 Type* type,
154 Isolate* isolate);
140 155
141 static bool IsCleared(Code* code) { 156 static bool IsCleared(Code* code) {
142 InlineCacheState state = code->ic_state(); 157 InlineCacheState state = code->ic_state();
143 return state == UNINITIALIZED || state == PREMONOMORPHIC; 158 return state == UNINITIALIZED || state == PREMONOMORPHIC;
144 } 159 }
145 160
161 // Utility functions to convert maps to types and back. There are two special
162 // cases:
163 // - The heap_number_map is used as a marker which includes heap numbers as
164 // well as smis.
165 // - The oddball map is only used for booleans.
166 static Handle<Map> TypeToMap(Type* type, Isolate* isolate);
167 static Type* MapToType(Handle<Map> type);
168
146 protected: 169 protected:
170 // Get the call-site target; used for determining the state.
171 Handle<Code> target() const { return target_; }
172
147 Address fp() const { return fp_; } 173 Address fp() const { return fp_; }
148 Address pc() const { return *pc_address_; } 174 Address pc() const { return *pc_address_; }
149 Isolate* isolate() const { return isolate_; } 175 Isolate* isolate() const { return isolate_; }
150 176
151 #ifdef ENABLE_DEBUGGER_SUPPORT 177 #ifdef ENABLE_DEBUGGER_SUPPORT
152 // Computes the address in the original code when the code running is 178 // Computes the address in the original code when the code running is
153 // containing break points (calls to DebugBreakXXX builtins). 179 // containing break points (calls to DebugBreakXXX builtins).
154 Address OriginalCodeAddress() const; 180 Address OriginalCodeAddress() const;
155 #endif 181 #endif
156 182
(...skipping 16 matching lines...) Expand all
173 Handle<Object> key); 199 Handle<Object> key);
174 Failure* ReferenceError(const char* type, Handle<String> name); 200 Failure* ReferenceError(const char* type, Handle<String> name);
175 201
176 // Access the target code for the given IC address. 202 // Access the target code for the given IC address.
177 static inline Code* GetTargetAtAddress(Address address); 203 static inline Code* GetTargetAtAddress(Address address);
178 static inline void SetTargetAtAddress(Address address, Code* target); 204 static inline void SetTargetAtAddress(Address address, Code* target);
179 static void PostPatching(Address address, Code* target, Code* old_target); 205 static void PostPatching(Address address, Code* target, Code* old_target);
180 206
181 // Compute the handler either by compiling or by retrieving a cached version. 207 // Compute the handler either by compiling or by retrieving a cached version.
182 Handle<Code> ComputeHandler(LookupResult* lookup, 208 Handle<Code> ComputeHandler(LookupResult* lookup,
183 Handle<JSObject> receiver, 209 Handle<Object> object,
184 Handle<String> name, 210 Handle<String> name,
185 Handle<Object> value = Handle<Code>::null()); 211 Handle<Object> value = Handle<Code>::null());
186 virtual Handle<Code> CompileHandler(LookupResult* lookup, 212 virtual Handle<Code> CompileHandler(LookupResult* lookup,
187 Handle<JSObject> receiver, 213 Handle<Object> object,
188 Handle<String> name, 214 Handle<String> name,
189 Handle<Object> value) { 215 Handle<Object> value,
216 InlineCacheHolderFlag cache_holder) {
190 UNREACHABLE(); 217 UNREACHABLE();
191 return Handle<Code>::null(); 218 return Handle<Code>::null();
192 } 219 }
193 void UpdateMonomorphicIC(Handle<HeapObject> receiver, 220
221 void UpdateMonomorphicIC(Handle<Type> type,
194 Handle<Code> handler, 222 Handle<Code> handler,
195 Handle<String> name); 223 Handle<String> name);
196 224
197 bool UpdatePolymorphicIC(Handle<HeapObject> receiver, 225 bool UpdatePolymorphicIC(Handle<Type> type,
198 Handle<String> name, 226 Handle<String> name,
199 Handle<Code> code); 227 Handle<Code> code);
200 228
229 virtual void UpdateMegamorphicCache(Type* type, Name* name, Code* code);
230
201 void CopyICToMegamorphicCache(Handle<String> name); 231 void CopyICToMegamorphicCache(Handle<String> name);
202 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); 232 bool IsTransitionOfMonomorphicTarget(Type* type);
203 void PatchCache(Handle<HeapObject> receiver, 233 void PatchCache(Handle<Type> type,
204 Handle<String> name, 234 Handle<String> name,
205 Handle<Code> code); 235 Handle<Code> code);
206 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code);
207 virtual Code::Kind kind() const { 236 virtual Code::Kind kind() const {
208 UNREACHABLE(); 237 UNREACHABLE();
209 return Code::STUB; 238 return Code::STUB;
210 } 239 }
211 virtual Handle<Code> slow_stub() const { 240 virtual Handle<Code> slow_stub() const {
212 UNREACHABLE(); 241 UNREACHABLE();
213 return Handle<Code>::null(); 242 return Handle<Code>::null();
214 } 243 }
215 virtual Handle<Code> megamorphic_stub() { 244 virtual Handle<Code> megamorphic_stub() {
216 UNREACHABLE(); 245 UNREACHABLE();
217 return Handle<Code>::null(); 246 return Handle<Code>::null();
218 } 247 }
219 virtual Handle<Code> generic_stub() const { 248 virtual Handle<Code> generic_stub() const {
220 UNREACHABLE(); 249 UNREACHABLE();
221 return Handle<Code>::null(); 250 return Handle<Code>::null();
222 } 251 }
223 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; } 252 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; }
224 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, 253 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
225 Handle<String> name); 254 Handle<String> name);
226 void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name); 255 void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name);
227 256
228 private: 257 private:
258 Code* raw_target() const { return GetTargetAtAddress(address()); }
259
229 // Frame pointer for the frame that uses (calls) the IC. 260 // Frame pointer for the frame that uses (calls) the IC.
230 Address fp_; 261 Address fp_;
231 262
232 // All access to the program counter of an IC structure is indirect 263 // All access to the program counter of an IC structure is indirect
233 // to make the code GC safe. This feature is crucial since 264 // to make the code GC safe. This feature is crucial since
234 // GetProperty and SetProperty are called and they in turn might 265 // GetProperty and SetProperty are called and they in turn might
235 // invoke the garbage collector. 266 // invoke the garbage collector.
236 Address* pc_address_; 267 Address* pc_address_;
237 268
238 Isolate* isolate_; 269 Isolate* isolate_;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 412
382 static void GenerateMegamorphic(MacroAssembler* masm, int argc); 413 static void GenerateMegamorphic(MacroAssembler* masm, int argc);
383 static void GenerateNormal(MacroAssembler* masm, int argc); 414 static void GenerateNormal(MacroAssembler* masm, int argc);
384 static void GenerateNonStrictArguments(MacroAssembler* masm, int argc); 415 static void GenerateNonStrictArguments(MacroAssembler* masm, int argc);
385 }; 416 };
386 417
387 418
388 class LoadIC: public IC { 419 class LoadIC: public IC {
389 public: 420 public:
390 explicit LoadIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { 421 explicit LoadIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) {
391 ASSERT(target()->is_load_stub() || target()->is_keyed_load_stub()); 422 ASSERT(IsLoadStub());
392 } 423 }
393 424
394 // Code generator routines. 425 // Code generator routines.
395 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 426 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
396 static void GeneratePreMonomorphic(MacroAssembler* masm) { 427 static void GeneratePreMonomorphic(MacroAssembler* masm) {
397 GenerateMiss(masm); 428 GenerateMiss(masm);
398 } 429 }
399 static void GenerateMiss(MacroAssembler* masm); 430 static void GenerateMiss(MacroAssembler* masm);
400 static void GenerateMegamorphic(MacroAssembler* masm); 431 static void GenerateMegamorphic(MacroAssembler* masm);
401 static void GenerateNormal(MacroAssembler* masm); 432 static void GenerateNormal(MacroAssembler* masm);
(...skipping 13 matching lines...) Expand all
415 return isolate()->builtins()->LoadIC_Megamorphic(); 446 return isolate()->builtins()->LoadIC_Megamorphic();
416 } 447 }
417 448
418 // Update the inline cache and the global stub cache based on the 449 // Update the inline cache and the global stub cache based on the
419 // lookup result. 450 // lookup result.
420 void UpdateCaches(LookupResult* lookup, 451 void UpdateCaches(LookupResult* lookup,
421 Handle<Object> object, 452 Handle<Object> object,
422 Handle<String> name); 453 Handle<String> name);
423 454
424 virtual Handle<Code> CompileHandler(LookupResult* lookup, 455 virtual Handle<Code> CompileHandler(LookupResult* lookup,
425 Handle<JSObject> receiver, 456 Handle<Object> object,
426 Handle<String> name, 457 Handle<String> name,
427 Handle<Object> unused); 458 Handle<Object> unused,
459 InlineCacheHolderFlag cache_holder);
428 460
429 private: 461 private:
430 // Stub accessors. 462 // Stub accessors.
431 static Handle<Code> initialize_stub(Isolate* isolate) { 463 static Handle<Code> initialize_stub(Isolate* isolate) {
432 return isolate->builtins()->LoadIC_Initialize(); 464 return isolate->builtins()->LoadIC_Initialize();
433 } 465 }
434 466
435 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 467 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
436 return isolate->builtins()->LoadIC_PreMonomorphic(); 468 return isolate->builtins()->LoadIC_PreMonomorphic();
437 } 469 }
438 470
439 virtual Handle<Code> pre_monomorphic_stub() { 471 virtual Handle<Code> pre_monomorphic_stub() {
440 return pre_monomorphic_stub(isolate()); 472 return pre_monomorphic_stub(isolate());
441 } 473 }
442 474
443 Handle<Code> SimpleFieldLoad(int offset, 475 Handle<Code> SimpleFieldLoad(int offset,
444 bool inobject = true, 476 bool inobject = true,
445 Representation representation = 477 Representation representation =
446 Representation::Tagged()); 478 Representation::Tagged());
447 479
448 static void Clear(Isolate* isolate, Address address, Code* target); 480 static void Clear(Isolate* isolate, Address address, Code* target);
449 481
450 friend class IC; 482 friend class IC;
451 }; 483 };
452 484
453 485
454 enum ICMissMode {
455 MISS_FORCE_GENERIC,
456 MISS
457 };
458
459
460 class KeyedLoadIC: public LoadIC { 486 class KeyedLoadIC: public LoadIC {
461 public: 487 public:
462 explicit KeyedLoadIC(FrameDepth depth, Isolate* isolate) 488 explicit KeyedLoadIC(FrameDepth depth, Isolate* isolate)
463 : LoadIC(depth, isolate) { 489 : LoadIC(depth, isolate) {
464 ASSERT(target()->is_keyed_load_stub()); 490 ASSERT(target()->is_keyed_load_stub());
465 } 491 }
466 492
467 MUST_USE_RESULT MaybeObject* Load(Handle<Object> object, 493 MUST_USE_RESULT MaybeObject* Load(Handle<Object> object,
468 Handle<Object> key, 494 Handle<Object> key);
469 ICMissMode force_generic);
470 495
471 // Code generator routines. 496 // Code generator routines.
472 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); 497 static void GenerateMiss(MacroAssembler* masm);
473 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 498 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
474 static void GenerateInitialize(MacroAssembler* masm) { 499 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
475 GenerateMiss(masm, MISS);
476 }
477 static void GeneratePreMonomorphic(MacroAssembler* masm) { 500 static void GeneratePreMonomorphic(MacroAssembler* masm) {
478 GenerateMiss(masm, MISS); 501 GenerateMiss(masm);
479 } 502 }
480 static void GenerateGeneric(MacroAssembler* masm); 503 static void GenerateGeneric(MacroAssembler* masm);
481 static void GenerateString(MacroAssembler* masm); 504 static void GenerateString(MacroAssembler* masm);
482 static void GenerateIndexedInterceptor(MacroAssembler* masm); 505 static void GenerateIndexedInterceptor(MacroAssembler* masm);
483 static void GenerateNonStrictArguments(MacroAssembler* masm); 506 static void GenerateNonStrictArguments(MacroAssembler* masm);
484 507
485 // Bit mask to be tested against bit field for the cases when 508 // Bit mask to be tested against bit field for the cases when
486 // generic stub should go into slow case. 509 // generic stub should go into slow case.
487 // Access check is necessary explicitly since generic stub does not perform 510 // Access check is necessary explicitly since generic stub does not perform
488 // map checks. 511 // map checks.
489 static const int kSlowCaseBitFieldMask = 512 static const int kSlowCaseBitFieldMask =
490 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); 513 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
491 514
492 protected: 515 protected:
493 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } 516 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
494 517
495 Handle<Code> LoadElementStub(Handle<JSObject> receiver); 518 Handle<Code> LoadElementStub(Handle<JSObject> receiver);
496 519
497 virtual Handle<Code> megamorphic_stub() { 520 virtual Handle<Code> megamorphic_stub() {
498 return isolate()->builtins()->KeyedLoadIC_Generic(); 521 return isolate()->builtins()->KeyedLoadIC_Generic();
499 } 522 }
500 virtual Handle<Code> generic_stub() const { 523 virtual Handle<Code> generic_stub() const {
501 return isolate()->builtins()->KeyedLoadIC_Generic(); 524 return isolate()->builtins()->KeyedLoadIC_Generic();
502 } 525 }
503 virtual Handle<Code> slow_stub() const { 526 virtual Handle<Code> slow_stub() const {
504 return isolate()->builtins()->KeyedLoadIC_Slow(); 527 return isolate()->builtins()->KeyedLoadIC_Slow();
505 } 528 }
506 529
507 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 530 virtual void UpdateMegamorphicCache(Type* type, Name* name, Code* code) { }
508 531
509 private: 532 private:
510 // Stub accessors. 533 // Stub accessors.
511 static Handle<Code> initialize_stub(Isolate* isolate) { 534 static Handle<Code> initialize_stub(Isolate* isolate) {
512 return isolate->builtins()->KeyedLoadIC_Initialize(); 535 return isolate->builtins()->KeyedLoadIC_Initialize();
513 } 536 }
514 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 537 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
515 return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); 538 return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
516 } 539 }
517 virtual Handle<Code> pre_monomorphic_stub() { 540 virtual Handle<Code> pre_monomorphic_stub() {
(...skipping 13 matching lines...) Expand all
531 554
532 friend class IC; 555 friend class IC;
533 }; 556 };
534 557
535 558
536 class StoreIC: public IC { 559 class StoreIC: public IC {
537 public: 560 public:
538 StoreIC(FrameDepth depth, Isolate* isolate) 561 StoreIC(FrameDepth depth, Isolate* isolate)
539 : IC(depth, isolate), 562 : IC(depth, isolate),
540 strict_mode_(Code::GetStrictMode(target()->extra_ic_state())) { 563 strict_mode_(Code::GetStrictMode(target()->extra_ic_state())) {
541 ASSERT(target()->is_store_stub() || target()->is_keyed_store_stub()); 564 ASSERT(IsStoreStub());
542 } 565 }
543 566
544 virtual StrictModeFlag strict_mode() const { return strict_mode_; } 567 virtual StrictModeFlag strict_mode() const { return strict_mode_; }
545 568
546 // Code generators for stub routines. Only called once at startup. 569 // Code generators for stub routines. Only called once at startup.
547 static void GenerateSlow(MacroAssembler* masm); 570 static void GenerateSlow(MacroAssembler* masm);
548 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 571 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
549 static void GeneratePreMonomorphic(MacroAssembler* masm) { 572 static void GeneratePreMonomorphic(MacroAssembler* masm) {
550 GenerateMiss(masm); 573 GenerateMiss(masm);
551 } 574 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 633 }
611 } 634 }
612 635
613 // Update the inline cache and the global stub cache based on the 636 // Update the inline cache and the global stub cache based on the
614 // lookup result. 637 // lookup result.
615 void UpdateCaches(LookupResult* lookup, 638 void UpdateCaches(LookupResult* lookup,
616 Handle<JSObject> receiver, 639 Handle<JSObject> receiver,
617 Handle<String> name, 640 Handle<String> name,
618 Handle<Object> value); 641 Handle<Object> value);
619 virtual Handle<Code> CompileHandler(LookupResult* lookup, 642 virtual Handle<Code> CompileHandler(LookupResult* lookup,
620 Handle<JSObject> receiver, 643 Handle<Object> object,
621 Handle<String> name, 644 Handle<String> name,
622 Handle<Object> value); 645 Handle<Object> value,
646 InlineCacheHolderFlag cache_holder);
623 647
624 private: 648 private:
625 void set_target(Code* code) { 649 void set_target(Code* code) {
626 // Strict mode must be preserved across IC patching. 650 // Strict mode must be preserved across IC patching.
627 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == 651 ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
628 Code::GetStrictMode(target()->extra_ic_state())); 652 Code::GetStrictMode(target()->extra_ic_state()));
629 IC::set_target(code); 653 IC::set_target(code);
630 } 654 }
631 655
632 static Handle<Code> initialize_stub(Isolate* isolate, 656 static Handle<Code> initialize_stub(Isolate* isolate,
(...skipping 27 matching lines...) Expand all
660 684
661 class KeyedStoreIC: public StoreIC { 685 class KeyedStoreIC: public StoreIC {
662 public: 686 public:
663 KeyedStoreIC(FrameDepth depth, Isolate* isolate) 687 KeyedStoreIC(FrameDepth depth, Isolate* isolate)
664 : StoreIC(depth, isolate) { 688 : StoreIC(depth, isolate) {
665 ASSERT(target()->is_keyed_store_stub()); 689 ASSERT(target()->is_keyed_store_stub());
666 } 690 }
667 691
668 MUST_USE_RESULT MaybeObject* Store(Handle<Object> object, 692 MUST_USE_RESULT MaybeObject* Store(Handle<Object> object,
669 Handle<Object> name, 693 Handle<Object> name,
670 Handle<Object> value, 694 Handle<Object> value);
671 ICMissMode force_generic);
672 695
673 // Code generators for stub routines. Only called once at startup. 696 // Code generators for stub routines. Only called once at startup.
674 static void GenerateInitialize(MacroAssembler* masm) { 697 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
675 GenerateMiss(masm, MISS); 698 static void GeneratePreMonomorphic(MacroAssembler* masm) {
699 GenerateMiss(masm);
676 } 700 }
677 static void GeneratePreMonomorphic(MacroAssembler* masm) { 701 static void GenerateMiss(MacroAssembler* masm);
678 GenerateMiss(masm, MISS);
679 }
680 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic);
681 static void GenerateSlow(MacroAssembler* masm); 702 static void GenerateSlow(MacroAssembler* masm);
682 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 703 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
683 StrictModeFlag strict_mode); 704 StrictModeFlag strict_mode);
684 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); 705 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
685 static void GenerateNonStrictArguments(MacroAssembler* masm); 706 static void GenerateNonStrictArguments(MacroAssembler* masm);
686 707
687 protected: 708 protected:
688 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } 709 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
689 710
690 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 711 virtual void UpdateMegamorphicCache(Type* type, Name* name, Code* code) { }
691 712
692 virtual Handle<Code> pre_monomorphic_stub() { 713 virtual Handle<Code> pre_monomorphic_stub() {
693 return pre_monomorphic_stub(isolate(), strict_mode()); 714 return pre_monomorphic_stub(isolate(), strict_mode());
694 } 715 }
695 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 716 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
696 StrictModeFlag strict_mode) { 717 StrictModeFlag strict_mode) {
697 if (strict_mode == kStrictMode) { 718 if (strict_mode == kStrictMode) {
698 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); 719 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict();
699 } else { 720 } else {
700 return isolate->builtins()->KeyedStoreIC_PreMonomorphic(); 721 return isolate->builtins()->KeyedStoreIC_PreMonomorphic();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 Handle<Type>* left_type, 835 Handle<Type>* left_type,
815 Handle<Type>* right_type, 836 Handle<Type>* right_type,
816 Handle<Type>* overall_type, 837 Handle<Type>* overall_type,
817 Handle<Map> map, 838 Handle<Map> map,
818 Isolate* isolate); 839 Isolate* isolate);
819 840
820 CompareIC(Isolate* isolate, Token::Value op) 841 CompareIC(Isolate* isolate, Token::Value op)
821 : IC(EXTRA_CALL_FRAME, isolate), op_(op) { } 842 : IC(EXTRA_CALL_FRAME, isolate), op_(op) { }
822 843
823 // Update the inline cache for the given operands. 844 // Update the inline cache for the given operands.
824 void UpdateCaches(Handle<Object> x, Handle<Object> y); 845 Code* UpdateCaches(Handle<Object> x, Handle<Object> y);
825 846
826 847
827 // Factory method for getting an uninitialized compare stub. 848 // Factory method for getting an uninitialized compare stub.
828 static Handle<Code> GetUninitialized(Isolate* isolate, Token::Value op); 849 static Handle<Code> GetUninitialized(Isolate* isolate, Token::Value op);
829 850
830 // Helper function for computing the condition for a compare operation. 851 // Helper function for computing the condition for a compare operation.
831 static Condition ComputeCondition(Token::Value op); 852 static Condition ComputeCondition(Token::Value op);
832 853
833 static const char* GetStateName(State state); 854 static const char* GetStateName(State state);
834 855
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 888
868 static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil, 889 static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil,
869 Handle<Object> object); 890 Handle<Object> object);
870 }; 891 };
871 892
872 893
873 class ToBooleanIC: public IC { 894 class ToBooleanIC: public IC {
874 public: 895 public:
875 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } 896 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
876 897
877 MaybeObject* ToBoolean(Handle<Object> object, Code::ExtraICState state); 898 MaybeObject* ToBoolean(Handle<Object> object);
878 }; 899 };
879 900
880 901
881 // Helper for BinaryOpIC and CompareIC. 902 // Helper for BinaryOpIC and CompareIC.
882 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; 903 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK };
883 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); 904 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check);
884 905
885 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); 906 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure);
886 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); 907 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure);
887 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); 908 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss);
888 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 909 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
910 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure);
889 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 911 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
890 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 912 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
891 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 913 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
892 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 914 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
893 915
894 916
895 } } // namespace v8::internal 917 } } // namespace v8::internal
896 918
897 #endif // V8_IC_H_ 919 #endif // V8_IC_H_
OLDNEW
« include/v8-platform.h ('K') | « src/ia32/stub-cache-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698