| 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 5951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5962 OverwriteMode mode_; | 5962 OverwriteMode mode_; |
| 5963 }; | 5963 }; |
| 5964 | 5964 |
| 5965 | 5965 |
| 5966 void DeferredInlineBinaryOperation::Generate() { | 5966 void DeferredInlineBinaryOperation::Generate() { |
| 5967 Label done; | 5967 Label done; |
| 5968 if ((op_ == Token::ADD) | 5968 if ((op_ == Token::ADD) |
| 5969 || (op_ ==Token::SUB) | 5969 || (op_ ==Token::SUB) |
| 5970 || (op_ == Token::MUL) | 5970 || (op_ == Token::MUL) |
| 5971 || (op_ == Token::DIV)) { | 5971 || (op_ == Token::DIV)) { |
| 5972 Label call_runtime, after_alloc_failure; | 5972 Label call_runtime; |
| 5973 Label left_smi, right_smi, load_right, do_op; | 5973 Label left_smi, right_smi, load_right, do_op; |
| 5974 __ JumpIfSmi(left_, &left_smi); | 5974 __ JumpIfSmi(left_, &left_smi); |
| 5975 __ CompareRoot(FieldOperand(left_, HeapObject::kMapOffset), | 5975 __ CompareRoot(FieldOperand(left_, HeapObject::kMapOffset), |
| 5976 Heap::kHeapNumberMapRootIndex); | 5976 Heap::kHeapNumberMapRootIndex); |
| 5977 __ j(not_equal, &call_runtime); | 5977 __ j(not_equal, &call_runtime); |
| 5978 __ movsd(xmm0, FieldOperand(left_, HeapNumber::kValueOffset)); | 5978 __ movsd(xmm0, FieldOperand(left_, HeapNumber::kValueOffset)); |
| 5979 if (mode_ == OVERWRITE_LEFT) { | 5979 if (mode_ == OVERWRITE_LEFT) { |
| 5980 __ movq(dst_, left_); | 5980 __ movq(dst_, left_); |
| 5981 } | 5981 } |
| 5982 __ jmp(&load_right); | 5982 __ jmp(&load_right); |
| 5983 | 5983 |
| 5984 __ bind(&left_smi); | 5984 __ bind(&left_smi); |
| 5985 __ SmiToInteger32(left_, left_); | 5985 __ SmiToInteger32(left_, left_); |
| 5986 __ cvtlsi2sd(xmm0, left_); | 5986 __ cvtlsi2sd(xmm0, left_); |
| 5987 __ Integer32ToSmi(left_, left_); | 5987 __ Integer32ToSmi(left_, left_); |
| 5988 if (mode_ == OVERWRITE_LEFT) { | 5988 if (mode_ == OVERWRITE_LEFT) { |
| 5989 Label alloc_failure; | 5989 Label alloc_failure; |
| 5990 __ push(left_); | 5990 __ AllocateHeapNumber(dst_, no_reg, &call_runtime); |
| 5991 __ AllocateHeapNumber(dst_, left_, &after_alloc_failure); | |
| 5992 __ pop(left_); | |
| 5993 } | 5991 } |
| 5994 | 5992 |
| 5995 __ bind(&load_right); | 5993 __ bind(&load_right); |
| 5996 __ JumpIfSmi(right_, &right_smi); | 5994 __ JumpIfSmi(right_, &right_smi); |
| 5997 __ CompareRoot(FieldOperand(right_, HeapObject::kMapOffset), | 5995 __ CompareRoot(FieldOperand(right_, HeapObject::kMapOffset), |
| 5998 Heap::kHeapNumberMapRootIndex); | 5996 Heap::kHeapNumberMapRootIndex); |
| 5999 __ j(not_equal, &call_runtime); | 5997 __ j(not_equal, &call_runtime); |
| 6000 __ movsd(xmm1, FieldOperand(right_, HeapNumber::kValueOffset)); | 5998 __ movsd(xmm1, FieldOperand(right_, HeapNumber::kValueOffset)); |
| 6001 if (mode_ == OVERWRITE_RIGHT) { | 5999 if (mode_ == OVERWRITE_RIGHT) { |
| 6002 __ movq(dst_, right_); | 6000 __ movq(dst_, right_); |
| 6003 } else if (mode_ == NO_OVERWRITE) { | 6001 } else if (mode_ == NO_OVERWRITE) { |
| 6004 Label alloc_failure; | 6002 Label alloc_failure; |
| 6005 __ push(left_); | 6003 __ AllocateHeapNumber(dst_, no_reg, &call_runtime); |
| 6006 __ AllocateHeapNumber(dst_, left_, &after_alloc_failure); | |
| 6007 __ pop(left_); | |
| 6008 } | 6004 } |
| 6009 __ jmp(&do_op); | 6005 __ jmp(&do_op); |
| 6010 | 6006 |
| 6011 __ bind(&right_smi); | 6007 __ bind(&right_smi); |
| 6012 __ SmiToInteger32(right_, right_); | 6008 __ SmiToInteger32(right_, right_); |
| 6013 __ cvtlsi2sd(xmm1, right_); | 6009 __ cvtlsi2sd(xmm1, right_); |
| 6014 __ Integer32ToSmi(right_, right_); | 6010 __ Integer32ToSmi(right_, right_); |
| 6015 if (mode_ == OVERWRITE_RIGHT || mode_ == NO_OVERWRITE) { | 6011 if (mode_ == OVERWRITE_RIGHT || mode_ == NO_OVERWRITE) { |
| 6016 Label alloc_failure; | 6012 Label alloc_failure; |
| 6017 __ push(left_); | 6013 __ AllocateHeapNumber(dst_, no_reg, &call_runtime); |
| 6018 __ AllocateHeapNumber(dst_, left_, &after_alloc_failure); | |
| 6019 __ pop(left_); | |
| 6020 } | 6014 } |
| 6021 | 6015 |
| 6022 __ bind(&do_op); | 6016 __ bind(&do_op); |
| 6023 switch (op_) { | 6017 switch (op_) { |
| 6024 case Token::ADD: __ addsd(xmm0, xmm1); break; | 6018 case Token::ADD: __ addsd(xmm0, xmm1); break; |
| 6025 case Token::SUB: __ subsd(xmm0, xmm1); break; | 6019 case Token::SUB: __ subsd(xmm0, xmm1); break; |
| 6026 case Token::MUL: __ mulsd(xmm0, xmm1); break; | 6020 case Token::MUL: __ mulsd(xmm0, xmm1); break; |
| 6027 case Token::DIV: __ divsd(xmm0, xmm1); break; | 6021 case Token::DIV: __ divsd(xmm0, xmm1); break; |
| 6028 default: UNREACHABLE(); | 6022 default: UNREACHABLE(); |
| 6029 } | 6023 } |
| 6030 __ movsd(FieldOperand(dst_, HeapNumber::kValueOffset), xmm0); | 6024 __ movsd(FieldOperand(dst_, HeapNumber::kValueOffset), xmm0); |
| 6031 __ jmp(&done); | 6025 __ jmp(&done); |
| 6032 | 6026 |
| 6033 __ bind(&after_alloc_failure); | |
| 6034 __ pop(left_); | |
| 6035 __ bind(&call_runtime); | 6027 __ bind(&call_runtime); |
| 6036 } | 6028 } |
| 6037 GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB); | 6029 GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB); |
| 6038 stub.GenerateCall(masm_, left_, right_); | 6030 stub.GenerateCall(masm_, left_, right_); |
| 6039 if (!dst_.is(rax)) __ movq(dst_, rax); | 6031 if (!dst_.is(rax)) __ movq(dst_, rax); |
| 6040 __ bind(&done); | 6032 __ bind(&done); |
| 6041 } | 6033 } |
| 6042 | 6034 |
| 6043 | 6035 |
| 6044 static TypeInfo CalculateTypeInfo(TypeInfo operands_type, | 6036 static TypeInfo CalculateTypeInfo(TypeInfo operands_type, |
| (...skipping 4986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11031 // Call the function from C++. | 11023 // Call the function from C++. |
| 11032 return FUNCTION_CAST<ModuloFunction>(buffer); | 11024 return FUNCTION_CAST<ModuloFunction>(buffer); |
| 11033 } | 11025 } |
| 11034 | 11026 |
| 11035 #endif | 11027 #endif |
| 11036 | 11028 |
| 11037 | 11029 |
| 11038 #undef __ | 11030 #undef __ |
| 11039 | 11031 |
| 11040 } } // namespace v8::internal | 11032 } } // namespace v8::internal |
| OLD | NEW |