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 6501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6512 Register dst_; | 6512 Register dst_; |
6513 Register left_; | 6513 Register left_; |
6514 Register right_; | 6514 Register right_; |
6515 OverwriteMode mode_; | 6515 OverwriteMode mode_; |
6516 }; | 6516 }; |
6517 | 6517 |
6518 | 6518 |
6519 void DeferredInlineBinaryOperation::Generate() { | 6519 void DeferredInlineBinaryOperation::Generate() { |
6520 Label done; | 6520 Label done; |
6521 if ((op_ == Token::ADD) | 6521 if ((op_ == Token::ADD) |
6522 || (op_ ==Token::SUB) | 6522 || (op_ == Token::SUB) |
6523 || (op_ == Token::MUL) | 6523 || (op_ == Token::MUL) |
6524 || (op_ == Token::DIV)) { | 6524 || (op_ == Token::DIV)) { |
6525 Label call_runtime; | 6525 Label call_runtime; |
6526 Label left_smi, right_smi, load_right, do_op; | 6526 Label left_smi, right_smi, load_right, do_op; |
6527 __ JumpIfSmi(left_, &left_smi); | 6527 __ JumpIfSmi(left_, &left_smi); |
6528 __ CompareRoot(FieldOperand(left_, HeapObject::kMapOffset), | 6528 __ CompareRoot(FieldOperand(left_, HeapObject::kMapOffset), |
6529 Heap::kHeapNumberMapRootIndex); | 6529 Heap::kHeapNumberMapRootIndex); |
6530 __ j(not_equal, &call_runtime); | 6530 __ j(not_equal, &call_runtime); |
6531 __ movsd(xmm0, FieldOperand(left_, HeapNumber::kValueOffset)); | 6531 __ movsd(xmm0, FieldOperand(left_, HeapNumber::kValueOffset)); |
6532 if (mode_ == OVERWRITE_LEFT) { | 6532 if (mode_ == OVERWRITE_LEFT) { |
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10024 // Get the untagged integer version of the eax heap number in ecx. | 10024 // Get the untagged integer version of the eax heap number in ecx. |
10025 IntegerConvert(masm, rcx, rax); | 10025 IntegerConvert(masm, rcx, rax); |
10026 __ bind(&done); | 10026 __ bind(&done); |
10027 __ movl(rax, rdx); | 10027 __ movl(rax, rdx); |
10028 } | 10028 } |
10029 | 10029 |
10030 | 10030 |
10031 // Input: rdx, rax are the left and right objects of a bit op. | 10031 // Input: rdx, rax are the left and right objects of a bit op. |
10032 // Output: rax, rcx are left and right integers for a bit op. | 10032 // Output: rax, rcx are left and right integers for a bit op. |
10033 void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm) { | 10033 void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm) { |
10034 if (FLAG_debug_code) { | |
10035 // Both arguments can not be smis. That case is handled by smi-only code. | |
10036 Label ok; | |
10037 __ JumpIfNotBothSmi(rax, rdx, &ok); | |
10038 __ Abort("Both arguments smi but not handled by smi-code."); | |
10039 __ bind(&ok); | |
10040 } | |
10041 // Check float operands. | 10034 // Check float operands. |
10042 Label done; | 10035 Label done; |
| 10036 Label rax_is_smi; |
10043 Label rax_is_object; | 10037 Label rax_is_object; |
10044 Label rdx_is_object; | 10038 Label rdx_is_object; |
10045 | 10039 |
10046 __ JumpIfNotSmi(rdx, &rdx_is_object); | 10040 __ JumpIfNotSmi(rdx, &rdx_is_object); |
10047 __ SmiToInteger32(rdx, rdx); | 10041 __ SmiToInteger32(rdx, rdx); |
| 10042 __ JumpIfSmi(rax, &rax_is_smi); |
10048 | 10043 |
10049 __ bind(&rax_is_object); | 10044 __ bind(&rax_is_object); |
10050 IntegerConvert(masm, rcx, rax); // Uses rdi, rcx and rbx. | 10045 IntegerConvert(masm, rcx, rax); // Uses rdi, rcx and rbx. |
10051 __ jmp(&done); | 10046 __ jmp(&done); |
10052 | 10047 |
10053 __ bind(&rdx_is_object); | 10048 __ bind(&rdx_is_object); |
10054 IntegerConvert(masm, rdx, rdx); // Uses rdi, rcx and rbx. | 10049 IntegerConvert(masm, rdx, rdx); // Uses rdi, rcx and rbx. |
10055 __ JumpIfNotSmi(rax, &rax_is_object); | 10050 __ JumpIfNotSmi(rax, &rax_is_object); |
| 10051 __ bind(&rax_is_smi); |
10056 __ SmiToInteger32(rcx, rax); | 10052 __ SmiToInteger32(rcx, rax); |
10057 | 10053 |
10058 __ bind(&done); | 10054 __ bind(&done); |
10059 __ movl(rax, rdx); | 10055 __ movl(rax, rdx); |
10060 } | 10056 } |
10061 | 10057 |
10062 | 10058 |
10063 const char* GenericBinaryOpStub::GetName() { | 10059 const char* GenericBinaryOpStub::GetName() { |
10064 if (name_ != NULL) return name_; | 10060 if (name_ != NULL) return name_; |
10065 const int len = 100; | 10061 const int len = 100; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10430 // (and only if smi code is generated). This is the right moment to | 10426 // (and only if smi code is generated). This is the right moment to |
10431 // patch to HEAP_NUMBERS state. The transition is attempted only for | 10427 // patch to HEAP_NUMBERS state. The transition is attempted only for |
10432 // the four basic operations. The stub stays in the DEFAULT state | 10428 // the four basic operations. The stub stays in the DEFAULT state |
10433 // forever for all other operations (also if smi code is skipped). | 10429 // forever for all other operations (also if smi code is skipped). |
10434 GenerateTypeTransition(masm); | 10430 GenerateTypeTransition(masm); |
10435 } | 10431 } |
10436 | 10432 |
10437 Label not_floats; | 10433 Label not_floats; |
10438 // rax: y | 10434 // rax: y |
10439 // rdx: x | 10435 // rdx: x |
10440 ASSERT(!static_operands_type_.IsSmi()); | |
10441 if (static_operands_type_.IsNumber()) { | 10436 if (static_operands_type_.IsNumber()) { |
10442 if (FLAG_debug_code) { | 10437 if (FLAG_debug_code) { |
10443 // Assert at runtime that inputs are only numbers. | 10438 // Assert at runtime that inputs are only numbers. |
10444 __ AbortIfNotNumber(rdx); | 10439 __ AbortIfNotNumber(rdx); |
10445 __ AbortIfNotNumber(rax); | 10440 __ AbortIfNotNumber(rax); |
10446 } | 10441 } |
10447 FloatingPointHelper::LoadSSE2NumberOperands(masm); | 10442 FloatingPointHelper::LoadSSE2NumberOperands(masm); |
10448 } else { | 10443 } else { |
10449 FloatingPointHelper::LoadSSE2UnknownOperands(masm, &call_runtime); | 10444 FloatingPointHelper::LoadSSE2UnknownOperands(masm, &call_runtime); |
10450 } | 10445 } |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11906 } | 11901 } |
11907 | 11902 |
11908 #endif | 11903 #endif |
11909 | 11904 |
11910 | 11905 |
11911 #undef __ | 11906 #undef __ |
11912 | 11907 |
11913 } } // namespace v8::internal | 11908 } } // namespace v8::internal |
11914 | 11909 |
11915 #endif // V8_TARGET_ARCH_X64 | 11910 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |