| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 V(FastCloneShallowArray) \ | 65 V(FastCloneShallowArray) \ |
| 66 V(RevertToNumber) \ | 66 V(RevertToNumber) \ |
| 67 V(ToBoolean) \ | 67 V(ToBoolean) \ |
| 68 V(ToNumber) \ | 68 V(ToNumber) \ |
| 69 V(CounterOp) \ | 69 V(CounterOp) \ |
| 70 V(ArgumentsAccess) \ | 70 V(ArgumentsAccess) \ |
| 71 V(RegExpConstructResult) \ | 71 V(RegExpConstructResult) \ |
| 72 V(NumberToString) \ | 72 V(NumberToString) \ |
| 73 V(CEntry) \ | 73 V(CEntry) \ |
| 74 V(JSEntry) \ | 74 V(JSEntry) \ |
| 75 V(KeyedLoadFastElement) \ | 75 V(KeyedLoadElement) \ |
| 76 V(KeyedStoreFastElement) \ | 76 V(KeyedStoreElement) \ |
| 77 V(KeyedLoadExternalArray) \ | |
| 78 V(KeyedStoreExternalArray) \ | |
| 79 V(DebuggerStatement) \ | 77 V(DebuggerStatement) \ |
| 80 V(StringDictionaryNegativeLookup) | 78 V(StringDictionaryNegativeLookup) |
| 81 | 79 |
| 82 // List of code stubs only used on ARM platforms. | 80 // List of code stubs only used on ARM platforms. |
| 83 #ifdef V8_TARGET_ARCH_ARM | 81 #ifdef V8_TARGET_ARCH_ARM |
| 84 #define CODE_STUB_LIST_ARM(V) \ | 82 #define CODE_STUB_LIST_ARM(V) \ |
| 85 V(GetProperty) \ | 83 V(GetProperty) \ |
| 86 V(SetProperty) \ | 84 V(SetProperty) \ |
| 87 V(InvokeBuiltin) \ | 85 V(InvokeBuiltin) \ |
| 88 V(RegExpCEntry) \ | 86 V(RegExpCEntry) \ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 return UNINITIALIZED; | 190 return UNINITIALIZED; |
| 193 } | 191 } |
| 194 | 192 |
| 195 // Returns a name for logging/debugging purposes. | 193 // Returns a name for logging/debugging purposes. |
| 196 virtual const char* GetName() { return MajorName(MajorKey(), false); } | 194 virtual const char* GetName() { return MajorName(MajorKey(), false); } |
| 197 | 195 |
| 198 // Returns whether the code generated for this stub needs to be allocated as | 196 // Returns whether the code generated for this stub needs to be allocated as |
| 199 // a fixed (non-moveable) code object. | 197 // a fixed (non-moveable) code object. |
| 200 virtual bool NeedsImmovableCode() { return false; } | 198 virtual bool NeedsImmovableCode() { return false; } |
| 201 | 199 |
| 202 #ifdef DEBUG | 200 #ifdef DEBUG |
| 203 virtual void Print() { PrintF("%s\n", GetName()); } | 201 virtual void Print() { PrintF("%s\n", GetName()); } |
| 204 #endif | 202 #endif |
| 205 | 203 |
| 206 // Computes the key based on major and minor. | 204 // Computes the key based on major and minor. |
| 207 uint32_t GetKey() { | 205 uint32_t GetKey() { |
| 208 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 206 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
| 209 return MinorKeyBits::encode(MinorKey()) | | 207 return MinorKeyBits::encode(MinorKey()) | |
| 210 MajorKeyBits::encode(MajorKey()); | 208 MajorKeyBits::encode(MajorKey()); |
| 211 } | 209 } |
| 212 | 210 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 }; | 275 }; |
| 278 | 276 |
| 279 | 277 |
| 280 class StackCheckStub : public CodeStub { | 278 class StackCheckStub : public CodeStub { |
| 281 public: | 279 public: |
| 282 StackCheckStub() { } | 280 StackCheckStub() { } |
| 283 | 281 |
| 284 void Generate(MacroAssembler* masm); | 282 void Generate(MacroAssembler* masm); |
| 285 | 283 |
| 286 private: | 284 private: |
| 287 | |
| 288 const char* GetName() { return "StackCheckStub"; } | |
| 289 | |
| 290 Major MajorKey() { return StackCheck; } | 285 Major MajorKey() { return StackCheck; } |
| 291 int MinorKey() { return 0; } | 286 int MinorKey() { return 0; } |
| 292 }; | 287 }; |
| 293 | 288 |
| 294 | 289 |
| 295 class ToNumberStub: public CodeStub { | 290 class ToNumberStub: public CodeStub { |
| 296 public: | 291 public: |
| 297 ToNumberStub() { } | 292 ToNumberStub() { } |
| 298 | 293 |
| 299 void Generate(MacroAssembler* masm); | 294 void Generate(MacroAssembler* masm); |
| 300 | 295 |
| 301 private: | 296 private: |
| 302 Major MajorKey() { return ToNumber; } | 297 Major MajorKey() { return ToNumber; } |
| 303 int MinorKey() { return 0; } | 298 int MinorKey() { return 0; } |
| 304 const char* GetName() { return "ToNumberStub"; } | |
| 305 }; | 299 }; |
| 306 | 300 |
| 307 | 301 |
| 308 class FastNewClosureStub : public CodeStub { | 302 class FastNewClosureStub : public CodeStub { |
| 309 public: | 303 public: |
| 310 explicit FastNewClosureStub(StrictModeFlag strict_mode) | 304 explicit FastNewClosureStub(StrictModeFlag strict_mode) |
| 311 : strict_mode_(strict_mode) { } | 305 : strict_mode_(strict_mode) { } |
| 312 | 306 |
| 313 void Generate(MacroAssembler* masm); | 307 void Generate(MacroAssembler* masm); |
| 314 | 308 |
| 315 private: | 309 private: |
| 316 const char* GetName() { return "FastNewClosureStub"; } | |
| 317 Major MajorKey() { return FastNewClosure; } | 310 Major MajorKey() { return FastNewClosure; } |
| 318 int MinorKey() { return strict_mode_; } | 311 int MinorKey() { return strict_mode_; } |
| 319 | 312 |
| 320 StrictModeFlag strict_mode_; | 313 StrictModeFlag strict_mode_; |
| 321 }; | 314 }; |
| 322 | 315 |
| 323 | 316 |
| 324 class FastNewContextStub : public CodeStub { | 317 class FastNewContextStub : public CodeStub { |
| 325 public: | 318 public: |
| 326 static const int kMaximumSlots = 64; | 319 static const int kMaximumSlots = 64; |
| 327 | 320 |
| 328 explicit FastNewContextStub(int slots) : slots_(slots) { | 321 explicit FastNewContextStub(int slots) : slots_(slots) { |
| 329 ASSERT(slots_ > 0 && slots <= kMaximumSlots); | 322 ASSERT(slots_ > 0 && slots <= kMaximumSlots); |
| 330 } | 323 } |
| 331 | 324 |
| 332 void Generate(MacroAssembler* masm); | 325 void Generate(MacroAssembler* masm); |
| 333 | 326 |
| 334 private: | 327 private: |
| 335 int slots_; | 328 int slots_; |
| 336 | 329 |
| 337 const char* GetName() { return "FastNewContextStub"; } | |
| 338 Major MajorKey() { return FastNewContext; } | 330 Major MajorKey() { return FastNewContext; } |
| 339 int MinorKey() { return slots_; } | 331 int MinorKey() { return slots_; } |
| 340 }; | 332 }; |
| 341 | 333 |
| 342 | 334 |
| 343 class FastCloneShallowArrayStub : public CodeStub { | 335 class FastCloneShallowArrayStub : public CodeStub { |
| 344 public: | 336 public: |
| 345 // Maximum length of copied elements array. | 337 // Maximum length of copied elements array. |
| 346 static const int kMaximumClonedLength = 8; | 338 static const int kMaximumClonedLength = 8; |
| 347 | 339 |
| 348 enum Mode { | 340 enum Mode { |
| 349 CLONE_ELEMENTS, | 341 CLONE_ELEMENTS, |
| 350 COPY_ON_WRITE_ELEMENTS | 342 COPY_ON_WRITE_ELEMENTS |
| 351 }; | 343 }; |
| 352 | 344 |
| 353 FastCloneShallowArrayStub(Mode mode, int length) | 345 FastCloneShallowArrayStub(Mode mode, int length) |
| 354 : mode_(mode), | 346 : mode_(mode), |
| 355 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 347 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
| 356 ASSERT(length_ >= 0); | 348 ASSERT(length_ >= 0); |
| 357 ASSERT(length_ <= kMaximumClonedLength); | 349 ASSERT(length_ <= kMaximumClonedLength); |
| 358 } | 350 } |
| 359 | 351 |
| 360 void Generate(MacroAssembler* masm); | 352 void Generate(MacroAssembler* masm); |
| 361 | 353 |
| 362 private: | 354 private: |
| 363 Mode mode_; | 355 Mode mode_; |
| 364 int length_; | 356 int length_; |
| 365 | 357 |
| 366 const char* GetName() { return "FastCloneShallowArrayStub"; } | |
| 367 Major MajorKey() { return FastCloneShallowArray; } | 358 Major MajorKey() { return FastCloneShallowArray; } |
| 368 int MinorKey() { | 359 int MinorKey() { |
| 369 ASSERT(mode_ == 0 || mode_ == 1); | 360 ASSERT(mode_ == 0 || mode_ == 1); |
| 370 return (length_ << 1) | mode_; | 361 return (length_ << 1) | mode_; |
| 371 } | 362 } |
| 372 }; | 363 }; |
| 373 | 364 |
| 374 | 365 |
| 375 class InstanceofStub: public CodeStub { | 366 class InstanceofStub: public CodeStub { |
| 376 public: | 367 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 397 } | 388 } |
| 398 | 389 |
| 399 bool HasCallSiteInlineCheck() const { | 390 bool HasCallSiteInlineCheck() const { |
| 400 return (flags_ & kCallSiteInlineCheck) != 0; | 391 return (flags_ & kCallSiteInlineCheck) != 0; |
| 401 } | 392 } |
| 402 | 393 |
| 403 bool ReturnTrueFalseObject() const { | 394 bool ReturnTrueFalseObject() const { |
| 404 return (flags_ & kReturnTrueFalseObject) != 0; | 395 return (flags_ & kReturnTrueFalseObject) != 0; |
| 405 } | 396 } |
| 406 | 397 |
| 407 const char* GetName(); | 398 virtual const char* GetName(); |
| 408 | 399 |
| 409 Flags flags_; | 400 Flags flags_; |
| 410 char* name_; | 401 char* name_; |
| 411 }; | 402 }; |
| 412 | 403 |
| 413 | 404 |
| 414 class MathPowStub: public CodeStub { | 405 class MathPowStub: public CodeStub { |
| 415 public: | 406 public: |
| 416 MathPowStub() {} | 407 MathPowStub() {} |
| 417 virtual void Generate(MacroAssembler* masm); | 408 virtual void Generate(MacroAssembler* masm); |
| 418 | 409 |
| 419 private: | 410 private: |
| 420 virtual CodeStub::Major MajorKey() { return MathPow; } | 411 virtual CodeStub::Major MajorKey() { return MathPow; } |
| 421 virtual int MinorKey() { return 0; } | 412 virtual int MinorKey() { return 0; } |
| 422 | |
| 423 const char* GetName() { return "MathPowStub"; } | |
| 424 }; | 413 }; |
| 425 | 414 |
| 426 | 415 |
| 427 class ICCompareStub: public CodeStub { | 416 class ICCompareStub: public CodeStub { |
| 428 public: | 417 public: |
| 429 ICCompareStub(Token::Value op, CompareIC::State state) | 418 ICCompareStub(Token::Value op, CompareIC::State state) |
| 430 : op_(op), state_(state) { | 419 : op_(op), state_(state) { |
| 431 ASSERT(Token::IsCompareOp(op)); | 420 ASSERT(Token::IsCompareOp(op)); |
| 432 } | 421 } |
| 433 | 422 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 537 |
| 549 // Branch to the label if the given object isn't a symbol. | 538 // Branch to the label if the given object isn't a symbol. |
| 550 void BranchIfNonSymbol(MacroAssembler* masm, | 539 void BranchIfNonSymbol(MacroAssembler* masm, |
| 551 Label* label, | 540 Label* label, |
| 552 Register object, | 541 Register object, |
| 553 Register scratch); | 542 Register scratch); |
| 554 | 543 |
| 555 // Unfortunately you have to run without snapshots to see most of these | 544 // Unfortunately you have to run without snapshots to see most of these |
| 556 // names in the profile since most compare stubs end up in the snapshot. | 545 // names in the profile since most compare stubs end up in the snapshot. |
| 557 char* name_; | 546 char* name_; |
| 558 const char* GetName(); | 547 virtual const char* GetName(); |
| 559 #ifdef DEBUG | 548 #ifdef DEBUG |
| 560 void Print() { | 549 void Print() { |
| 561 PrintF("CompareStub (minor %d) (cc %d), (strict %s), " | 550 PrintF("CompareStub (minor %d) (cc %d), (strict %s), " |
| 562 "(never_nan_nan %s), (smi_compare %s) (number_compare %s) ", | 551 "(never_nan_nan %s), (smi_compare %s) (number_compare %s) ", |
| 563 MinorKey(), | 552 MinorKey(), |
| 564 static_cast<int>(cc_), | 553 static_cast<int>(cc_), |
| 565 strict_ ? "true" : "false", | 554 strict_ ? "true" : "false", |
| 566 never_nan_nan_ ? "true" : "false", | 555 never_nan_nan_ ? "true" : "false", |
| 567 include_smi_compare_ ? "inluded" : "not included", | 556 include_smi_compare_ ? "inluded" : "not included", |
| 568 include_number_compare_ ? "included" : "not included"); | 557 include_number_compare_ ? "included" : "not included"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 597 UncatchableExceptionType type); | 586 UncatchableExceptionType type); |
| 598 | 587 |
| 599 // Number of pointers/values returned. | 588 // Number of pointers/values returned. |
| 600 const int result_size_; | 589 const int result_size_; |
| 601 SaveFPRegsMode save_doubles_; | 590 SaveFPRegsMode save_doubles_; |
| 602 | 591 |
| 603 Major MajorKey() { return CEntry; } | 592 Major MajorKey() { return CEntry; } |
| 604 int MinorKey(); | 593 int MinorKey(); |
| 605 | 594 |
| 606 bool NeedsImmovableCode(); | 595 bool NeedsImmovableCode(); |
| 607 | |
| 608 const char* GetName() { return "CEntryStub"; } | |
| 609 }; | 596 }; |
| 610 | 597 |
| 611 | 598 |
| 612 class JSEntryStub : public CodeStub { | 599 class JSEntryStub : public CodeStub { |
| 613 public: | 600 public: |
| 614 JSEntryStub() { } | 601 JSEntryStub() { } |
| 615 | 602 |
| 616 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 603 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
| 617 | 604 |
| 618 protected: | 605 protected: |
| 619 void GenerateBody(MacroAssembler* masm, bool is_construct); | 606 void GenerateBody(MacroAssembler* masm, bool is_construct); |
| 620 | 607 |
| 621 private: | 608 private: |
| 622 Major MajorKey() { return JSEntry; } | 609 Major MajorKey() { return JSEntry; } |
| 623 int MinorKey() { return 0; } | 610 int MinorKey() { return 0; } |
| 624 | |
| 625 const char* GetName() { return "JSEntryStub"; } | |
| 626 }; | 611 }; |
| 627 | 612 |
| 628 | 613 |
| 629 class JSConstructEntryStub : public JSEntryStub { | 614 class JSConstructEntryStub : public JSEntryStub { |
| 630 public: | 615 public: |
| 631 JSConstructEntryStub() { } | 616 JSConstructEntryStub() { } |
| 632 | 617 |
| 633 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } | 618 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } |
| 634 | 619 |
| 635 private: | 620 private: |
| 636 int MinorKey() { return 1; } | 621 int MinorKey() { return 1; } |
| 637 | 622 |
| 638 const char* GetName() { return "JSConstructEntryStub"; } | 623 virtual const char* GetName() { return "JSConstructEntryStub"; } |
| 639 }; | 624 }; |
| 640 | 625 |
| 641 | 626 |
| 642 class ArgumentsAccessStub: public CodeStub { | 627 class ArgumentsAccessStub: public CodeStub { |
| 643 public: | 628 public: |
| 644 enum Type { | 629 enum Type { |
| 645 READ_ELEMENT, | 630 READ_ELEMENT, |
| 646 NEW_NON_STRICT, | 631 NEW_NON_STRICT_FAST, |
| 632 NEW_NON_STRICT_SLOW, |
| 647 NEW_STRICT | 633 NEW_STRICT |
| 648 }; | 634 }; |
| 649 | 635 |
| 650 explicit ArgumentsAccessStub(Type type) : type_(type) { } | 636 explicit ArgumentsAccessStub(Type type) : type_(type) { } |
| 651 | 637 |
| 652 private: | 638 private: |
| 653 Type type_; | 639 Type type_; |
| 654 | 640 |
| 655 Major MajorKey() { return ArgumentsAccess; } | 641 Major MajorKey() { return ArgumentsAccess; } |
| 656 int MinorKey() { return type_; } | 642 int MinorKey() { return type_; } |
| 657 | 643 |
| 658 void Generate(MacroAssembler* masm); | 644 void Generate(MacroAssembler* masm); |
| 659 void GenerateReadElement(MacroAssembler* masm); | 645 void GenerateReadElement(MacroAssembler* masm); |
| 660 void GenerateNewObject(MacroAssembler* masm); | 646 void GenerateNewStrict(MacroAssembler* masm); |
| 661 | 647 void GenerateNewNonStrictFast(MacroAssembler* masm); |
| 662 int GetArgumentsBoilerplateIndex() const { | 648 void GenerateNewNonStrictSlow(MacroAssembler* masm); |
| 663 return (type_ == NEW_STRICT) | |
| 664 ? Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX | |
| 665 : Context::ARGUMENTS_BOILERPLATE_INDEX; | |
| 666 } | |
| 667 | |
| 668 int GetArgumentsObjectSize() const { | |
| 669 if (type_ == NEW_STRICT) | |
| 670 return Heap::kArgumentsObjectSizeStrict; | |
| 671 else | |
| 672 return Heap::kArgumentsObjectSize; | |
| 673 } | |
| 674 | |
| 675 const char* GetName() { return "ArgumentsAccessStub"; } | |
| 676 | 649 |
| 677 #ifdef DEBUG | 650 #ifdef DEBUG |
| 678 void Print() { | 651 void Print() { |
| 679 PrintF("ArgumentsAccessStub (type %d)\n", type_); | 652 PrintF("ArgumentsAccessStub (type %d)\n", type_); |
| 680 } | 653 } |
| 681 #endif | 654 #endif |
| 682 }; | 655 }; |
| 683 | 656 |
| 684 | 657 |
| 685 class RegExpExecStub: public CodeStub { | 658 class RegExpExecStub: public CodeStub { |
| 686 public: | 659 public: |
| 687 RegExpExecStub() { } | 660 RegExpExecStub() { } |
| 688 | 661 |
| 689 private: | 662 private: |
| 690 Major MajorKey() { return RegExpExec; } | 663 Major MajorKey() { return RegExpExec; } |
| 691 int MinorKey() { return 0; } | 664 int MinorKey() { return 0; } |
| 692 | 665 |
| 693 void Generate(MacroAssembler* masm); | 666 void Generate(MacroAssembler* masm); |
| 694 | |
| 695 const char* GetName() { return "RegExpExecStub"; } | |
| 696 | |
| 697 #ifdef DEBUG | |
| 698 void Print() { | |
| 699 PrintF("RegExpExecStub\n"); | |
| 700 } | |
| 701 #endif | |
| 702 }; | 667 }; |
| 703 | 668 |
| 704 | 669 |
| 705 class RegExpConstructResultStub: public CodeStub { | 670 class RegExpConstructResultStub: public CodeStub { |
| 706 public: | 671 public: |
| 707 RegExpConstructResultStub() { } | 672 RegExpConstructResultStub() { } |
| 708 | 673 |
| 709 private: | 674 private: |
| 710 Major MajorKey() { return RegExpConstructResult; } | 675 Major MajorKey() { return RegExpConstructResult; } |
| 711 int MinorKey() { return 0; } | 676 int MinorKey() { return 0; } |
| 712 | 677 |
| 713 void Generate(MacroAssembler* masm); | 678 void Generate(MacroAssembler* masm); |
| 714 | |
| 715 const char* GetName() { return "RegExpConstructResultStub"; } | |
| 716 | |
| 717 #ifdef DEBUG | |
| 718 void Print() { | |
| 719 PrintF("RegExpConstructResultStub\n"); | |
| 720 } | |
| 721 #endif | |
| 722 }; | 679 }; |
| 723 | 680 |
| 724 | 681 |
| 725 class CallFunctionStub: public CodeStub { | 682 class CallFunctionStub: public CodeStub { |
| 726 public: | 683 public: |
| 727 CallFunctionStub(int argc, InLoopFlag in_loop, CallFunctionFlags flags) | 684 CallFunctionStub(int argc, InLoopFlag in_loop, CallFunctionFlags flags) |
| 728 : argc_(argc), in_loop_(in_loop), flags_(flags) { } | 685 : argc_(argc), in_loop_(in_loop), flags_(flags) { } |
| 729 | 686 |
| 730 void Generate(MacroAssembler* masm); | 687 void Generate(MacroAssembler* masm); |
| 731 | 688 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 masm_->set_allow_stub_calls(previous_allow_); | 892 masm_->set_allow_stub_calls(previous_allow_); |
| 936 } | 893 } |
| 937 | 894 |
| 938 private: | 895 private: |
| 939 MacroAssembler* masm_; | 896 MacroAssembler* masm_; |
| 940 bool previous_allow_; | 897 bool previous_allow_; |
| 941 | 898 |
| 942 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); | 899 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); |
| 943 }; | 900 }; |
| 944 | 901 |
| 945 #ifdef DEBUG | |
| 946 #define DECLARE_ARRAY_STUB_PRINT(name) void Print() { PrintF(#name); } | |
| 947 #else | |
| 948 #define DECLARE_ARRAY_STUB_PRINT(name) | |
| 949 #endif | |
| 950 | 902 |
| 903 class KeyedLoadElementStub : public CodeStub { |
| 904 public: |
| 905 explicit KeyedLoadElementStub(JSObject::ElementsKind elements_kind) |
| 906 : elements_kind_(elements_kind) |
| 907 { } |
| 951 | 908 |
| 952 class KeyedLoadFastElementStub : public CodeStub { | 909 Major MajorKey() { return KeyedLoadElement; } |
| 953 public: | 910 int MinorKey() { return elements_kind_; } |
| 954 explicit KeyedLoadFastElementStub() { | |
| 955 } | |
| 956 | |
| 957 Major MajorKey() { return KeyedLoadFastElement; } | |
| 958 int MinorKey() { return 0; } | |
| 959 | 911 |
| 960 void Generate(MacroAssembler* masm); | 912 void Generate(MacroAssembler* masm); |
| 961 | 913 |
| 962 const char* GetName() { return "KeyedLoadFastElementStub"; } | 914 private: |
| 915 JSObject::ElementsKind elements_kind_; |
| 963 | 916 |
| 964 DECLARE_ARRAY_STUB_PRINT(KeyedLoadFastElementStub) | 917 DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub); |
| 965 }; | 918 }; |
| 966 | 919 |
| 967 | 920 |
| 968 class KeyedStoreFastElementStub : public CodeStub { | 921 class KeyedStoreElementStub : public CodeStub { |
| 969 public: | 922 public: |
| 970 explicit KeyedStoreFastElementStub(bool is_js_array) | 923 KeyedStoreElementStub(bool is_js_array, |
| 971 : is_js_array_(is_js_array) { } | 924 JSObject::ElementsKind elements_kind) |
| 925 : is_js_array_(is_js_array), |
| 926 elements_kind_(elements_kind) { } |
| 972 | 927 |
| 973 Major MajorKey() { return KeyedStoreFastElement; } | 928 Major MajorKey() { return KeyedStoreElement; } |
| 974 int MinorKey() { return is_js_array_ ? 1 : 0; } | 929 int MinorKey() { |
| 930 return (is_js_array_ ? 0 : JSObject::kElementsKindCount) + elements_kind_; |
| 931 } |
| 975 | 932 |
| 976 void Generate(MacroAssembler* masm); | 933 void Generate(MacroAssembler* masm); |
| 977 | 934 |
| 978 const char* GetName() { return "KeyedStoreFastElementStub"; } | |
| 979 | |
| 980 DECLARE_ARRAY_STUB_PRINT(KeyedStoreFastElementStub) | |
| 981 | |
| 982 private: | 935 private: |
| 983 bool is_js_array_; | 936 bool is_js_array_; |
| 937 JSObject::ElementsKind elements_kind_; |
| 938 |
| 939 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); |
| 984 }; | 940 }; |
| 985 | 941 |
| 986 | 942 |
| 987 class KeyedLoadExternalArrayStub : public CodeStub { | 943 class ToBooleanStub: public CodeStub { |
| 988 public: | 944 public: |
| 989 explicit KeyedLoadExternalArrayStub(ExternalArrayType array_type) | 945 explicit ToBooleanStub(Register tos) : tos_(tos) { } |
| 990 : array_type_(array_type) { } | |
| 991 | |
| 992 Major MajorKey() { return KeyedLoadExternalArray; } | |
| 993 int MinorKey() { return array_type_; } | |
| 994 | 946 |
| 995 void Generate(MacroAssembler* masm); | 947 void Generate(MacroAssembler* masm); |
| 996 | 948 |
| 997 const char* GetName() { return "KeyedLoadExternalArrayStub"; } | 949 private: |
| 998 | 950 Register tos_; |
| 999 DECLARE_ARRAY_STUB_PRINT(KeyedLoadExternalArrayStub) | 951 Major MajorKey() { return ToBoolean; } |
| 1000 | 952 int MinorKey() { return tos_.code(); } |
| 1001 protected: | |
| 1002 ExternalArrayType array_type_; | |
| 1003 }; | 953 }; |
| 1004 | 954 |
| 1005 | |
| 1006 class KeyedStoreExternalArrayStub : public CodeStub { | |
| 1007 public: | |
| 1008 explicit KeyedStoreExternalArrayStub(ExternalArrayType array_type) | |
| 1009 : array_type_(array_type) { } | |
| 1010 | |
| 1011 Major MajorKey() { return KeyedStoreExternalArray; } | |
| 1012 int MinorKey() { return array_type_; } | |
| 1013 | |
| 1014 void Generate(MacroAssembler* masm); | |
| 1015 | |
| 1016 const char* GetName() { return "KeyedStoreExternalArrayStub"; } | |
| 1017 | |
| 1018 DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub) | |
| 1019 | |
| 1020 protected: | |
| 1021 ExternalArrayType array_type_; | |
| 1022 }; | |
| 1023 | |
| 1024 | |
| 1025 } } // namespace v8::internal | 955 } } // namespace v8::internal |
| 1026 | 956 |
| 1027 #endif // V8_CODE_STUBS_H_ | 957 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |