| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 | 
| 6 | 6 | 
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" | 
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" | 
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" | 
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" | 
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 912 | 912 | 
| 913       __ cmpp(rdx, rax); | 913       __ cmpp(rdx, rax); | 
| 914       __ j(not_equal, &next_test); | 914       __ j(not_equal, &next_test); | 
| 915       __ Drop(1);  // Switch value is no longer needed. | 915       __ Drop(1);  // Switch value is no longer needed. | 
| 916       __ jmp(clause->body_target()); | 916       __ jmp(clause->body_target()); | 
| 917       __ bind(&slow_case); | 917       __ bind(&slow_case); | 
| 918     } | 918     } | 
| 919 | 919 | 
| 920     // Record position before stub call for type feedback. | 920     // Record position before stub call for type feedback. | 
| 921     SetExpressionPosition(clause); | 921     SetExpressionPosition(clause); | 
| 922     Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 922     Handle<Code> ic = | 
| 923                                              strength(language_mode())).code(); | 923         CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code(); | 
| 924     CallIC(ic, clause->CompareId()); | 924     CallIC(ic, clause->CompareId()); | 
| 925     patch_site.EmitPatchInfo(); | 925     patch_site.EmitPatchInfo(); | 
| 926 | 926 | 
| 927     Label skip; | 927     Label skip; | 
| 928     __ jmp(&skip, Label::kNear); | 928     __ jmp(&skip, Label::kNear); | 
| 929     PrepareForBailout(clause, TOS_REG); | 929     PrepareForBailout(clause, TOS_REG); | 
| 930     __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 930     __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 
| 931     __ j(not_equal, &next_test); | 931     __ j(not_equal, &next_test); | 
| 932     __ Drop(1); | 932     __ Drop(1); | 
| 933     __ jmp(clause->body_target()); | 933     __ jmp(clause->body_target()); | 
| (...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2071   // rcx to make the shifts easier. | 2071   // rcx to make the shifts easier. | 
| 2072   Label done, stub_call, smi_case; | 2072   Label done, stub_call, smi_case; | 
| 2073   __ Pop(rdx); | 2073   __ Pop(rdx); | 
| 2074   __ movp(rcx, rax); | 2074   __ movp(rcx, rax); | 
| 2075   __ orp(rax, rdx); | 2075   __ orp(rax, rdx); | 
| 2076   JumpPatchSite patch_site(masm_); | 2076   JumpPatchSite patch_site(masm_); | 
| 2077   patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); | 2077   patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); | 
| 2078 | 2078 | 
| 2079   __ bind(&stub_call); | 2079   __ bind(&stub_call); | 
| 2080   __ movp(rax, rcx); | 2080   __ movp(rax, rcx); | 
| 2081   Handle<Code> code = | 2081   Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 
| 2082       CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |  | 
| 2083   CallIC(code, expr->BinaryOperationFeedbackId()); | 2082   CallIC(code, expr->BinaryOperationFeedbackId()); | 
| 2084   patch_site.EmitPatchInfo(); | 2083   patch_site.EmitPatchInfo(); | 
| 2085   __ jmp(&done, Label::kNear); | 2084   __ jmp(&done, Label::kNear); | 
| 2086 | 2085 | 
| 2087   __ bind(&smi_case); | 2086   __ bind(&smi_case); | 
| 2088   switch (op) { | 2087   switch (op) { | 
| 2089     case Token::SAR: | 2088     case Token::SAR: | 
| 2090       __ SmiShiftArithmeticRight(rax, rdx, rcx); | 2089       __ SmiShiftArithmeticRight(rax, rdx, rcx); | 
| 2091       break; | 2090       break; | 
| 2092     case Token::SHL: | 2091     case Token::SHL: | 
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2172 | 2171 | 
| 2173       default: | 2172       default: | 
| 2174         UNREACHABLE(); | 2173         UNREACHABLE(); | 
| 2175     } | 2174     } | 
| 2176   } | 2175   } | 
| 2177 } | 2176 } | 
| 2178 | 2177 | 
| 2179 | 2178 | 
| 2180 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2179 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 
| 2181   __ Pop(rdx); | 2180   __ Pop(rdx); | 
| 2182   Handle<Code> code = | 2181   Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 
| 2183       CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |  | 
| 2184   JumpPatchSite patch_site(masm_);    // unbound, signals no inlined smi code. | 2182   JumpPatchSite patch_site(masm_);    // unbound, signals no inlined smi code. | 
| 2185   CallIC(code, expr->BinaryOperationFeedbackId()); | 2183   CallIC(code, expr->BinaryOperationFeedbackId()); | 
| 2186   patch_site.EmitPatchInfo(); | 2184   patch_site.EmitPatchInfo(); | 
| 2187   context()->Plug(rax); | 2185   context()->Plug(rax); | 
| 2188 } | 2186 } | 
| 2189 | 2187 | 
| 2190 | 2188 | 
| 2191 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2189 void FullCodeGenerator::EmitAssignment(Expression* expr, | 
| 2192                                        FeedbackVectorSlot slot) { | 2190                                        FeedbackVectorSlot slot) { | 
| 2193   DCHECK(expr->IsValidReferenceExpressionOrThis()); | 2191   DCHECK(expr->IsValidReferenceExpressionOrThis()); | 
| (...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4036       } | 4034       } | 
| 4037     } | 4035     } | 
| 4038   } | 4036   } | 
| 4039 | 4037 | 
| 4040   SetExpressionPosition(expr); | 4038   SetExpressionPosition(expr); | 
| 4041 | 4039 | 
| 4042   // Call stub for +1/-1. | 4040   // Call stub for +1/-1. | 
| 4043   __ bind(&stub_call); | 4041   __ bind(&stub_call); | 
| 4044   __ movp(rdx, rax); | 4042   __ movp(rdx, rax); | 
| 4045   __ Move(rax, Smi::FromInt(1)); | 4043   __ Move(rax, Smi::FromInt(1)); | 
| 4046   Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), | 4044   Handle<Code> code = | 
| 4047                                               strength(language_mode())).code(); | 4045       CodeFactory::BinaryOpIC(isolate(), expr->binary_op()).code(); | 
| 4048   CallIC(code, expr->CountBinOpFeedbackId()); | 4046   CallIC(code, expr->CountBinOpFeedbackId()); | 
| 4049   patch_site.EmitPatchInfo(); | 4047   patch_site.EmitPatchInfo(); | 
| 4050   __ bind(&done); | 4048   __ bind(&done); | 
| 4051 | 4049 | 
| 4052   if (is_strong(language_mode())) { | 4050   if (is_strong(language_mode())) { | 
| 4053     PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 4051     PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 
| 4054   } | 4052   } | 
| 4055   // Store the value returned in rax. | 4053   // Store the value returned in rax. | 
| 4056   switch (assign_type) { | 4054   switch (assign_type) { | 
| 4057     case VARIABLE: | 4055     case VARIABLE: | 
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4264       if (inline_smi_code) { | 4262       if (inline_smi_code) { | 
| 4265         Label slow_case; | 4263         Label slow_case; | 
| 4266         __ movp(rcx, rdx); | 4264         __ movp(rcx, rdx); | 
| 4267         __ orp(rcx, rax); | 4265         __ orp(rcx, rax); | 
| 4268         patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); | 4266         patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); | 
| 4269         __ cmpp(rdx, rax); | 4267         __ cmpp(rdx, rax); | 
| 4270         Split(cc, if_true, if_false, NULL); | 4268         Split(cc, if_true, if_false, NULL); | 
| 4271         __ bind(&slow_case); | 4269         __ bind(&slow_case); | 
| 4272       } | 4270       } | 
| 4273 | 4271 | 
| 4274       Handle<Code> ic = CodeFactory::CompareIC( | 4272       Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); | 
| 4275                             isolate(), op, strength(language_mode())).code(); |  | 
| 4276       CallIC(ic, expr->CompareOperationFeedbackId()); | 4273       CallIC(ic, expr->CompareOperationFeedbackId()); | 
| 4277       patch_site.EmitPatchInfo(); | 4274       patch_site.EmitPatchInfo(); | 
| 4278 | 4275 | 
| 4279       PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4276       PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 
| 4280       __ testp(rax, rax); | 4277       __ testp(rax, rax); | 
| 4281       Split(cc, if_true, if_false, fall_through); | 4278       Split(cc, if_true, if_false, fall_through); | 
| 4282     } | 4279     } | 
| 4283   } | 4280   } | 
| 4284 | 4281 | 
| 4285   // Convert the result of the comparison into one expected for this | 4282   // Convert the result of the comparison into one expected for this | 
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4507   DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4504   DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 
| 4508             Assembler::target_address_at(call_target_address, | 4505             Assembler::target_address_at(call_target_address, | 
| 4509                                          unoptimized_code)); | 4506                                          unoptimized_code)); | 
| 4510   return OSR_AFTER_STACK_CHECK; | 4507   return OSR_AFTER_STACK_CHECK; | 
| 4511 } | 4508 } | 
| 4512 | 4509 | 
| 4513 }  // namespace internal | 4510 }  // namespace internal | 
| 4514 }  // namespace v8 | 4511 }  // namespace v8 | 
| 4515 | 4512 | 
| 4516 #endif  // V8_TARGET_ARCH_X64 | 4513 #endif  // V8_TARGET_ARCH_X64 | 
| OLD | NEW | 
|---|