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