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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 __ cmp(edx, eax); | 1009 __ cmp(edx, eax); |
1010 __ j(not_equal, &next_test); | 1010 __ j(not_equal, &next_test); |
1011 __ Drop(1); // Switch value is no longer needed. | 1011 __ Drop(1); // Switch value is no longer needed. |
1012 __ jmp(clause->body_target()); | 1012 __ jmp(clause->body_target()); |
1013 __ bind(&slow_case); | 1013 __ bind(&slow_case); |
1014 } | 1014 } |
1015 | 1015 |
1016 // Record position before stub call for type feedback. | 1016 // Record position before stub call for type feedback. |
1017 SetSourcePosition(clause->position()); | 1017 SetSourcePosition(clause->position()); |
1018 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 1018 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
1019 language_mode()).code(); | 1019 strength(language_mode())).code(); |
1020 CallIC(ic, clause->CompareId()); | 1020 CallIC(ic, clause->CompareId()); |
1021 patch_site.EmitPatchInfo(); | 1021 patch_site.EmitPatchInfo(); |
1022 | 1022 |
1023 Label skip; | 1023 Label skip; |
1024 __ jmp(&skip, Label::kNear); | 1024 __ jmp(&skip, Label::kNear); |
1025 PrepareForBailout(clause, TOS_REG); | 1025 PrepareForBailout(clause, TOS_REG); |
1026 __ cmp(eax, isolate()->factory()->true_value()); | 1026 __ cmp(eax, isolate()->factory()->true_value()); |
1027 __ j(not_equal, &next_test); | 1027 __ j(not_equal, &next_test); |
1028 __ Drop(1); | 1028 __ Drop(1); |
1029 __ jmp(clause->body_target()); | 1029 __ jmp(clause->body_target()); |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2379 // stack. Right operand is in eax. | 2379 // stack. Right operand is in eax. |
2380 Label smi_case, done, stub_call; | 2380 Label smi_case, done, stub_call; |
2381 __ pop(edx); | 2381 __ pop(edx); |
2382 __ mov(ecx, eax); | 2382 __ mov(ecx, eax); |
2383 __ or_(eax, edx); | 2383 __ or_(eax, edx); |
2384 JumpPatchSite patch_site(masm_); | 2384 JumpPatchSite patch_site(masm_); |
2385 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2385 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
2386 | 2386 |
2387 __ bind(&stub_call); | 2387 __ bind(&stub_call); |
2388 __ mov(eax, ecx); | 2388 __ mov(eax, ecx); |
2389 Handle<Code> code = CodeFactory::BinaryOpIC( | 2389 Handle<Code> code = |
2390 isolate(), op, language_mode()).code(); | 2390 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2391 CallIC(code, expr->BinaryOperationFeedbackId()); | 2391 CallIC(code, expr->BinaryOperationFeedbackId()); |
2392 patch_site.EmitPatchInfo(); | 2392 patch_site.EmitPatchInfo(); |
2393 __ jmp(&done, Label::kNear); | 2393 __ jmp(&done, Label::kNear); |
2394 | 2394 |
2395 // Smi case. | 2395 // Smi case. |
2396 __ bind(&smi_case); | 2396 __ bind(&smi_case); |
2397 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2397 __ mov(eax, edx); // Copy left operand in case of a stub call. |
2398 | 2398 |
2399 switch (op) { | 2399 switch (op) { |
2400 case Token::SAR: | 2400 case Token::SAR: |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 __ CallRuntime(Runtime::kToFastProperties, 1); | 2533 __ CallRuntime(Runtime::kToFastProperties, 1); |
2534 | 2534 |
2535 // Verify that compilation exactly consumed the number of store ic slots that | 2535 // Verify that compilation exactly consumed the number of store ic slots that |
2536 // the ClassLiteral node had to offer. | 2536 // the ClassLiteral node had to offer. |
2537 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); | 2537 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
2538 } | 2538 } |
2539 | 2539 |
2540 | 2540 |
2541 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2541 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2542 __ pop(edx); | 2542 __ pop(edx); |
2543 Handle<Code> code = CodeFactory::BinaryOpIC( | 2543 Handle<Code> code = |
2544 isolate(), op, language_mode()).code(); | 2544 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2545 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2545 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2546 CallIC(code, expr->BinaryOperationFeedbackId()); | 2546 CallIC(code, expr->BinaryOperationFeedbackId()); |
2547 patch_site.EmitPatchInfo(); | 2547 patch_site.EmitPatchInfo(); |
2548 context()->Plug(eax); | 2548 context()->Plug(eax); |
2549 } | 2549 } |
2550 | 2550 |
2551 | 2551 |
2552 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2552 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2553 FeedbackVectorICSlot slot) { | 2553 FeedbackVectorICSlot slot) { |
2554 DCHECK(expr->IsValidReferenceExpression()); | 2554 DCHECK(expr->IsValidReferenceExpression()); |
(...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4961 } | 4961 } |
4962 } | 4962 } |
4963 | 4963 |
4964 // Record position before stub call. | 4964 // Record position before stub call. |
4965 SetSourcePosition(expr->position()); | 4965 SetSourcePosition(expr->position()); |
4966 | 4966 |
4967 // Call stub for +1/-1. | 4967 // Call stub for +1/-1. |
4968 __ bind(&stub_call); | 4968 __ bind(&stub_call); |
4969 __ mov(edx, eax); | 4969 __ mov(edx, eax); |
4970 __ mov(eax, Immediate(Smi::FromInt(1))); | 4970 __ mov(eax, Immediate(Smi::FromInt(1))); |
4971 Handle<Code> code = | 4971 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
4972 CodeFactory::BinaryOpIC( | 4972 strength(language_mode())).code(); |
4973 isolate(), expr->binary_op(), language_mode()).code(); | |
4974 CallIC(code, expr->CountBinOpFeedbackId()); | 4973 CallIC(code, expr->CountBinOpFeedbackId()); |
4975 patch_site.EmitPatchInfo(); | 4974 patch_site.EmitPatchInfo(); |
4976 __ bind(&done); | 4975 __ bind(&done); |
4977 | 4976 |
4978 // Store the value returned in eax. | 4977 // Store the value returned in eax. |
4979 switch (assign_type) { | 4978 switch (assign_type) { |
4980 case VARIABLE: | 4979 case VARIABLE: |
4981 if (expr->is_postfix()) { | 4980 if (expr->is_postfix()) { |
4982 // Perform the assignment as if via '='. | 4981 // Perform the assignment as if via '='. |
4983 { EffectContext context(this); | 4982 { EffectContext context(this); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5230 __ mov(ecx, edx); | 5229 __ mov(ecx, edx); |
5231 __ or_(ecx, eax); | 5230 __ or_(ecx, eax); |
5232 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 5231 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
5233 __ cmp(edx, eax); | 5232 __ cmp(edx, eax); |
5234 Split(cc, if_true, if_false, NULL); | 5233 Split(cc, if_true, if_false, NULL); |
5235 __ bind(&slow_case); | 5234 __ bind(&slow_case); |
5236 } | 5235 } |
5237 | 5236 |
5238 // Record position and call the compare IC. | 5237 // Record position and call the compare IC. |
5239 SetSourcePosition(expr->position()); | 5238 SetSourcePosition(expr->position()); |
5240 Handle<Code> ic = | 5239 Handle<Code> ic = CodeFactory::CompareIC( |
5241 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5240 isolate(), op, strength(language_mode())).code(); |
5242 CallIC(ic, expr->CompareOperationFeedbackId()); | 5241 CallIC(ic, expr->CompareOperationFeedbackId()); |
5243 patch_site.EmitPatchInfo(); | 5242 patch_site.EmitPatchInfo(); |
5244 | 5243 |
5245 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5244 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
5246 __ test(eax, eax); | 5245 __ test(eax, eax); |
5247 Split(cc, if_true, if_false, fall_through); | 5246 Split(cc, if_true, if_false, fall_through); |
5248 } | 5247 } |
5249 } | 5248 } |
5250 | 5249 |
5251 // Convert the result of the comparison into one expected for this | 5250 // Convert the result of the comparison into one expected for this |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5469 Assembler::target_address_at(call_target_address, | 5468 Assembler::target_address_at(call_target_address, |
5470 unoptimized_code)); | 5469 unoptimized_code)); |
5471 return OSR_AFTER_STACK_CHECK; | 5470 return OSR_AFTER_STACK_CHECK; |
5472 } | 5471 } |
5473 | 5472 |
5474 | 5473 |
5475 } // namespace internal | 5474 } // namespace internal |
5476 } // namespace v8 | 5475 } // namespace v8 |
5477 | 5476 |
5478 #endif // V8_TARGET_ARCH_IA32 | 5477 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |