OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 V(CallConstruct) \ | 28 V(CallConstruct) \ |
29 V(CallFunction) \ | 29 V(CallFunction) \ |
30 V(CallIC) \ | 30 V(CallIC) \ |
31 V(CallIC_Array) \ | 31 V(CallIC_Array) \ |
32 V(CEntry) \ | 32 V(CEntry) \ |
33 V(CompareIC) \ | 33 V(CompareIC) \ |
34 V(DoubleToI) \ | 34 V(DoubleToI) \ |
35 V(FunctionPrototype) \ | 35 V(FunctionPrototype) \ |
36 V(Instanceof) \ | 36 V(Instanceof) \ |
37 V(InternalArrayConstructor) \ | 37 V(InternalArrayConstructor) \ |
| 38 V(JSConstructEntry) \ |
38 V(JSEntry) \ | 39 V(JSEntry) \ |
39 V(KeyedLoadICTrampoline) \ | 40 V(KeyedLoadICTrampoline) \ |
40 V(LoadICTrampoline) \ | 41 V(LoadICTrampoline) \ |
41 V(MathPow) \ | 42 V(MathPow) \ |
42 V(ProfileEntryHook) \ | 43 V(ProfileEntryHook) \ |
43 V(RecordWrite) \ | 44 V(RecordWrite) \ |
44 V(RegExpExec) \ | 45 V(RegExpExec) \ |
45 V(StoreArrayLiteralElement) \ | 46 V(StoreArrayLiteralElement) \ |
46 V(StoreBufferOverflow) \ | 47 V(StoreBufferOverflow) \ |
47 V(StoreElement) \ | 48 V(StoreElement) \ |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 192 } |
192 | 193 |
193 friend OStream& operator<<(OStream& os, const CodeStub& s) { | 194 friend OStream& operator<<(OStream& os, const CodeStub& s) { |
194 s.PrintName(os); | 195 s.PrintName(os); |
195 return os; | 196 return os; |
196 } | 197 } |
197 | 198 |
198 Isolate* isolate() const { return isolate_; } | 199 Isolate* isolate() const { return isolate_; } |
199 | 200 |
200 protected: | 201 protected: |
201 explicit CodeStub(uint32_t key) : minor_key_(MinorKeyFromKey(key)) {} | 202 CodeStub(uint32_t key, Isolate* isolate) |
| 203 : minor_key_(MinorKeyFromKey(key)), isolate_(isolate) {} |
202 | 204 |
203 // Generates the assembler code for the stub. | 205 // Generates the assembler code for the stub. |
204 virtual Handle<Code> GenerateCode() = 0; | 206 virtual Handle<Code> GenerateCode() = 0; |
205 | 207 |
206 // Returns whether the code generated for this stub needs to be allocated as | 208 // Returns whether the code generated for this stub needs to be allocated as |
207 // a fixed (non-moveable) code object. | 209 // a fixed (non-moveable) code object. |
208 virtual bool NeedsImmovableCode() { return false; } | 210 virtual bool NeedsImmovableCode() { return false; } |
209 | 211 |
210 virtual void PrintName(OStream& os) const; // NOLINT | 212 virtual void PrintName(OStream& os) const; // NOLINT |
211 virtual void PrintBaseName(OStream& os) const; // NOLINT | 213 virtual void PrintBaseName(OStream& os) const; // NOLINT |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; | 253 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; |
252 class MinorKeyBits: public BitField<uint32_t, | 254 class MinorKeyBits: public BitField<uint32_t, |
253 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT | 255 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT |
254 | 256 |
255 friend class BreakPointIterator; | 257 friend class BreakPointIterator; |
256 | 258 |
257 Isolate* isolate_; | 259 Isolate* isolate_; |
258 }; | 260 }; |
259 | 261 |
260 | 262 |
| 263 #define DEFINE_CODE_STUB_BASE(NAME, SUPER) \ |
| 264 public: \ |
| 265 NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \ |
| 266 \ |
| 267 private: \ |
| 268 DISALLOW_COPY_AND_ASSIGN(NAME) |
| 269 |
| 270 |
| 271 #define DEFINE_CODE_STUB(NAME, SUPER) \ |
| 272 protected: \ |
| 273 virtual inline Major MajorKey() const OVERRIDE { \ |
| 274 return NAME; \ |
| 275 }; \ |
| 276 DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER) |
| 277 |
| 278 |
261 class PlatformCodeStub : public CodeStub { | 279 class PlatformCodeStub : public CodeStub { |
262 public: | 280 public: |
263 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) { } | |
264 | |
265 // Retrieve the code for the stub. Generate the code if needed. | 281 // Retrieve the code for the stub. Generate the code if needed. |
266 virtual Handle<Code> GenerateCode() OVERRIDE; | 282 virtual Handle<Code> GenerateCode() OVERRIDE; |
267 | 283 |
268 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 284 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
269 | 285 |
270 protected: | 286 protected: |
| 287 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {} |
| 288 |
271 // Generates the assembler code for the stub. | 289 // Generates the assembler code for the stub. |
272 virtual void Generate(MacroAssembler* masm) = 0; | 290 virtual void Generate(MacroAssembler* masm) = 0; |
273 | 291 |
274 explicit PlatformCodeStub(uint32_t key) : CodeStub(key) {} | 292 DEFINE_CODE_STUB_BASE(PlatformCodeStub, CodeStub); |
275 | |
276 private: | |
277 DISALLOW_COPY_AND_ASSIGN(PlatformCodeStub); | |
278 }; | 293 }; |
279 | 294 |
280 | 295 |
281 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; | 296 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
282 enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS }; | 297 enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS }; |
283 | 298 |
284 | 299 |
285 class CodeStubInterfaceDescriptor { | 300 class CodeStubInterfaceDescriptor { |
286 public: | 301 public: |
287 CodeStubInterfaceDescriptor(); | 302 CodeStubInterfaceDescriptor(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 }; | 399 }; |
385 | 400 |
386 | 401 |
387 class HydrogenCodeStub : public CodeStub { | 402 class HydrogenCodeStub : public CodeStub { |
388 public: | 403 public: |
389 enum InitializationState { | 404 enum InitializationState { |
390 UNINITIALIZED, | 405 UNINITIALIZED, |
391 INITIALIZED | 406 INITIALIZED |
392 }; | 407 }; |
393 | 408 |
394 explicit HydrogenCodeStub(Isolate* isolate, | |
395 InitializationState state = INITIALIZED) | |
396 : CodeStub(isolate) { | |
397 minor_key_ = IsMissBits::encode(state == UNINITIALIZED); | |
398 } | |
399 | |
400 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 409 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
401 | 410 |
402 CodeStubInterfaceDescriptor* GetInterfaceDescriptor() { | 411 CodeStubInterfaceDescriptor* GetInterfaceDescriptor() { |
403 return isolate()->code_stub_interface_descriptor(MajorKey()); | 412 return isolate()->code_stub_interface_descriptor(MajorKey()); |
404 } | 413 } |
405 | 414 |
406 template<class SubClass> | 415 template<class SubClass> |
407 static Handle<Code> GetUninitialized(Isolate* isolate) { | 416 static Handle<Code> GetUninitialized(Isolate* isolate) { |
408 SubClass::GenerateAheadOfTime(isolate); | 417 SubClass::GenerateAheadOfTime(isolate); |
409 return SubClass().GetCode(isolate); | 418 return SubClass().GetCode(isolate); |
410 } | 419 } |
411 | 420 |
412 virtual void InitializeInterfaceDescriptor( | 421 virtual void InitializeInterfaceDescriptor( |
413 CodeStubInterfaceDescriptor* descriptor) = 0; | 422 CodeStubInterfaceDescriptor* descriptor) = 0; |
414 | 423 |
415 // Retrieve the code for the stub. Generate the code if needed. | 424 // Retrieve the code for the stub. Generate the code if needed. |
416 virtual Handle<Code> GenerateCode() = 0; | 425 virtual Handle<Code> GenerateCode() = 0; |
417 | 426 |
418 bool IsUninitialized() const { return IsMissBits::decode(minor_key_); } | 427 bool IsUninitialized() const { return IsMissBits::decode(minor_key_); } |
419 | 428 |
420 Handle<Code> GenerateLightweightMissCode(); | 429 Handle<Code> GenerateLightweightMissCode(); |
421 | 430 |
422 template<class StateType> | 431 template<class StateType> |
423 void TraceTransition(StateType from, StateType to); | 432 void TraceTransition(StateType from, StateType to); |
424 | 433 |
425 protected: | 434 protected: |
| 435 explicit HydrogenCodeStub(Isolate* isolate, |
| 436 InitializationState state = INITIALIZED) |
| 437 : CodeStub(isolate) { |
| 438 minor_key_ = IsMissBits::encode(state == UNINITIALIZED); |
| 439 } |
| 440 |
426 void set_sub_minor_key(uint32_t key) { | 441 void set_sub_minor_key(uint32_t key) { |
427 minor_key_ = SubMinorKeyBits::update(minor_key_, key); | 442 minor_key_ = SubMinorKeyBits::update(minor_key_, key); |
428 } | 443 } |
429 | 444 |
430 uint32_t sub_minor_key() const { return SubMinorKeyBits::decode(minor_key_); } | 445 uint32_t sub_minor_key() const { return SubMinorKeyBits::decode(minor_key_); } |
431 | 446 |
432 static const int kSubMinorKeyBits = kStubMinorKeyBits - 1; | 447 static const int kSubMinorKeyBits = kStubMinorKeyBits - 1; |
433 | 448 |
434 private: | 449 private: |
435 class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {}; | 450 class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {}; |
436 class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {}; | 451 class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {}; |
437 | 452 |
438 void GenerateLightweightMiss(MacroAssembler* masm); | 453 void GenerateLightweightMiss(MacroAssembler* masm); |
439 | 454 |
440 DISALLOW_COPY_AND_ASSIGN(HydrogenCodeStub); | 455 DEFINE_CODE_STUB_BASE(HydrogenCodeStub, CodeStub); |
441 }; | 456 }; |
442 | 457 |
443 | 458 |
444 // Helper interface to prepare to/restore after making runtime calls. | 459 // Helper interface to prepare to/restore after making runtime calls. |
445 class RuntimeCallHelper { | 460 class RuntimeCallHelper { |
446 public: | 461 public: |
447 virtual ~RuntimeCallHelper() {} | 462 virtual ~RuntimeCallHelper() {} |
448 | 463 |
449 virtual void BeforeCall(MacroAssembler* masm) const = 0; | 464 virtual void BeforeCall(MacroAssembler* masm) const = 0; |
450 | 465 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 528 |
514 virtual void InitializeInterfaceDescriptor( | 529 virtual void InitializeInterfaceDescriptor( |
515 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 530 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
516 | 531 |
517 static void InstallDescriptors(Isolate* isolate) { | 532 static void InstallDescriptors(Isolate* isolate) { |
518 ToNumberStub stub(isolate); | 533 ToNumberStub stub(isolate); |
519 stub.InitializeInterfaceDescriptor( | 534 stub.InitializeInterfaceDescriptor( |
520 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); | 535 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); |
521 } | 536 } |
522 | 537 |
523 private: | 538 DEFINE_CODE_STUB(ToNumber, HydrogenCodeStub); |
524 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
525 | |
526 DISALLOW_COPY_AND_ASSIGN(ToNumberStub); | |
527 }; | 539 }; |
528 | 540 |
529 | 541 |
530 class NumberToStringStub FINAL : public HydrogenCodeStub { | 542 class NumberToStringStub FINAL : public HydrogenCodeStub { |
531 public: | 543 public: |
532 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 544 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
533 | 545 |
534 virtual Handle<Code> GenerateCode() OVERRIDE; | 546 virtual Handle<Code> GenerateCode() OVERRIDE; |
535 | 547 |
536 virtual void InitializeInterfaceDescriptor( | 548 virtual void InitializeInterfaceDescriptor( |
537 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 549 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
538 | 550 |
539 static void InstallDescriptors(Isolate* isolate); | 551 static void InstallDescriptors(Isolate* isolate); |
540 | 552 |
541 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 553 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
542 static const int kNumber = 0; | 554 static const int kNumber = 0; |
543 | 555 |
544 private: | 556 DEFINE_CODE_STUB(NumberToString, HydrogenCodeStub); |
545 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
546 | |
547 DISALLOW_COPY_AND_ASSIGN(NumberToStringStub); | |
548 }; | 557 }; |
549 | 558 |
550 | 559 |
551 class FastNewClosureStub : public HydrogenCodeStub { | 560 class FastNewClosureStub : public HydrogenCodeStub { |
552 public: | 561 public: |
553 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, | 562 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, |
554 bool is_generator) | 563 bool is_generator) |
555 : HydrogenCodeStub(isolate) { | 564 : HydrogenCodeStub(isolate) { |
556 set_sub_minor_key(StrictModeBits::encode(strict_mode) | | 565 set_sub_minor_key(StrictModeBits::encode(strict_mode) | |
557 IsGeneratorBits::encode(is_generator)); | 566 IsGeneratorBits::encode(is_generator)); |
558 } | 567 } |
559 | 568 |
560 virtual Handle<Code> GenerateCode() OVERRIDE; | 569 virtual Handle<Code> GenerateCode() OVERRIDE; |
561 | 570 |
562 virtual void InitializeInterfaceDescriptor( | 571 virtual void InitializeInterfaceDescriptor( |
563 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 572 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
564 | 573 |
565 static void InstallDescriptors(Isolate* isolate); | 574 static void InstallDescriptors(Isolate* isolate); |
566 | 575 |
567 StrictMode strict_mode() const { | 576 StrictMode strict_mode() const { |
568 return StrictModeBits::decode(sub_minor_key()); | 577 return StrictModeBits::decode(sub_minor_key()); |
569 } | 578 } |
570 | 579 |
571 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } | 580 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } |
572 | 581 |
573 private: | 582 private: |
574 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
575 | |
576 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; | 583 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; |
577 class IsGeneratorBits : public BitField<bool, 1, 1> {}; | 584 class IsGeneratorBits : public BitField<bool, 1, 1> {}; |
578 | 585 |
579 DISALLOW_COPY_AND_ASSIGN(FastNewClosureStub); | 586 DEFINE_CODE_STUB(FastNewClosure, HydrogenCodeStub); |
580 }; | 587 }; |
581 | 588 |
582 | 589 |
583 class FastNewContextStub FINAL : public HydrogenCodeStub { | 590 class FastNewContextStub FINAL : public HydrogenCodeStub { |
584 public: | 591 public: |
585 static const int kMaximumSlots = 64; | 592 static const int kMaximumSlots = 64; |
586 | 593 |
587 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) { | 594 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) { |
588 DCHECK(slots > 0 && slots <= kMaximumSlots); | 595 DCHECK(slots > 0 && slots <= kMaximumSlots); |
589 set_sub_minor_key(SlotsBits::encode(slots)); | 596 set_sub_minor_key(SlotsBits::encode(slots)); |
590 } | 597 } |
591 | 598 |
592 virtual Handle<Code> GenerateCode() OVERRIDE; | 599 virtual Handle<Code> GenerateCode() OVERRIDE; |
593 | 600 |
594 virtual void InitializeInterfaceDescriptor( | 601 virtual void InitializeInterfaceDescriptor( |
595 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 602 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
596 | 603 |
597 static void InstallDescriptors(Isolate* isolate); | 604 static void InstallDescriptors(Isolate* isolate); |
598 | 605 |
599 int slots() const { return SlotsBits::decode(sub_minor_key()); } | 606 int slots() const { return SlotsBits::decode(sub_minor_key()); } |
600 | 607 |
601 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 608 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
602 static const int kFunction = 0; | 609 static const int kFunction = 0; |
603 | 610 |
604 private: | 611 private: |
605 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
606 | |
607 class SlotsBits : public BitField<int, 0, 8> {}; | 612 class SlotsBits : public BitField<int, 0, 8> {}; |
608 | 613 |
609 DISALLOW_COPY_AND_ASSIGN(FastNewContextStub); | 614 DEFINE_CODE_STUB(FastNewContext, HydrogenCodeStub); |
610 }; | 615 }; |
611 | 616 |
612 | 617 |
613 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 618 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
614 public: | 619 public: |
615 FastCloneShallowArrayStub(Isolate* isolate, | 620 FastCloneShallowArrayStub(Isolate* isolate, |
616 AllocationSiteMode allocation_site_mode) | 621 AllocationSiteMode allocation_site_mode) |
617 : HydrogenCodeStub(isolate) { | 622 : HydrogenCodeStub(isolate) { |
618 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode)); | 623 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode)); |
619 } | 624 } |
620 | 625 |
621 AllocationSiteMode allocation_site_mode() const { | 626 AllocationSiteMode allocation_site_mode() const { |
622 return AllocationSiteModeBits::decode(sub_minor_key()); | 627 return AllocationSiteModeBits::decode(sub_minor_key()); |
623 } | 628 } |
624 | 629 |
625 virtual Handle<Code> GenerateCode(); | 630 virtual Handle<Code> GenerateCode(); |
626 | 631 |
627 virtual void InitializeInterfaceDescriptor( | 632 virtual void InitializeInterfaceDescriptor( |
628 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 633 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
629 | 634 |
630 static void InstallDescriptors(Isolate* isolate); | 635 static void InstallDescriptors(Isolate* isolate); |
631 | 636 |
632 private: | 637 private: |
633 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
634 | |
635 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 638 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
636 | 639 |
637 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowArrayStub); | 640 DEFINE_CODE_STUB(FastCloneShallowArray, HydrogenCodeStub); |
638 }; | 641 }; |
639 | 642 |
640 | 643 |
641 class FastCloneShallowObjectStub : public HydrogenCodeStub { | 644 class FastCloneShallowObjectStub : public HydrogenCodeStub { |
642 public: | 645 public: |
643 // Maximum number of properties in copied object. | 646 // Maximum number of properties in copied object. |
644 static const int kMaximumClonedProperties = 6; | 647 static const int kMaximumClonedProperties = 6; |
645 | 648 |
646 FastCloneShallowObjectStub(Isolate* isolate, int length) | 649 FastCloneShallowObjectStub(Isolate* isolate, int length) |
647 : HydrogenCodeStub(isolate) { | 650 : HydrogenCodeStub(isolate) { |
648 DCHECK_GE(length, 0); | 651 DCHECK_GE(length, 0); |
649 DCHECK_LE(length, kMaximumClonedProperties); | 652 DCHECK_LE(length, kMaximumClonedProperties); |
650 set_sub_minor_key(LengthBits::encode(length)); | 653 set_sub_minor_key(LengthBits::encode(length)); |
651 } | 654 } |
652 | 655 |
653 int length() const { return LengthBits::decode(sub_minor_key()); } | 656 int length() const { return LengthBits::decode(sub_minor_key()); } |
654 | 657 |
655 virtual Handle<Code> GenerateCode() OVERRIDE; | 658 virtual Handle<Code> GenerateCode() OVERRIDE; |
656 | 659 |
657 virtual void InitializeInterfaceDescriptor( | 660 virtual void InitializeInterfaceDescriptor( |
658 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 661 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
659 | 662 |
660 private: | 663 private: |
661 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
662 | |
663 class LengthBits : public BitField<int, 0, 4> {}; | 664 class LengthBits : public BitField<int, 0, 4> {}; |
664 | 665 |
665 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 666 DEFINE_CODE_STUB(FastCloneShallowObject, HydrogenCodeStub); |
666 }; | 667 }; |
667 | 668 |
668 | 669 |
669 class CreateAllocationSiteStub : public HydrogenCodeStub { | 670 class CreateAllocationSiteStub : public HydrogenCodeStub { |
670 public: | 671 public: |
671 explicit CreateAllocationSiteStub(Isolate* isolate) | 672 explicit CreateAllocationSiteStub(Isolate* isolate) |
672 : HydrogenCodeStub(isolate) { } | 673 : HydrogenCodeStub(isolate) { } |
673 | 674 |
674 virtual Handle<Code> GenerateCode() OVERRIDE; | 675 virtual Handle<Code> GenerateCode() OVERRIDE; |
675 | 676 |
676 static void GenerateAheadOfTime(Isolate* isolate); | 677 static void GenerateAheadOfTime(Isolate* isolate); |
677 | 678 |
678 virtual void InitializeInterfaceDescriptor( | 679 virtual void InitializeInterfaceDescriptor( |
679 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 680 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
680 | 681 |
681 private: | 682 DEFINE_CODE_STUB(CreateAllocationSite, HydrogenCodeStub); |
682 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
683 | |
684 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); | |
685 }; | 683 }; |
686 | 684 |
687 | 685 |
688 class InstanceofStub: public PlatformCodeStub { | 686 class InstanceofStub: public PlatformCodeStub { |
689 public: | 687 public: |
690 enum Flags { | 688 enum Flags { |
691 kNoFlags = 0, | 689 kNoFlags = 0, |
692 kArgsInRegisters = 1 << 0, | 690 kArgsInRegisters = 1 << 0, |
693 kCallSiteInlineCheck = 1 << 1, | 691 kCallSiteInlineCheck = 1 << 1, |
694 kReturnTrueFalseObject = 1 << 2 | 692 kReturnTrueFalseObject = 1 << 2 |
695 }; | 693 }; |
696 | 694 |
697 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { | 695 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { |
698 minor_key_ = FlagBits::encode(flags); | 696 minor_key_ = FlagBits::encode(flags); |
699 } | 697 } |
700 | 698 |
701 void Generate(MacroAssembler* masm); | 699 void Generate(MacroAssembler* masm); |
702 | 700 |
703 static Register left() { return InstanceofDescriptor::left(); } | 701 static Register left() { return InstanceofDescriptor::left(); } |
704 static Register right() { return InstanceofDescriptor::right(); } | 702 static Register right() { return InstanceofDescriptor::right(); } |
705 | 703 |
706 virtual void InitializeInterfaceDescriptor( | 704 virtual void InitializeInterfaceDescriptor( |
707 CodeStubInterfaceDescriptor* descriptor); | 705 CodeStubInterfaceDescriptor* descriptor); |
708 | 706 |
709 private: | 707 private: |
710 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
711 | |
712 Flags flags() const { return FlagBits::decode(minor_key_); } | 708 Flags flags() const { return FlagBits::decode(minor_key_); } |
713 | 709 |
714 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } | 710 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } |
715 | 711 |
716 bool HasCallSiteInlineCheck() const { | 712 bool HasCallSiteInlineCheck() const { |
717 return (flags() & kCallSiteInlineCheck) != 0; | 713 return (flags() & kCallSiteInlineCheck) != 0; |
718 } | 714 } |
719 | 715 |
720 bool ReturnTrueFalseObject() const { | 716 bool ReturnTrueFalseObject() const { |
721 return (flags() & kReturnTrueFalseObject) != 0; | 717 return (flags() & kReturnTrueFalseObject) != 0; |
722 } | 718 } |
723 | 719 |
724 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT | 720 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
725 | 721 |
726 class FlagBits : public BitField<Flags, 0, 3> {}; | 722 class FlagBits : public BitField<Flags, 0, 3> {}; |
727 | 723 |
728 DISALLOW_COPY_AND_ASSIGN(InstanceofStub); | 724 DEFINE_CODE_STUB(Instanceof, PlatformCodeStub); |
729 }; | 725 }; |
730 | 726 |
731 | 727 |
732 enum AllocationSiteOverrideMode { | 728 enum AllocationSiteOverrideMode { |
733 DONT_OVERRIDE, | 729 DONT_OVERRIDE, |
734 DISABLE_ALLOCATION_SITES, | 730 DISABLE_ALLOCATION_SITES, |
735 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES | 731 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES |
736 }; | 732 }; |
737 | 733 |
738 | 734 |
739 class ArrayConstructorStub: public PlatformCodeStub { | 735 class ArrayConstructorStub: public PlatformCodeStub { |
740 public: | 736 public: |
741 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; | 737 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; |
| 738 |
742 ArrayConstructorStub(Isolate* isolate, int argument_count); | 739 ArrayConstructorStub(Isolate* isolate, int argument_count); |
743 | 740 |
744 explicit ArrayConstructorStub(Isolate* isolate); | 741 explicit ArrayConstructorStub(Isolate* isolate); |
745 | 742 |
746 void Generate(MacroAssembler* masm); | 743 void Generate(MacroAssembler* masm); |
747 | 744 |
748 private: | 745 private: |
749 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
750 | |
751 ArgumentCountKey argument_count() const { | 746 ArgumentCountKey argument_count() const { |
752 return ArgumentCountBits::decode(minor_key_); | 747 return ArgumentCountBits::decode(minor_key_); |
753 } | 748 } |
754 | 749 |
755 void GenerateDispatchToArrayStub(MacroAssembler* masm, | 750 void GenerateDispatchToArrayStub(MacroAssembler* masm, |
756 AllocationSiteOverrideMode mode); | 751 AllocationSiteOverrideMode mode); |
757 | 752 |
758 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT | 753 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
759 | 754 |
760 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; | 755 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; |
761 | 756 |
762 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStub); | 757 DEFINE_CODE_STUB(ArrayConstructor, PlatformCodeStub); |
763 }; | 758 }; |
764 | 759 |
765 | 760 |
766 class InternalArrayConstructorStub: public PlatformCodeStub { | 761 class InternalArrayConstructorStub: public PlatformCodeStub { |
767 public: | 762 public: |
768 explicit InternalArrayConstructorStub(Isolate* isolate); | 763 explicit InternalArrayConstructorStub(Isolate* isolate); |
769 | 764 |
770 void Generate(MacroAssembler* masm); | 765 void Generate(MacroAssembler* masm); |
771 | 766 |
772 private: | 767 private: |
773 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
774 | |
775 void GenerateCase(MacroAssembler* masm, ElementsKind kind); | 768 void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
776 | 769 |
777 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStub); | 770 DEFINE_CODE_STUB(InternalArrayConstructor, PlatformCodeStub); |
778 }; | 771 }; |
779 | 772 |
780 | 773 |
781 class MathPowStub: public PlatformCodeStub { | 774 class MathPowStub: public PlatformCodeStub { |
782 public: | 775 public: |
783 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; | 776 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; |
784 | 777 |
785 MathPowStub(Isolate* isolate, ExponentType exponent_type) | 778 MathPowStub(Isolate* isolate, ExponentType exponent_type) |
786 : PlatformCodeStub(isolate) { | 779 : PlatformCodeStub(isolate) { |
787 minor_key_ = ExponentTypeBits::encode(exponent_type); | 780 minor_key_ = ExponentTypeBits::encode(exponent_type); |
788 } | 781 } |
789 | 782 |
790 virtual void Generate(MacroAssembler* masm); | 783 virtual void Generate(MacroAssembler* masm); |
791 | 784 |
792 private: | 785 private: |
793 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
794 | |
795 ExponentType exponent_type() const { | 786 ExponentType exponent_type() const { |
796 return ExponentTypeBits::decode(minor_key_); | 787 return ExponentTypeBits::decode(minor_key_); |
797 } | 788 } |
798 | 789 |
799 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; | 790 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; |
800 | 791 |
801 DISALLOW_COPY_AND_ASSIGN(MathPowStub); | 792 DEFINE_CODE_STUB(MathPow, PlatformCodeStub); |
802 }; | 793 }; |
803 | 794 |
804 | 795 |
805 class CallICStub: public PlatformCodeStub { | 796 class CallICStub: public PlatformCodeStub { |
806 public: | 797 public: |
807 CallICStub(Isolate* isolate, const CallIC::State& state) | 798 CallICStub(Isolate* isolate, const CallIC::State& state) |
808 : PlatformCodeStub(isolate) { | 799 : PlatformCodeStub(isolate) { |
809 minor_key_ = state.GetExtraICState(); | 800 minor_key_ = state.GetExtraICState(); |
810 } | 801 } |
811 | 802 |
(...skipping 18 matching lines...) Expand all Loading... |
830 int arg_count() const { return state().arg_count(); } | 821 int arg_count() const { return state().arg_count(); } |
831 | 822 |
832 CallIC::State state() const { | 823 CallIC::State state() const { |
833 return CallIC::State(static_cast<ExtraICState>(minor_key_)); | 824 return CallIC::State(static_cast<ExtraICState>(minor_key_)); |
834 } | 825 } |
835 | 826 |
836 // Code generation helpers. | 827 // Code generation helpers. |
837 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); | 828 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); |
838 | 829 |
839 private: | 830 private: |
840 virtual inline Major MajorKey() const OVERRIDE; | |
841 | |
842 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT | 831 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
843 | 832 |
844 DISALLOW_COPY_AND_ASSIGN(CallICStub); | 833 DEFINE_CODE_STUB(CallIC, PlatformCodeStub); |
845 }; | 834 }; |
846 | 835 |
847 | 836 |
848 class CallIC_ArrayStub: public CallICStub { | 837 class CallIC_ArrayStub: public CallICStub { |
849 public: | 838 public: |
850 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) | 839 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) |
851 : CallICStub(isolate, state_in) {} | 840 : CallICStub(isolate, state_in) {} |
852 | 841 |
853 virtual void Generate(MacroAssembler* masm); | 842 virtual void Generate(MacroAssembler* masm); |
854 | 843 |
855 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 844 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
856 return MONOMORPHIC; | 845 return MONOMORPHIC; |
857 } | 846 } |
858 | 847 |
859 private: | 848 private: |
860 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
861 | |
862 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT | 849 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
863 | 850 |
864 DISALLOW_COPY_AND_ASSIGN(CallIC_ArrayStub); | 851 DEFINE_CODE_STUB(CallIC_Array, CallICStub); |
865 }; | 852 }; |
866 | 853 |
867 | 854 |
868 // TODO(verwaest): Translate to hydrogen code stub. | 855 // TODO(verwaest): Translate to hydrogen code stub. |
869 class FunctionPrototypeStub : public PlatformCodeStub { | 856 class FunctionPrototypeStub : public PlatformCodeStub { |
870 public: | 857 public: |
871 explicit FunctionPrototypeStub(Isolate* isolate) | 858 explicit FunctionPrototypeStub(Isolate* isolate) |
872 : PlatformCodeStub(isolate) {} | 859 : PlatformCodeStub(isolate) {} |
| 860 |
873 virtual void Generate(MacroAssembler* masm); | 861 virtual void Generate(MacroAssembler* masm); |
| 862 |
874 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 863 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
875 | 864 |
876 private: | 865 DEFINE_CODE_STUB(FunctionPrototype, PlatformCodeStub); |
877 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
878 | |
879 DISALLOW_COPY_AND_ASSIGN(FunctionPrototypeStub); | |
880 }; | 866 }; |
881 | 867 |
882 | 868 |
883 class HandlerStub : public HydrogenCodeStub { | 869 class HandlerStub : public HydrogenCodeStub { |
884 public: | 870 public: |
885 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 871 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
886 virtual ExtraICState GetExtraICState() const { return kind(); } | 872 virtual ExtraICState GetExtraICState() const { return kind(); } |
887 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } | 873 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } |
888 | 874 |
889 virtual void InitializeInterfaceDescriptor( | 875 virtual void InitializeInterfaceDescriptor( |
890 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 876 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
891 | 877 |
892 protected: | 878 protected: |
893 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 879 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 880 |
894 virtual Code::Kind kind() const = 0; | 881 virtual Code::Kind kind() const = 0; |
895 | 882 |
896 private: | 883 DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub); |
897 DISALLOW_COPY_AND_ASSIGN(HandlerStub); | |
898 }; | 884 }; |
899 | 885 |
900 | 886 |
901 class LoadFieldStub: public HandlerStub { | 887 class LoadFieldStub: public HandlerStub { |
902 public: | 888 public: |
903 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) { | 889 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) { |
904 int property_index_key = index.GetFieldAccessStubKey(); | 890 int property_index_key = index.GetFieldAccessStubKey(); |
905 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key)); | 891 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key)); |
906 } | 892 } |
907 | 893 |
908 virtual Handle<Code> GenerateCode() OVERRIDE; | 894 virtual Handle<Code> GenerateCode() OVERRIDE; |
909 | 895 |
910 FieldIndex index() const { | 896 FieldIndex index() const { |
911 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); | 897 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); |
912 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 898 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
913 } | 899 } |
914 | 900 |
915 protected: | 901 protected: |
916 explicit LoadFieldStub(Isolate* isolate); | |
917 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 902 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
918 virtual Code::StubType GetStubType() { return Code::FAST; } | 903 virtual Code::StubType GetStubType() { return Code::FAST; } |
919 | 904 |
920 private: | 905 private: |
921 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
922 | |
923 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; | 906 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; |
924 | 907 |
925 DISALLOW_COPY_AND_ASSIGN(LoadFieldStub); | 908 DEFINE_CODE_STUB(LoadField, HandlerStub); |
926 }; | 909 }; |
927 | 910 |
928 | 911 |
929 class LoadConstantStub : public HandlerStub { | 912 class LoadConstantStub : public HandlerStub { |
930 public: | 913 public: |
931 LoadConstantStub(Isolate* isolate, int constant_index) | 914 LoadConstantStub(Isolate* isolate, int constant_index) |
932 : HandlerStub(isolate) { | 915 : HandlerStub(isolate) { |
933 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); | 916 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); |
934 } | 917 } |
935 | 918 |
936 virtual Handle<Code> GenerateCode() OVERRIDE; | 919 virtual Handle<Code> GenerateCode() OVERRIDE; |
937 | 920 |
938 int constant_index() const { | 921 int constant_index() const { |
939 return ConstantIndexBits::decode(sub_minor_key()); | 922 return ConstantIndexBits::decode(sub_minor_key()); |
940 } | 923 } |
941 | 924 |
942 protected: | 925 protected: |
943 explicit LoadConstantStub(Isolate* isolate); | |
944 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 926 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
945 virtual Code::StubType GetStubType() { return Code::FAST; } | 927 virtual Code::StubType GetStubType() { return Code::FAST; } |
946 | 928 |
947 private: | 929 private: |
948 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
949 | |
950 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; | 930 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; |
951 | 931 |
952 DISALLOW_COPY_AND_ASSIGN(LoadConstantStub); | 932 DEFINE_CODE_STUB(LoadConstant, HandlerStub); |
953 }; | 933 }; |
954 | 934 |
955 | 935 |
956 class StringLengthStub: public HandlerStub { | 936 class StringLengthStub: public HandlerStub { |
957 public: | 937 public: |
958 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} | 938 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} |
| 939 |
959 virtual Handle<Code> GenerateCode() OVERRIDE; | 940 virtual Handle<Code> GenerateCode() OVERRIDE; |
960 | 941 |
961 protected: | 942 protected: |
962 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 943 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
963 virtual Code::StubType GetStubType() { return Code::FAST; } | 944 virtual Code::StubType GetStubType() { return Code::FAST; } |
964 | 945 |
965 private: | 946 DEFINE_CODE_STUB(StringLength, HandlerStub); |
966 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
967 | |
968 DISALLOW_COPY_AND_ASSIGN(StringLengthStub); | |
969 }; | 947 }; |
970 | 948 |
971 | 949 |
972 class StoreFieldStub : public HandlerStub { | 950 class StoreFieldStub : public HandlerStub { |
973 public: | 951 public: |
974 StoreFieldStub(Isolate* isolate, FieldIndex index, | 952 StoreFieldStub(Isolate* isolate, FieldIndex index, |
975 Representation representation) | 953 Representation representation) |
976 : HandlerStub(isolate) { | 954 : HandlerStub(isolate) { |
977 int property_index_key = index.GetFieldAccessStubKey(); | 955 int property_index_key = index.GetFieldAccessStubKey(); |
978 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); | 956 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); |
979 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | | 957 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | |
980 RepresentationBits::encode(repr)); | 958 RepresentationBits::encode(repr)); |
981 } | 959 } |
982 | 960 |
983 virtual Handle<Code> GenerateCode() OVERRIDE; | 961 virtual Handle<Code> GenerateCode() OVERRIDE; |
984 | 962 |
985 FieldIndex index() const { | 963 FieldIndex index() const { |
986 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); | 964 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); |
987 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 965 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
988 } | 966 } |
989 | 967 |
990 Representation representation() { | 968 Representation representation() { |
991 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 969 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
992 return PropertyDetails::DecodeRepresentation(repr); | 970 return PropertyDetails::DecodeRepresentation(repr); |
993 } | 971 } |
994 | 972 |
995 static void InstallDescriptors(Isolate* isolate); | 973 static void InstallDescriptors(Isolate* isolate); |
996 | 974 |
997 protected: | 975 protected: |
998 explicit StoreFieldStub(Isolate* isolate); | |
999 virtual Code::Kind kind() const { return Code::STORE_IC; } | 976 virtual Code::Kind kind() const { return Code::STORE_IC; } |
1000 virtual Code::StubType GetStubType() { return Code::FAST; } | 977 virtual Code::StubType GetStubType() { return Code::FAST; } |
1001 | 978 |
1002 private: | 979 private: |
1003 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1004 | |
1005 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 980 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
1006 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 981 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
1007 | 982 |
1008 DISALLOW_COPY_AND_ASSIGN(StoreFieldStub); | 983 DEFINE_CODE_STUB(StoreField, HandlerStub); |
1009 }; | 984 }; |
1010 | 985 |
1011 | 986 |
1012 class StoreGlobalStub : public HandlerStub { | 987 class StoreGlobalStub : public HandlerStub { |
1013 public: | 988 public: |
1014 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 989 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
1015 : HandlerStub(isolate) { | 990 : HandlerStub(isolate) { |
1016 set_sub_minor_key(IsConstantBits::encode(is_constant) | | 991 set_sub_minor_key(IsConstantBits::encode(is_constant) | |
1017 CheckGlobalBits::encode(check_global)); | 992 CheckGlobalBits::encode(check_global)); |
1018 } | 993 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 Representation representation() { | 1026 Representation representation() { |
1052 return Representation::FromKind( | 1027 return Representation::FromKind( |
1053 RepresentationBits::decode(sub_minor_key())); | 1028 RepresentationBits::decode(sub_minor_key())); |
1054 } | 1029 } |
1055 | 1030 |
1056 void set_representation(Representation r) { | 1031 void set_representation(Representation r) { |
1057 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); | 1032 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); |
1058 } | 1033 } |
1059 | 1034 |
1060 private: | 1035 private: |
1061 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1062 | |
1063 class IsConstantBits: public BitField<bool, 0, 1> {}; | 1036 class IsConstantBits: public BitField<bool, 0, 1> {}; |
1064 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; | 1037 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
1065 class CheckGlobalBits: public BitField<bool, 9, 1> {}; | 1038 class CheckGlobalBits: public BitField<bool, 9, 1> {}; |
1066 | 1039 |
1067 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | 1040 DEFINE_CODE_STUB(StoreGlobal, HandlerStub); |
1068 }; | 1041 }; |
1069 | 1042 |
1070 | 1043 |
1071 class CallApiFunctionStub : public PlatformCodeStub { | 1044 class CallApiFunctionStub : public PlatformCodeStub { |
1072 public: | 1045 public: |
1073 CallApiFunctionStub(Isolate* isolate, | 1046 CallApiFunctionStub(Isolate* isolate, |
1074 bool is_store, | 1047 bool is_store, |
1075 bool call_data_undefined, | 1048 bool call_data_undefined, |
1076 int argc) : PlatformCodeStub(isolate) { | 1049 int argc) : PlatformCodeStub(isolate) { |
1077 minor_key_ = IsStoreBits::encode(is_store) | | 1050 minor_key_ = IsStoreBits::encode(is_store) | |
1078 CallDataUndefinedBits::encode(call_data_undefined) | | 1051 CallDataUndefinedBits::encode(call_data_undefined) | |
1079 ArgumentBits::encode(argc); | 1052 ArgumentBits::encode(argc); |
1080 DCHECK(!is_store || argc == 1); | 1053 DCHECK(!is_store || argc == 1); |
1081 } | 1054 } |
1082 | 1055 |
1083 private: | 1056 private: |
1084 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1085 | |
1086 virtual void Generate(MacroAssembler* masm) OVERRIDE; | 1057 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
1087 | 1058 |
1088 bool is_store() const { return IsStoreBits::decode(minor_key_); } | 1059 bool is_store() const { return IsStoreBits::decode(minor_key_); } |
1089 bool call_data_undefined() const { | 1060 bool call_data_undefined() const { |
1090 return CallDataUndefinedBits::decode(minor_key_); | 1061 return CallDataUndefinedBits::decode(minor_key_); |
1091 } | 1062 } |
1092 int argc() const { return ArgumentBits::decode(minor_key_); } | 1063 int argc() const { return ArgumentBits::decode(minor_key_); } |
1093 | 1064 |
1094 class IsStoreBits: public BitField<bool, 0, 1> {}; | 1065 class IsStoreBits: public BitField<bool, 0, 1> {}; |
1095 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; | 1066 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; |
1096 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; | 1067 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; |
1097 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | 1068 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); |
1098 | 1069 |
1099 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub); | 1070 DEFINE_CODE_STUB(CallApiFunction, PlatformCodeStub); |
1100 }; | 1071 }; |
1101 | 1072 |
1102 | 1073 |
1103 class CallApiGetterStub : public PlatformCodeStub { | 1074 class CallApiGetterStub : public PlatformCodeStub { |
1104 public: | 1075 public: |
1105 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 1076 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
1106 | 1077 |
1107 private: | 1078 private: |
1108 virtual void Generate(MacroAssembler* masm) OVERRIDE; | 1079 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
1109 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1110 | 1080 |
1111 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); | 1081 DEFINE_CODE_STUB(CallApiGetter, PlatformCodeStub); |
1112 }; | 1082 }; |
1113 | 1083 |
1114 | 1084 |
1115 class BinaryOpICStub : public HydrogenCodeStub { | 1085 class BinaryOpICStub : public HydrogenCodeStub { |
1116 public: | 1086 public: |
1117 BinaryOpICStub(Isolate* isolate, Token::Value op, | 1087 BinaryOpICStub(Isolate* isolate, Token::Value op, |
1118 OverwriteMode mode = NO_OVERWRITE) | 1088 OverwriteMode mode = NO_OVERWRITE) |
1119 : HydrogenCodeStub(isolate, UNINITIALIZED) { | 1089 : HydrogenCodeStub(isolate, UNINITIALIZED) { |
1120 BinaryOpIC::State state(isolate, op, mode); | 1090 BinaryOpIC::State state(isolate, op, mode); |
1121 set_sub_minor_key(state.GetExtraICState()); | 1091 set_sub_minor_key(state.GetExtraICState()); |
1122 } | 1092 } |
1123 | 1093 |
1124 explicit BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) | 1094 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) |
1125 : HydrogenCodeStub(isolate) { | 1095 : HydrogenCodeStub(isolate) { |
1126 set_sub_minor_key(state.GetExtraICState()); | 1096 set_sub_minor_key(state.GetExtraICState()); |
1127 } | 1097 } |
1128 | 1098 |
1129 static void GenerateAheadOfTime(Isolate* isolate); | 1099 static void GenerateAheadOfTime(Isolate* isolate); |
1130 | 1100 |
1131 virtual void InitializeInterfaceDescriptor( | 1101 virtual void InitializeInterfaceDescriptor( |
1132 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1102 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1133 | 1103 |
1134 static void InstallDescriptors(Isolate* isolate); | 1104 static void InstallDescriptors(Isolate* isolate); |
(...skipping 16 matching lines...) Expand all Loading... |
1151 return BinaryOpIC::State(isolate(), GetExtraICState()); | 1121 return BinaryOpIC::State(isolate(), GetExtraICState()); |
1152 } | 1122 } |
1153 | 1123 |
1154 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT | 1124 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT |
1155 | 1125 |
1156 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1126 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1157 static const int kLeft = 0; | 1127 static const int kLeft = 0; |
1158 static const int kRight = 1; | 1128 static const int kRight = 1; |
1159 | 1129 |
1160 private: | 1130 private: |
1161 virtual inline Major MajorKey() const OVERRIDE; | |
1162 | |
1163 static void GenerateAheadOfTime(Isolate* isolate, | 1131 static void GenerateAheadOfTime(Isolate* isolate, |
1164 const BinaryOpIC::State& state); | 1132 const BinaryOpIC::State& state); |
1165 | 1133 |
1166 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); | 1134 DEFINE_CODE_STUB(BinaryOpIC, HydrogenCodeStub); |
1167 }; | 1135 }; |
1168 | 1136 |
1169 | 1137 |
1170 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail | 1138 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail |
1171 // call support for stubs in Hydrogen. | 1139 // call support for stubs in Hydrogen. |
1172 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub { | 1140 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub { |
1173 public: | 1141 public: |
1174 BinaryOpICWithAllocationSiteStub(Isolate* isolate, | 1142 BinaryOpICWithAllocationSiteStub(Isolate* isolate, |
1175 const BinaryOpIC::State& state) | 1143 const BinaryOpIC::State& state) |
1176 : PlatformCodeStub(isolate) { | 1144 : PlatformCodeStub(isolate) { |
(...skipping 18 matching lines...) Expand all Loading... |
1195 | 1163 |
1196 virtual ExtraICState GetExtraICState() const OVERRIDE { | 1164 virtual ExtraICState GetExtraICState() const OVERRIDE { |
1197 return static_cast<ExtraICState>(minor_key_); | 1165 return static_cast<ExtraICState>(minor_key_); |
1198 } | 1166 } |
1199 | 1167 |
1200 virtual void Generate(MacroAssembler* masm) OVERRIDE; | 1168 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
1201 | 1169 |
1202 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT | 1170 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
1203 | 1171 |
1204 private: | 1172 private: |
1205 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1206 | |
1207 BinaryOpIC::State state() const { | 1173 BinaryOpIC::State state() const { |
1208 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); | 1174 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); |
1209 } | 1175 } |
1210 | 1176 |
1211 static void GenerateAheadOfTime(Isolate* isolate, | 1177 static void GenerateAheadOfTime(Isolate* isolate, |
1212 const BinaryOpIC::State& state); | 1178 const BinaryOpIC::State& state); |
1213 | 1179 |
1214 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); | 1180 DEFINE_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); |
1215 }; | 1181 }; |
1216 | 1182 |
1217 | 1183 |
1218 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { | 1184 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { |
1219 public: | 1185 public: |
1220 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1186 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
1221 Token::Value op, | 1187 Token::Value op, |
1222 OverwriteMode mode) | 1188 OverwriteMode mode) |
1223 : BinaryOpICStub(isolate, op, mode) {} | 1189 : BinaryOpICStub(isolate, op, mode) {} |
1224 | 1190 |
1225 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1191 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
1226 const BinaryOpIC::State& state) | 1192 const BinaryOpIC::State& state) |
1227 : BinaryOpICStub(isolate, state) {} | 1193 : BinaryOpICStub(isolate, state) {} |
1228 | 1194 |
1229 virtual void InitializeInterfaceDescriptor( | 1195 virtual void InitializeInterfaceDescriptor( |
1230 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1196 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1231 | 1197 |
1232 static void InstallDescriptors(Isolate* isolate); | 1198 static void InstallDescriptors(Isolate* isolate); |
1233 | 1199 |
1234 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { | 1200 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { |
1235 return Code::STUB; | 1201 return Code::STUB; |
1236 } | 1202 } |
1237 | 1203 |
1238 virtual Handle<Code> GenerateCode() OVERRIDE; | 1204 virtual Handle<Code> GenerateCode() OVERRIDE; |
1239 | 1205 |
1240 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1241 | |
1242 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1206 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1243 static const int kAllocationSite = 0; | 1207 static const int kAllocationSite = 0; |
1244 static const int kLeft = 1; | 1208 static const int kLeft = 1; |
1245 static const int kRight = 2; | 1209 static const int kRight = 2; |
| 1210 |
| 1211 DEFINE_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); |
1246 }; | 1212 }; |
1247 | 1213 |
1248 | 1214 |
1249 enum StringAddFlags { | 1215 enum StringAddFlags { |
1250 // Omit both parameter checks. | 1216 // Omit both parameter checks. |
1251 STRING_ADD_CHECK_NONE = 0, | 1217 STRING_ADD_CHECK_NONE = 0, |
1252 // Check left parameter. | 1218 // Check left parameter. |
1253 STRING_ADD_CHECK_LEFT = 1 << 0, | 1219 STRING_ADD_CHECK_LEFT = 1 << 0, |
1254 // Check right parameter. | 1220 // Check right parameter. |
1255 STRING_ADD_CHECK_RIGHT = 1 << 1, | 1221 STRING_ADD_CHECK_RIGHT = 1 << 1, |
(...skipping 24 matching lines...) Expand all Loading... |
1280 virtual void InitializeInterfaceDescriptor( | 1246 virtual void InitializeInterfaceDescriptor( |
1281 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1247 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1282 | 1248 |
1283 static void InstallDescriptors(Isolate* isolate); | 1249 static void InstallDescriptors(Isolate* isolate); |
1284 | 1250 |
1285 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1251 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1286 static const int kLeft = 0; | 1252 static const int kLeft = 0; |
1287 static const int kRight = 1; | 1253 static const int kRight = 1; |
1288 | 1254 |
1289 private: | 1255 private: |
1290 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1291 | |
1292 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; | 1256 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; |
1293 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; | 1257 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; |
1294 | 1258 |
1295 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT | 1259 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT |
1296 | 1260 |
1297 DISALLOW_COPY_AND_ASSIGN(StringAddStub); | 1261 DEFINE_CODE_STUB(StringAdd, HydrogenCodeStub); |
1298 }; | 1262 }; |
1299 | 1263 |
1300 | 1264 |
1301 class CompareICStub : public PlatformCodeStub { | 1265 class CompareICStub : public PlatformCodeStub { |
1302 public: | 1266 public: |
1303 CompareICStub(Isolate* isolate, Token::Value op, CompareIC::State left, | 1267 CompareICStub(Isolate* isolate, Token::Value op, CompareIC::State left, |
1304 CompareIC::State right, CompareIC::State state) | 1268 CompareIC::State right, CompareIC::State state) |
1305 : PlatformCodeStub(isolate) { | 1269 : PlatformCodeStub(isolate) { |
1306 DCHECK(Token::IsCompareOp(op)); | 1270 DCHECK(Token::IsCompareOp(op)); |
1307 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | | 1271 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | |
1308 RightStateBits::encode(right) | StateBits::encode(state); | 1272 RightStateBits::encode(right) | StateBits::encode(state); |
1309 } | 1273 } |
1310 | 1274 |
1311 virtual void Generate(MacroAssembler* masm); | 1275 virtual void Generate(MacroAssembler* masm); |
1312 | 1276 |
1313 void set_known_map(Handle<Map> map) { known_map_ = map; } | 1277 void set_known_map(Handle<Map> map) { known_map_ = map; } |
1314 | 1278 |
1315 explicit CompareICStub(uint32_t stub_key) : PlatformCodeStub(stub_key) { | |
1316 DCHECK_EQ(MajorKeyFromKey(stub_key), MajorKey()); | |
1317 } | |
1318 | |
1319 virtual InlineCacheState GetICState() const; | 1279 virtual InlineCacheState GetICState() const; |
1320 | 1280 |
1321 Token::Value op() const { | 1281 Token::Value op() const { |
1322 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); | 1282 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); |
1323 } | 1283 } |
1324 | 1284 |
1325 CompareIC::State left() const { return LeftStateBits::decode(minor_key_); } | 1285 CompareIC::State left() const { return LeftStateBits::decode(minor_key_); } |
1326 CompareIC::State right() const { return RightStateBits::decode(minor_key_); } | 1286 CompareIC::State right() const { return RightStateBits::decode(minor_key_); } |
1327 CompareIC::State state() const { return StateBits::decode(minor_key_); } | 1287 CompareIC::State state() const { return StateBits::decode(minor_key_); } |
1328 | 1288 |
1329 private: | 1289 private: |
1330 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1331 | |
1332 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } | 1290 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } |
1333 | 1291 |
1334 void GenerateSmis(MacroAssembler* masm); | 1292 void GenerateSmis(MacroAssembler* masm); |
1335 void GenerateNumbers(MacroAssembler* masm); | 1293 void GenerateNumbers(MacroAssembler* masm); |
1336 void GenerateInternalizedStrings(MacroAssembler* masm); | 1294 void GenerateInternalizedStrings(MacroAssembler* masm); |
1337 void GenerateStrings(MacroAssembler* masm); | 1295 void GenerateStrings(MacroAssembler* masm); |
1338 void GenerateUniqueNames(MacroAssembler* masm); | 1296 void GenerateUniqueNames(MacroAssembler* masm); |
1339 void GenerateObjects(MacroAssembler* masm); | 1297 void GenerateObjects(MacroAssembler* masm); |
1340 void GenerateMiss(MacroAssembler* masm); | 1298 void GenerateMiss(MacroAssembler* masm); |
1341 void GenerateKnownObjects(MacroAssembler* masm); | 1299 void GenerateKnownObjects(MacroAssembler* masm); |
1342 void GenerateGeneric(MacroAssembler* masm); | 1300 void GenerateGeneric(MacroAssembler* masm); |
1343 | 1301 |
1344 bool strict() const { return op() == Token::EQ_STRICT; } | 1302 bool strict() const { return op() == Token::EQ_STRICT; } |
1345 Condition GetCondition() const { return CompareIC::ComputeCondition(op()); } | 1303 Condition GetCondition() const { return CompareIC::ComputeCondition(op()); } |
1346 | 1304 |
1347 virtual void AddToSpecialCache(Handle<Code> new_object); | 1305 virtual void AddToSpecialCache(Handle<Code> new_object); |
1348 virtual bool FindCodeInSpecialCache(Code** code_out); | 1306 virtual bool FindCodeInSpecialCache(Code** code_out); |
1349 virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; } | 1307 virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; } |
1350 | 1308 |
1351 class OpBits : public BitField<int, 0, 3> {}; | 1309 class OpBits : public BitField<int, 0, 3> {}; |
1352 class LeftStateBits : public BitField<CompareIC::State, 3, 4> {}; | 1310 class LeftStateBits : public BitField<CompareIC::State, 3, 4> {}; |
1353 class RightStateBits : public BitField<CompareIC::State, 7, 4> {}; | 1311 class RightStateBits : public BitField<CompareIC::State, 7, 4> {}; |
1354 class StateBits : public BitField<CompareIC::State, 11, 4> {}; | 1312 class StateBits : public BitField<CompareIC::State, 11, 4> {}; |
1355 | 1313 |
1356 Handle<Map> known_map_; | 1314 Handle<Map> known_map_; |
1357 | 1315 |
1358 DISALLOW_COPY_AND_ASSIGN(CompareICStub); | 1316 DEFINE_CODE_STUB(CompareIC, PlatformCodeStub); |
1359 }; | 1317 }; |
1360 | 1318 |
1361 | 1319 |
1362 class CompareNilICStub : public HydrogenCodeStub { | 1320 class CompareNilICStub : public HydrogenCodeStub { |
1363 public: | 1321 public: |
1364 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>()); | 1322 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>()); |
1365 Type* GetInputType(Zone* zone, Handle<Map> map); | 1323 Type* GetInputType(Zone* zone, Handle<Map> map); |
1366 | 1324 |
1367 CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) { | 1325 CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) { |
1368 set_sub_minor_key(NilValueBits::encode(nil)); | 1326 set_sub_minor_key(NilValueBits::encode(nil)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT | 1376 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
1419 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT | 1377 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT |
1420 | 1378 |
1421 private: | 1379 private: |
1422 CompareNilICStub(Isolate* isolate, NilValue nil, | 1380 CompareNilICStub(Isolate* isolate, NilValue nil, |
1423 InitializationState init_state) | 1381 InitializationState init_state) |
1424 : HydrogenCodeStub(isolate, init_state) { | 1382 : HydrogenCodeStub(isolate, init_state) { |
1425 set_sub_minor_key(NilValueBits::encode(nil)); | 1383 set_sub_minor_key(NilValueBits::encode(nil)); |
1426 } | 1384 } |
1427 | 1385 |
1428 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1429 | |
1430 enum CompareNilType { | 1386 enum CompareNilType { |
1431 UNDEFINED, | 1387 UNDEFINED, |
1432 NULL_TYPE, | 1388 NULL_TYPE, |
1433 MONOMORPHIC_MAP, | 1389 MONOMORPHIC_MAP, |
1434 GENERIC, | 1390 GENERIC, |
1435 NUMBER_OF_TYPES | 1391 NUMBER_OF_TYPES |
1436 }; | 1392 }; |
1437 | 1393 |
1438 // At most 6 different types can be distinguished, because the Code object | 1394 // At most 6 different types can be distinguished, because the Code object |
1439 // only has room for a single byte to hold a set and there are two more | 1395 // only has room for a single byte to hold a set and there are two more |
1440 // boolean flags we need to store. :-P | 1396 // boolean flags we need to store. :-P |
1441 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); | 1397 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); |
1442 | 1398 |
1443 class State : public EnumSet<CompareNilType, byte> { | 1399 class State : public EnumSet<CompareNilType, byte> { |
1444 public: | 1400 public: |
1445 State() : EnumSet<CompareNilType, byte>(0) { } | 1401 State() : EnumSet<CompareNilType, byte>(0) { } |
1446 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } | 1402 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } |
1447 }; | 1403 }; |
1448 friend OStream& operator<<(OStream& os, const State& s); | 1404 friend OStream& operator<<(OStream& os, const State& s); |
1449 | 1405 |
1450 State state() const { return State(TypesBits::decode(sub_minor_key())); } | 1406 State state() const { return State(TypesBits::decode(sub_minor_key())); } |
1451 | 1407 |
1452 class NilValueBits : public BitField<NilValue, 0, 1> {}; | 1408 class NilValueBits : public BitField<NilValue, 0, 1> {}; |
1453 class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {}; | 1409 class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {}; |
1454 | 1410 |
1455 friend class CompareNilIC; | 1411 friend class CompareNilIC; |
1456 | 1412 |
1457 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); | 1413 DEFINE_CODE_STUB(CompareNilIC, HydrogenCodeStub); |
1458 }; | 1414 }; |
1459 | 1415 |
1460 | 1416 |
1461 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); | 1417 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); |
1462 | 1418 |
1463 | 1419 |
1464 class CEntryStub : public PlatformCodeStub { | 1420 class CEntryStub : public PlatformCodeStub { |
1465 public: | 1421 public: |
1466 CEntryStub(Isolate* isolate, int result_size, | 1422 CEntryStub(Isolate* isolate, int result_size, |
1467 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 1423 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
1468 : PlatformCodeStub(isolate) { | 1424 : PlatformCodeStub(isolate) { |
1469 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs); | 1425 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs); |
1470 DCHECK(result_size == 1 || result_size == 2); | 1426 DCHECK(result_size == 1 || result_size == 2); |
1471 #ifdef _WIN64 | 1427 #ifdef _WIN64 |
1472 minor_key_ = ResultSizeBits::update(minor_key_, result_size); | 1428 minor_key_ = ResultSizeBits::update(minor_key_, result_size); |
1473 #endif // _WIN64 | 1429 #endif // _WIN64 |
1474 } | 1430 } |
1475 | 1431 |
1476 void Generate(MacroAssembler* masm); | 1432 void Generate(MacroAssembler* masm); |
1477 | 1433 |
1478 // The version of this stub that doesn't save doubles is generated ahead of | 1434 // The version of this stub that doesn't save doubles is generated ahead of |
1479 // time, so it's OK to call it from other stubs that can't cope with GC during | 1435 // time, so it's OK to call it from other stubs that can't cope with GC during |
1480 // their code generation. On machines that always have gp registers (x64) we | 1436 // their code generation. On machines that always have gp registers (x64) we |
1481 // can generate both variants ahead of time. | 1437 // can generate both variants ahead of time. |
1482 static void GenerateAheadOfTime(Isolate* isolate); | 1438 static void GenerateAheadOfTime(Isolate* isolate); |
1483 | 1439 |
1484 private: | 1440 private: |
1485 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1486 | |
1487 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } | 1441 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } |
1488 #ifdef _WIN64 | 1442 #ifdef _WIN64 |
1489 int result_size() const { return ResultSizeBits::decode(minor_key_); } | 1443 int result_size() const { return ResultSizeBits::decode(minor_key_); } |
1490 #endif // _WIN64 | 1444 #endif // _WIN64 |
1491 | 1445 |
1492 bool NeedsImmovableCode(); | 1446 bool NeedsImmovableCode(); |
1493 | 1447 |
1494 class SaveDoublesBits : public BitField<bool, 0, 1> {}; | 1448 class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
1495 class ResultSizeBits : public BitField<int, 1, 3> {}; | 1449 class ResultSizeBits : public BitField<int, 1, 3> {}; |
1496 | 1450 |
1497 DISALLOW_COPY_AND_ASSIGN(CEntryStub); | 1451 DEFINE_CODE_STUB(CEntry, PlatformCodeStub); |
1498 }; | 1452 }; |
1499 | 1453 |
1500 | 1454 |
1501 class JSEntryStub : public PlatformCodeStub { | 1455 class JSEntryStub : public PlatformCodeStub { |
1502 public: | 1456 public: |
1503 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1457 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
1504 | 1458 |
1505 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 1459 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
1506 | 1460 |
1507 protected: | 1461 protected: |
1508 void GenerateBody(MacroAssembler* masm, bool is_construct); | 1462 void GenerateBody(MacroAssembler* masm, bool is_construct); |
1509 | 1463 |
1510 private: | 1464 private: |
1511 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1512 | |
1513 virtual void FinishCode(Handle<Code> code); | 1465 virtual void FinishCode(Handle<Code> code); |
1514 | 1466 |
1515 int handler_offset_; | 1467 int handler_offset_; |
1516 | 1468 |
1517 DISALLOW_COPY_AND_ASSIGN(JSEntryStub); | 1469 DEFINE_CODE_STUB(JSEntry, PlatformCodeStub); |
1518 }; | 1470 }; |
1519 | 1471 |
1520 | 1472 |
1521 class JSConstructEntryStub : public JSEntryStub { | 1473 class JSConstructEntryStub : public JSEntryStub { |
1522 public: | 1474 public: |
1523 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { | 1475 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) {} |
1524 minor_key_ = 1; | |
1525 } | |
1526 | 1476 |
1527 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } | 1477 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } |
1528 | 1478 |
1529 private: | 1479 private: |
1530 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT | 1480 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT |
1531 os << "JSConstructEntryStub"; | 1481 os << "JSConstructEntryStub"; |
1532 } | 1482 } |
1533 | 1483 |
1534 DISALLOW_COPY_AND_ASSIGN(JSConstructEntryStub); | 1484 DEFINE_CODE_STUB(JSConstructEntry, JSEntryStub); |
1535 }; | 1485 }; |
1536 | 1486 |
1537 | 1487 |
1538 class ArgumentsAccessStub: public PlatformCodeStub { | 1488 class ArgumentsAccessStub: public PlatformCodeStub { |
1539 public: | 1489 public: |
1540 enum Type { | 1490 enum Type { |
1541 READ_ELEMENT, | 1491 READ_ELEMENT, |
1542 NEW_SLOPPY_FAST, | 1492 NEW_SLOPPY_FAST, |
1543 NEW_SLOPPY_SLOW, | 1493 NEW_SLOPPY_SLOW, |
1544 NEW_STRICT | 1494 NEW_STRICT |
1545 }; | 1495 }; |
1546 | 1496 |
1547 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { | 1497 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { |
1548 minor_key_ = TypeBits::encode(type); | 1498 minor_key_ = TypeBits::encode(type); |
1549 } | 1499 } |
1550 | 1500 |
1551 private: | 1501 private: |
1552 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1553 | |
1554 Type type() const { return TypeBits::decode(minor_key_); } | 1502 Type type() const { return TypeBits::decode(minor_key_); } |
1555 | 1503 |
1556 void Generate(MacroAssembler* masm); | 1504 void Generate(MacroAssembler* masm); |
1557 void GenerateReadElement(MacroAssembler* masm); | 1505 void GenerateReadElement(MacroAssembler* masm); |
1558 void GenerateNewStrict(MacroAssembler* masm); | 1506 void GenerateNewStrict(MacroAssembler* masm); |
1559 void GenerateNewSloppyFast(MacroAssembler* masm); | 1507 void GenerateNewSloppyFast(MacroAssembler* masm); |
1560 void GenerateNewSloppySlow(MacroAssembler* masm); | 1508 void GenerateNewSloppySlow(MacroAssembler* masm); |
1561 | 1509 |
1562 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT | 1510 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
1563 | 1511 |
1564 class TypeBits : public BitField<Type, 0, 2> {}; | 1512 class TypeBits : public BitField<Type, 0, 2> {}; |
1565 | 1513 |
1566 DISALLOW_COPY_AND_ASSIGN(ArgumentsAccessStub); | 1514 DEFINE_CODE_STUB(ArgumentsAccess, PlatformCodeStub); |
1567 }; | 1515 }; |
1568 | 1516 |
1569 | 1517 |
1570 class RegExpExecStub: public PlatformCodeStub { | 1518 class RegExpExecStub: public PlatformCodeStub { |
1571 public: | 1519 public: |
1572 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1520 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
1573 | 1521 |
1574 private: | 1522 private: |
1575 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1576 | |
1577 void Generate(MacroAssembler* masm); | 1523 void Generate(MacroAssembler* masm); |
1578 | 1524 |
1579 DISALLOW_COPY_AND_ASSIGN(RegExpExecStub); | 1525 DEFINE_CODE_STUB(RegExpExec, PlatformCodeStub); |
1580 }; | 1526 }; |
1581 | 1527 |
1582 | 1528 |
1583 class RegExpConstructResultStub FINAL : public HydrogenCodeStub { | 1529 class RegExpConstructResultStub FINAL : public HydrogenCodeStub { |
1584 public: | 1530 public: |
1585 explicit RegExpConstructResultStub(Isolate* isolate) | 1531 explicit RegExpConstructResultStub(Isolate* isolate) |
1586 : HydrogenCodeStub(isolate) { } | 1532 : HydrogenCodeStub(isolate) { } |
1587 | 1533 |
1588 virtual Handle<Code> GenerateCode() OVERRIDE; | 1534 virtual Handle<Code> GenerateCode() OVERRIDE; |
1589 | 1535 |
1590 virtual void InitializeInterfaceDescriptor( | 1536 virtual void InitializeInterfaceDescriptor( |
1591 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1537 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1592 | 1538 |
1593 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1594 | |
1595 static void InstallDescriptors(Isolate* isolate); | 1539 static void InstallDescriptors(Isolate* isolate); |
1596 | 1540 |
1597 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1541 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1598 static const int kLength = 0; | 1542 static const int kLength = 0; |
1599 static const int kIndex = 1; | 1543 static const int kIndex = 1; |
1600 static const int kInput = 2; | 1544 static const int kInput = 2; |
1601 | 1545 |
1602 private: | 1546 DEFINE_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); |
1603 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); | |
1604 }; | 1547 }; |
1605 | 1548 |
1606 | 1549 |
1607 class CallFunctionStub: public PlatformCodeStub { | 1550 class CallFunctionStub: public PlatformCodeStub { |
1608 public: | 1551 public: |
1609 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) | 1552 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) |
1610 : PlatformCodeStub(isolate) { | 1553 : PlatformCodeStub(isolate) { |
1611 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); | 1554 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); |
1612 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); | 1555 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); |
1613 } | 1556 } |
1614 | 1557 |
1615 void Generate(MacroAssembler* masm); | 1558 void Generate(MacroAssembler* masm); |
1616 | 1559 |
1617 static int ExtractArgcFromMinorKey(int minor_key) { | 1560 static int ExtractArgcFromMinorKey(int minor_key) { |
1618 return ArgcBits::decode(minor_key); | 1561 return ArgcBits::decode(minor_key); |
1619 } | 1562 } |
1620 | 1563 |
1621 virtual void InitializeInterfaceDescriptor( | 1564 virtual void InitializeInterfaceDescriptor( |
1622 CodeStubInterfaceDescriptor* descriptor); | 1565 CodeStubInterfaceDescriptor* descriptor); |
1623 | 1566 |
1624 private: | 1567 private: |
1625 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1626 | |
1627 int argc() const { return ArgcBits::decode(minor_key_); } | 1568 int argc() const { return ArgcBits::decode(minor_key_); } |
1628 int flags() const { return FlagBits::decode(minor_key_); } | 1569 int flags() const { return FlagBits::decode(minor_key_); } |
1629 | 1570 |
1630 bool CallAsMethod() const { | 1571 bool CallAsMethod() const { |
1631 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; | 1572 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; |
1632 } | 1573 } |
1633 | 1574 |
1634 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } | 1575 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } |
1635 | 1576 |
1636 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT | 1577 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
1637 | 1578 |
1638 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 1579 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
1639 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; | 1580 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; |
1640 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; | 1581 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; |
1641 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | 1582 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); |
1642 | 1583 |
1643 DISALLOW_COPY_AND_ASSIGN(CallFunctionStub); | 1584 DEFINE_CODE_STUB(CallFunction, PlatformCodeStub); |
1644 }; | 1585 }; |
1645 | 1586 |
1646 | 1587 |
1647 class CallConstructStub: public PlatformCodeStub { | 1588 class CallConstructStub: public PlatformCodeStub { |
1648 public: | 1589 public: |
1649 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) | 1590 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) |
1650 : PlatformCodeStub(isolate) { | 1591 : PlatformCodeStub(isolate) { |
1651 minor_key_ = FlagBits::encode(flags); | 1592 minor_key_ = FlagBits::encode(flags); |
1652 } | 1593 } |
1653 | 1594 |
1654 void Generate(MacroAssembler* masm); | 1595 void Generate(MacroAssembler* masm); |
1655 | 1596 |
1656 virtual void FinishCode(Handle<Code> code) { | 1597 virtual void FinishCode(Handle<Code> code) { |
1657 code->set_has_function_cache(RecordCallTarget()); | 1598 code->set_has_function_cache(RecordCallTarget()); |
1658 } | 1599 } |
1659 | 1600 |
1660 virtual void InitializeInterfaceDescriptor( | 1601 virtual void InitializeInterfaceDescriptor( |
1661 CodeStubInterfaceDescriptor* descriptor); | 1602 CodeStubInterfaceDescriptor* descriptor); |
1662 | 1603 |
1663 private: | 1604 private: |
1664 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1665 | |
1666 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } | 1605 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } |
1667 | 1606 |
1668 bool RecordCallTarget() const { | 1607 bool RecordCallTarget() const { |
1669 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; | 1608 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; |
1670 } | 1609 } |
1671 | 1610 |
1672 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT | 1611 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
1673 | 1612 |
1674 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; | 1613 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; |
1675 | 1614 |
1676 DISALLOW_COPY_AND_ASSIGN(CallConstructStub); | 1615 DEFINE_CODE_STUB(CallConstruct, PlatformCodeStub); |
1677 }; | 1616 }; |
1678 | 1617 |
1679 | 1618 |
1680 enum StringIndexFlags { | 1619 enum StringIndexFlags { |
1681 // Accepts smis or heap numbers. | 1620 // Accepts smis or heap numbers. |
1682 STRING_INDEX_IS_NUMBER, | 1621 STRING_INDEX_IS_NUMBER, |
1683 | 1622 |
1684 // Accepts smis or heap numbers that are valid array indices | 1623 // Accepts smis or heap numbers that are valid array indices |
1685 // (ECMA-262 15.4). Invalid indices are reported as being out of | 1624 // (ECMA-262 15.4). Invalid indices are reported as being out of |
1686 // range. | 1625 // range. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 class LoadDictionaryElementStub : public HydrogenCodeStub { | 1793 class LoadDictionaryElementStub : public HydrogenCodeStub { |
1855 public: | 1794 public: |
1856 explicit LoadDictionaryElementStub(Isolate* isolate) | 1795 explicit LoadDictionaryElementStub(Isolate* isolate) |
1857 : HydrogenCodeStub(isolate) {} | 1796 : HydrogenCodeStub(isolate) {} |
1858 | 1797 |
1859 virtual Handle<Code> GenerateCode() OVERRIDE; | 1798 virtual Handle<Code> GenerateCode() OVERRIDE; |
1860 | 1799 |
1861 virtual void InitializeInterfaceDescriptor( | 1800 virtual void InitializeInterfaceDescriptor( |
1862 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1801 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1863 | 1802 |
1864 private: | 1803 DEFINE_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); |
1865 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1866 | |
1867 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementStub); | |
1868 }; | 1804 }; |
1869 | 1805 |
1870 | 1806 |
1871 class KeyedLoadGenericStub : public HydrogenCodeStub { | 1807 class KeyedLoadGenericStub : public HydrogenCodeStub { |
1872 public: | 1808 public: |
1873 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1809 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
1874 | 1810 |
1875 virtual Handle<Code> GenerateCode() OVERRIDE; | 1811 virtual Handle<Code> GenerateCode() OVERRIDE; |
1876 | 1812 |
1877 virtual void InitializeInterfaceDescriptor( | 1813 virtual void InitializeInterfaceDescriptor( |
1878 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1814 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1879 | 1815 |
1880 static void InstallDescriptors(Isolate* isolate); | 1816 static void InstallDescriptors(Isolate* isolate); |
1881 | 1817 |
1882 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } | 1818 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } |
1883 virtual InlineCacheState GetICState() const { return GENERIC; } | 1819 virtual InlineCacheState GetICState() const { return GENERIC; } |
1884 | 1820 |
1885 private: | 1821 DEFINE_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); |
1886 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1887 | |
1888 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub); | |
1889 }; | 1822 }; |
1890 | 1823 |
1891 | 1824 |
1892 class LoadICTrampolineStub : public PlatformCodeStub { | 1825 class LoadICTrampolineStub : public PlatformCodeStub { |
1893 public: | 1826 public: |
1894 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) | 1827 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) |
1895 : PlatformCodeStub(isolate) { | 1828 : PlatformCodeStub(isolate) { |
1896 minor_key_ = state.GetExtraICState(); | 1829 minor_key_ = state.GetExtraICState(); |
1897 } | 1830 } |
1898 | 1831 |
1899 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1832 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1900 | 1833 |
1901 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1834 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
1902 return GENERIC; | 1835 return GENERIC; |
1903 } | 1836 } |
1904 | 1837 |
1905 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1838 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1906 return static_cast<ExtraICState>(minor_key_); | 1839 return static_cast<ExtraICState>(minor_key_); |
1907 } | 1840 } |
1908 | 1841 |
1909 virtual inline Major MajorKey() const OVERRIDE; | |
1910 | |
1911 private: | 1842 private: |
1912 LoadIC::State state() const { | 1843 LoadIC::State state() const { |
1913 return LoadIC::State(static_cast<ExtraICState>(minor_key_)); | 1844 return LoadIC::State(static_cast<ExtraICState>(minor_key_)); |
1914 } | 1845 } |
1915 | 1846 |
1916 virtual void Generate(MacroAssembler* masm); | 1847 virtual void Generate(MacroAssembler* masm); |
1917 | 1848 |
1918 DISALLOW_COPY_AND_ASSIGN(LoadICTrampolineStub); | 1849 DEFINE_CODE_STUB(LoadICTrampoline, PlatformCodeStub); |
1919 }; | 1850 }; |
1920 | 1851 |
1921 | 1852 |
1922 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { | 1853 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { |
1923 public: | 1854 public: |
1924 explicit KeyedLoadICTrampolineStub(Isolate* isolate) | 1855 explicit KeyedLoadICTrampolineStub(Isolate* isolate) |
1925 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {} | 1856 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {} |
1926 | 1857 |
1927 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1858 virtual Code::Kind GetCodeKind() const OVERRIDE { |
1928 return Code::KEYED_LOAD_IC; | 1859 return Code::KEYED_LOAD_IC; |
1929 } | 1860 } |
1930 | 1861 |
1931 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1932 | |
1933 private: | 1862 private: |
1934 virtual void Generate(MacroAssembler* masm); | 1863 virtual void Generate(MacroAssembler* masm); |
1935 | 1864 |
1936 DISALLOW_COPY_AND_ASSIGN(KeyedLoadICTrampolineStub); | 1865 DEFINE_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub); |
1937 }; | 1866 }; |
1938 | 1867 |
1939 | 1868 |
1940 class VectorLoadStub : public HydrogenCodeStub { | 1869 class VectorLoadStub : public HydrogenCodeStub { |
1941 public: | 1870 public: |
1942 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state) | 1871 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state) |
1943 : HydrogenCodeStub(isolate) { | 1872 : HydrogenCodeStub(isolate) { |
1944 set_sub_minor_key(state.GetExtraICState()); | 1873 set_sub_minor_key(state.GetExtraICState()); |
1945 } | 1874 } |
1946 | 1875 |
1947 virtual Handle<Code> GenerateCode() OVERRIDE; | 1876 virtual Handle<Code> GenerateCode() OVERRIDE; |
1948 | 1877 |
1949 virtual void InitializeInterfaceDescriptor( | 1878 virtual void InitializeInterfaceDescriptor( |
1950 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1879 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1951 | 1880 |
1952 static void InstallDescriptors(Isolate* isolate); | 1881 static void InstallDescriptors(Isolate* isolate); |
1953 | 1882 |
1954 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1883 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1955 | 1884 |
1956 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1885 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
1957 return GENERIC; | 1886 return GENERIC; |
1958 } | 1887 } |
1959 | 1888 |
1960 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1889 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1961 return static_cast<ExtraICState>(sub_minor_key()); | 1890 return static_cast<ExtraICState>(sub_minor_key()); |
1962 } | 1891 } |
1963 | 1892 |
1964 private: | 1893 private: |
1965 virtual inline Major MajorKey() const OVERRIDE; | |
1966 | |
1967 LoadIC::State state() const { return LoadIC::State(GetExtraICState()); } | 1894 LoadIC::State state() const { return LoadIC::State(GetExtraICState()); } |
1968 | 1895 |
1969 DISALLOW_COPY_AND_ASSIGN(VectorLoadStub); | 1896 DEFINE_CODE_STUB(VectorLoad, HydrogenCodeStub); |
1970 }; | 1897 }; |
1971 | 1898 |
1972 | 1899 |
1973 class VectorKeyedLoadStub : public VectorLoadStub { | 1900 class VectorKeyedLoadStub : public VectorLoadStub { |
1974 public: | 1901 public: |
1975 explicit VectorKeyedLoadStub(Isolate* isolate) | 1902 explicit VectorKeyedLoadStub(Isolate* isolate) |
1976 : VectorLoadStub(isolate, LoadIC::State(0)) {} | 1903 : VectorLoadStub(isolate, LoadIC::State(0)) {} |
1977 | 1904 |
1978 virtual Handle<Code> GenerateCode() OVERRIDE; | 1905 virtual Handle<Code> GenerateCode() OVERRIDE; |
1979 | 1906 |
1980 virtual void InitializeInterfaceDescriptor( | 1907 virtual void InitializeInterfaceDescriptor( |
1981 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1908 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
1982 | 1909 |
1983 static void InstallDescriptors(Isolate* isolate); | 1910 static void InstallDescriptors(Isolate* isolate); |
1984 | 1911 |
1985 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1912 virtual Code::Kind GetCodeKind() const OVERRIDE { |
1986 return Code::KEYED_LOAD_IC; | 1913 return Code::KEYED_LOAD_IC; |
1987 } | 1914 } |
1988 | 1915 |
1989 private: | 1916 DEFINE_CODE_STUB(VectorKeyedLoad, VectorLoadStub); |
1990 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
1991 | |
1992 DISALLOW_COPY_AND_ASSIGN(VectorKeyedLoadStub); | |
1993 }; | 1917 }; |
1994 | 1918 |
1995 | 1919 |
1996 class DoubleToIStub : public PlatformCodeStub { | 1920 class DoubleToIStub : public PlatformCodeStub { |
1997 public: | 1921 public: |
1998 DoubleToIStub(Isolate* isolate, Register source, Register destination, | 1922 DoubleToIStub(Isolate* isolate, Register source, Register destination, |
1999 int offset, bool is_truncating, bool skip_fastpath = false) | 1923 int offset, bool is_truncating, bool skip_fastpath = false) |
2000 : PlatformCodeStub(isolate) { | 1924 : PlatformCodeStub(isolate) { |
2001 minor_key_ = SourceRegisterBits::encode(source.code()) | | 1925 minor_key_ = SourceRegisterBits::encode(source.code()) | |
2002 DestinationRegisterBits::encode(destination.code()) | | 1926 DestinationRegisterBits::encode(destination.code()) | |
2003 OffsetBits::encode(offset) | | 1927 OffsetBits::encode(offset) | |
2004 IsTruncatingBits::encode(is_truncating) | | 1928 IsTruncatingBits::encode(is_truncating) | |
2005 SkipFastPathBits::encode(skip_fastpath) | | 1929 SkipFastPathBits::encode(skip_fastpath) | |
2006 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); | 1930 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); |
2007 } | 1931 } |
2008 | 1932 |
2009 void Generate(MacroAssembler* masm); | 1933 void Generate(MacroAssembler* masm); |
2010 | 1934 |
2011 virtual bool SometimesSetsUpAFrame() { return false; } | 1935 virtual bool SometimesSetsUpAFrame() { return false; } |
2012 | 1936 |
2013 private: | 1937 private: |
2014 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2015 | |
2016 Register source() const { | 1938 Register source() const { |
2017 return Register::from_code(SourceRegisterBits::decode(minor_key_)); | 1939 return Register::from_code(SourceRegisterBits::decode(minor_key_)); |
2018 } | 1940 } |
2019 Register destination() const { | 1941 Register destination() const { |
2020 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); | 1942 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); |
2021 } | 1943 } |
2022 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } | 1944 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } |
2023 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } | 1945 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } |
2024 int offset() const { return OffsetBits::decode(minor_key_); } | 1946 int offset() const { return OffsetBits::decode(minor_key_); } |
2025 | 1947 |
2026 static const int kBitsPerRegisterNumber = 6; | 1948 static const int kBitsPerRegisterNumber = 6; |
2027 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); | 1949 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); |
2028 class SourceRegisterBits: | 1950 class SourceRegisterBits: |
2029 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT | 1951 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT |
2030 class DestinationRegisterBits: | 1952 class DestinationRegisterBits: |
2031 public BitField<int, kBitsPerRegisterNumber, | 1953 public BitField<int, kBitsPerRegisterNumber, |
2032 kBitsPerRegisterNumber> {}; // NOLINT | 1954 kBitsPerRegisterNumber> {}; // NOLINT |
2033 class IsTruncatingBits: | 1955 class IsTruncatingBits: |
2034 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT | 1956 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT |
2035 class OffsetBits: | 1957 class OffsetBits: |
2036 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT | 1958 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT |
2037 class SkipFastPathBits: | 1959 class SkipFastPathBits: |
2038 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT | 1960 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT |
2039 class SSE3Bits: | 1961 class SSE3Bits: |
2040 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT | 1962 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT |
2041 | 1963 |
2042 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); | 1964 DEFINE_CODE_STUB(DoubleToI, PlatformCodeStub); |
2043 }; | 1965 }; |
2044 | 1966 |
2045 | 1967 |
2046 class LoadFastElementStub : public HydrogenCodeStub { | 1968 class LoadFastElementStub : public HydrogenCodeStub { |
2047 public: | 1969 public: |
2048 LoadFastElementStub(Isolate* isolate, bool is_js_array, | 1970 LoadFastElementStub(Isolate* isolate, bool is_js_array, |
2049 ElementsKind elements_kind) | 1971 ElementsKind elements_kind) |
2050 : HydrogenCodeStub(isolate) { | 1972 : HydrogenCodeStub(isolate) { |
2051 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 1973 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
2052 IsJSArrayBits::encode(is_js_array)); | 1974 IsJSArrayBits::encode(is_js_array)); |
2053 } | 1975 } |
2054 | 1976 |
2055 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 1977 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
2056 | 1978 |
2057 ElementsKind elements_kind() const { | 1979 ElementsKind elements_kind() const { |
2058 return ElementsKindBits::decode(sub_minor_key()); | 1980 return ElementsKindBits::decode(sub_minor_key()); |
2059 } | 1981 } |
2060 | 1982 |
2061 virtual Handle<Code> GenerateCode() OVERRIDE; | 1983 virtual Handle<Code> GenerateCode() OVERRIDE; |
2062 | 1984 |
2063 static void InstallDescriptors(Isolate* isolate); | 1985 static void InstallDescriptors(Isolate* isolate); |
2064 | 1986 |
2065 virtual void InitializeInterfaceDescriptor( | 1987 virtual void InitializeInterfaceDescriptor( |
2066 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 1988 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2067 | 1989 |
2068 private: | 1990 private: |
2069 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2070 | |
2071 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1991 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2072 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 1992 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
2073 | 1993 |
2074 DISALLOW_COPY_AND_ASSIGN(LoadFastElementStub); | 1994 DEFINE_CODE_STUB(LoadFastElement, HydrogenCodeStub); |
2075 }; | 1995 }; |
2076 | 1996 |
2077 | 1997 |
2078 class StoreFastElementStub : public HydrogenCodeStub { | 1998 class StoreFastElementStub : public HydrogenCodeStub { |
2079 public: | 1999 public: |
2080 StoreFastElementStub(Isolate* isolate, bool is_js_array, | 2000 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
2081 ElementsKind elements_kind, KeyedAccessStoreMode mode) | 2001 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
2082 : HydrogenCodeStub(isolate) { | 2002 : HydrogenCodeStub(isolate) { |
2083 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2003 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
2084 IsJSArrayBits::encode(is_js_array) | | 2004 IsJSArrayBits::encode(is_js_array) | |
2085 StoreModeBits::encode(mode)); | 2005 StoreModeBits::encode(mode)); |
2086 } | 2006 } |
2087 | 2007 |
2088 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2008 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
2089 | 2009 |
2090 ElementsKind elements_kind() const { | 2010 ElementsKind elements_kind() const { |
2091 return ElementsKindBits::decode(sub_minor_key()); | 2011 return ElementsKindBits::decode(sub_minor_key()); |
2092 } | 2012 } |
2093 | 2013 |
2094 KeyedAccessStoreMode store_mode() const { | 2014 KeyedAccessStoreMode store_mode() const { |
2095 return StoreModeBits::decode(sub_minor_key()); | 2015 return StoreModeBits::decode(sub_minor_key()); |
2096 } | 2016 } |
2097 | 2017 |
2098 virtual Handle<Code> GenerateCode() OVERRIDE; | 2018 virtual Handle<Code> GenerateCode() OVERRIDE; |
2099 | 2019 |
2100 virtual void InitializeInterfaceDescriptor( | 2020 virtual void InitializeInterfaceDescriptor( |
2101 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2021 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2102 | 2022 |
2103 private: | 2023 private: |
2104 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2105 | |
2106 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2024 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2107 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2025 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
2108 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | 2026 class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
2109 | 2027 |
2110 DISALLOW_COPY_AND_ASSIGN(StoreFastElementStub); | 2028 DEFINE_CODE_STUB(StoreFastElement, HydrogenCodeStub); |
2111 }; | 2029 }; |
2112 | 2030 |
2113 | 2031 |
2114 class TransitionElementsKindStub : public HydrogenCodeStub { | 2032 class TransitionElementsKindStub : public HydrogenCodeStub { |
2115 public: | 2033 public: |
2116 TransitionElementsKindStub(Isolate* isolate, | 2034 TransitionElementsKindStub(Isolate* isolate, |
2117 ElementsKind from_kind, | 2035 ElementsKind from_kind, |
2118 ElementsKind to_kind, | 2036 ElementsKind to_kind, |
2119 bool is_js_array) : HydrogenCodeStub(isolate) { | 2037 bool is_js_array) : HydrogenCodeStub(isolate) { |
2120 set_sub_minor_key(FromKindBits::encode(from_kind) | | 2038 set_sub_minor_key(FromKindBits::encode(from_kind) | |
2121 ToKindBits::encode(to_kind) | | 2039 ToKindBits::encode(to_kind) | |
2122 IsJSArrayBits::encode(is_js_array)); | 2040 IsJSArrayBits::encode(is_js_array)); |
2123 } | 2041 } |
2124 | 2042 |
2125 ElementsKind from_kind() const { | 2043 ElementsKind from_kind() const { |
2126 return FromKindBits::decode(sub_minor_key()); | 2044 return FromKindBits::decode(sub_minor_key()); |
2127 } | 2045 } |
2128 | 2046 |
2129 ElementsKind to_kind() const { return ToKindBits::decode(sub_minor_key()); } | 2047 ElementsKind to_kind() const { return ToKindBits::decode(sub_minor_key()); } |
2130 | 2048 |
2131 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2049 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
2132 | 2050 |
2133 virtual Handle<Code> GenerateCode() OVERRIDE; | 2051 virtual Handle<Code> GenerateCode() OVERRIDE; |
2134 | 2052 |
2135 virtual void InitializeInterfaceDescriptor( | 2053 virtual void InitializeInterfaceDescriptor( |
2136 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2054 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2137 | 2055 |
2138 private: | 2056 private: |
2139 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2140 | |
2141 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; | 2057 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; |
2142 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 2058 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
2143 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2059 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
2144 | 2060 |
2145 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 2061 DEFINE_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); |
2146 }; | 2062 }; |
2147 | 2063 |
2148 | 2064 |
2149 class ArrayConstructorStubBase : public HydrogenCodeStub { | 2065 class ArrayConstructorStubBase : public HydrogenCodeStub { |
2150 public: | 2066 public: |
2151 ArrayConstructorStubBase(Isolate* isolate, | 2067 ArrayConstructorStubBase(Isolate* isolate, |
2152 ElementsKind kind, | 2068 ElementsKind kind, |
2153 AllocationSiteOverrideMode override_mode) | 2069 AllocationSiteOverrideMode override_mode) |
2154 : HydrogenCodeStub(isolate) { | 2070 : HydrogenCodeStub(isolate) { |
2155 // It only makes sense to override local allocation site behavior | 2071 // It only makes sense to override local allocation site behavior |
(...skipping 24 matching lines...) Expand all Loading... |
2180 OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT | 2096 OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT |
2181 | 2097 |
2182 private: | 2098 private: |
2183 // Ensure data fits within available bits. | 2099 // Ensure data fits within available bits. |
2184 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); | 2100 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
2185 | 2101 |
2186 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2102 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2187 class AllocationSiteOverrideModeBits: public | 2103 class AllocationSiteOverrideModeBits: public |
2188 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT | 2104 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
2189 | 2105 |
2190 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 2106 DEFINE_CODE_STUB_BASE(ArrayConstructorStubBase, HydrogenCodeStub); |
2191 }; | 2107 }; |
2192 | 2108 |
2193 | 2109 |
2194 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 2110 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
2195 public: | 2111 public: |
2196 ArrayNoArgumentConstructorStub( | 2112 ArrayNoArgumentConstructorStub( |
2197 Isolate* isolate, | 2113 Isolate* isolate, |
2198 ElementsKind kind, | 2114 ElementsKind kind, |
2199 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2115 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2200 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2116 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2201 } | 2117 } |
2202 | 2118 |
2203 virtual Handle<Code> GenerateCode() OVERRIDE; | 2119 virtual Handle<Code> GenerateCode() OVERRIDE; |
2204 | 2120 |
2205 virtual void InitializeInterfaceDescriptor( | 2121 virtual void InitializeInterfaceDescriptor( |
2206 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2122 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2207 | 2123 |
2208 private: | 2124 private: |
2209 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2210 | |
2211 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT | 2125 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT |
2212 BasePrintName(os, "ArrayNoArgumentConstructorStub"); | 2126 BasePrintName(os, "ArrayNoArgumentConstructorStub"); |
2213 } | 2127 } |
2214 | 2128 |
2215 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 2129 DEFINE_CODE_STUB(ArrayNoArgumentConstructor, ArrayConstructorStubBase); |
2216 }; | 2130 }; |
2217 | 2131 |
2218 | 2132 |
2219 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2133 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
2220 public: | 2134 public: |
2221 ArraySingleArgumentConstructorStub( | 2135 ArraySingleArgumentConstructorStub( |
2222 Isolate* isolate, | 2136 Isolate* isolate, |
2223 ElementsKind kind, | 2137 ElementsKind kind, |
2224 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2138 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2225 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2139 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2226 } | 2140 } |
2227 | 2141 |
2228 virtual Handle<Code> GenerateCode() OVERRIDE; | 2142 virtual Handle<Code> GenerateCode() OVERRIDE; |
2229 | 2143 |
2230 virtual void InitializeInterfaceDescriptor( | 2144 virtual void InitializeInterfaceDescriptor( |
2231 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2145 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2232 | 2146 |
2233 private: | 2147 private: |
2234 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2235 | |
2236 virtual void PrintName(OStream& os) const { // NOLINT | 2148 virtual void PrintName(OStream& os) const { // NOLINT |
2237 BasePrintName(os, "ArraySingleArgumentConstructorStub"); | 2149 BasePrintName(os, "ArraySingleArgumentConstructorStub"); |
2238 } | 2150 } |
2239 | 2151 |
2240 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 2152 DEFINE_CODE_STUB(ArraySingleArgumentConstructor, ArrayConstructorStubBase); |
2241 }; | 2153 }; |
2242 | 2154 |
2243 | 2155 |
2244 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2156 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
2245 public: | 2157 public: |
2246 ArrayNArgumentsConstructorStub( | 2158 ArrayNArgumentsConstructorStub( |
2247 Isolate* isolate, | 2159 Isolate* isolate, |
2248 ElementsKind kind, | 2160 ElementsKind kind, |
2249 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2161 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2250 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2162 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2251 } | 2163 } |
2252 | 2164 |
2253 virtual Handle<Code> GenerateCode() OVERRIDE; | 2165 virtual Handle<Code> GenerateCode() OVERRIDE; |
2254 | 2166 |
2255 virtual void InitializeInterfaceDescriptor( | 2167 virtual void InitializeInterfaceDescriptor( |
2256 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2168 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2257 | 2169 |
2258 private: | 2170 private: |
2259 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2260 | |
2261 virtual void PrintName(OStream& os) const { // NOLINT | 2171 virtual void PrintName(OStream& os) const { // NOLINT |
2262 BasePrintName(os, "ArrayNArgumentsConstructorStub"); | 2172 BasePrintName(os, "ArrayNArgumentsConstructorStub"); |
2263 } | 2173 } |
2264 | 2174 |
2265 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 2175 DEFINE_CODE_STUB(ArrayNArgumentsConstructor, ArrayConstructorStubBase); |
2266 }; | 2176 }; |
2267 | 2177 |
2268 | 2178 |
2269 class InternalArrayConstructorStubBase : public HydrogenCodeStub { | 2179 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
2270 public: | 2180 public: |
2271 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind) | 2181 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind) |
2272 : HydrogenCodeStub(isolate) { | 2182 : HydrogenCodeStub(isolate) { |
2273 set_sub_minor_key(ElementsKindBits::encode(kind)); | 2183 set_sub_minor_key(ElementsKindBits::encode(kind)); |
2274 } | 2184 } |
2275 | 2185 |
2276 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2186 static void GenerateStubsAheadOfTime(Isolate* isolate); |
2277 static void InstallDescriptors(Isolate* isolate); | 2187 static void InstallDescriptors(Isolate* isolate); |
2278 | 2188 |
2279 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2189 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
2280 static const int kConstructor = 0; | 2190 static const int kConstructor = 0; |
2281 | 2191 |
2282 ElementsKind elements_kind() const { | 2192 ElementsKind elements_kind() const { |
2283 return ElementsKindBits::decode(sub_minor_key()); | 2193 return ElementsKindBits::decode(sub_minor_key()); |
2284 } | 2194 } |
2285 | 2195 |
2286 private: | 2196 private: |
2287 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; | 2197 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
2288 | 2198 |
2289 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStubBase); | 2199 DEFINE_CODE_STUB_BASE(InternalArrayConstructorStubBase, HydrogenCodeStub); |
2290 }; | 2200 }; |
2291 | 2201 |
2292 | 2202 |
2293 class InternalArrayNoArgumentConstructorStub : public | 2203 class InternalArrayNoArgumentConstructorStub : public |
2294 InternalArrayConstructorStubBase { | 2204 InternalArrayConstructorStubBase { |
2295 public: | 2205 public: |
2296 InternalArrayNoArgumentConstructorStub(Isolate* isolate, | 2206 InternalArrayNoArgumentConstructorStub(Isolate* isolate, |
2297 ElementsKind kind) | 2207 ElementsKind kind) |
2298 : InternalArrayConstructorStubBase(isolate, kind) { } | 2208 : InternalArrayConstructorStubBase(isolate, kind) { } |
2299 | 2209 |
2300 virtual Handle<Code> GenerateCode() OVERRIDE; | 2210 virtual Handle<Code> GenerateCode() OVERRIDE; |
2301 | 2211 |
2302 virtual void InitializeInterfaceDescriptor( | 2212 virtual void InitializeInterfaceDescriptor( |
2303 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2213 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2304 | 2214 |
2305 private: | 2215 DEFINE_CODE_STUB(InternalArrayNoArgumentConstructor, |
2306 virtual inline Major MajorKey() const FINAL OVERRIDE; | 2216 InternalArrayConstructorStubBase); |
2307 | |
2308 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); | |
2309 }; | 2217 }; |
2310 | 2218 |
2311 | 2219 |
2312 class InternalArraySingleArgumentConstructorStub : public | 2220 class InternalArraySingleArgumentConstructorStub : public |
2313 InternalArrayConstructorStubBase { | 2221 InternalArrayConstructorStubBase { |
2314 public: | 2222 public: |
2315 InternalArraySingleArgumentConstructorStub(Isolate* isolate, | 2223 InternalArraySingleArgumentConstructorStub(Isolate* isolate, |
2316 ElementsKind kind) | 2224 ElementsKind kind) |
2317 : InternalArrayConstructorStubBase(isolate, kind) { } | 2225 : InternalArrayConstructorStubBase(isolate, kind) { } |
2318 | 2226 |
2319 virtual Handle<Code> GenerateCode() OVERRIDE; | 2227 virtual Handle<Code> GenerateCode() OVERRIDE; |
2320 | 2228 |
2321 virtual void InitializeInterfaceDescriptor( | 2229 virtual void InitializeInterfaceDescriptor( |
2322 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2230 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2323 | 2231 |
2324 private: | 2232 DEFINE_CODE_STUB(InternalArraySingleArgumentConstructor, |
2325 virtual inline Major MajorKey() const FINAL OVERRIDE; | 2233 InternalArrayConstructorStubBase); |
2326 | |
2327 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); | |
2328 }; | 2234 }; |
2329 | 2235 |
2330 | 2236 |
2331 class InternalArrayNArgumentsConstructorStub : public | 2237 class InternalArrayNArgumentsConstructorStub : public |
2332 InternalArrayConstructorStubBase { | 2238 InternalArrayConstructorStubBase { |
2333 public: | 2239 public: |
2334 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) | 2240 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) |
2335 : InternalArrayConstructorStubBase(isolate, kind) { } | 2241 : InternalArrayConstructorStubBase(isolate, kind) { } |
2336 | 2242 |
2337 virtual Handle<Code> GenerateCode() OVERRIDE; | 2243 virtual Handle<Code> GenerateCode() OVERRIDE; |
2338 | 2244 |
2339 virtual void InitializeInterfaceDescriptor( | 2245 virtual void InitializeInterfaceDescriptor( |
2340 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; | 2246 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
2341 | 2247 |
2342 private: | 2248 DEFINE_CODE_STUB(InternalArrayNArgumentsConstructor, |
2343 virtual inline Major MajorKey() const FINAL OVERRIDE; | 2249 InternalArrayConstructorStubBase); |
2344 | |
2345 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); | |
2346 }; | 2250 }; |
2347 | 2251 |
2348 | 2252 |
2349 class StoreElementStub : public PlatformCodeStub { | 2253 class StoreElementStub : public PlatformCodeStub { |
2350 public: | 2254 public: |
2351 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) | 2255 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) |
2352 : PlatformCodeStub(isolate) { | 2256 : PlatformCodeStub(isolate) { |
2353 minor_key_ = ElementsKindBits::encode(elements_kind); | 2257 minor_key_ = ElementsKindBits::encode(elements_kind); |
2354 } | 2258 } |
2355 | 2259 |
2356 void Generate(MacroAssembler* masm); | 2260 void Generate(MacroAssembler* masm); |
2357 | 2261 |
2358 private: | 2262 private: |
2359 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2360 | |
2361 ElementsKind elements_kind() const { | 2263 ElementsKind elements_kind() const { |
2362 return ElementsKindBits::decode(minor_key_); | 2264 return ElementsKindBits::decode(minor_key_); |
2363 } | 2265 } |
2364 | 2266 |
2365 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; | 2267 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
2366 | 2268 |
2367 DISALLOW_COPY_AND_ASSIGN(StoreElementStub); | 2269 DEFINE_CODE_STUB(StoreElement, PlatformCodeStub); |
2368 }; | 2270 }; |
2369 | 2271 |
2370 | 2272 |
2371 class ToBooleanStub: public HydrogenCodeStub { | 2273 class ToBooleanStub: public HydrogenCodeStub { |
2372 public: | 2274 public: |
2373 enum Type { | 2275 enum Type { |
2374 UNDEFINED, | 2276 UNDEFINED, |
2375 BOOLEAN, | 2277 BOOLEAN, |
2376 NULL_TYPE, | 2278 NULL_TYPE, |
2377 SMI, | 2279 SMI, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 return MONOMORPHIC; | 2352 return MONOMORPHIC; |
2451 } | 2353 } |
2452 } | 2354 } |
2453 | 2355 |
2454 private: | 2356 private: |
2455 ToBooleanStub(Isolate* isolate, InitializationState init_state) | 2357 ToBooleanStub(Isolate* isolate, InitializationState init_state) |
2456 : HydrogenCodeStub(isolate, init_state) { | 2358 : HydrogenCodeStub(isolate, init_state) { |
2457 set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI)); | 2359 set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI)); |
2458 } | 2360 } |
2459 | 2361 |
2460 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2461 | |
2462 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; | 2362 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; |
2463 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; | 2363 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; |
2464 | 2364 |
2465 DISALLOW_COPY_AND_ASSIGN(ToBooleanStub); | 2365 DEFINE_CODE_STUB(ToBoolean, HydrogenCodeStub); |
2466 }; | 2366 }; |
2467 | 2367 |
2468 | 2368 |
2469 OStream& operator<<(OStream& os, const ToBooleanStub::Types& t); | 2369 OStream& operator<<(OStream& os, const ToBooleanStub::Types& t); |
2470 | 2370 |
2471 | 2371 |
2472 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { | 2372 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { |
2473 public: | 2373 public: |
2474 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind, | 2374 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind, |
2475 ElementsKind to_kind, bool is_jsarray, | 2375 ElementsKind to_kind, bool is_jsarray, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 return ElementTransitionAndStoreDescriptor::MapRegister(); | 2408 return ElementTransitionAndStoreDescriptor::MapRegister(); |
2509 } | 2409 } |
2510 static const Register KeyRegister() { | 2410 static const Register KeyRegister() { |
2511 return ElementTransitionAndStoreDescriptor::NameRegister(); | 2411 return ElementTransitionAndStoreDescriptor::NameRegister(); |
2512 } | 2412 } |
2513 static const Register ObjectRegister() { | 2413 static const Register ObjectRegister() { |
2514 return ElementTransitionAndStoreDescriptor::ReceiverRegister(); | 2414 return ElementTransitionAndStoreDescriptor::ReceiverRegister(); |
2515 } | 2415 } |
2516 | 2416 |
2517 private: | 2417 private: |
2518 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2519 | |
2520 class FromBits : public BitField<ElementsKind, 0, 8> {}; | 2418 class FromBits : public BitField<ElementsKind, 0, 8> {}; |
2521 class ToBits : public BitField<ElementsKind, 8, 8> {}; | 2419 class ToBits : public BitField<ElementsKind, 8, 8> {}; |
2522 class IsJSArrayBits : public BitField<bool, 16, 1> {}; | 2420 class IsJSArrayBits : public BitField<bool, 16, 1> {}; |
2523 class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {}; | 2421 class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {}; |
2524 | 2422 |
2525 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); | 2423 DEFINE_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); |
2526 }; | 2424 }; |
2527 | 2425 |
2528 | 2426 |
2529 class StoreArrayLiteralElementStub : public PlatformCodeStub { | 2427 class StoreArrayLiteralElementStub : public PlatformCodeStub { |
2530 public: | 2428 public: |
2531 explicit StoreArrayLiteralElementStub(Isolate* isolate) | 2429 explicit StoreArrayLiteralElementStub(Isolate* isolate) |
2532 : PlatformCodeStub(isolate) { } | 2430 : PlatformCodeStub(isolate) { } |
2533 | 2431 |
2534 private: | 2432 private: |
2535 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2536 | |
2537 void Generate(MacroAssembler* masm); | 2433 void Generate(MacroAssembler* masm); |
2538 | 2434 |
2539 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 2435 DEFINE_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub); |
2540 }; | 2436 }; |
2541 | 2437 |
2542 | 2438 |
2543 class StubFailureTrampolineStub : public PlatformCodeStub { | 2439 class StubFailureTrampolineStub : public PlatformCodeStub { |
2544 public: | 2440 public: |
2545 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) | 2441 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) |
2546 : PlatformCodeStub(isolate) { | 2442 : PlatformCodeStub(isolate) { |
2547 minor_key_ = FunctionModeField::encode(function_mode); | 2443 minor_key_ = FunctionModeField::encode(function_mode); |
2548 } | 2444 } |
2549 | 2445 |
2550 static void GenerateAheadOfTime(Isolate* isolate); | 2446 static void GenerateAheadOfTime(Isolate* isolate); |
2551 | 2447 |
2552 private: | 2448 private: |
2553 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2554 | |
2555 StubFunctionMode function_mode() const { | 2449 StubFunctionMode function_mode() const { |
2556 return FunctionModeField::decode(minor_key_); | 2450 return FunctionModeField::decode(minor_key_); |
2557 } | 2451 } |
2558 | 2452 |
2559 void Generate(MacroAssembler* masm); | 2453 void Generate(MacroAssembler* masm); |
2560 | 2454 |
2561 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; | 2455 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; |
2562 | 2456 |
2563 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 2457 DEFINE_CODE_STUB(StubFailureTrampoline, PlatformCodeStub); |
2564 }; | 2458 }; |
2565 | 2459 |
2566 | 2460 |
2567 class ProfileEntryHookStub : public PlatformCodeStub { | 2461 class ProfileEntryHookStub : public PlatformCodeStub { |
2568 public: | 2462 public: |
2569 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2463 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
2570 | 2464 |
2571 // The profile entry hook function is not allowed to cause a GC. | 2465 // The profile entry hook function is not allowed to cause a GC. |
2572 virtual bool SometimesSetsUpAFrame() { return false; } | 2466 virtual bool SometimesSetsUpAFrame() { return false; } |
2573 | 2467 |
2574 // Generates a call to the entry hook if it's enabled. | 2468 // Generates a call to the entry hook if it's enabled. |
2575 static void MaybeCallEntryHook(MacroAssembler* masm); | 2469 static void MaybeCallEntryHook(MacroAssembler* masm); |
2576 | 2470 |
2577 private: | 2471 private: |
2578 static void EntryHookTrampoline(intptr_t function, | 2472 static void EntryHookTrampoline(intptr_t function, |
2579 intptr_t stack_pointer, | 2473 intptr_t stack_pointer, |
2580 Isolate* isolate); | 2474 Isolate* isolate); |
2581 | 2475 |
2582 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2583 | |
2584 void Generate(MacroAssembler* masm); | 2476 void Generate(MacroAssembler* masm); |
2585 | 2477 |
2586 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2478 DEFINE_CODE_STUB(ProfileEntryHook, PlatformCodeStub); |
2587 }; | 2479 }; |
2588 | 2480 |
2589 | 2481 |
2590 class StoreBufferOverflowStub : public PlatformCodeStub { | 2482 class StoreBufferOverflowStub : public PlatformCodeStub { |
2591 public: | 2483 public: |
2592 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) | 2484 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) |
2593 : PlatformCodeStub(isolate) { | 2485 : PlatformCodeStub(isolate) { |
2594 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs); | 2486 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs); |
2595 } | 2487 } |
2596 | 2488 |
2597 void Generate(MacroAssembler* masm); | 2489 void Generate(MacroAssembler* masm); |
2598 | 2490 |
2599 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | 2491 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); |
2600 virtual bool SometimesSetsUpAFrame() { return false; } | 2492 virtual bool SometimesSetsUpAFrame() { return false; } |
2601 | 2493 |
2602 private: | 2494 private: |
2603 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2604 | |
2605 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } | 2495 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } |
2606 | 2496 |
2607 class SaveDoublesBits : public BitField<bool, 0, 1> {}; | 2497 class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
2608 | 2498 |
2609 DISALLOW_COPY_AND_ASSIGN(StoreBufferOverflowStub); | 2499 DEFINE_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); |
2610 }; | 2500 }; |
2611 | 2501 |
2612 | 2502 |
2613 class SubStringStub : public PlatformCodeStub { | 2503 class SubStringStub : public PlatformCodeStub { |
2614 public: | 2504 public: |
2615 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2505 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
2616 | 2506 |
2617 private: | 2507 private: |
2618 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2619 | |
2620 void Generate(MacroAssembler* masm); | 2508 void Generate(MacroAssembler* masm); |
2621 | 2509 |
2622 DISALLOW_COPY_AND_ASSIGN(SubStringStub); | 2510 DEFINE_CODE_STUB(SubString, PlatformCodeStub); |
2623 }; | 2511 }; |
2624 | 2512 |
2625 | 2513 |
2626 class StringCompareStub : public PlatformCodeStub { | 2514 class StringCompareStub : public PlatformCodeStub { |
2627 public: | 2515 public: |
2628 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2516 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
2629 | 2517 |
2630 private: | 2518 private: |
2631 virtual inline Major MajorKey() const FINAL OVERRIDE; | |
2632 | |
2633 virtual void Generate(MacroAssembler* masm); | 2519 virtual void Generate(MacroAssembler* masm); |
2634 | 2520 |
2635 DISALLOW_COPY_AND_ASSIGN(StringCompareStub); | 2521 DEFINE_CODE_STUB(StringCompare, PlatformCodeStub); |
2636 }; | 2522 }; |
2637 | 2523 |
2638 | 2524 |
2639 #define DEFINE_MAJOR_KEY(NAME) \ | 2525 #undef DEFINE_CODE_STUB |
2640 CodeStub::Major NAME##Stub::MajorKey() const { return NAME; } | 2526 #undef DEFINE_CODE_STUB_BASE |
2641 | |
2642 CODE_STUB_LIST(DEFINE_MAJOR_KEY) | |
2643 | |
2644 #undef DEFINE_MAJOR_KEY | |
2645 } } // namespace v8::internal | 2527 } } // namespace v8::internal |
2646 | 2528 |
2647 #endif // V8_CODE_STUBS_H_ | 2529 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |