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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2522 // prototype | 2522 // prototype |
2523 __ CallRuntime(Runtime::kToFastProperties, 1); | 2523 __ CallRuntime(Runtime::kToFastProperties, 1); |
2524 | 2524 |
2525 // constructor | 2525 // constructor |
2526 __ CallRuntime(Runtime::kToFastProperties, 1); | 2526 __ CallRuntime(Runtime::kToFastProperties, 1); |
2527 } | 2527 } |
2528 | 2528 |
2529 | 2529 |
2530 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2530 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2531 __ Pop(rdx); | 2531 __ Pop(rdx); |
2532 Handle<Code> code = CodeFactory::BinaryOpIC( | 2532 Handle<Code> code = |
2533 isolate(), op, language_mode()).code(); | 2533 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2534 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2534 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2535 CallIC(code, expr->BinaryOperationFeedbackId()); | 2535 CallIC(code, expr->BinaryOperationFeedbackId()); |
2536 patch_site.EmitPatchInfo(); | 2536 patch_site.EmitPatchInfo(); |
2537 context()->Plug(rax); | 2537 context()->Plug(rax); |
2538 } | 2538 } |
2539 | 2539 |
2540 | 2540 |
2541 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2541 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2542 FeedbackVectorICSlot slot) { | 2542 FeedbackVectorICSlot slot) { |
2543 DCHECK(expr->IsValidReferenceExpression()); | 2543 DCHECK(expr->IsValidReferenceExpression()); |
(...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4974 } | 4974 } |
4975 } | 4975 } |
4976 | 4976 |
4977 // Record position before stub call. | 4977 // Record position before stub call. |
4978 SetSourcePosition(expr->position()); | 4978 SetSourcePosition(expr->position()); |
4979 | 4979 |
4980 // Call stub for +1/-1. | 4980 // Call stub for +1/-1. |
4981 __ bind(&stub_call); | 4981 __ bind(&stub_call); |
4982 __ movp(rdx, rax); | 4982 __ movp(rdx, rax); |
4983 __ Move(rax, Smi::FromInt(1)); | 4983 __ Move(rax, Smi::FromInt(1)); |
4984 Handle<Code> code = CodeFactory::BinaryOpIC( | 4984 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
4985 isolate(), expr->binary_op(), language_mode()).code(); | 4985 strength(language_mode())).code(); |
4986 CallIC(code, expr->CountBinOpFeedbackId()); | 4986 CallIC(code, expr->CountBinOpFeedbackId()); |
4987 patch_site.EmitPatchInfo(); | 4987 patch_site.EmitPatchInfo(); |
4988 __ bind(&done); | 4988 __ bind(&done); |
4989 | 4989 |
4990 // Store the value returned in rax. | 4990 // Store the value returned in rax. |
4991 switch (assign_type) { | 4991 switch (assign_type) { |
4992 case VARIABLE: | 4992 case VARIABLE: |
4993 if (expr->is_postfix()) { | 4993 if (expr->is_postfix()) { |
4994 // Perform the assignment as if via '='. | 4994 // Perform the assignment as if via '='. |
4995 { EffectContext context(this); | 4995 { EffectContext context(this); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5241 __ movp(rcx, rdx); | 5241 __ movp(rcx, rdx); |
5242 __ orp(rcx, rax); | 5242 __ orp(rcx, rax); |
5243 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); | 5243 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); |
5244 __ cmpp(rdx, rax); | 5244 __ cmpp(rdx, rax); |
5245 Split(cc, if_true, if_false, NULL); | 5245 Split(cc, if_true, if_false, NULL); |
5246 __ bind(&slow_case); | 5246 __ bind(&slow_case); |
5247 } | 5247 } |
5248 | 5248 |
5249 // Record position and call the compare IC. | 5249 // Record position and call the compare IC. |
5250 SetSourcePosition(expr->position()); | 5250 SetSourcePosition(expr->position()); |
5251 Handle<Code> ic = | 5251 Handle<Code> ic = CodeFactory::CompareIC( |
5252 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5252 isolate(), op, strength(language_mode())).code(); |
5253 CallIC(ic, expr->CompareOperationFeedbackId()); | 5253 CallIC(ic, expr->CompareOperationFeedbackId()); |
5254 patch_site.EmitPatchInfo(); | 5254 patch_site.EmitPatchInfo(); |
5255 | 5255 |
5256 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5256 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
5257 __ testp(rax, rax); | 5257 __ testp(rax, rax); |
5258 Split(cc, if_true, if_false, fall_through); | 5258 Split(cc, if_true, if_false, fall_through); |
5259 } | 5259 } |
5260 } | 5260 } |
5261 | 5261 |
5262 // Convert the result of the comparison into one expected for this | 5262 // Convert the result of the comparison into one expected for this |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5481 Assembler::target_address_at(call_target_address, | 5481 Assembler::target_address_at(call_target_address, |
5482 unoptimized_code)); | 5482 unoptimized_code)); |
5483 return OSR_AFTER_STACK_CHECK; | 5483 return OSR_AFTER_STACK_CHECK; |
5484 } | 5484 } |
5485 | 5485 |
5486 | 5486 |
5487 } // namespace internal | 5487 } // namespace internal |
5488 } // namespace v8 | 5488 } // namespace v8 |
5489 | 5489 |
5490 #endif // V8_TARGET_ARCH_X64 | 5490 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |