| 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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 __ cmp(edx, eax); | 1002 __ cmp(edx, eax); |
| 1003 __ j(not_equal, &next_test); | 1003 __ j(not_equal, &next_test); |
| 1004 __ Drop(1); // Switch value is no longer needed. | 1004 __ Drop(1); // Switch value is no longer needed. |
| 1005 __ jmp(clause->body_target()); | 1005 __ jmp(clause->body_target()); |
| 1006 __ bind(&slow_case); | 1006 __ bind(&slow_case); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 // Record position before stub call for type feedback. | 1009 // Record position before stub call for type feedback. |
| 1010 SetSourcePosition(clause->position()); | 1010 SetSourcePosition(clause->position()); |
| 1011 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 1011 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
| 1012 language_mode()).code(); | 1012 strength(language_mode())).code(); |
| 1013 CallIC(ic, clause->CompareId()); | 1013 CallIC(ic, clause->CompareId()); |
| 1014 patch_site.EmitPatchInfo(); | 1014 patch_site.EmitPatchInfo(); |
| 1015 | 1015 |
| 1016 Label skip; | 1016 Label skip; |
| 1017 __ jmp(&skip, Label::kNear); | 1017 __ jmp(&skip, Label::kNear); |
| 1018 PrepareForBailout(clause, TOS_REG); | 1018 PrepareForBailout(clause, TOS_REG); |
| 1019 __ cmp(eax, isolate()->factory()->true_value()); | 1019 __ cmp(eax, isolate()->factory()->true_value()); |
| 1020 __ j(not_equal, &next_test); | 1020 __ j(not_equal, &next_test); |
| 1021 __ Drop(1); | 1021 __ Drop(1); |
| 1022 __ jmp(clause->body_target()); | 1022 __ jmp(clause->body_target()); |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 // stack. Right operand is in eax. | 2369 // stack. Right operand is in eax. |
| 2370 Label smi_case, done, stub_call; | 2370 Label smi_case, done, stub_call; |
| 2371 __ pop(edx); | 2371 __ pop(edx); |
| 2372 __ mov(ecx, eax); | 2372 __ mov(ecx, eax); |
| 2373 __ or_(eax, edx); | 2373 __ or_(eax, edx); |
| 2374 JumpPatchSite patch_site(masm_); | 2374 JumpPatchSite patch_site(masm_); |
| 2375 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2375 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
| 2376 | 2376 |
| 2377 __ bind(&stub_call); | 2377 __ bind(&stub_call); |
| 2378 __ mov(eax, ecx); | 2378 __ mov(eax, ecx); |
| 2379 Handle<Code> code = CodeFactory::BinaryOpIC( | 2379 Handle<Code> code = |
| 2380 isolate(), op, language_mode()).code(); | 2380 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2381 CallIC(code, expr->BinaryOperationFeedbackId()); | 2381 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2382 patch_site.EmitPatchInfo(); | 2382 patch_site.EmitPatchInfo(); |
| 2383 __ jmp(&done, Label::kNear); | 2383 __ jmp(&done, Label::kNear); |
| 2384 | 2384 |
| 2385 // Smi case. | 2385 // Smi case. |
| 2386 __ bind(&smi_case); | 2386 __ bind(&smi_case); |
| 2387 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2387 __ mov(eax, edx); // Copy left operand in case of a stub call. |
| 2388 | 2388 |
| 2389 switch (op) { | 2389 switch (op) { |
| 2390 case Token::SAR: | 2390 case Token::SAR: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 // prototype | 2514 // prototype |
| 2515 __ CallRuntime(Runtime::kToFastProperties, 1); | 2515 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2516 | 2516 |
| 2517 // constructor | 2517 // constructor |
| 2518 __ CallRuntime(Runtime::kToFastProperties, 1); | 2518 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2519 } | 2519 } |
| 2520 | 2520 |
| 2521 | 2521 |
| 2522 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2522 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2523 __ pop(edx); | 2523 __ pop(edx); |
| 2524 Handle<Code> code = CodeFactory::BinaryOpIC( | 2524 Handle<Code> code = |
| 2525 isolate(), op, language_mode()).code(); | 2525 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2526 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2526 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2527 CallIC(code, expr->BinaryOperationFeedbackId()); | 2527 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2528 patch_site.EmitPatchInfo(); | 2528 patch_site.EmitPatchInfo(); |
| 2529 context()->Plug(eax); | 2529 context()->Plug(eax); |
| 2530 } | 2530 } |
| 2531 | 2531 |
| 2532 | 2532 |
| 2533 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2533 void FullCodeGenerator::EmitAssignment(Expression* expr, |
| 2534 FeedbackVectorICSlot slot) { | 2534 FeedbackVectorICSlot slot) { |
| 2535 DCHECK(expr->IsValidReferenceExpression()); | 2535 DCHECK(expr->IsValidReferenceExpression()); |
| (...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4920 } | 4920 } |
| 4921 } | 4921 } |
| 4922 | 4922 |
| 4923 // Record position before stub call. | 4923 // Record position before stub call. |
| 4924 SetSourcePosition(expr->position()); | 4924 SetSourcePosition(expr->position()); |
| 4925 | 4925 |
| 4926 // Call stub for +1/-1. | 4926 // Call stub for +1/-1. |
| 4927 __ bind(&stub_call); | 4927 __ bind(&stub_call); |
| 4928 __ mov(edx, eax); | 4928 __ mov(edx, eax); |
| 4929 __ mov(eax, Immediate(Smi::FromInt(1))); | 4929 __ mov(eax, Immediate(Smi::FromInt(1))); |
| 4930 Handle<Code> code = | 4930 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
| 4931 CodeFactory::BinaryOpIC( | 4931 strength(language_mode())).code(); |
| 4932 isolate(), expr->binary_op(), language_mode()).code(); | |
| 4933 CallIC(code, expr->CountBinOpFeedbackId()); | 4932 CallIC(code, expr->CountBinOpFeedbackId()); |
| 4934 patch_site.EmitPatchInfo(); | 4933 patch_site.EmitPatchInfo(); |
| 4935 __ bind(&done); | 4934 __ bind(&done); |
| 4936 | 4935 |
| 4937 // Store the value returned in eax. | 4936 // Store the value returned in eax. |
| 4938 switch (assign_type) { | 4937 switch (assign_type) { |
| 4939 case VARIABLE: | 4938 case VARIABLE: |
| 4940 if (expr->is_postfix()) { | 4939 if (expr->is_postfix()) { |
| 4941 // Perform the assignment as if via '='. | 4940 // Perform the assignment as if via '='. |
| 4942 { EffectContext context(this); | 4941 { EffectContext context(this); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5189 __ mov(ecx, edx); | 5188 __ mov(ecx, edx); |
| 5190 __ or_(ecx, eax); | 5189 __ or_(ecx, eax); |
| 5191 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 5190 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
| 5192 __ cmp(edx, eax); | 5191 __ cmp(edx, eax); |
| 5193 Split(cc, if_true, if_false, NULL); | 5192 Split(cc, if_true, if_false, NULL); |
| 5194 __ bind(&slow_case); | 5193 __ bind(&slow_case); |
| 5195 } | 5194 } |
| 5196 | 5195 |
| 5197 // Record position and call the compare IC. | 5196 // Record position and call the compare IC. |
| 5198 SetSourcePosition(expr->position()); | 5197 SetSourcePosition(expr->position()); |
| 5199 Handle<Code> ic = | 5198 Handle<Code> ic = CodeFactory::CompareIC( |
| 5200 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5199 isolate(), op, strength(language_mode())).code(); |
| 5201 CallIC(ic, expr->CompareOperationFeedbackId()); | 5200 CallIC(ic, expr->CompareOperationFeedbackId()); |
| 5202 patch_site.EmitPatchInfo(); | 5201 patch_site.EmitPatchInfo(); |
| 5203 | 5202 |
| 5204 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5203 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 5205 __ test(eax, eax); | 5204 __ test(eax, eax); |
| 5206 Split(cc, if_true, if_false, fall_through); | 5205 Split(cc, if_true, if_false, fall_through); |
| 5207 } | 5206 } |
| 5208 } | 5207 } |
| 5209 | 5208 |
| 5210 // Convert the result of the comparison into one expected for this | 5209 // Convert the result of the comparison into one expected for this |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5428 Assembler::target_address_at(call_target_address, | 5427 Assembler::target_address_at(call_target_address, |
| 5429 unoptimized_code)); | 5428 unoptimized_code)); |
| 5430 return OSR_AFTER_STACK_CHECK; | 5429 return OSR_AFTER_STACK_CHECK; |
| 5431 } | 5430 } |
| 5432 | 5431 |
| 5433 | 5432 |
| 5434 } // namespace internal | 5433 } // namespace internal |
| 5435 } // namespace v8 | 5434 } // namespace v8 |
| 5436 | 5435 |
| 5437 #endif // V8_TARGET_ARCH_X87 | 5436 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |