| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 20 matching lines...) Expand all Loading... |
| 31 #include "ic-inl.h" | 31 #include "ic-inl.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 | 36 |
| 37 // Compute a transcendental math function natively, or call the | 37 // Compute a transcendental math function natively, or call the |
| 38 // TranscendentalCache runtime function. | 38 // TranscendentalCache runtime function. |
| 39 class TranscendentalCacheStub: public CodeStub { | 39 class TranscendentalCacheStub: public CodeStub { |
| 40 public: | 40 public: |
| 41 explicit TranscendentalCacheStub(TranscendentalCache::Type type) | 41 enum ArgumentType { |
| 42 : type_(type) {} | 42 TAGGED = 0 << TranscendentalCache::kTranscendentalTypeBits, |
| 43 UNTAGGED = 1 << TranscendentalCache::kTranscendentalTypeBits |
| 44 }; |
| 45 |
| 46 TranscendentalCacheStub(TranscendentalCache::Type type, |
| 47 ArgumentType argument_type) |
| 48 : type_(type), argument_type_(argument_type) { } |
| 43 void Generate(MacroAssembler* masm); | 49 void Generate(MacroAssembler* masm); |
| 44 private: | 50 private: |
| 45 TranscendentalCache::Type type_; | 51 TranscendentalCache::Type type_; |
| 52 ArgumentType argument_type_; |
| 53 void GenerateCallCFunction(MacroAssembler* masm, Register scratch); |
| 54 |
| 46 Major MajorKey() { return TranscendentalCache; } | 55 Major MajorKey() { return TranscendentalCache; } |
| 47 int MinorKey() { return type_; } | 56 int MinorKey() { return type_ | argument_type_; } |
| 48 Runtime::FunctionId RuntimeFunction(); | 57 Runtime::FunctionId RuntimeFunction(); |
| 49 }; | 58 }; |
| 50 | 59 |
| 51 | 60 |
| 52 class ToBooleanStub: public CodeStub { | 61 class ToBooleanStub: public CodeStub { |
| 53 public: | 62 public: |
| 54 explicit ToBooleanStub(Register tos) : tos_(tos) { } | 63 explicit ToBooleanStub(Register tos) : tos_(tos) { } |
| 55 | 64 |
| 56 void Generate(MacroAssembler* masm); | 65 void Generate(MacroAssembler* masm); |
| 57 | 66 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 code->set_type_recording_binary_op_result_type(result_type_); | 337 code->set_type_recording_binary_op_result_type(result_type_); |
| 329 } | 338 } |
| 330 | 339 |
| 331 friend class CodeGenerator; | 340 friend class CodeGenerator; |
| 332 }; | 341 }; |
| 333 | 342 |
| 334 | 343 |
| 335 // Flag that indicates how to generate code for the stub StringAddStub. | 344 // Flag that indicates how to generate code for the stub StringAddStub. |
| 336 enum StringAddFlags { | 345 enum StringAddFlags { |
| 337 NO_STRING_ADD_FLAGS = 0, | 346 NO_STRING_ADD_FLAGS = 0, |
| 338 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub. | 347 // Omit left string check in stub (left is definitely a string). |
| 348 NO_STRING_CHECK_LEFT_IN_STUB = 1 << 0, |
| 349 // Omit right string check in stub (right is definitely a string). |
| 350 NO_STRING_CHECK_RIGHT_IN_STUB = 1 << 1, |
| 351 // Omit both string checks in stub. |
| 352 NO_STRING_CHECK_IN_STUB = |
| 353 NO_STRING_CHECK_LEFT_IN_STUB | NO_STRING_CHECK_RIGHT_IN_STUB |
| 339 }; | 354 }; |
| 340 | 355 |
| 341 | 356 |
| 342 class StringAddStub: public CodeStub { | 357 class StringAddStub: public CodeStub { |
| 343 public: | 358 public: |
| 344 explicit StringAddStub(StringAddFlags flags) { | 359 explicit StringAddStub(StringAddFlags flags) : flags_(flags) {} |
| 345 string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0); | |
| 346 } | |
| 347 | 360 |
| 348 private: | 361 private: |
| 349 Major MajorKey() { return StringAdd; } | 362 Major MajorKey() { return StringAdd; } |
| 350 int MinorKey() { return string_check_ ? 0 : 1; } | 363 int MinorKey() { return flags_; } |
| 351 | 364 |
| 352 void Generate(MacroAssembler* masm); | 365 void Generate(MacroAssembler* masm); |
| 353 | 366 |
| 354 // Should the stub check whether arguments are strings? | 367 void GenerateConvertArgument(MacroAssembler* masm, |
| 355 bool string_check_; | 368 int stack_offset, |
| 369 Register arg, |
| 370 Register scratch1, |
| 371 Register scratch2, |
| 372 Register scratch3, |
| 373 Register scratch4, |
| 374 Label* slow); |
| 375 |
| 376 const StringAddFlags flags_; |
| 356 }; | 377 }; |
| 357 | 378 |
| 358 | 379 |
| 359 class SubStringStub: public CodeStub { | 380 class SubStringStub: public CodeStub { |
| 360 public: | 381 public: |
| 361 SubStringStub() {} | 382 SubStringStub() {} |
| 362 | 383 |
| 363 private: | 384 private: |
| 364 Major MajorKey() { return SubString; } | 385 Major MajorKey() { return SubString; } |
| 365 int MinorKey() { return 0; } | 386 int MinorKey() { return 0; } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 594 |
| 574 // Trampoline stub to call into native code. To call safely into native code | 595 // Trampoline stub to call into native code. To call safely into native code |
| 575 // in the presence of compacting GC (which can move code objects) we need to | 596 // in the presence of compacting GC (which can move code objects) we need to |
| 576 // keep the code which called into native pinned in the memory. Currently the | 597 // keep the code which called into native pinned in the memory. Currently the |
| 577 // simplest approach is to generate such stub early enough so it can never be | 598 // simplest approach is to generate such stub early enough so it can never be |
| 578 // moved by GC | 599 // moved by GC |
| 579 class DirectCEntryStub: public CodeStub { | 600 class DirectCEntryStub: public CodeStub { |
| 580 public: | 601 public: |
| 581 DirectCEntryStub() {} | 602 DirectCEntryStub() {} |
| 582 void Generate(MacroAssembler* masm); | 603 void Generate(MacroAssembler* masm); |
| 583 void GenerateCall(MacroAssembler* masm, ApiFunction *function); | 604 void GenerateCall(MacroAssembler* masm, ExternalReference function); |
| 605 void GenerateCall(MacroAssembler* masm, Register target); |
| 584 | 606 |
| 585 private: | 607 private: |
| 586 Major MajorKey() { return DirectCEntry; } | 608 Major MajorKey() { return DirectCEntry; } |
| 587 int MinorKey() { return 0; } | 609 int MinorKey() { return 0; } |
| 588 const char* GetName() { return "DirectCEntryStub"; } | 610 const char* GetName() { return "DirectCEntryStub"; } |
| 589 }; | 611 }; |
| 590 | 612 |
| 591 | 613 |
| 592 // Generate code the to load an element from a pixel array. The receiver is | 614 // Generate code to load an element from a pixel array. The receiver is assumed |
| 593 // assumed to not be a smi and to have elements, the caller must guarantee this | 615 // to not be a smi and to have elements, the caller must guarantee this |
| 594 // precondition. If the receiver does not have elements that are pixel arrays, | 616 // precondition. If key is not a smi, then the generated code branches to |
| 595 // the generated code jumps to not_pixel_array. If key is not a smi, then the | 617 // key_not_smi. Callers can specify NULL for key_not_smi to signal that a smi |
| 596 // generated code branches to key_not_smi. Callers can specify NULL for | 618 // check has already been performed on key so that the smi check is not |
| 597 // key_not_smi to signal that a smi check has already been performed on key so | 619 // generated. If key is not a valid index within the bounds of the pixel array, |
| 598 // that the smi check is not generated . If key is not a valid index within the | 620 // the generated code jumps to out_of_range. receiver, key and elements are |
| 599 // bounds of the pixel array, the generated code jumps to out_of_range. | 621 // unchanged throughout the generated code sequence. |
| 600 void GenerateFastPixelArrayLoad(MacroAssembler* masm, | 622 void GenerateFastPixelArrayLoad(MacroAssembler* masm, |
| 601 Register receiver, | 623 Register receiver, |
| 602 Register key, | 624 Register key, |
| 603 Register elements_map, | 625 Register elements_map, |
| 604 Register elements, | 626 Register elements, |
| 605 Register scratch1, | 627 Register scratch1, |
| 606 Register scratch2, | 628 Register scratch2, |
| 607 Register result, | 629 Register result, |
| 608 Label* not_pixel_array, | 630 Label* not_pixel_array, |
| 609 Label* key_not_smi, | 631 Label* key_not_smi, |
| 610 Label* out_of_range); | 632 Label* out_of_range); |
| 611 | 633 |
| 634 // Generate code to store an element into a pixel array, clamping values between |
| 635 // [0..255]. The receiver is assumed to not be a smi and to have elements, the |
| 636 // caller must guarantee this precondition. If key is not a smi, then the |
| 637 // generated code branches to key_not_smi. Callers can specify NULL for |
| 638 // key_not_smi to signal that a smi check has already been performed on key so |
| 639 // that the smi check is not generated. If value is not a smi, the generated |
| 640 // code will branch to value_not_smi. If the receiver doesn't have pixel array |
| 641 // elements, the generated code will branch to not_pixel_array, unless |
| 642 // not_pixel_array is NULL, in which case the caller must ensure that the |
| 643 // receiver has pixel array elements. If key is not a valid index within the |
| 644 // bounds of the pixel array, the generated code jumps to out_of_range. If |
| 645 // load_elements_from_receiver is true, then the elements of receiver is loaded |
| 646 // into elements, otherwise elements is assumed to already be the receiver's |
| 647 // elements. If load_elements_map_from_elements is true, elements_map is loaded |
| 648 // from elements, otherwise it is assumed to already contain the element map. |
| 649 void GenerateFastPixelArrayStore(MacroAssembler* masm, |
| 650 Register receiver, |
| 651 Register key, |
| 652 Register value, |
| 653 Register elements, |
| 654 Register elements_map, |
| 655 Register scratch1, |
| 656 Register scratch2, |
| 657 bool load_elements_from_receiver, |
| 658 bool load_elements_map_from_elements, |
| 659 Label* key_not_smi, |
| 660 Label* value_not_smi, |
| 661 Label* not_pixel_array, |
| 662 Label* out_of_range); |
| 612 | 663 |
| 613 } } // namespace v8::internal | 664 } } // namespace v8::internal |
| 614 | 665 |
| 615 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 666 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
| OLD | NEW |