| 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_ARM_CODE_STUBS_ARM_H_ | 28 #ifndef V8_ARM_CODE_STUBS_ARM_H_ |
| 29 #define V8_ARM_CODE_STUBS_ARM_H_ | 29 #define V8_ARM_CODE_STUBS_ARM_H_ |
| 30 | 30 |
| 31 #include "codegen-inl.h" | |
| 32 #include "ic-inl.h" | 31 #include "ic-inl.h" |
| 33 #include "ast.h" | |
| 34 | 32 |
| 35 namespace v8 { | 33 namespace v8 { |
| 36 namespace internal { | 34 namespace internal { |
| 37 | 35 |
| 38 | 36 |
| 39 // Compute a transcendental math function natively, or call the | 37 // Compute a transcendental math function natively, or call the |
| 40 // TranscendentalCache runtime function. | 38 // TranscendentalCache runtime function. |
| 41 class TranscendentalCacheStub: public CodeStub { | 39 class TranscendentalCacheStub: public CodeStub { |
| 42 public: | 40 public: |
| 43 explicit TranscendentalCacheStub(TranscendentalCache::Type type) | 41 explicit TranscendentalCacheStub(TranscendentalCache::Type type) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 | 57 |
| 60 private: | 58 private: |
| 61 Register tos_; | 59 Register tos_; |
| 62 Major MajorKey() { return ToBoolean; } | 60 Major MajorKey() { return ToBoolean; } |
| 63 int MinorKey() { return tos_.code(); } | 61 int MinorKey() { return tos_.code(); } |
| 64 }; | 62 }; |
| 65 | 63 |
| 66 | 64 |
| 67 class GenericBinaryOpStub : public CodeStub { | 65 class GenericBinaryOpStub : public CodeStub { |
| 68 public: | 66 public: |
| 67 static const int kUnknownIntValue = -1; |
| 68 |
| 69 GenericBinaryOpStub(Token::Value op, | 69 GenericBinaryOpStub(Token::Value op, |
| 70 OverwriteMode mode, | 70 OverwriteMode mode, |
| 71 Register lhs, | 71 Register lhs, |
| 72 Register rhs, | 72 Register rhs, |
| 73 int constant_rhs = CodeGenerator::kUnknownIntValue) | 73 int constant_rhs = kUnknownIntValue) |
| 74 : op_(op), | 74 : op_(op), |
| 75 mode_(mode), | 75 mode_(mode), |
| 76 lhs_(lhs), | 76 lhs_(lhs), |
| 77 rhs_(rhs), | 77 rhs_(rhs), |
| 78 constant_rhs_(constant_rhs), | 78 constant_rhs_(constant_rhs), |
| 79 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)), | 79 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)), |
| 80 runtime_operands_type_(BinaryOpIC::DEFAULT), | 80 runtime_operands_type_(BinaryOpIC::DEFAULT), |
| 81 name_(NULL) { } | 81 name_(NULL) { } |
| 82 | 82 |
| 83 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) | 83 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 Register lhs, | 127 Register lhs, |
| 128 Register rhs); | 128 Register rhs); |
| 129 void HandleBinaryOpSlowCases(MacroAssembler* masm, | 129 void HandleBinaryOpSlowCases(MacroAssembler* masm, |
| 130 Label* not_smi, | 130 Label* not_smi, |
| 131 Register lhs, | 131 Register lhs, |
| 132 Register rhs, | 132 Register rhs, |
| 133 const Builtins::JavaScript& builtin); | 133 const Builtins::JavaScript& builtin); |
| 134 void GenerateTypeTransition(MacroAssembler* masm); | 134 void GenerateTypeTransition(MacroAssembler* masm); |
| 135 | 135 |
| 136 static bool RhsIsOneWeWantToOptimizeFor(Token::Value op, int constant_rhs) { | 136 static bool RhsIsOneWeWantToOptimizeFor(Token::Value op, int constant_rhs) { |
| 137 if (constant_rhs == CodeGenerator::kUnknownIntValue) return false; | 137 if (constant_rhs == kUnknownIntValue) return false; |
| 138 if (op == Token::DIV) return constant_rhs >= 2 && constant_rhs <= 3; | 138 if (op == Token::DIV) return constant_rhs >= 2 && constant_rhs <= 3; |
| 139 if (op == Token::MOD) { | 139 if (op == Token::MOD) { |
| 140 if (constant_rhs <= 1) return false; | 140 if (constant_rhs <= 1) return false; |
| 141 if (constant_rhs <= 10) return true; | 141 if (constant_rhs <= 10) return true; |
| 142 if (constant_rhs <= kMaxKnownRhs && IsPowerOf2(constant_rhs)) return true; | 142 if (constant_rhs <= kMaxKnownRhs && IsPowerOf2(constant_rhs)) return true; |
| 143 return false; | 143 return false; |
| 144 } | 144 } |
| 145 return false; | 145 return false; |
| 146 } | 146 } |
| 147 | 147 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 #ifdef DEBUG | 463 #ifdef DEBUG |
| 464 void Print() { | 464 void Print() { |
| 465 PrintF("RecordWriteStub (object reg %d), (offset reg %d)," | 465 PrintF("RecordWriteStub (object reg %d), (offset reg %d)," |
| 466 " (scratch reg %d)\n", | 466 " (scratch reg %d)\n", |
| 467 object_.code(), offset_.code(), scratch_.code()); | 467 object_.code(), offset_.code(), scratch_.code()); |
| 468 } | 468 } |
| 469 #endif | 469 #endif |
| 470 }; | 470 }; |
| 471 | 471 |
| 472 | 472 |
| 473 // Enter C code from generated RegExp code in a way that allows |
| 474 // the C code to fix the return address in case of a GC. |
| 475 // Currently only needed on ARM. |
| 476 class RegExpCEntryStub: public CodeStub { |
| 477 public: |
| 478 RegExpCEntryStub() {} |
| 479 virtual ~RegExpCEntryStub() {} |
| 480 void Generate(MacroAssembler* masm); |
| 481 |
| 482 private: |
| 483 Major MajorKey() { return RegExpCEntry; } |
| 484 int MinorKey() { return 0; } |
| 485 const char* GetName() { return "RegExpCEntryStub"; } |
| 486 }; |
| 487 |
| 488 |
| 473 } } // namespace v8::internal | 489 } } // namespace v8::internal |
| 474 | 490 |
| 475 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 491 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
| OLD | NEW |