Revision f230a1cf deps/v8/src/ic.h
deps/v8/src/ic.h | ||
---|---|---|
57 | 57 |
ICU(LoadPropertyWithInterceptorForCall) \ |
58 | 58 |
ICU(KeyedLoadPropertyWithInterceptor) \ |
59 | 59 |
ICU(StoreInterceptorProperty) \ |
60 |
ICU(BinaryOp_Patch) \ |
|
61 | 60 |
ICU(CompareIC_Miss) \ |
61 |
ICU(BinaryOpIC_Miss) \ |
|
62 | 62 |
ICU(CompareNilIC_Miss) \ |
63 | 63 |
ICU(Unreachable) \ |
64 | 64 |
ICU(ToBooleanIC_Miss) |
... | ... | |
95 | 95 |
virtual ~IC() {} |
96 | 96 |
|
97 | 97 |
// Get the call-site target; used for determining the state. |
98 |
Code* target() const { return GetTargetAtAddress(address()); } |
|
98 |
Handle<Code> target() const { return target_; } |
|
99 |
Code* raw_target() const { return GetTargetAtAddress(address()); } |
|
100 |
|
|
101 |
State state() const { return state_; } |
|
99 | 102 |
inline Address address() const; |
100 | 103 |
|
101 | 104 |
// Compute the current IC state based on the target stub, receiver and name. |
102 |
static State StateFrom(Code* target, Object* receiver, Object* name); |
|
105 |
void UpdateState(Handle<Object> receiver, Handle<Object> name); |
|
106 |
void MarkMonomorphicPrototypeFailure() { |
|
107 |
state_ = MONOMORPHIC_PROTOTYPE_FAILURE; |
|
108 |
} |
|
103 | 109 |
|
104 | 110 |
// Clear the inline cache to initial state. |
105 | 111 |
static void Clear(Isolate* isolate, Address address); |
... | ... | |
128 | 134 |
// These methods should not be called with undefined or null. |
129 | 135 |
static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, |
130 | 136 |
JSObject* holder); |
131 |
static inline InlineCacheHolderFlag GetCodeCacheForObject(JSObject* object, |
|
132 |
JSObject* holder); |
|
133 | 137 |
static inline JSObject* GetCodeCacheHolder(Isolate* isolate, |
134 | 138 |
Object* object, |
135 | 139 |
InlineCacheHolderFlag holder); |
136 | 140 |
|
141 |
static bool IsCleared(Code* code) { |
|
142 |
InlineCacheState state = code->ic_state(); |
|
143 |
return state == UNINITIALIZED || state == PREMONOMORPHIC; |
|
144 |
} |
|
145 |
|
|
137 | 146 |
protected: |
138 | 147 |
Address fp() const { return fp_; } |
139 | 148 |
Address pc() const { return *pc_address_; } |
... | ... | |
146 | 155 |
#endif |
147 | 156 |
|
148 | 157 |
// Set the call-site target. |
149 |
void set_target(Code* code) { SetTargetAtAddress(address(), code); } |
|
158 |
void set_target(Code* code) { |
|
159 |
SetTargetAtAddress(address(), code); |
|
160 |
target_set_ = true; |
|
161 |
} |
|
162 |
|
|
163 |
bool is_target_set() { return target_set_; } |
|
150 | 164 |
|
151 | 165 |
#ifdef DEBUG |
152 | 166 |
char TransitionMarkFromState(IC::State state); |
153 | 167 |
|
154 |
void TraceIC(const char* type, |
|
155 |
Handle<Object> name, |
|
156 |
State old_state, |
|
157 |
Code* new_target); |
|
168 |
void TraceIC(const char* type, Handle<Object> name); |
|
158 | 169 |
#endif |
159 | 170 |
|
160 | 171 |
Failure* TypeError(const char* type, |
... | ... | |
167 | 178 |
static inline void SetTargetAtAddress(Address address, Code* target); |
168 | 179 |
static void PostPatching(Address address, Code* target, Code* old_target); |
169 | 180 |
|
170 |
virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
|
171 |
Handle<Code> handler, |
|
172 |
Handle<String> name, |
|
173 |
StrictModeFlag strict_mode) { |
|
174 |
set_target(*handler); |
|
175 |
} |
|
176 |
bool UpdatePolymorphicIC(State state, |
|
177 |
Handle<HeapObject> receiver, |
|
178 |
Handle<String> name, |
|
179 |
Handle<Code> code, |
|
180 |
StrictModeFlag strict_mode); |
|
181 |
|
|
182 |
virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
|
183 |
CodeHandleList* handlers, |
|
184 |
int number_of_valid_maps, |
|
185 |
Handle<Name> name, |
|
186 |
StrictModeFlag strict_mode) { |
|
181 |
// Compute the handler either by compiling or by retrieving a cached version. |
|
182 |
Handle<Code> ComputeHandler(LookupResult* lookup, |
|
183 |
Handle<JSObject> receiver, |
|
184 |
Handle<String> name, |
|
185 |
Handle<Object> value = Handle<Code>::null()); |
|
186 |
virtual Handle<Code> CompileHandler(LookupResult* lookup, |
|
187 |
Handle<JSObject> receiver, |
|
188 |
Handle<String> name, |
|
189 |
Handle<Object> value) { |
|
187 | 190 |
UNREACHABLE(); |
188 | 191 |
return Handle<Code>::null(); |
189 |
}; |
|
192 |
} |
|
193 |
void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
|
194 |
Handle<Code> handler, |
|
195 |
Handle<String> name); |
|
196 |
|
|
197 |
bool UpdatePolymorphicIC(Handle<HeapObject> receiver, |
|
198 |
Handle<String> name, |
|
199 |
Handle<Code> code); |
|
190 | 200 |
|
191 | 201 |
void CopyICToMegamorphicCache(Handle<String> name); |
192 | 202 |
bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); |
193 |
void PatchCache(State state, |
|
194 |
StrictModeFlag strict_mode, |
|
195 |
Handle<HeapObject> receiver, |
|
203 |
void PatchCache(Handle<HeapObject> receiver, |
|
196 | 204 |
Handle<String> name, |
197 | 205 |
Handle<Code> code); |
198 | 206 |
virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); |
199 |
virtual Handle<Code> megamorphic_stub() {
|
|
207 |
virtual Code::Kind kind() const {
|
|
200 | 208 |
UNREACHABLE(); |
201 |
return Handle<Code>::null();
|
|
209 |
return Code::STUB;
|
|
202 | 210 |
} |
203 |
virtual Handle<Code> megamorphic_stub_strict() {
|
|
211 |
virtual Handle<Code> slow_stub() const {
|
|
204 | 212 |
UNREACHABLE(); |
205 | 213 |
return Handle<Code>::null(); |
206 | 214 |
} |
207 |
virtual Handle<Code> generic_stub() const {
|
|
215 |
virtual Handle<Code> megamorphic_stub() {
|
|
208 | 216 |
UNREACHABLE(); |
209 | 217 |
return Handle<Code>::null(); |
210 | 218 |
} |
211 |
virtual Handle<Code> generic_stub_strict() const {
|
|
219 |
virtual Handle<Code> generic_stub() const { |
|
212 | 220 |
UNREACHABLE(); |
213 | 221 |
return Handle<Code>::null(); |
214 | 222 |
} |
223 |
virtual StrictModeFlag strict_mode() const { return kNonStrictMode; } |
|
224 |
bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, |
|
225 |
Handle<String> name); |
|
226 |
void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name); |
|
215 | 227 |
|
216 | 228 |
private: |
217 | 229 |
// Frame pointer for the frame that uses (calls) the IC. |
... | ... | |
225 | 237 |
|
226 | 238 |
Isolate* isolate_; |
227 | 239 |
|
240 |
// The original code target that missed. |
|
241 |
Handle<Code> target_; |
|
242 |
State state_; |
|
243 |
bool target_set_; |
|
244 |
|
|
228 | 245 |
DISALLOW_IMPLICIT_CONSTRUCTORS(IC); |
229 | 246 |
}; |
230 | 247 |
|
... | ... | |
251 | 268 |
class StringStubState: public BitField<StringStubFeedback, 1, 1> {}; |
252 | 269 |
|
253 | 270 |
// Returns a JSFunction or a Failure. |
254 |
MUST_USE_RESULT MaybeObject* LoadFunction(State state, |
|
255 |
Code::ExtraICState extra_ic_state, |
|
256 |
Handle<Object> object, |
|
271 |
MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object, |
|
257 | 272 |
Handle<String> name); |
258 | 273 |
|
259 | 274 |
protected: |
260 | 275 |
CallICBase(Code::Kind kind, Isolate* isolate) |
261 | 276 |
: IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} |
262 | 277 |
|
263 |
bool TryUpdateExtraICState(LookupResult* lookup, |
|
264 |
Handle<Object> object, |
|
265 |
Code::ExtraICState* extra_ic_state); |
|
278 |
virtual Code::ExtraICState extra_ic_state() { return Code::kNoExtraICState; } |
|
266 | 279 |
|
267 | 280 |
// Compute a monomorphic stub if possible, otherwise return a null handle. |
268 | 281 |
Handle<Code> ComputeMonomorphicStub(LookupResult* lookup, |
269 |
State state, |
|
270 |
Code::ExtraICState extra_state, |
|
271 | 282 |
Handle<Object> object, |
272 | 283 |
Handle<String> name); |
273 | 284 |
|
274 | 285 |
// Update the inline cache and the global stub cache based on the lookup |
275 | 286 |
// result. |
276 | 287 |
void UpdateCaches(LookupResult* lookup, |
277 |
State state, |
|
278 |
Code::ExtraICState extra_ic_state, |
|
279 | 288 |
Handle<Object> object, |
280 | 289 |
Handle<String> name); |
281 | 290 |
|
... | ... | |
302 | 311 |
Code::Kind kind, |
303 | 312 |
Code::ExtraICState extra_state); |
304 | 313 |
|
314 |
virtual Handle<Code> megamorphic_stub(); |
|
315 |
virtual Handle<Code> pre_monomorphic_stub(); |
|
316 |
|
|
305 | 317 |
Code::Kind kind_; |
306 | 318 |
|
307 | 319 |
friend class IC; |
... | ... | |
310 | 322 |
|
311 | 323 |
class CallIC: public CallICBase { |
312 | 324 |
public: |
313 |
explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) { |
|
325 |
explicit CallIC(Isolate* isolate) |
|
326 |
: CallICBase(Code::CALL_IC, isolate), |
|
327 |
extra_ic_state_(target()->extra_ic_state()) { |
|
314 | 328 |
ASSERT(target()->is_call_stub()); |
315 | 329 |
} |
316 | 330 |
|
... | ... | |
335 | 349 |
CallICBase::GenerateNormal(masm, argc); |
336 | 350 |
GenerateMiss(masm, argc, Code::kNoExtraICState); |
337 | 351 |
} |
352 |
bool TryUpdateExtraICState(LookupResult* lookup, Handle<Object> object); |
|
353 |
|
|
354 |
protected: |
|
355 |
virtual Code::ExtraICState extra_ic_state() { return extra_ic_state_; } |
|
356 |
|
|
357 |
private: |
|
358 |
Code::ExtraICState extra_ic_state_; |
|
338 | 359 |
}; |
339 | 360 |
|
340 | 361 |
|
... | ... | |
345 | 366 |
ASSERT(target()->is_keyed_call_stub()); |
346 | 367 |
} |
347 | 368 |
|
348 |
MUST_USE_RESULT MaybeObject* LoadFunction(State state, |
|
349 |
Handle<Object> object, |
|
369 |
MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object, |
|
350 | 370 |
Handle<Object> key); |
351 | 371 |
|
352 | 372 |
// Code generator routines. |
... | ... | |
381 | 401 |
static void GenerateNormal(MacroAssembler* masm); |
382 | 402 |
static void GenerateRuntimeGetProperty(MacroAssembler* masm); |
383 | 403 |
|
384 |
MUST_USE_RESULT MaybeObject* Load(State state, |
|
385 |
Handle<Object> object, |
|
404 |
MUST_USE_RESULT MaybeObject* Load(Handle<Object> object, |
|
386 | 405 |
Handle<String> name); |
387 | 406 |
|
388 | 407 |
protected: |
... | ... | |
399 | 418 |
// Update the inline cache and the global stub cache based on the |
400 | 419 |
// lookup result. |
401 | 420 |
void UpdateCaches(LookupResult* lookup, |
402 |
State state, |
|
403 | 421 |
Handle<Object> object, |
404 | 422 |
Handle<String> name); |
405 | 423 |
|
406 |
virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
|
407 |
Handle<Code> handler, |
|
408 |
Handle<String> name, |
|
409 |
StrictModeFlag strict_mode); |
|
410 |
|
|
411 |
virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
|
412 |
CodeHandleList* handlers, |
|
413 |
int number_of_valid_maps, |
|
414 |
Handle<Name> name, |
|
415 |
StrictModeFlag strict_mode); |
|
416 |
|
|
417 |
virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
|
418 |
Handle<JSObject> receiver, |
|
419 |
Handle<String> name); |
|
424 |
virtual Handle<Code> CompileHandler(LookupResult* lookup, |
|
425 |
Handle<JSObject> receiver, |
|
426 |
Handle<String> name, |
|
427 |
Handle<Object> unused); |
|
420 | 428 |
|
421 | 429 |
private: |
422 | 430 |
// Stub accessors. |
423 | 431 |
static Handle<Code> initialize_stub(Isolate* isolate) { |
424 | 432 |
return isolate->builtins()->LoadIC_Initialize(); |
425 | 433 |
} |
434 |
|
|
435 |
static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { |
|
436 |
return isolate->builtins()->LoadIC_PreMonomorphic(); |
|
437 |
} |
|
438 |
|
|
426 | 439 |
virtual Handle<Code> pre_monomorphic_stub() { |
427 |
return isolate()->builtins()->LoadIC_PreMonomorphic();
|
|
440 |
return pre_monomorphic_stub(isolate());
|
|
428 | 441 |
} |
429 | 442 |
|
443 |
Handle<Code> SimpleFieldLoad(int offset, |
|
444 |
bool inobject = true, |
|
445 |
Representation representation = |
|
446 |
Representation::Tagged()); |
|
447 |
|
|
430 | 448 |
static void Clear(Isolate* isolate, Address address, Code* target); |
431 | 449 |
|
432 | 450 |
friend class IC; |
... | ... | |
446 | 464 |
ASSERT(target()->is_keyed_load_stub()); |
447 | 465 |
} |
448 | 466 |
|
449 |
MUST_USE_RESULT MaybeObject* Load(State state, |
|
450 |
Handle<Object> object, |
|
467 |
MUST_USE_RESULT MaybeObject* Load(Handle<Object> object, |
|
451 | 468 |
Handle<Object> key, |
452 | 469 |
ICMissMode force_generic); |
453 | 470 |
|
... | ... | |
487 | 504 |
return isolate()->builtins()->KeyedLoadIC_Slow(); |
488 | 505 |
} |
489 | 506 |
|
490 |
// Update the inline cache. |
|
491 |
virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
|
492 |
Handle<Code> handler, |
|
493 |
Handle<String> name, |
|
494 |
StrictModeFlag strict_mode); |
|
495 |
virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
|
496 |
Handle<JSObject> receiver, |
|
497 |
Handle<String> name); |
|
498 | 507 |
virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
499 | 508 |
|
500 | 509 |
private: |
... | ... | |
502 | 511 |
static Handle<Code> initialize_stub(Isolate* isolate) { |
503 | 512 |
return isolate->builtins()->KeyedLoadIC_Initialize(); |
504 | 513 |
} |
514 |
static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { |
|
515 |
return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); |
|
516 |
} |
|
505 | 517 |
virtual Handle<Code> pre_monomorphic_stub() { |
506 |
return isolate()->builtins()->KeyedLoadIC_PreMonomorphic();
|
|
518 |
return pre_monomorphic_stub(isolate());
|
|
507 | 519 |
} |
508 | 520 |
Handle<Code> indexed_interceptor_stub() { |
509 | 521 |
return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); |
... | ... | |
523 | 535 |
|
524 | 536 |
class StoreIC: public IC { |
525 | 537 |
public: |
526 |
StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { |
|
538 |
StoreIC(FrameDepth depth, Isolate* isolate) |
|
539 |
: IC(depth, isolate), |
|
540 |
strict_mode_(Code::GetStrictMode(target()->extra_ic_state())) { |
|
527 | 541 |
ASSERT(target()->is_store_stub() || target()->is_keyed_store_stub()); |
528 | 542 |
} |
529 | 543 |
|
544 |
virtual StrictModeFlag strict_mode() const { return strict_mode_; } |
|
545 |
|
|
530 | 546 |
// Code generators for stub routines. Only called once at startup. |
531 | 547 |
static void GenerateSlow(MacroAssembler* masm); |
532 | 548 |
static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
... | ... | |
541 | 557 |
StrictModeFlag strict_mode); |
542 | 558 |
|
543 | 559 |
MUST_USE_RESULT MaybeObject* Store( |
544 |
State state, |
|
545 |
StrictModeFlag strict_mode, |
|
546 | 560 |
Handle<Object> object, |
547 | 561 |
Handle<String> name, |
548 | 562 |
Handle<Object> value, |
... | ... | |
552 | 566 |
protected: |
553 | 567 |
virtual Code::Kind kind() const { return Code::STORE_IC; } |
554 | 568 |
virtual Handle<Code> megamorphic_stub() { |
555 |
return isolate()->builtins()->StoreIC_Megamorphic(); |
|
569 |
if (strict_mode() == kStrictMode) { |
|
570 |
return isolate()->builtins()->StoreIC_Megamorphic_Strict(); |
|
571 |
} else { |
|
572 |
return isolate()->builtins()->StoreIC_Megamorphic(); |
|
573 |
} |
|
556 | 574 |
} |
557 | 575 |
// Stub accessors. |
558 |
virtual Handle<Code> megamorphic_stub_strict() { |
|
559 |
return isolate()->builtins()->StoreIC_Megamorphic_Strict(); |
|
560 |
} |
|
561 | 576 |
virtual Handle<Code> generic_stub() const { |
562 |
return isolate()->builtins()->StoreIC_Generic(); |
|
577 |
if (strict_mode() == kStrictMode) { |
|
578 |
return isolate()->builtins()->StoreIC_Generic_Strict(); |
|
579 |
} else { |
|
580 |
return isolate()->builtins()->StoreIC_Generic(); |
|
581 |
} |
|
563 | 582 |
} |
564 |
virtual Handle<Code> generic_stub_strict() const { |
|
565 |
return isolate()->builtins()->StoreIC_Generic_Strict(); |
|
583 |
|
|
584 |
virtual Handle<Code> slow_stub() const { |
|
585 |
if (strict_mode() == kStrictMode) { |
|
586 |
return isolate()->builtins()->StoreIC_Slow_Strict(); |
|
587 |
} else { |
|
588 |
return isolate()->builtins()->StoreIC_Slow(); |
|
589 |
} |
|
566 | 590 |
} |
567 |
virtual Handle<Code> pre_monomorphic_stub() const { |
|
568 |
return isolate()->builtins()->StoreIC_PreMonomorphic(); |
|
591 |
|
|
592 |
virtual Handle<Code> pre_monomorphic_stub() { |
|
593 |
return pre_monomorphic_stub(isolate(), strict_mode()); |
|
569 | 594 |
} |
570 |
virtual Handle<Code> pre_monomorphic_stub_strict() const { |
|
571 |
return isolate()->builtins()->StoreIC_PreMonomorphic_Strict(); |
|
595 |
|
|
596 |
static Handle<Code> pre_monomorphic_stub(Isolate* isolate, |
|
597 |
StrictModeFlag strict_mode) { |
|
598 |
if (strict_mode == kStrictMode) { |
|
599 |
return isolate->builtins()->StoreIC_PreMonomorphic_Strict(); |
|
600 |
} else { |
|
601 |
return isolate->builtins()->StoreIC_PreMonomorphic(); |
|
602 |
} |
|
572 | 603 |
} |
604 |
|
|
573 | 605 |
virtual Handle<Code> global_proxy_stub() { |
574 |
return isolate()->builtins()->StoreIC_GlobalProxy(); |
|
575 |
} |
|
576 |
virtual Handle<Code> global_proxy_stub_strict() { |
|
577 |
return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); |
|
606 |
if (strict_mode() == kStrictMode) { |
|
607 |
return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); |
|
608 |
} else { |
|
609 |
return isolate()->builtins()->StoreIC_GlobalProxy(); |
|
610 |
} |
|
578 | 611 |
} |
579 | 612 |
|
580 |
virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
|
581 |
Handle<Code> handler, |
|
582 |
Handle<String> name, |
|
583 |
StrictModeFlag strict_mode); |
|
584 |
|
|
585 |
virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
|
586 |
CodeHandleList* handlers, |
|
587 |
int number_of_valid_maps, |
|
588 |
Handle<Name> name, |
|
589 |
StrictModeFlag strict_mode); |
|
590 |
|
|
591 | 613 |
// Update the inline cache and the global stub cache based on the |
592 | 614 |
// lookup result. |
593 | 615 |
void UpdateCaches(LookupResult* lookup, |
594 |
State state, |
|
595 |
StrictModeFlag strict_mode, |
|
596 | 616 |
Handle<JSObject> receiver, |
597 | 617 |
Handle<String> name, |
598 | 618 |
Handle<Object> value); |
599 |
// Compute the code stub for this store; used for rewriting to |
|
600 |
// monomorphic state and making sure that the code stub is in the |
|
601 |
// stub cache. |
|
602 |
virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, |
|
603 |
StrictModeFlag strict_mode, |
|
604 |
Handle<JSObject> receiver, |
|
605 |
Handle<String> name, |
|
606 |
Handle<Object> value); |
|
619 |
virtual Handle<Code> CompileHandler(LookupResult* lookup, |
|
620 |
Handle<JSObject> receiver, |
|
621 |
Handle<String> name, |
|
622 |
Handle<Object> value); |
|
607 | 623 |
|
608 | 624 |
private: |
609 | 625 |
void set_target(Code* code) { |
... | ... | |
613 | 629 |
IC::set_target(code); |
614 | 630 |
} |
615 | 631 |
|
616 |
static Handle<Code> initialize_stub(Isolate* isolate) { |
|
617 |
return isolate->builtins()->StoreIC_Initialize(); |
|
618 |
} |
|
619 |
static Handle<Code> initialize_stub_strict(Isolate* isolate) { |
|
620 |
return isolate->builtins()->StoreIC_Initialize_Strict(); |
|
632 |
static Handle<Code> initialize_stub(Isolate* isolate, |
|
633 |
StrictModeFlag strict_mode) { |
|
634 |
if (strict_mode == kStrictMode) { |
|
635 |
return isolate->builtins()->StoreIC_Initialize_Strict(); |
|
636 |
} else { |
|
637 |
return isolate->builtins()->StoreIC_Initialize(); |
|
638 |
} |
|
621 | 639 |
} |
640 |
|
|
622 | 641 |
static void Clear(Isolate* isolate, Address address, Code* target); |
623 | 642 |
|
643 |
StrictModeFlag strict_mode_; |
|
644 |
|
|
624 | 645 |
friend class IC; |
625 | 646 |
}; |
626 | 647 |
|
... | ... | |
644 | 665 |
ASSERT(target()->is_keyed_store_stub()); |
645 | 666 |
} |
646 | 667 |
|
647 |
MUST_USE_RESULT MaybeObject* Store(State state, |
|
648 |
StrictModeFlag strict_mode, |
|
649 |
Handle<Object> object, |
|
668 |
MUST_USE_RESULT MaybeObject* Store(Handle<Object> object, |
|
650 | 669 |
Handle<Object> name, |
651 | 670 |
Handle<Object> value, |
652 | 671 |
ICMissMode force_generic); |
... | ... | |
668 | 687 |
protected: |
669 | 688 |
virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
670 | 689 |
|
671 |
virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, |
|
672 |
StrictModeFlag strict_mode, |
|
673 |
Handle<JSObject> receiver, |
|
674 |
Handle<String> name, |
|
675 |
Handle<Object> value); |
|
676 | 690 |
virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
677 | 691 |
|
678 |
virtual Handle<Code> pre_monomorphic_stub() const {
|
|
679 |
return isolate()->builtins()->KeyedStoreIC_PreMonomorphic();
|
|
692 |
virtual Handle<Code> pre_monomorphic_stub() { |
|
693 |
return pre_monomorphic_stub(isolate(), strict_mode());
|
|
680 | 694 |
} |
681 |
virtual Handle<Code> pre_monomorphic_stub_strict() const { |
|
682 |
return isolate()->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); |
|
695 |
static Handle<Code> pre_monomorphic_stub(Isolate* isolate, |
|
696 |
StrictModeFlag strict_mode) { |
|
697 |
if (strict_mode == kStrictMode) { |
|
698 |
return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); |
|
699 |
} else { |
|
700 |
return isolate->builtins()->KeyedStoreIC_PreMonomorphic(); |
|
701 |
} |
|
683 | 702 |
} |
684 |
virtual Handle<Code> megamorphic_stub() { |
|
685 |
return isolate()->builtins()->KeyedStoreIC_Generic(); |
|
703 |
virtual Handle<Code> slow_stub() const { |
|
704 |
if (strict_mode() == kStrictMode) { |
|
705 |
return isolate()->builtins()->KeyedStoreIC_Slow_Strict(); |
|
706 |
} else { |
|
707 |
return isolate()->builtins()->KeyedStoreIC_Slow(); |
|
708 |
} |
|
686 | 709 |
} |
687 |
virtual Handle<Code> megamorphic_stub_strict() { |
|
688 |
return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
|
710 |
virtual Handle<Code> megamorphic_stub() { |
|
711 |
if (strict_mode() == kStrictMode) { |
|
712 |
return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
|
713 |
} else { |
|
714 |
return isolate()->builtins()->KeyedStoreIC_Generic(); |
|
715 |
} |
|
689 | 716 |
} |
690 | 717 |
|
691 | 718 |
Handle<Code> StoreElementStub(Handle<JSObject> receiver, |
692 |
KeyedAccessStoreMode store_mode, |
|
693 |
StrictModeFlag strict_mode); |
|
694 |
|
|
695 |
virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver, |
|
696 |
Handle<Code> handler, |
|
697 |
Handle<String> name, |
|
698 |
StrictModeFlag strict_mode); |
|
719 |
KeyedAccessStoreMode store_mode); |
|
699 | 720 |
|
700 | 721 |
private: |
701 | 722 |
void set_target(Code* code) { |
702 | 723 |
// Strict mode must be preserved across IC patching. |
703 |
ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
|
704 |
Code::GetStrictMode(target()->extra_ic_state())); |
|
724 |
ASSERT(Code::GetStrictMode(code->extra_ic_state()) == strict_mode()); |
|
705 | 725 |
IC::set_target(code); |
706 | 726 |
} |
707 | 727 |
|
708 | 728 |
// Stub accessors. |
709 |
static Handle<Code> initialize_stub(Isolate* isolate) { |
|
710 |
return isolate->builtins()->KeyedStoreIC_Initialize(); |
|
711 |
} |
|
712 |
static Handle<Code> initialize_stub_strict(Isolate* isolate) { |
|
713 |
return isolate->builtins()->KeyedStoreIC_Initialize_Strict(); |
|
714 |
} |
|
715 |
Handle<Code> generic_stub() const { |
|
716 |
return isolate()->builtins()->KeyedStoreIC_Generic(); |
|
729 |
static Handle<Code> initialize_stub(Isolate* isolate, |
|
730 |
StrictModeFlag strict_mode) { |
|
731 |
if (strict_mode == kStrictMode) { |
|
732 |
return isolate->builtins()->KeyedStoreIC_Initialize_Strict(); |
|
733 |
} else { |
|
734 |
return isolate->builtins()->KeyedStoreIC_Initialize(); |
|
735 |
} |
|
717 | 736 |
} |
718 |
Handle<Code> generic_stub_strict() const { |
|
719 |
return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
|
737 |
|
|
738 |
virtual Handle<Code> generic_stub() const { |
|
739 |
if (strict_mode() == kStrictMode) { |
|
740 |
return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
|
741 |
} else { |
|
742 |
return isolate()->builtins()->KeyedStoreIC_Generic(); |
|
743 |
} |
|
720 | 744 |
} |
745 |
|
|
721 | 746 |
Handle<Code> non_strict_arguments_stub() { |
722 | 747 |
return isolate()->builtins()->KeyedStoreIC_NonStrictArguments(); |
723 | 748 |
} |
... | ... | |
748 | 773 |
GENERIC |
749 | 774 |
}; |
750 | 775 |
|
751 |
static void StubInfoToType(int minor_key, |
|
752 |
Handle<Type>* left, |
|
753 |
Handle<Type>* right, |
|
754 |
Handle<Type>* result, |
|
755 |
Isolate* isolate); |
|
756 |
|
|
757 |
explicit BinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } |
|
776 |
explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
|
758 | 777 |
|
759 |
void patch(Code* code);
|
|
778 |
static Builtins::JavaScript TokenToJSBuiltin(Token::Value op);
|
|
760 | 779 |
|
761 | 780 |
static const char* GetName(TypeInfo type_info); |
762 | 781 |
|
763 |
static State ToState(TypeInfo type_info); |
|
764 |
|
|
765 |
private: |
|
766 |
static Handle<Type> TypeInfoToType(TypeInfo binary_type, Isolate* isolate); |
|
782 |
MUST_USE_RESULT MaybeObject* Transition(Handle<Object> left, |
|
783 |
Handle<Object> right); |
|
767 | 784 |
}; |
768 | 785 |
|
769 | 786 |
|
... | ... | |
870 | 887 |
DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
871 | 888 |
DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
872 | 889 |
DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
890 |
DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); |
|
873 | 891 |
DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
874 | 892 |
DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
875 | 893 |
|
Also available in: Unified diff