OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 Token::Value op = instr->op(); | 2520 Token::Value op = instr->op(); |
2521 | 2521 |
2522 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2522 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); |
2523 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2523 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2524 // On MIPS there is no need for a "no inlined smi code" marker (nop). | 2524 // On MIPS there is no need for a "no inlined smi code" marker (nop). |
2525 | 2525 |
2526 Condition condition = ComputeCompareCondition(op); | 2526 Condition condition = ComputeCompareCondition(op); |
2527 // A minor optimization that relies on LoadRoot always emitting one | 2527 // A minor optimization that relies on LoadRoot always emitting one |
2528 // instruction. | 2528 // instruction. |
2529 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); | 2529 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); |
2530 Label done; | 2530 Label done, check; |
2531 __ Branch(USE_DELAY_SLOT, &done, condition, v0, Operand(zero_reg)); | 2531 __ Branch(USE_DELAY_SLOT, &done, condition, v0, Operand(zero_reg)); |
| 2532 __ bind(&check); |
2532 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); | 2533 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); |
| 2534 ASSERT_EQ(1, masm()->InstructionsGeneratedSince(&check)); |
2533 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); | 2535 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); |
2534 ASSERT_EQ(3, masm()->InstructionsGeneratedSince(&done)); | |
2535 __ bind(&done); | 2536 __ bind(&done); |
2536 } | 2537 } |
2537 | 2538 |
2538 | 2539 |
2539 void LCodeGen::DoReturn(LReturn* instr) { | 2540 void LCodeGen::DoReturn(LReturn* instr) { |
2540 if (FLAG_trace && info()->IsOptimizing()) { | 2541 if (FLAG_trace && info()->IsOptimizing()) { |
2541 // Push the return value on the stack as the parameter. | 2542 // Push the return value on the stack as the parameter. |
2542 // Runtime::TraceExit returns its parameter in v0. | 2543 // Runtime::TraceExit returns its parameter in v0. |
2543 __ push(v0); | 2544 __ push(v0); |
2544 __ CallRuntime(Runtime::kTraceExit, 1); | 2545 __ CallRuntime(Runtime::kTraceExit, 1); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 } | 3500 } |
3500 | 3501 |
3501 | 3502 |
3502 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { | 3503 void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) { |
3503 Register input = ToRegister(instr->value()); | 3504 Register input = ToRegister(instr->value()); |
3504 Register result = ToRegister(instr->result()); | 3505 Register result = ToRegister(instr->result()); |
3505 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 3506 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
3506 Label done; | 3507 Label done; |
3507 __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg)); | 3508 __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg)); |
3508 __ mov(result, input); | 3509 __ mov(result, input); |
3509 ASSERT_EQ(2, masm()->InstructionsGeneratedSince(&done)); | |
3510 __ subu(result, zero_reg, input); | |
3511 // Overflow if result is still negative, i.e. 0x80000000. | 3510 // Overflow if result is still negative, i.e. 0x80000000. |
3512 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg)); | 3511 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg)); |
3513 __ bind(&done); | 3512 __ bind(&done); |
3514 } | 3513 } |
3515 | 3514 |
3516 | 3515 |
3517 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { | 3516 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { |
3518 CpuFeatureScope scope(masm(), FPU); | 3517 CpuFeatureScope scope(masm(), FPU); |
3519 // Class for deferred case. | 3518 // Class for deferred case. |
3520 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { | 3519 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { |
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6064 __ Subu(scratch, result, scratch); | 6063 __ Subu(scratch, result, scratch); |
6065 __ lw(result, FieldMemOperand(scratch, | 6064 __ lw(result, FieldMemOperand(scratch, |
6066 FixedArray::kHeaderSize - kPointerSize)); | 6065 FixedArray::kHeaderSize - kPointerSize)); |
6067 __ bind(&done); | 6066 __ bind(&done); |
6068 } | 6067 } |
6069 | 6068 |
6070 | 6069 |
6071 #undef __ | 6070 #undef __ |
6072 | 6071 |
6073 } } // namespace v8::internal | 6072 } } // namespace v8::internal |
OLD | NEW |