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

Side by Side Diff: src/ic.h

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
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/stub-cache-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());
387 } 406 }
388 407
389 MUST_USE_RESULT MaybeObject* Load(Handle<Object> object, 408 MUST_USE_RESULT MaybeObject* Load(Handle<Object> object,
390 Handle<Object> key); 409 Handle<Object> key);
391 410
392 // Code generator routines. 411 // Code generator routines.
393 static void GenerateMiss(MacroAssembler* masm); 412 static void GenerateMiss(MacroAssembler* masm);
394 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 413 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
395 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 414 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
396 static void GeneratePreMonomorphic(MacroAssembler* masm) { 415 static void GeneratePreMonomorphic(MacroAssembler* masm) {
397 GenerateMiss(masm); 416 GenerateMiss(masm);
398 } 417 }
399 static void GenerateGeneric(MacroAssembler* masm); 418 static void GenerateGeneric(MacroAssembler* masm);
400 static void GenerateString(MacroAssembler* masm); 419 static void GenerateString(MacroAssembler* masm);
401 static void GenerateIndexedInterceptor(MacroAssembler* masm); 420 static void GenerateIndexedInterceptor(MacroAssembler* masm);
402 static void GenerateNonStrictArguments(MacroAssembler* masm); 421 static void GenerateSloppyArguments(MacroAssembler* masm);
403 422
404 // Bit mask to be tested against bit field for the cases when 423 // Bit mask to be tested against bit field for the cases when
405 // generic stub should go into slow case. 424 // generic stub should go into slow case.
406 // Access check is necessary explicitly since generic stub does not perform 425 // Access check is necessary explicitly since generic stub does not perform
407 // map checks. 426 // map checks.
408 static const int kSlowCaseBitFieldMask = 427 static const int kSlowCaseBitFieldMask =
409 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); 428 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
410 429
411 protected: 430 protected:
412 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } 431 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
(...skipping 16 matching lines...) Expand all
429 // Stub accessors. 448 // Stub accessors.
430 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 449 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
431 return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); 450 return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
432 } 451 }
433 virtual Handle<Code> pre_monomorphic_stub() { 452 virtual Handle<Code> pre_monomorphic_stub() {
434 return pre_monomorphic_stub(isolate()); 453 return pre_monomorphic_stub(isolate());
435 } 454 }
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> sloppy_arguments_stub() {
440 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); 459 return isolate()->builtins()->KeyedLoadIC_SloppyArguments();
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<StrictMode, 1, 1> {};
455 static ExtraICState ComputeExtraICState(StrictModeFlag flag) { 477 static ExtraICState ComputeExtraICState(StrictMode flag) {
456 return StrictModeState::encode(flag); 478 return StrictModeState::encode(flag);
457 } 479 }
458 480 static StrictMode GetStrictMode(ExtraICState state) {
459 static StrictModeFlag GetStrictMode(ExtraICState state) {
460 return StrictModeState::decode(state); 481 return StrictModeState::decode(state);
461 } 482 }
462 483
463 // For convenience, a statically declared encoding of strict mode extra 484 // For convenience, a statically declared encoding of strict mode extra
464 // IC state. 485 // IC state.
465 static const ExtraICState kStrictModeState = 486 static const ExtraICState kStrictModeState =
466 1 << StrictModeState::kShift; 487 1 << StrictModeState::kShift;
467 488
468 StoreIC(FrameDepth depth, Isolate* isolate) 489 StoreIC(FrameDepth depth, Isolate* isolate)
469 : IC(depth, isolate) { 490 : IC(depth, isolate) {
470 ASSERT(IsStoreStub()); 491 ASSERT(IsStoreStub());
471 } 492 }
472 493
473 StrictModeFlag strict_mode() const { 494 StrictMode strict_mode() const {
474 return StrictModeState::decode(extra_ic_state()); 495 return StrictModeState::decode(extra_ic_state());
475 } 496 }
476 497
477 // Code generators for stub routines. Only called once at startup. 498 // Code generators for stub routines. Only called once at startup.
478 static void GenerateSlow(MacroAssembler* masm); 499 static void GenerateSlow(MacroAssembler* masm);
479 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 500 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
480 static void GeneratePreMonomorphic(MacroAssembler* masm) { 501 static void GeneratePreMonomorphic(MacroAssembler* masm) {
481 GenerateMiss(masm); 502 GenerateMiss(masm);
482 } 503 }
483 static void GenerateMiss(MacroAssembler* masm); 504 static void GenerateMiss(MacroAssembler* masm);
484 static void GenerateMegamorphic(MacroAssembler* masm); 505 static void GenerateMegamorphic(MacroAssembler* masm);
485 static void GenerateNormal(MacroAssembler* masm); 506 static void GenerateNormal(MacroAssembler* masm);
486 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 507 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
487 StrictModeFlag strict_mode); 508 StrictMode strict_mode);
488 509
489 static Handle<Code> initialize_stub(Isolate* isolate, 510 static Handle<Code> initialize_stub(Isolate* isolate,
490 StrictModeFlag strict_mode); 511 StrictMode strict_mode);
491 512
492 MUST_USE_RESULT MaybeObject* Store( 513 MUST_USE_RESULT MaybeObject* Store(
493 Handle<Object> object, 514 Handle<Object> object,
494 Handle<String> name, 515 Handle<String> name,
495 Handle<Object> value, 516 Handle<Object> value,
496 JSReceiver::StoreFromKeyed store_mode = 517 JSReceiver::StoreFromKeyed store_mode =
497 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); 518 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED);
498 519
499 protected: 520 protected:
500 virtual Code::Kind kind() const { return Code::STORE_IC; } 521 virtual Code::Kind kind() const { return Code::STORE_IC; }
501 virtual Handle<Code> megamorphic_stub(); 522 virtual Handle<Code> megamorphic_stub();
502 523
503 // Stub accessors. 524 // Stub accessors.
504 virtual Handle<Code> generic_stub() const; 525 virtual Handle<Code> generic_stub() const;
505 526
506 virtual Handle<Code> slow_stub() const { 527 virtual Handle<Code> slow_stub() const {
507 return isolate()->builtins()->StoreIC_Slow(); 528 return isolate()->builtins()->StoreIC_Slow();
508 } 529 }
509 530
510 virtual Handle<Code> pre_monomorphic_stub() { 531 virtual Handle<Code> pre_monomorphic_stub() {
511 return pre_monomorphic_stub(isolate(), strict_mode()); 532 return pre_monomorphic_stub(isolate(), strict_mode());
512 } 533 }
513 534
514 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 535 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
515 StrictModeFlag strict_mode); 536 StrictMode strict_mode);
516 537
517 // Update the inline cache and the global stub cache based on the 538 // Update the inline cache and the global stub cache based on the
518 // lookup result. 539 // lookup result.
519 void UpdateCaches(LookupResult* lookup, 540 void UpdateCaches(LookupResult* lookup,
520 Handle<JSObject> receiver, 541 Handle<JSObject> receiver,
521 Handle<String> name, 542 Handle<String> name,
522 Handle<Object> value); 543 Handle<Object> value);
523 virtual Handle<Code> CompileHandler(LookupResult* lookup, 544 virtual Handle<Code> CompileHandler(LookupResult* lookup,
524 Handle<Object> object, 545 Handle<Object> object,
525 Handle<String> name, 546 Handle<String> name,
526 Handle<Object> value, 547 Handle<Object> value,
527 InlineCacheHolderFlag cache_holder); 548 InlineCacheHolderFlag cache_holder);
528 549
529 private: 550 private:
530 void set_target(Code* code) { 551 void set_target(Code* code) {
531 // Strict mode must be preserved across IC patching. 552 // Strict mode must be preserved across IC patching.
532 ASSERT(GetStrictMode(code->extra_ic_state()) == 553 ASSERT(GetStrictMode(code->extra_ic_state()) ==
533 GetStrictMode(target()->extra_ic_state())); 554 GetStrictMode(target()->extra_ic_state()));
534 IC::set_target(code); 555 IC::set_target(code);
535 } 556 }
536 557
537 static void Clear(Isolate* isolate, Address address, Code* target); 558 static void Clear(Isolate* isolate,
559 Address address,
560 Code* target,
561 ConstantPoolArray* constant_pool);
538 562
539 friend class IC; 563 friend class IC;
540 }; 564 };
541 565
542 566
543 enum KeyedStoreCheckMap { 567 enum KeyedStoreCheckMap {
544 kDontCheckMap, 568 kDontCheckMap,
545 kCheckMap 569 kCheckMap
546 }; 570 };
547 571
548 572
549 enum KeyedStoreIncrementLength { 573 enum KeyedStoreIncrementLength {
550 kDontIncrementLength, 574 kDontIncrementLength,
551 kIncrementLength 575 kIncrementLength
552 }; 576 };
553 577
554 578
555 class KeyedStoreIC: public StoreIC { 579 class KeyedStoreIC: public StoreIC {
556 public: 580 public:
557 // ExtraICState bits (building on IC) 581 // ExtraICState bits (building on IC)
558 // ExtraICState bits 582 // ExtraICState bits
559 class ExtraICStateKeyedAccessStoreMode: 583 class ExtraICStateKeyedAccessStoreMode:
560 public BitField<KeyedAccessStoreMode, 2, 4> {}; // NOLINT 584 public BitField<KeyedAccessStoreMode, 2, 4> {}; // NOLINT
561 585
562 static ExtraICState ComputeExtraICState(StrictModeFlag flag, 586 static ExtraICState ComputeExtraICState(StrictMode flag,
563 KeyedAccessStoreMode mode) { 587 KeyedAccessStoreMode mode) {
564 return StrictModeState::encode(flag) | 588 return StrictModeState::encode(flag) |
565 ExtraICStateKeyedAccessStoreMode::encode(mode); 589 ExtraICStateKeyedAccessStoreMode::encode(mode);
566 } 590 }
567 591
568 static KeyedAccessStoreMode GetKeyedAccessStoreMode( 592 static KeyedAccessStoreMode GetKeyedAccessStoreMode(
569 ExtraICState extra_state) { 593 ExtraICState extra_state) {
570 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); 594 return ExtraICStateKeyedAccessStoreMode::decode(extra_state);
571 } 595 }
572 596
573 KeyedStoreIC(FrameDepth depth, Isolate* isolate) 597 KeyedStoreIC(FrameDepth depth, Isolate* isolate)
574 : StoreIC(depth, isolate) { 598 : StoreIC(depth, isolate) {
575 ASSERT(target()->is_keyed_store_stub()); 599 ASSERT(target()->is_keyed_store_stub());
576 } 600 }
577 601
578 MUST_USE_RESULT MaybeObject* Store(Handle<Object> object, 602 MUST_USE_RESULT MaybeObject* Store(Handle<Object> object,
579 Handle<Object> name, 603 Handle<Object> name,
580 Handle<Object> value); 604 Handle<Object> value);
581 605
582 // Code generators for stub routines. Only called once at startup. 606 // Code generators for stub routines. Only called once at startup.
583 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 607 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
584 static void GeneratePreMonomorphic(MacroAssembler* masm) { 608 static void GeneratePreMonomorphic(MacroAssembler* masm) {
585 GenerateMiss(masm); 609 GenerateMiss(masm);
586 } 610 }
587 static void GenerateMiss(MacroAssembler* masm); 611 static void GenerateMiss(MacroAssembler* masm);
588 static void GenerateSlow(MacroAssembler* masm); 612 static void GenerateSlow(MacroAssembler* masm);
589 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 613 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
590 StrictModeFlag strict_mode); 614 StrictMode strict_mode);
591 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); 615 static void GenerateGeneric(MacroAssembler* masm, StrictMode strict_mode);
592 static void GenerateNonStrictArguments(MacroAssembler* masm); 616 static void GenerateSloppyArguments(MacroAssembler* masm);
593 617
594 protected: 618 protected:
595 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } 619 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
596 620
597 virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {} 621 virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
598 622
599 virtual Handle<Code> pre_monomorphic_stub() { 623 virtual Handle<Code> pre_monomorphic_stub() {
600 return pre_monomorphic_stub(isolate(), strict_mode()); 624 return pre_monomorphic_stub(isolate(), strict_mode());
601 } 625 }
602 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 626 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
603 StrictModeFlag strict_mode) { 627 StrictMode strict_mode) {
604 if (strict_mode == kStrictMode) { 628 if (strict_mode == STRICT) {
605 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); 629 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict();
606 } else { 630 } else {
607 return isolate->builtins()->KeyedStoreIC_PreMonomorphic(); 631 return isolate->builtins()->KeyedStoreIC_PreMonomorphic();
608 } 632 }
609 } 633 }
610 virtual Handle<Code> slow_stub() const { 634 virtual Handle<Code> slow_stub() const {
611 return isolate()->builtins()->KeyedStoreIC_Slow(); 635 return isolate()->builtins()->KeyedStoreIC_Slow();
612 } 636 }
613 virtual Handle<Code> megamorphic_stub() { 637 virtual Handle<Code> megamorphic_stub() {
614 if (strict_mode() == kStrictMode) { 638 if (strict_mode() == STRICT) {
615 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 639 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
616 } else { 640 } else {
617 return isolate()->builtins()->KeyedStoreIC_Generic(); 641 return isolate()->builtins()->KeyedStoreIC_Generic();
618 } 642 }
619 } 643 }
620 644
621 Handle<Code> StoreElementStub(Handle<JSObject> receiver, 645 Handle<Code> StoreElementStub(Handle<JSObject> receiver,
622 KeyedAccessStoreMode store_mode); 646 KeyedAccessStoreMode store_mode);
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(GetStrictMode(code->extra_ic_state()) == strict_mode()); 651 ASSERT(GetStrictMode(code->extra_ic_state()) == strict_mode());
628 IC::set_target(code); 652 IC::set_target(code);
629 } 653 }
630 654
631 // Stub accessors. 655 // Stub accessors.
632 virtual Handle<Code> generic_stub() const { 656 virtual Handle<Code> generic_stub() const {
633 if (strict_mode() == kStrictMode) { 657 if (strict_mode() == STRICT) {
634 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 658 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
635 } else { 659 } else {
636 return isolate()->builtins()->KeyedStoreIC_Generic(); 660 return isolate()->builtins()->KeyedStoreIC_Generic();
637 } 661 }
638 } 662 }
639 663
640 Handle<Code> non_strict_arguments_stub() { 664 Handle<Code> sloppy_arguments_stub() {
641 return isolate()->builtins()->KeyedStoreIC_NonStrictArguments(); 665 return isolate()->builtins()->KeyedStoreIC_SloppyArguments();
642 } 666 }
643 667
644 static void Clear(Isolate* isolate, Address address, Code* target); 668 static void Clear(Isolate* isolate,
669 Address address,
670 Code* target,
671 ConstantPoolArray* constant_pool);
645 672
646 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver, 673 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver,
647 Handle<Object> key, 674 Handle<Object> key,
648 Handle<Object> value); 675 Handle<Object> value);
649 676
650 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, 677 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver,
651 KeyedAccessStoreMode store_mode); 678 KeyedAccessStoreMode store_mode);
652 679
653 friend class IC; 680 friend class IC;
654 }; 681 };
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 State old_right, 868 State old_right,
842 bool has_inlined_smi_code, 869 bool has_inlined_smi_code,
843 Handle<Object> x, 870 Handle<Object> x,
844 Handle<Object> y); 871 Handle<Object> y);
845 872
846 bool strict() const { return op_ == Token::EQ_STRICT; } 873 bool strict() const { return op_ == Token::EQ_STRICT; }
847 Condition GetCondition() const { return ComputeCondition(op_); } 874 Condition GetCondition() const { return ComputeCondition(op_); }
848 875
849 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op); 876 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op);
850 877
851 static void Clear(Isolate* isolate, Address address, Code* target); 878 static void Clear(Isolate* isolate,
879 Address address,
880 Code* target,
881 ConstantPoolArray* constant_pool);
852 882
853 Token::Value op_; 883 Token::Value op_;
854 884
855 friend class IC; 885 friend class IC;
856 }; 886 };
857 887
858 888
859 class CompareNilIC: public IC { 889 class CompareNilIC: public IC {
860 public: 890 public:
861 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} 891 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {}
862 892
863 MUST_USE_RESULT MaybeObject* CompareNil(Handle<Object> object); 893 MUST_USE_RESULT MaybeObject* CompareNil(Handle<Object> object);
864 894
865 static Handle<Code> GetUninitialized(); 895 static Handle<Code> GetUninitialized();
866 896
867 static void Clear(Address address, Code* target); 897 static void Clear(Address address,
898 Code* target,
899 ConstantPoolArray* constant_pool);
868 900
869 static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil, 901 static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil,
870 Handle<Object> object); 902 Handle<Object> object);
871 }; 903 };
872 904
873 905
874 class ToBooleanIC: public IC { 906 class ToBooleanIC: public IC {
875 public: 907 public:
876 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } 908 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
877 909
(...skipping 12 matching lines...) Expand all
890 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 922 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
891 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 923 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
892 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); 924 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite);
893 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 925 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
894 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 926 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
895 927
896 928
897 } } // namespace v8::internal 929 } } // namespace v8::internal
898 930
899 #endif // V8_IC_H_ 931 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « 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