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 4038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4049 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); | 4049 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); |
4050 } else { | 4050 } else { |
4051 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); | 4051 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); |
4052 } | 4052 } |
4053 } | 4053 } |
4054 | 4054 |
4055 // Record position before stub call. | 4055 // Record position before stub call. |
4056 SetSourcePosition(expr->position()); | 4056 SetSourcePosition(expr->position()); |
4057 | 4057 |
4058 // Call stub for +1/-1. | 4058 // Call stub for +1/-1. |
| 4059 __ movq(rdx, rax); |
| 4060 __ Move(rax, Smi::FromInt(1)); |
4059 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); | 4061 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); |
4060 if (expr->op() == Token::INC) { | |
4061 __ Move(rdx, Smi::FromInt(1)); | |
4062 } else { | |
4063 __ movq(rdx, rax); | |
4064 __ Move(rax, Smi::FromInt(1)); | |
4065 } | |
4066 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountBinOpFeedbackId()); | 4062 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountBinOpFeedbackId()); |
4067 patch_site.EmitPatchInfo(); | 4063 patch_site.EmitPatchInfo(); |
4068 __ bind(&done); | 4064 __ bind(&done); |
4069 | 4065 |
4070 // Store the value returned in rax. | 4066 // Store the value returned in rax. |
4071 switch (assign_type) { | 4067 switch (assign_type) { |
4072 case VARIABLE: | 4068 case VARIABLE: |
4073 if (expr->is_postfix()) { | 4069 if (expr->is_postfix()) { |
4074 // Perform the assignment as if via '='. | 4070 // Perform the assignment as if via '='. |
4075 { EffectContext context(this); | 4071 { EffectContext context(this); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4274 __ CallStub(&stub); | 4270 __ CallStub(&stub); |
4275 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4271 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
4276 __ testq(rax, rax); | 4272 __ testq(rax, rax); |
4277 // The stub returns 0 for true. | 4273 // The stub returns 0 for true. |
4278 Split(zero, if_true, if_false, fall_through); | 4274 Split(zero, if_true, if_false, fall_through); |
4279 break; | 4275 break; |
4280 } | 4276 } |
4281 | 4277 |
4282 default: { | 4278 default: { |
4283 VisitForAccumulatorValue(expr->right()); | 4279 VisitForAccumulatorValue(expr->right()); |
4284 Condition cc = no_condition; | 4280 Condition cc = CompareIC::ComputeCondition(op); |
4285 switch (op) { | |
4286 case Token::EQ_STRICT: | |
4287 case Token::EQ: | |
4288 cc = equal; | |
4289 break; | |
4290 case Token::LT: | |
4291 cc = less; | |
4292 break; | |
4293 case Token::GT: | |
4294 cc = greater; | |
4295 break; | |
4296 case Token::LTE: | |
4297 cc = less_equal; | |
4298 break; | |
4299 case Token::GTE: | |
4300 cc = greater_equal; | |
4301 break; | |
4302 case Token::IN: | |
4303 case Token::INSTANCEOF: | |
4304 default: | |
4305 UNREACHABLE(); | |
4306 } | |
4307 __ pop(rdx); | 4281 __ pop(rdx); |
4308 | 4282 |
4309 bool inline_smi_code = ShouldInlineSmiCase(op); | 4283 bool inline_smi_code = ShouldInlineSmiCase(op); |
4310 JumpPatchSite patch_site(masm_); | 4284 JumpPatchSite patch_site(masm_); |
4311 if (inline_smi_code) { | 4285 if (inline_smi_code) { |
4312 Label slow_case; | 4286 Label slow_case; |
4313 __ movq(rcx, rdx); | 4287 __ movq(rcx, rdx); |
4314 __ or_(rcx, rax); | 4288 __ or_(rcx, rax); |
4315 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); | 4289 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); |
4316 __ cmpq(rdx, rax); | 4290 __ cmpq(rdx, rax); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4514 *context_length = 0; | 4488 *context_length = 0; |
4515 return previous_; | 4489 return previous_; |
4516 } | 4490 } |
4517 | 4491 |
4518 | 4492 |
4519 #undef __ | 4493 #undef __ |
4520 | 4494 |
4521 } } // namespace v8::internal | 4495 } } // namespace v8::internal |
4522 | 4496 |
4523 #endif // V8_TARGET_ARCH_X64 | 4497 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |