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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 __ cmpp(rdx, rax); | 1032 __ cmpp(rdx, rax); |
1033 __ j(not_equal, &next_test); | 1033 __ j(not_equal, &next_test); |
1034 __ Drop(1); // Switch value is no longer needed. | 1034 __ Drop(1); // Switch value is no longer needed. |
1035 __ jmp(clause->body_target()); | 1035 __ jmp(clause->body_target()); |
1036 __ bind(&slow_case); | 1036 __ bind(&slow_case); |
1037 } | 1037 } |
1038 | 1038 |
1039 // Record position before stub call for type feedback. | 1039 // Record position before stub call for type feedback. |
1040 SetSourcePosition(clause->position()); | 1040 SetSourcePosition(clause->position()); |
1041 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 1041 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
1042 language_mode()).code(); | 1042 strength(language_mode())).code(); |
1043 CallIC(ic, clause->CompareId()); | 1043 CallIC(ic, clause->CompareId()); |
1044 patch_site.EmitPatchInfo(); | 1044 patch_site.EmitPatchInfo(); |
1045 | 1045 |
1046 Label skip; | 1046 Label skip; |
1047 __ jmp(&skip, Label::kNear); | 1047 __ jmp(&skip, Label::kNear); |
1048 PrepareForBailout(clause, TOS_REG); | 1048 PrepareForBailout(clause, TOS_REG); |
1049 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 1049 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
1050 __ j(not_equal, &next_test); | 1050 __ j(not_equal, &next_test); |
1051 __ Drop(1); | 1051 __ Drop(1); |
1052 __ jmp(clause->body_target()); | 1052 __ jmp(clause->body_target()); |
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 // rcx to make the shifts easier. | 2409 // rcx to make the shifts easier. |
2410 Label done, stub_call, smi_case; | 2410 Label done, stub_call, smi_case; |
2411 __ Pop(rdx); | 2411 __ Pop(rdx); |
2412 __ movp(rcx, rax); | 2412 __ movp(rcx, rax); |
2413 __ orp(rax, rdx); | 2413 __ orp(rax, rdx); |
2414 JumpPatchSite patch_site(masm_); | 2414 JumpPatchSite patch_site(masm_); |
2415 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); | 2415 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); |
2416 | 2416 |
2417 __ bind(&stub_call); | 2417 __ bind(&stub_call); |
2418 __ movp(rax, rcx); | 2418 __ movp(rax, rcx); |
2419 Handle<Code> code = CodeFactory::BinaryOpIC( | 2419 Handle<Code> code = |
2420 isolate(), op, language_mode()).code(); | 2420 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2421 CallIC(code, expr->BinaryOperationFeedbackId()); | 2421 CallIC(code, expr->BinaryOperationFeedbackId()); |
2422 patch_site.EmitPatchInfo(); | 2422 patch_site.EmitPatchInfo(); |
2423 __ jmp(&done, Label::kNear); | 2423 __ jmp(&done, Label::kNear); |
2424 | 2424 |
2425 __ bind(&smi_case); | 2425 __ bind(&smi_case); |
2426 switch (op) { | 2426 switch (op) { |
2427 case Token::SAR: | 2427 case Token::SAR: |
2428 __ SmiShiftArithmeticRight(rax, rdx, rcx); | 2428 __ SmiShiftArithmeticRight(rax, rdx, rcx); |
2429 break; | 2429 break; |
2430 case Token::SHL: | 2430 case Token::SHL: |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2531 __ CallRuntime(Runtime::kToFastProperties, 1); | 2531 __ CallRuntime(Runtime::kToFastProperties, 1); |
2532 | 2532 |
2533 // Verify that compilation exactly consumed the number of store ic slots that | 2533 // Verify that compilation exactly consumed the number of store ic slots that |
2534 // the ClassLiteral node had to offer. | 2534 // the ClassLiteral node had to offer. |
2535 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); | 2535 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
2536 } | 2536 } |
2537 | 2537 |
2538 | 2538 |
2539 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2539 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2540 __ Pop(rdx); | 2540 __ Pop(rdx); |
2541 Handle<Code> code = CodeFactory::BinaryOpIC( | 2541 Handle<Code> code = |
2542 isolate(), op, language_mode()).code(); | 2542 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2543 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2543 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2544 CallIC(code, expr->BinaryOperationFeedbackId()); | 2544 CallIC(code, expr->BinaryOperationFeedbackId()); |
2545 patch_site.EmitPatchInfo(); | 2545 patch_site.EmitPatchInfo(); |
2546 context()->Plug(rax); | 2546 context()->Plug(rax); |
2547 } | 2547 } |
2548 | 2548 |
2549 | 2549 |
2550 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2550 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2551 FeedbackVectorICSlot slot) { | 2551 FeedbackVectorICSlot slot) { |
2552 DCHECK(expr->IsValidReferenceExpression()); | 2552 DCHECK(expr->IsValidReferenceExpression()); |
(...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4983 } | 4983 } |
4984 } | 4984 } |
4985 | 4985 |
4986 // Record position before stub call. | 4986 // Record position before stub call. |
4987 SetSourcePosition(expr->position()); | 4987 SetSourcePosition(expr->position()); |
4988 | 4988 |
4989 // Call stub for +1/-1. | 4989 // Call stub for +1/-1. |
4990 __ bind(&stub_call); | 4990 __ bind(&stub_call); |
4991 __ movp(rdx, rax); | 4991 __ movp(rdx, rax); |
4992 __ Move(rax, Smi::FromInt(1)); | 4992 __ Move(rax, Smi::FromInt(1)); |
4993 Handle<Code> code = CodeFactory::BinaryOpIC( | 4993 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
4994 isolate(), expr->binary_op(), language_mode()).code(); | 4994 strength(language_mode())).code(); |
4995 CallIC(code, expr->CountBinOpFeedbackId()); | 4995 CallIC(code, expr->CountBinOpFeedbackId()); |
4996 patch_site.EmitPatchInfo(); | 4996 patch_site.EmitPatchInfo(); |
4997 __ bind(&done); | 4997 __ bind(&done); |
4998 | 4998 |
4999 // Store the value returned in rax. | 4999 // Store the value returned in rax. |
5000 switch (assign_type) { | 5000 switch (assign_type) { |
5001 case VARIABLE: | 5001 case VARIABLE: |
5002 if (expr->is_postfix()) { | 5002 if (expr->is_postfix()) { |
5003 // Perform the assignment as if via '='. | 5003 // Perform the assignment as if via '='. |
5004 { EffectContext context(this); | 5004 { EffectContext context(this); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5250 __ movp(rcx, rdx); | 5250 __ movp(rcx, rdx); |
5251 __ orp(rcx, rax); | 5251 __ orp(rcx, rax); |
5252 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); | 5252 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); |
5253 __ cmpp(rdx, rax); | 5253 __ cmpp(rdx, rax); |
5254 Split(cc, if_true, if_false, NULL); | 5254 Split(cc, if_true, if_false, NULL); |
5255 __ bind(&slow_case); | 5255 __ bind(&slow_case); |
5256 } | 5256 } |
5257 | 5257 |
5258 // Record position and call the compare IC. | 5258 // Record position and call the compare IC. |
5259 SetSourcePosition(expr->position()); | 5259 SetSourcePosition(expr->position()); |
5260 Handle<Code> ic = | 5260 Handle<Code> ic = CodeFactory::CompareIC( |
5261 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5261 isolate(), op, strength(language_mode())).code(); |
5262 CallIC(ic, expr->CompareOperationFeedbackId()); | 5262 CallIC(ic, expr->CompareOperationFeedbackId()); |
5263 patch_site.EmitPatchInfo(); | 5263 patch_site.EmitPatchInfo(); |
5264 | 5264 |
5265 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5265 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
5266 __ testp(rax, rax); | 5266 __ testp(rax, rax); |
5267 Split(cc, if_true, if_false, fall_through); | 5267 Split(cc, if_true, if_false, fall_through); |
5268 } | 5268 } |
5269 } | 5269 } |
5270 | 5270 |
5271 // Convert the result of the comparison into one expected for this | 5271 // Convert the result of the comparison into one expected for this |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5490 Assembler::target_address_at(call_target_address, | 5490 Assembler::target_address_at(call_target_address, |
5491 unoptimized_code)); | 5491 unoptimized_code)); |
5492 return OSR_AFTER_STACK_CHECK; | 5492 return OSR_AFTER_STACK_CHECK; |
5493 } | 5493 } |
5494 | 5494 |
5495 | 5495 |
5496 } // namespace internal | 5496 } // namespace internal |
5497 } // namespace v8 | 5497 } // namespace v8 |
5498 | 5498 |
5499 #endif // V8_TARGET_ARCH_X64 | 5499 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |