| 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 4368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4379 } | 4379 } |
| 4380 | 4380 |
| 4381 // We need a second deoptimization point after loading the value | 4381 // We need a second deoptimization point after loading the value |
| 4382 // in case evaluating the property load my have a side effect. | 4382 // in case evaluating the property load my have a side effect. |
| 4383 if (assign_type == VARIABLE) { | 4383 if (assign_type == VARIABLE) { |
| 4384 PrepareForBailout(expr->expression(), TOS_REG); | 4384 PrepareForBailout(expr->expression(), TOS_REG); |
| 4385 } else { | 4385 } else { |
| 4386 PrepareForBailoutForId(prop->LoadId(), TOS_REG); | 4386 PrepareForBailoutForId(prop->LoadId(), TOS_REG); |
| 4387 } | 4387 } |
| 4388 | 4388 |
| 4389 // Call ToNumber only if operand is not a smi. | 4389 // Inline smi case if we are in a loop. |
| 4390 Label no_conversion; | 4390 Label done, stub_call; |
| 4391 JumpPatchSite patch_site(masm_); |
| 4391 if (ShouldInlineSmiCase(expr->op())) { | 4392 if (ShouldInlineSmiCase(expr->op())) { |
| 4392 __ JumpIfSmi(rax, &no_conversion, Label::kNear); | 4393 Label slow; |
| 4394 patch_site.EmitJumpIfNotSmi(rax, &slow, Label::kNear); |
| 4395 |
| 4396 // Save result for postfix expressions. |
| 4397 if (expr->is_postfix()) { |
| 4398 if (!context()->IsEffect()) { |
| 4399 // Save the result on the stack. If we have a named or keyed property |
| 4400 // we store the result under the receiver that is currently on top |
| 4401 // of the stack. |
| 4402 switch (assign_type) { |
| 4403 case VARIABLE: |
| 4404 __ push(rax); |
| 4405 break; |
| 4406 case NAMED_PROPERTY: |
| 4407 __ movq(Operand(rsp, kPointerSize), rax); |
| 4408 break; |
| 4409 case KEYED_PROPERTY: |
| 4410 __ movq(Operand(rsp, 2 * kPointerSize), rax); |
| 4411 break; |
| 4412 } |
| 4413 } |
| 4414 } |
| 4415 |
| 4416 if (expr->op() == Token::INC) { |
| 4417 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); |
| 4418 __ j(no_overflow, &done, Label::kNear); |
| 4419 // Call stub. Undo operation first. |
| 4420 if (expr->op() == Token::INC) { |
| 4421 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); |
| 4422 } |
| 4423 } else { |
| 4424 SmiExecutionMode mode = static_cast<SmiExecutionMode>( |
| 4425 SMI_NEED_RESERVE_SOURCES | SMI_BAILOUT_ON_NO_OVERFLOW); |
| 4426 __ SmiSubConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear); |
| 4427 } |
| 4428 __ jmp(&stub_call, Label::kNear); |
| 4429 __ bind(&slow); |
| 4393 } | 4430 } |
| 4431 |
| 4394 ToNumberStub convert_stub; | 4432 ToNumberStub convert_stub; |
| 4395 __ CallStub(&convert_stub); | 4433 __ CallStub(&convert_stub); |
| 4396 __ bind(&no_conversion); | |
| 4397 | 4434 |
| 4398 // Save result for postfix expressions. | 4435 // Save result for postfix expressions. |
| 4399 if (expr->is_postfix()) { | 4436 if (expr->is_postfix()) { |
| 4400 if (!context()->IsEffect()) { | 4437 if (!context()->IsEffect()) { |
| 4401 // Save the result on the stack. If we have a named or keyed property | 4438 // Save the result on the stack. If we have a named or keyed property |
| 4402 // we store the result under the receiver that is currently on top | 4439 // we store the result under the receiver that is currently on top |
| 4403 // of the stack. | 4440 // of the stack. |
| 4404 switch (assign_type) { | 4441 switch (assign_type) { |
| 4405 case VARIABLE: | 4442 case VARIABLE: |
| 4406 __ push(rax); | 4443 __ push(rax); |
| 4407 break; | 4444 break; |
| 4408 case NAMED_PROPERTY: | 4445 case NAMED_PROPERTY: |
| 4409 __ movq(Operand(rsp, kPointerSize), rax); | 4446 __ movq(Operand(rsp, kPointerSize), rax); |
| 4410 break; | 4447 break; |
| 4411 case KEYED_PROPERTY: | 4448 case KEYED_PROPERTY: |
| 4412 __ movq(Operand(rsp, 2 * kPointerSize), rax); | 4449 __ movq(Operand(rsp, 2 * kPointerSize), rax); |
| 4413 break; | 4450 break; |
| 4414 } | 4451 } |
| 4415 } | 4452 } |
| 4416 } | 4453 } |
| 4417 | 4454 |
| 4418 // Inline smi case if we are in a loop. | |
| 4419 Label done, stub_call; | |
| 4420 JumpPatchSite patch_site(masm_); | |
| 4421 | |
| 4422 if (ShouldInlineSmiCase(expr->op())) { | |
| 4423 if (expr->op() == Token::INC) { | |
| 4424 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); | |
| 4425 } else { | |
| 4426 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); | |
| 4427 } | |
| 4428 __ j(overflow, &stub_call, Label::kNear); | |
| 4429 // We could eliminate this smi check if we split the code at | |
| 4430 // the first smi check before calling ToNumber. | |
| 4431 patch_site.EmitJumpIfSmi(rax, &done, Label::kNear); | |
| 4432 | |
| 4433 __ bind(&stub_call); | |
| 4434 // Call stub. Undo operation first. | |
| 4435 if (expr->op() == Token::INC) { | |
| 4436 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); | |
| 4437 } else { | |
| 4438 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); | |
| 4439 } | |
| 4440 } | |
| 4441 | |
| 4442 // Record position before stub call. | 4455 // Record position before stub call. |
| 4443 SetSourcePosition(expr->position()); | 4456 SetSourcePosition(expr->position()); |
| 4444 | 4457 |
| 4445 // Call stub for +1/-1. | 4458 // Call stub for +1/-1. |
| 4459 __ bind(&stub_call); |
| 4446 __ movq(rdx, rax); | 4460 __ movq(rdx, rax); |
| 4447 __ Move(rax, Smi::FromInt(1)); | 4461 __ Move(rax, Smi::FromInt(1)); |
| 4448 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); | 4462 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); |
| 4449 CallIC(stub.GetCode(isolate()), | 4463 CallIC(stub.GetCode(isolate()), |
| 4450 RelocInfo::CODE_TARGET, | 4464 RelocInfo::CODE_TARGET, |
| 4451 expr->CountBinOpFeedbackId()); | 4465 expr->CountBinOpFeedbackId()); |
| 4452 patch_site.EmitPatchInfo(); | 4466 patch_site.EmitPatchInfo(); |
| 4453 __ bind(&done); | 4467 __ bind(&done); |
| 4454 | 4468 |
| 4455 // Store the value returned in rax. | 4469 // Store the value returned in rax. |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4946 | 4960 |
| 4947 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4961 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4948 Assembler::target_address_at(call_target_address)); | 4962 Assembler::target_address_at(call_target_address)); |
| 4949 return OSR_AFTER_STACK_CHECK; | 4963 return OSR_AFTER_STACK_CHECK; |
| 4950 } | 4964 } |
| 4951 | 4965 |
| 4952 | 4966 |
| 4953 } } // namespace v8::internal | 4967 } } // namespace v8::internal |
| 4954 | 4968 |
| 4955 #endif // V8_TARGET_ARCH_X64 | 4969 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |