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 4085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4096 } | 4096 } |
4097 } | 4097 } |
4098 } | 4098 } |
4099 __ mov(a0, result_register()); | 4099 __ mov(a0, result_register()); |
4100 | 4100 |
4101 // Inline smi case if we are in a loop. | 4101 // Inline smi case if we are in a loop. |
4102 Label stub_call, done; | 4102 Label stub_call, done; |
4103 JumpPatchSite patch_site(masm_); | 4103 JumpPatchSite patch_site(masm_); |
4104 | 4104 |
4105 int count_value = expr->op() == Token::INC ? 1 : -1; | 4105 int count_value = expr->op() == Token::INC ? 1 : -1; |
4106 __ li(a1, Operand(Smi::FromInt(count_value))); | |
4107 | |
4108 if (ShouldInlineSmiCase(expr->op())) { | 4106 if (ShouldInlineSmiCase(expr->op())) { |
| 4107 __ li(a1, Operand(Smi::FromInt(count_value))); |
4109 __ AdduAndCheckForOverflow(v0, a0, a1, t0); | 4108 __ AdduAndCheckForOverflow(v0, a0, a1, t0); |
4110 __ BranchOnOverflow(&stub_call, t0); // Do stub on overflow. | 4109 __ BranchOnOverflow(&stub_call, t0); // Do stub on overflow. |
4111 | 4110 |
4112 // We could eliminate this smi check if we split the code at | 4111 // We could eliminate this smi check if we split the code at |
4113 // the first smi check before calling ToNumber. | 4112 // the first smi check before calling ToNumber. |
4114 patch_site.EmitJumpIfSmi(v0, &done); | 4113 patch_site.EmitJumpIfSmi(v0, &done); |
4115 __ bind(&stub_call); | 4114 __ bind(&stub_call); |
4116 } | 4115 } |
| 4116 __ mov(a1, a0); |
| 4117 __ li(a0, Operand(Smi::FromInt(count_value))); |
4117 | 4118 |
4118 // Record position before stub call. | 4119 // Record position before stub call. |
4119 SetSourcePosition(expr->position()); | 4120 SetSourcePosition(expr->position()); |
4120 | 4121 |
4121 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 4122 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); |
4122 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountBinOpFeedbackId()); | 4123 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountBinOpFeedbackId()); |
4123 patch_site.EmitPatchInfo(); | 4124 patch_site.EmitPatchInfo(); |
4124 __ bind(&done); | 4125 __ bind(&done); |
4125 | 4126 |
4126 // Store the value returned in v0. | 4127 // Store the value returned in v0. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4329 InstanceofStub stub(InstanceofStub::kNoFlags); | 4330 InstanceofStub stub(InstanceofStub::kNoFlags); |
4330 __ CallStub(&stub); | 4331 __ CallStub(&stub); |
4331 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4332 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
4332 // The stub returns 0 for true. | 4333 // The stub returns 0 for true. |
4333 Split(eq, v0, Operand(zero_reg), if_true, if_false, fall_through); | 4334 Split(eq, v0, Operand(zero_reg), if_true, if_false, fall_through); |
4334 break; | 4335 break; |
4335 } | 4336 } |
4336 | 4337 |
4337 default: { | 4338 default: { |
4338 VisitForAccumulatorValue(expr->right()); | 4339 VisitForAccumulatorValue(expr->right()); |
4339 Condition cc = eq; | 4340 Condition cc = CompareIC::ComputeCondition(op); |
4340 switch (op) { | |
4341 case Token::EQ_STRICT: | |
4342 case Token::EQ: | |
4343 cc = eq; | |
4344 break; | |
4345 case Token::LT: | |
4346 cc = lt; | |
4347 break; | |
4348 case Token::GT: | |
4349 cc = gt; | |
4350 break; | |
4351 case Token::LTE: | |
4352 cc = le; | |
4353 break; | |
4354 case Token::GTE: | |
4355 cc = ge; | |
4356 break; | |
4357 case Token::IN: | |
4358 case Token::INSTANCEOF: | |
4359 default: | |
4360 UNREACHABLE(); | |
4361 } | |
4362 __ mov(a0, result_register()); | 4341 __ mov(a0, result_register()); |
4363 __ pop(a1); | 4342 __ pop(a1); |
4364 | 4343 |
4365 bool inline_smi_code = ShouldInlineSmiCase(op); | 4344 bool inline_smi_code = ShouldInlineSmiCase(op); |
4366 JumpPatchSite patch_site(masm_); | 4345 JumpPatchSite patch_site(masm_); |
4367 if (inline_smi_code) { | 4346 if (inline_smi_code) { |
4368 Label slow_case; | 4347 Label slow_case; |
4369 __ Or(a2, a0, Operand(a1)); | 4348 __ Or(a2, a0, Operand(a1)); |
4370 patch_site.EmitJumpIfNotSmi(a2, &slow_case); | 4349 patch_site.EmitJumpIfNotSmi(a2, &slow_case); |
4371 Split(cc, a1, Operand(a0), if_true, if_false, NULL); | 4350 Split(cc, a1, Operand(a0), if_true, if_false, NULL); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4571 *context_length = 0; | 4550 *context_length = 0; |
4572 return previous_; | 4551 return previous_; |
4573 } | 4552 } |
4574 | 4553 |
4575 | 4554 |
4576 #undef __ | 4555 #undef __ |
4577 | 4556 |
4578 } } // namespace v8::internal | 4557 } } // namespace v8::internal |
4579 | 4558 |
4580 #endif // V8_TARGET_ARCH_MIPS | 4559 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |