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 4424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4435 } | 4435 } |
4436 | 4436 |
4437 // We need a second deoptimization point after loading the value | 4437 // We need a second deoptimization point after loading the value |
4438 // in case evaluating the property load my have a side effect. | 4438 // in case evaluating the property load my have a side effect. |
4439 if (assign_type == VARIABLE) { | 4439 if (assign_type == VARIABLE) { |
4440 PrepareForBailout(expr->expression(), TOS_REG); | 4440 PrepareForBailout(expr->expression(), TOS_REG); |
4441 } else { | 4441 } else { |
4442 PrepareForBailoutForId(prop->LoadId(), TOS_REG); | 4442 PrepareForBailoutForId(prop->LoadId(), TOS_REG); |
4443 } | 4443 } |
4444 | 4444 |
4445 // Call ToNumber only if operand is not a smi. | 4445 // Inline smi case if we are in a loop. |
4446 Label no_conversion; | 4446 Label stub_call, done; |
| 4447 JumpPatchSite patch_site(masm_); |
| 4448 |
| 4449 int count_value = expr->op() == Token::INC ? 1 : -1; |
| 4450 __ mov(a0, v0); |
4447 if (ShouldInlineSmiCase(expr->op())) { | 4451 if (ShouldInlineSmiCase(expr->op())) { |
4448 __ JumpIfSmi(v0, &no_conversion); | 4452 Label slow; |
| 4453 patch_site.EmitJumpIfNotSmi(v0, &slow); |
| 4454 |
| 4455 // Save result for postfix expressions. |
| 4456 if (expr->is_postfix()) { |
| 4457 if (!context()->IsEffect()) { |
| 4458 // Save the result on the stack. If we have a named or keyed property |
| 4459 // we store the result under the receiver that is currently on top |
| 4460 // of the stack. |
| 4461 switch (assign_type) { |
| 4462 case VARIABLE: |
| 4463 __ push(v0); |
| 4464 break; |
| 4465 case NAMED_PROPERTY: |
| 4466 __ sw(v0, MemOperand(sp, kPointerSize)); |
| 4467 break; |
| 4468 case KEYED_PROPERTY: |
| 4469 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); |
| 4470 break; |
| 4471 } |
| 4472 } |
| 4473 } |
| 4474 |
| 4475 Register scratch1 = a1; |
| 4476 Register scratch2 = t0; |
| 4477 __ li(scratch1, Operand(Smi::FromInt(count_value))); |
| 4478 __ AdduAndCheckForOverflow(v0, v0, scratch1, scratch2); |
| 4479 __ BranchOnNoOverflow(&done, scratch2); |
| 4480 // Call stub. Undo operation first. |
| 4481 __ Move(v0, a0); |
| 4482 __ jmp(&stub_call); |
| 4483 __ bind(&slow); |
4449 } | 4484 } |
4450 __ mov(a0, v0); | |
4451 ToNumberStub convert_stub; | 4485 ToNumberStub convert_stub; |
4452 __ CallStub(&convert_stub); | 4486 __ CallStub(&convert_stub); |
4453 __ bind(&no_conversion); | |
4454 | 4487 |
4455 // Save result for postfix expressions. | 4488 // Save result for postfix expressions. |
4456 if (expr->is_postfix()) { | 4489 if (expr->is_postfix()) { |
4457 if (!context()->IsEffect()) { | 4490 if (!context()->IsEffect()) { |
4458 // Save the result on the stack. If we have a named or keyed property | 4491 // Save the result on the stack. If we have a named or keyed property |
4459 // we store the result under the receiver that is currently on top | 4492 // we store the result under the receiver that is currently on top |
4460 // of the stack. | 4493 // of the stack. |
4461 switch (assign_type) { | 4494 switch (assign_type) { |
4462 case VARIABLE: | 4495 case VARIABLE: |
4463 __ push(v0); | 4496 __ push(v0); |
4464 break; | 4497 break; |
4465 case NAMED_PROPERTY: | 4498 case NAMED_PROPERTY: |
4466 __ sw(v0, MemOperand(sp, kPointerSize)); | 4499 __ sw(v0, MemOperand(sp, kPointerSize)); |
4467 break; | 4500 break; |
4468 case KEYED_PROPERTY: | 4501 case KEYED_PROPERTY: |
4469 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); | 4502 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); |
4470 break; | 4503 break; |
4471 } | 4504 } |
4472 } | 4505 } |
4473 } | 4506 } |
4474 __ mov(a0, result_register()); | |
4475 | 4507 |
4476 // Inline smi case if we are in a loop. | 4508 __ bind(&stub_call); |
4477 Label stub_call, done; | 4509 __ mov(a1, v0); |
4478 JumpPatchSite patch_site(masm_); | |
4479 | |
4480 int count_value = expr->op() == Token::INC ? 1 : -1; | |
4481 if (ShouldInlineSmiCase(expr->op())) { | |
4482 __ li(a1, Operand(Smi::FromInt(count_value))); | |
4483 __ AdduAndCheckForOverflow(v0, a0, a1, t0); | |
4484 __ BranchOnOverflow(&stub_call, t0); // Do stub on overflow. | |
4485 | |
4486 // We could eliminate this smi check if we split the code at | |
4487 // the first smi check before calling ToNumber. | |
4488 patch_site.EmitJumpIfSmi(v0, &done); | |
4489 __ bind(&stub_call); | |
4490 } | |
4491 __ mov(a1, a0); | |
4492 __ li(a0, Operand(Smi::FromInt(count_value))); | 4510 __ li(a0, Operand(Smi::FromInt(count_value))); |
4493 | 4511 |
4494 // Record position before stub call. | 4512 // Record position before stub call. |
4495 SetSourcePosition(expr->position()); | 4513 SetSourcePosition(expr->position()); |
4496 | 4514 |
4497 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 4515 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); |
4498 CallIC(stub.GetCode(isolate()), | 4516 CallIC(stub.GetCode(isolate()), |
4499 RelocInfo::CODE_TARGET, | 4517 RelocInfo::CODE_TARGET, |
4500 expr->CountBinOpFeedbackId()); | 4518 expr->CountBinOpFeedbackId()); |
4501 patch_site.EmitPatchInfo(); | 4519 patch_site.EmitPatchInfo(); |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4998 Assembler::target_address_at(pc_immediate_load_address)) == | 5016 Assembler::target_address_at(pc_immediate_load_address)) == |
4999 reinterpret_cast<uint32_t>( | 5017 reinterpret_cast<uint32_t>( |
5000 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5018 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5001 return OSR_AFTER_STACK_CHECK; | 5019 return OSR_AFTER_STACK_CHECK; |
5002 } | 5020 } |
5003 | 5021 |
5004 | 5022 |
5005 } } // namespace v8::internal | 5023 } } // namespace v8::internal |
5006 | 5024 |
5007 #endif // V8_TARGET_ARCH_MIPS | 5025 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |