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