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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 __ cmp(edx, eax); | 984 __ cmp(edx, eax); |
985 __ j(not_equal, &next_test); | 985 __ j(not_equal, &next_test); |
986 __ Drop(1); // Switch value is no longer needed. | 986 __ Drop(1); // Switch value is no longer needed. |
987 __ jmp(clause->body_target()); | 987 __ jmp(clause->body_target()); |
988 __ bind(&slow_case); | 988 __ bind(&slow_case); |
989 } | 989 } |
990 | 990 |
991 // Record position before stub call for type feedback. | 991 // Record position before stub call for type feedback. |
992 SetSourcePosition(clause->position()); | 992 SetSourcePosition(clause->position()); |
993 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 993 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
994 language_mode()).code(); | 994 strength(language_mode())).code(); |
995 CallIC(ic, clause->CompareId()); | 995 CallIC(ic, clause->CompareId()); |
996 patch_site.EmitPatchInfo(); | 996 patch_site.EmitPatchInfo(); |
997 | 997 |
998 Label skip; | 998 Label skip; |
999 __ jmp(&skip, Label::kNear); | 999 __ jmp(&skip, Label::kNear); |
1000 PrepareForBailout(clause, TOS_REG); | 1000 PrepareForBailout(clause, TOS_REG); |
1001 __ cmp(eax, isolate()->factory()->true_value()); | 1001 __ cmp(eax, isolate()->factory()->true_value()); |
1002 __ j(not_equal, &next_test); | 1002 __ j(not_equal, &next_test); |
1003 __ Drop(1); | 1003 __ Drop(1); |
1004 __ jmp(clause->body_target()); | 1004 __ jmp(clause->body_target()); |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 // stack. Right operand is in eax. | 2350 // stack. Right operand is in eax. |
2351 Label smi_case, done, stub_call; | 2351 Label smi_case, done, stub_call; |
2352 __ pop(edx); | 2352 __ pop(edx); |
2353 __ mov(ecx, eax); | 2353 __ mov(ecx, eax); |
2354 __ or_(eax, edx); | 2354 __ or_(eax, edx); |
2355 JumpPatchSite patch_site(masm_); | 2355 JumpPatchSite patch_site(masm_); |
2356 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2356 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
2357 | 2357 |
2358 __ bind(&stub_call); | 2358 __ bind(&stub_call); |
2359 __ mov(eax, ecx); | 2359 __ mov(eax, ecx); |
2360 Handle<Code> code = CodeFactory::BinaryOpIC( | 2360 Handle<Code> code = |
2361 isolate(), op, language_mode()).code(); | 2361 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2362 CallIC(code, expr->BinaryOperationFeedbackId()); | 2362 CallIC(code, expr->BinaryOperationFeedbackId()); |
2363 patch_site.EmitPatchInfo(); | 2363 patch_site.EmitPatchInfo(); |
2364 __ jmp(&done, Label::kNear); | 2364 __ jmp(&done, Label::kNear); |
2365 | 2365 |
2366 // Smi case. | 2366 // Smi case. |
2367 __ bind(&smi_case); | 2367 __ bind(&smi_case); |
2368 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2368 __ mov(eax, edx); // Copy left operand in case of a stub call. |
2369 | 2369 |
2370 switch (op) { | 2370 switch (op) { |
2371 case Token::SAR: | 2371 case Token::SAR: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2495 // prototype | 2495 // prototype |
2496 __ CallRuntime(Runtime::kToFastProperties, 1); | 2496 __ CallRuntime(Runtime::kToFastProperties, 1); |
2497 | 2497 |
2498 // constructor | 2498 // constructor |
2499 __ CallRuntime(Runtime::kToFastProperties, 1); | 2499 __ CallRuntime(Runtime::kToFastProperties, 1); |
2500 } | 2500 } |
2501 | 2501 |
2502 | 2502 |
2503 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2503 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2504 __ pop(edx); | 2504 __ pop(edx); |
2505 Handle<Code> code = CodeFactory::BinaryOpIC( | 2505 Handle<Code> code = |
2506 isolate(), op, language_mode()).code(); | 2506 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2507 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2507 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2508 CallIC(code, expr->BinaryOperationFeedbackId()); | 2508 CallIC(code, expr->BinaryOperationFeedbackId()); |
2509 patch_site.EmitPatchInfo(); | 2509 patch_site.EmitPatchInfo(); |
2510 context()->Plug(eax); | 2510 context()->Plug(eax); |
2511 } | 2511 } |
2512 | 2512 |
2513 | 2513 |
2514 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2514 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2515 FeedbackVectorICSlot slot) { | 2515 FeedbackVectorICSlot slot) { |
2516 DCHECK(expr->IsValidReferenceExpression()); | 2516 DCHECK(expr->IsValidReferenceExpression()); |
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4900 } | 4900 } |
4901 } | 4901 } |
4902 | 4902 |
4903 // Record position before stub call. | 4903 // Record position before stub call. |
4904 SetSourcePosition(expr->position()); | 4904 SetSourcePosition(expr->position()); |
4905 | 4905 |
4906 // Call stub for +1/-1. | 4906 // Call stub for +1/-1. |
4907 __ bind(&stub_call); | 4907 __ bind(&stub_call); |
4908 __ mov(edx, eax); | 4908 __ mov(edx, eax); |
4909 __ mov(eax, Immediate(Smi::FromInt(1))); | 4909 __ mov(eax, Immediate(Smi::FromInt(1))); |
4910 Handle<Code> code = | 4910 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
4911 CodeFactory::BinaryOpIC( | 4911 strength(language_mode())).code(); |
4912 isolate(), expr->binary_op(), language_mode()).code(); | |
4913 CallIC(code, expr->CountBinOpFeedbackId()); | 4912 CallIC(code, expr->CountBinOpFeedbackId()); |
4914 patch_site.EmitPatchInfo(); | 4913 patch_site.EmitPatchInfo(); |
4915 __ bind(&done); | 4914 __ bind(&done); |
4916 | 4915 |
4917 // Store the value returned in eax. | 4916 // Store the value returned in eax. |
4918 switch (assign_type) { | 4917 switch (assign_type) { |
4919 case VARIABLE: | 4918 case VARIABLE: |
4920 if (expr->is_postfix()) { | 4919 if (expr->is_postfix()) { |
4921 // Perform the assignment as if via '='. | 4920 // Perform the assignment as if via '='. |
4922 { EffectContext context(this); | 4921 { EffectContext context(this); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5169 __ mov(ecx, edx); | 5168 __ mov(ecx, edx); |
5170 __ or_(ecx, eax); | 5169 __ or_(ecx, eax); |
5171 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 5170 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
5172 __ cmp(edx, eax); | 5171 __ cmp(edx, eax); |
5173 Split(cc, if_true, if_false, NULL); | 5172 Split(cc, if_true, if_false, NULL); |
5174 __ bind(&slow_case); | 5173 __ bind(&slow_case); |
5175 } | 5174 } |
5176 | 5175 |
5177 // Record position and call the compare IC. | 5176 // Record position and call the compare IC. |
5178 SetSourcePosition(expr->position()); | 5177 SetSourcePosition(expr->position()); |
5179 Handle<Code> ic = | 5178 Handle<Code> ic = CodeFactory::CompareIC( |
5180 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5179 isolate(), op, strength(language_mode())).code(); |
5181 CallIC(ic, expr->CompareOperationFeedbackId()); | 5180 CallIC(ic, expr->CompareOperationFeedbackId()); |
5182 patch_site.EmitPatchInfo(); | 5181 patch_site.EmitPatchInfo(); |
5183 | 5182 |
5184 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5183 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
5185 __ test(eax, eax); | 5184 __ test(eax, eax); |
5186 Split(cc, if_true, if_false, fall_through); | 5185 Split(cc, if_true, if_false, fall_through); |
5187 } | 5186 } |
5188 } | 5187 } |
5189 | 5188 |
5190 // Convert the result of the comparison into one expected for this | 5189 // Convert the result of the comparison into one expected for this |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5408 Assembler::target_address_at(call_target_address, | 5407 Assembler::target_address_at(call_target_address, |
5409 unoptimized_code)); | 5408 unoptimized_code)); |
5410 return OSR_AFTER_STACK_CHECK; | 5409 return OSR_AFTER_STACK_CHECK; |
5411 } | 5410 } |
5412 | 5411 |
5413 | 5412 |
5414 } // namespace internal | 5413 } // namespace internal |
5415 } // namespace v8 | 5414 } // namespace v8 |
5416 | 5415 |
5417 #endif // V8_TARGET_ARCH_X87 | 5416 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |