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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 893 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
894 | 894 |
895 __ cmp(edx, eax); | 895 __ cmp(edx, eax); |
896 __ j(not_equal, &next_test); | 896 __ j(not_equal, &next_test); |
897 __ Drop(1); // Switch value is no longer needed. | 897 __ Drop(1); // Switch value is no longer needed. |
898 __ jmp(clause->body_target()); | 898 __ jmp(clause->body_target()); |
899 __ bind(&slow_case); | 899 __ bind(&slow_case); |
900 } | 900 } |
901 | 901 |
902 SetExpressionPosition(clause); | 902 SetExpressionPosition(clause); |
903 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 903 Handle<Code> ic = |
904 strength(language_mode())).code(); | 904 CodeFactory::CompareIC(isolate(), Token::EQ_STRICT).code(); |
905 CallIC(ic, clause->CompareId()); | 905 CallIC(ic, clause->CompareId()); |
906 patch_site.EmitPatchInfo(); | 906 patch_site.EmitPatchInfo(); |
907 | 907 |
908 Label skip; | 908 Label skip; |
909 __ jmp(&skip, Label::kNear); | 909 __ jmp(&skip, Label::kNear); |
910 PrepareForBailout(clause, TOS_REG); | 910 PrepareForBailout(clause, TOS_REG); |
911 __ cmp(eax, isolate()->factory()->true_value()); | 911 __ cmp(eax, isolate()->factory()->true_value()); |
912 __ j(not_equal, &next_test); | 912 __ j(not_equal, &next_test); |
913 __ Drop(1); | 913 __ Drop(1); |
914 __ jmp(clause->body_target()); | 914 __ jmp(clause->body_target()); |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 // stack. Right operand is in eax. | 2043 // stack. Right operand is in eax. |
2044 Label smi_case, done, stub_call; | 2044 Label smi_case, done, stub_call; |
2045 __ pop(edx); | 2045 __ pop(edx); |
2046 __ mov(ecx, eax); | 2046 __ mov(ecx, eax); |
2047 __ or_(eax, edx); | 2047 __ or_(eax, edx); |
2048 JumpPatchSite patch_site(masm_); | 2048 JumpPatchSite patch_site(masm_); |
2049 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2049 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
2050 | 2050 |
2051 __ bind(&stub_call); | 2051 __ bind(&stub_call); |
2052 __ mov(eax, ecx); | 2052 __ mov(eax, ecx); |
2053 Handle<Code> code = | 2053 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
2054 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | |
2055 CallIC(code, expr->BinaryOperationFeedbackId()); | 2054 CallIC(code, expr->BinaryOperationFeedbackId()); |
2056 patch_site.EmitPatchInfo(); | 2055 patch_site.EmitPatchInfo(); |
2057 __ jmp(&done, Label::kNear); | 2056 __ jmp(&done, Label::kNear); |
2058 | 2057 |
2059 // Smi case. | 2058 // Smi case. |
2060 __ bind(&smi_case); | 2059 __ bind(&smi_case); |
2061 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2060 __ mov(eax, edx); // Copy left operand in case of a stub call. |
2062 | 2061 |
2063 switch (op) { | 2062 switch (op) { |
2064 case Token::SAR: | 2063 case Token::SAR: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 __ Push(Smi::FromInt(DONT_ENUM)); | 2175 __ Push(Smi::FromInt(DONT_ENUM)); |
2177 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); | 2176 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); |
2178 break; | 2177 break; |
2179 } | 2178 } |
2180 } | 2179 } |
2181 } | 2180 } |
2182 | 2181 |
2183 | 2182 |
2184 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2183 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2185 __ pop(edx); | 2184 __ pop(edx); |
2186 Handle<Code> code = | 2185 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
2187 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | |
2188 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2186 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2189 CallIC(code, expr->BinaryOperationFeedbackId()); | 2187 CallIC(code, expr->BinaryOperationFeedbackId()); |
2190 patch_site.EmitPatchInfo(); | 2188 patch_site.EmitPatchInfo(); |
2191 context()->Plug(eax); | 2189 context()->Plug(eax); |
2192 } | 2190 } |
2193 | 2191 |
2194 | 2192 |
2195 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2193 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2196 FeedbackVectorSlot slot) { | 2194 FeedbackVectorSlot slot) { |
2197 DCHECK(expr->IsValidReferenceExpressionOrThis()); | 2195 DCHECK(expr->IsValidReferenceExpressionOrThis()); |
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4019 } | 4017 } |
4020 } | 4018 } |
4021 } | 4019 } |
4022 | 4020 |
4023 SetExpressionPosition(expr); | 4021 SetExpressionPosition(expr); |
4024 | 4022 |
4025 // Call stub for +1/-1. | 4023 // Call stub for +1/-1. |
4026 __ bind(&stub_call); | 4024 __ bind(&stub_call); |
4027 __ mov(edx, eax); | 4025 __ mov(edx, eax); |
4028 __ mov(eax, Immediate(Smi::FromInt(1))); | 4026 __ mov(eax, Immediate(Smi::FromInt(1))); |
4029 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), | 4027 Handle<Code> code = |
4030 strength(language_mode())).code(); | 4028 CodeFactory::BinaryOpIC(isolate(), expr->binary_op()).code(); |
4031 CallIC(code, expr->CountBinOpFeedbackId()); | 4029 CallIC(code, expr->CountBinOpFeedbackId()); |
4032 patch_site.EmitPatchInfo(); | 4030 patch_site.EmitPatchInfo(); |
4033 __ bind(&done); | 4031 __ bind(&done); |
4034 | 4032 |
4035 if (is_strong(language_mode())) { | 4033 if (is_strong(language_mode())) { |
4036 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 4034 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); |
4037 } | 4035 } |
4038 // Store the value returned in eax. | 4036 // Store the value returned in eax. |
4039 switch (assign_type) { | 4037 switch (assign_type) { |
4040 case VARIABLE: | 4038 case VARIABLE: |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4247 if (inline_smi_code) { | 4245 if (inline_smi_code) { |
4248 Label slow_case; | 4246 Label slow_case; |
4249 __ mov(ecx, edx); | 4247 __ mov(ecx, edx); |
4250 __ or_(ecx, eax); | 4248 __ or_(ecx, eax); |
4251 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 4249 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
4252 __ cmp(edx, eax); | 4250 __ cmp(edx, eax); |
4253 Split(cc, if_true, if_false, NULL); | 4251 Split(cc, if_true, if_false, NULL); |
4254 __ bind(&slow_case); | 4252 __ bind(&slow_case); |
4255 } | 4253 } |
4256 | 4254 |
4257 Handle<Code> ic = CodeFactory::CompareIC( | 4255 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
4258 isolate(), op, strength(language_mode())).code(); | |
4259 CallIC(ic, expr->CompareOperationFeedbackId()); | 4256 CallIC(ic, expr->CompareOperationFeedbackId()); |
4260 patch_site.EmitPatchInfo(); | 4257 patch_site.EmitPatchInfo(); |
4261 | 4258 |
4262 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4259 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
4263 __ test(eax, eax); | 4260 __ test(eax, eax); |
4264 Split(cc, if_true, if_false, fall_through); | 4261 Split(cc, if_true, if_false, fall_through); |
4265 } | 4262 } |
4266 } | 4263 } |
4267 | 4264 |
4268 // Convert the result of the comparison into one expected for this | 4265 // Convert the result of the comparison into one expected for this |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4491 Assembler::target_address_at(call_target_address, | 4488 Assembler::target_address_at(call_target_address, |
4492 unoptimized_code)); | 4489 unoptimized_code)); |
4493 return OSR_AFTER_STACK_CHECK; | 4490 return OSR_AFTER_STACK_CHECK; |
4494 } | 4491 } |
4495 | 4492 |
4496 | 4493 |
4497 } // namespace internal | 4494 } // namespace internal |
4498 } // namespace v8 | 4495 } // namespace v8 |
4499 | 4496 |
4500 #endif // V8_TARGET_ARCH_X87 | 4497 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |