| 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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 __ cmpp(rdx, rax); | 1050 __ cmpp(rdx, rax); |
| 1051 __ j(not_equal, &next_test); | 1051 __ j(not_equal, &next_test); |
| 1052 __ Drop(1); // Switch value is no longer needed. | 1052 __ Drop(1); // Switch value is no longer needed. |
| 1053 __ jmp(clause->body_target()); | 1053 __ jmp(clause->body_target()); |
| 1054 __ bind(&slow_case); | 1054 __ bind(&slow_case); |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 // Record position before stub call for type feedback. | 1057 // Record position before stub call for type feedback. |
| 1058 SetSourcePosition(clause->position()); | 1058 SetSourcePosition(clause->position()); |
| 1059 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 1059 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
| 1060 language_mode()).code(); | 1060 strength(language_mode())).code(); |
| 1061 CallIC(ic, clause->CompareId()); | 1061 CallIC(ic, clause->CompareId()); |
| 1062 patch_site.EmitPatchInfo(); | 1062 patch_site.EmitPatchInfo(); |
| 1063 | 1063 |
| 1064 Label skip; | 1064 Label skip; |
| 1065 __ jmp(&skip, Label::kNear); | 1065 __ jmp(&skip, Label::kNear); |
| 1066 PrepareForBailout(clause, TOS_REG); | 1066 PrepareForBailout(clause, TOS_REG); |
| 1067 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 1067 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
| 1068 __ j(not_equal, &next_test); | 1068 __ j(not_equal, &next_test); |
| 1069 __ Drop(1); | 1069 __ Drop(1); |
| 1070 __ jmp(clause->body_target()); | 1070 __ jmp(clause->body_target()); |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2427 // rcx to make the shifts easier. | 2427 // rcx to make the shifts easier. |
| 2428 Label done, stub_call, smi_case; | 2428 Label done, stub_call, smi_case; |
| 2429 __ Pop(rdx); | 2429 __ Pop(rdx); |
| 2430 __ movp(rcx, rax); | 2430 __ movp(rcx, rax); |
| 2431 __ orp(rax, rdx); | 2431 __ orp(rax, rdx); |
| 2432 JumpPatchSite patch_site(masm_); | 2432 JumpPatchSite patch_site(masm_); |
| 2433 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); | 2433 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); |
| 2434 | 2434 |
| 2435 __ bind(&stub_call); | 2435 __ bind(&stub_call); |
| 2436 __ movp(rax, rcx); | 2436 __ movp(rax, rcx); |
| 2437 Handle<Code> code = CodeFactory::BinaryOpIC( | 2437 Handle<Code> code = |
| 2438 isolate(), op, language_mode()).code(); | 2438 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2439 CallIC(code, expr->BinaryOperationFeedbackId()); | 2439 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2440 patch_site.EmitPatchInfo(); | 2440 patch_site.EmitPatchInfo(); |
| 2441 __ jmp(&done, Label::kNear); | 2441 __ jmp(&done, Label::kNear); |
| 2442 | 2442 |
| 2443 __ bind(&smi_case); | 2443 __ bind(&smi_case); |
| 2444 switch (op) { | 2444 switch (op) { |
| 2445 case Token::SAR: | 2445 case Token::SAR: |
| 2446 __ SmiShiftArithmeticRight(rax, rdx, rcx); | 2446 __ SmiShiftArithmeticRight(rax, rdx, rcx); |
| 2447 break; | 2447 break; |
| 2448 case Token::SHL: | 2448 case Token::SHL: |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2540 // prototype | 2540 // prototype |
| 2541 __ CallRuntime(Runtime::kToFastProperties, 1); | 2541 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2542 | 2542 |
| 2543 // constructor | 2543 // constructor |
| 2544 __ CallRuntime(Runtime::kToFastProperties, 1); | 2544 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2545 } | 2545 } |
| 2546 | 2546 |
| 2547 | 2547 |
| 2548 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2548 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2549 __ Pop(rdx); | 2549 __ Pop(rdx); |
| 2550 Handle<Code> code = CodeFactory::BinaryOpIC( | 2550 Handle<Code> code = |
| 2551 isolate(), op, language_mode()).code(); | 2551 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2552 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2552 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2553 CallIC(code, expr->BinaryOperationFeedbackId()); | 2553 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2554 patch_site.EmitPatchInfo(); | 2554 patch_site.EmitPatchInfo(); |
| 2555 context()->Plug(rax); | 2555 context()->Plug(rax); |
| 2556 } | 2556 } |
| 2557 | 2557 |
| 2558 | 2558 |
| 2559 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2559 void FullCodeGenerator::EmitAssignment(Expression* expr, |
| 2560 FeedbackVectorICSlot slot) { | 2560 FeedbackVectorICSlot slot) { |
| 2561 DCHECK(expr->IsValidReferenceExpression()); | 2561 DCHECK(expr->IsValidReferenceExpression()); |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4992 } | 4992 } |
| 4993 } | 4993 } |
| 4994 | 4994 |
| 4995 // Record position before stub call. | 4995 // Record position before stub call. |
| 4996 SetSourcePosition(expr->position()); | 4996 SetSourcePosition(expr->position()); |
| 4997 | 4997 |
| 4998 // Call stub for +1/-1. | 4998 // Call stub for +1/-1. |
| 4999 __ bind(&stub_call); | 4999 __ bind(&stub_call); |
| 5000 __ movp(rdx, rax); | 5000 __ movp(rdx, rax); |
| 5001 __ Move(rax, Smi::FromInt(1)); | 5001 __ Move(rax, Smi::FromInt(1)); |
| 5002 Handle<Code> code = CodeFactory::BinaryOpIC( | 5002 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
| 5003 isolate(), expr->binary_op(), language_mode()).code(); | 5003 strength(language_mode())).code(); |
| 5004 CallIC(code, expr->CountBinOpFeedbackId()); | 5004 CallIC(code, expr->CountBinOpFeedbackId()); |
| 5005 patch_site.EmitPatchInfo(); | 5005 patch_site.EmitPatchInfo(); |
| 5006 __ bind(&done); | 5006 __ bind(&done); |
| 5007 | 5007 |
| 5008 // Store the value returned in rax. | 5008 // Store the value returned in rax. |
| 5009 switch (assign_type) { | 5009 switch (assign_type) { |
| 5010 case VARIABLE: | 5010 case VARIABLE: |
| 5011 if (expr->is_postfix()) { | 5011 if (expr->is_postfix()) { |
| 5012 // Perform the assignment as if via '='. | 5012 // Perform the assignment as if via '='. |
| 5013 { EffectContext context(this); | 5013 { EffectContext context(this); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5259 __ movp(rcx, rdx); | 5259 __ movp(rcx, rdx); |
| 5260 __ orp(rcx, rax); | 5260 __ orp(rcx, rax); |
| 5261 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); | 5261 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); |
| 5262 __ cmpp(rdx, rax); | 5262 __ cmpp(rdx, rax); |
| 5263 Split(cc, if_true, if_false, NULL); | 5263 Split(cc, if_true, if_false, NULL); |
| 5264 __ bind(&slow_case); | 5264 __ bind(&slow_case); |
| 5265 } | 5265 } |
| 5266 | 5266 |
| 5267 // Record position and call the compare IC. | 5267 // Record position and call the compare IC. |
| 5268 SetSourcePosition(expr->position()); | 5268 SetSourcePosition(expr->position()); |
| 5269 Handle<Code> ic = | 5269 Handle<Code> ic = CodeFactory::CompareIC( |
| 5270 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5270 isolate(), op, strength(language_mode())).code(); |
| 5271 CallIC(ic, expr->CompareOperationFeedbackId()); | 5271 CallIC(ic, expr->CompareOperationFeedbackId()); |
| 5272 patch_site.EmitPatchInfo(); | 5272 patch_site.EmitPatchInfo(); |
| 5273 | 5273 |
| 5274 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5274 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 5275 __ testp(rax, rax); | 5275 __ testp(rax, rax); |
| 5276 Split(cc, if_true, if_false, fall_through); | 5276 Split(cc, if_true, if_false, fall_through); |
| 5277 } | 5277 } |
| 5278 } | 5278 } |
| 5279 | 5279 |
| 5280 // Convert the result of the comparison into one expected for this | 5280 // Convert the result of the comparison into one expected for this |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5499 Assembler::target_address_at(call_target_address, | 5499 Assembler::target_address_at(call_target_address, |
| 5500 unoptimized_code)); | 5500 unoptimized_code)); |
| 5501 return OSR_AFTER_STACK_CHECK; | 5501 return OSR_AFTER_STACK_CHECK; |
| 5502 } | 5502 } |
| 5503 | 5503 |
| 5504 | 5504 |
| 5505 } // namespace internal | 5505 } // namespace internal |
| 5506 } // namespace v8 | 5506 } // namespace v8 |
| 5507 | 5507 |
| 5508 #endif // V8_TARGET_ARCH_X64 | 5508 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |