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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 901 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
902 | 902 |
903 __ cmp(edx, eax); | 903 __ cmp(edx, eax); |
904 __ j(not_equal, &next_test); | 904 __ j(not_equal, &next_test); |
905 __ Drop(1); // Switch value is no longer needed. | 905 __ Drop(1); // Switch value is no longer needed. |
906 __ jmp(clause->body_target()); | 906 __ jmp(clause->body_target()); |
907 __ bind(&slow_case); | 907 __ bind(&slow_case); |
908 } | 908 } |
909 | 909 |
910 SetExpressionPosition(clause); | 910 SetExpressionPosition(clause); |
911 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 911 Handle<Code> ic = |
912 strength(language_mode())).code(); | 912 CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code(); |
913 CallIC(ic, clause->CompareId()); | 913 CallIC(ic, clause->CompareId()); |
914 patch_site.EmitPatchInfo(); | 914 patch_site.EmitPatchInfo(); |
915 | 915 |
916 Label skip; | 916 Label skip; |
917 __ jmp(&skip, Label::kNear); | 917 __ jmp(&skip, Label::kNear); |
918 PrepareForBailout(clause, TOS_REG); | 918 PrepareForBailout(clause, TOS_REG); |
919 __ cmp(eax, isolate()->factory()->true_value()); | 919 __ cmp(eax, isolate()->factory()->true_value()); |
920 __ j(not_equal, &next_test); | 920 __ j(not_equal, &next_test); |
921 __ Drop(1); | 921 __ Drop(1); |
922 __ jmp(clause->body_target()); | 922 __ jmp(clause->body_target()); |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 // stack. Right operand is in eax. | 2051 // stack. Right operand is in eax. |
2052 Label smi_case, done, stub_call; | 2052 Label smi_case, done, stub_call; |
2053 __ pop(edx); | 2053 __ pop(edx); |
2054 __ mov(ecx, eax); | 2054 __ mov(ecx, eax); |
2055 __ or_(eax, edx); | 2055 __ or_(eax, edx); |
2056 JumpPatchSite patch_site(masm_); | 2056 JumpPatchSite patch_site(masm_); |
2057 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2057 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
2058 | 2058 |
2059 __ bind(&stub_call); | 2059 __ bind(&stub_call); |
2060 __ mov(eax, ecx); | 2060 __ mov(eax, ecx); |
2061 Handle<Code> code = | 2061 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
2062 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | |
2063 CallIC(code, expr->BinaryOperationFeedbackId()); | 2062 CallIC(code, expr->BinaryOperationFeedbackId()); |
2064 patch_site.EmitPatchInfo(); | 2063 patch_site.EmitPatchInfo(); |
2065 __ jmp(&done, Label::kNear); | 2064 __ jmp(&done, Label::kNear); |
2066 | 2065 |
2067 // Smi case. | 2066 // Smi case. |
2068 __ bind(&smi_case); | 2067 __ bind(&smi_case); |
2069 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2068 __ mov(eax, edx); // Copy left operand in case of a stub call. |
2070 | 2069 |
2071 switch (op) { | 2070 switch (op) { |
2072 case Token::SAR: | 2071 case Token::SAR: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 __ Push(Smi::FromInt(DONT_ENUM)); | 2183 __ Push(Smi::FromInt(DONT_ENUM)); |
2185 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); | 2184 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); |
2186 break; | 2185 break; |
2187 } | 2186 } |
2188 } | 2187 } |
2189 } | 2188 } |
2190 | 2189 |
2191 | 2190 |
2192 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2191 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2193 __ pop(edx); | 2192 __ pop(edx); |
2194 Handle<Code> code = | 2193 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
2195 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | |
2196 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2194 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2197 CallIC(code, expr->BinaryOperationFeedbackId()); | 2195 CallIC(code, expr->BinaryOperationFeedbackId()); |
2198 patch_site.EmitPatchInfo(); | 2196 patch_site.EmitPatchInfo(); |
2199 context()->Plug(eax); | 2197 context()->Plug(eax); |
2200 } | 2198 } |
2201 | 2199 |
2202 | 2200 |
2203 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2201 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2204 FeedbackVectorSlot slot) { | 2202 FeedbackVectorSlot slot) { |
2205 DCHECK(expr->IsValidReferenceExpressionOrThis()); | 2203 DCHECK(expr->IsValidReferenceExpressionOrThis()); |
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4035 } | 4033 } |
4036 } | 4034 } |
4037 } | 4035 } |
4038 | 4036 |
4039 SetExpressionPosition(expr); | 4037 SetExpressionPosition(expr); |
4040 | 4038 |
4041 // Call stub for +1/-1. | 4039 // Call stub for +1/-1. |
4042 __ bind(&stub_call); | 4040 __ bind(&stub_call); |
4043 __ mov(edx, eax); | 4041 __ mov(edx, eax); |
4044 __ mov(eax, Immediate(Smi::FromInt(1))); | 4042 __ mov(eax, Immediate(Smi::FromInt(1))); |
4045 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), | 4043 Handle<Code> code = |
4046 strength(language_mode())).code(); | 4044 CodeFactory::BinaryOpIC(isolate(), expr->binary_op()).code(); |
4047 CallIC(code, expr->CountBinOpFeedbackId()); | 4045 CallIC(code, expr->CountBinOpFeedbackId()); |
4048 patch_site.EmitPatchInfo(); | 4046 patch_site.EmitPatchInfo(); |
4049 __ bind(&done); | 4047 __ bind(&done); |
4050 | 4048 |
4051 if (is_strong(language_mode())) { | 4049 if (is_strong(language_mode())) { |
4052 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 4050 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); |
4053 } | 4051 } |
4054 // Store the value returned in eax. | 4052 // Store the value returned in eax. |
4055 switch (assign_type) { | 4053 switch (assign_type) { |
4056 case VARIABLE: | 4054 case VARIABLE: |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4263 if (inline_smi_code) { | 4261 if (inline_smi_code) { |
4264 Label slow_case; | 4262 Label slow_case; |
4265 __ mov(ecx, edx); | 4263 __ mov(ecx, edx); |
4266 __ or_(ecx, eax); | 4264 __ or_(ecx, eax); |
4267 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 4265 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
4268 __ cmp(edx, eax); | 4266 __ cmp(edx, eax); |
4269 Split(cc, if_true, if_false, NULL); | 4267 Split(cc, if_true, if_false, NULL); |
4270 __ bind(&slow_case); | 4268 __ bind(&slow_case); |
4271 } | 4269 } |
4272 | 4270 |
4273 Handle<Code> ic = CodeFactory::CompareIC( | 4271 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
4274 isolate(), op, strength(language_mode())).code(); | |
4275 CallIC(ic, expr->CompareOperationFeedbackId()); | 4272 CallIC(ic, expr->CompareOperationFeedbackId()); |
4276 patch_site.EmitPatchInfo(); | 4273 patch_site.EmitPatchInfo(); |
4277 | 4274 |
4278 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4275 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
4279 __ test(eax, eax); | 4276 __ test(eax, eax); |
4280 Split(cc, if_true, if_false, fall_through); | 4277 Split(cc, if_true, if_false, fall_through); |
4281 } | 4278 } |
4282 } | 4279 } |
4283 | 4280 |
4284 // Convert the result of the comparison into one expected for this | 4281 // Convert the result of the comparison into one expected for this |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 Assembler::target_address_at(call_target_address, | 4504 Assembler::target_address_at(call_target_address, |
4508 unoptimized_code)); | 4505 unoptimized_code)); |
4509 return OSR_AFTER_STACK_CHECK; | 4506 return OSR_AFTER_STACK_CHECK; |
4510 } | 4507 } |
4511 | 4508 |
4512 | 4509 |
4513 } // namespace internal | 4510 } // namespace internal |
4514 } // namespace v8 | 4511 } // namespace v8 |
4515 | 4512 |
4516 #endif // V8_TARGET_ARCH_IA32 | 4513 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |