| 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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 __ cmp(edx, eax); | 1027 __ cmp(edx, eax); |
| 1028 __ j(not_equal, &next_test); | 1028 __ j(not_equal, &next_test); |
| 1029 __ Drop(1); // Switch value is no longer needed. | 1029 __ Drop(1); // Switch value is no longer needed. |
| 1030 __ jmp(clause->body_target()); | 1030 __ jmp(clause->body_target()); |
| 1031 __ bind(&slow_case); | 1031 __ bind(&slow_case); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 // Record position before stub call for type feedback. | 1034 // Record position before stub call for type feedback. |
| 1035 SetSourcePosition(clause->position()); | 1035 SetSourcePosition(clause->position()); |
| 1036 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 1036 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
| 1037 language_mode()).code(); | 1037 strength(language_mode())).code(); |
| 1038 CallIC(ic, clause->CompareId()); | 1038 CallIC(ic, clause->CompareId()); |
| 1039 patch_site.EmitPatchInfo(); | 1039 patch_site.EmitPatchInfo(); |
| 1040 | 1040 |
| 1041 Label skip; | 1041 Label skip; |
| 1042 __ jmp(&skip, Label::kNear); | 1042 __ jmp(&skip, Label::kNear); |
| 1043 PrepareForBailout(clause, TOS_REG); | 1043 PrepareForBailout(clause, TOS_REG); |
| 1044 __ cmp(eax, isolate()->factory()->true_value()); | 1044 __ cmp(eax, isolate()->factory()->true_value()); |
| 1045 __ j(not_equal, &next_test); | 1045 __ j(not_equal, &next_test); |
| 1046 __ Drop(1); | 1046 __ Drop(1); |
| 1047 __ jmp(clause->body_target()); | 1047 __ jmp(clause->body_target()); |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 // stack. Right operand is in eax. | 2397 // stack. Right operand is in eax. |
| 2398 Label smi_case, done, stub_call; | 2398 Label smi_case, done, stub_call; |
| 2399 __ pop(edx); | 2399 __ pop(edx); |
| 2400 __ mov(ecx, eax); | 2400 __ mov(ecx, eax); |
| 2401 __ or_(eax, edx); | 2401 __ or_(eax, edx); |
| 2402 JumpPatchSite patch_site(masm_); | 2402 JumpPatchSite patch_site(masm_); |
| 2403 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2403 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
| 2404 | 2404 |
| 2405 __ bind(&stub_call); | 2405 __ bind(&stub_call); |
| 2406 __ mov(eax, ecx); | 2406 __ mov(eax, ecx); |
| 2407 Handle<Code> code = CodeFactory::BinaryOpIC( | 2407 Handle<Code> code = |
| 2408 isolate(), op, language_mode()).code(); | 2408 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2409 CallIC(code, expr->BinaryOperationFeedbackId()); | 2409 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2410 patch_site.EmitPatchInfo(); | 2410 patch_site.EmitPatchInfo(); |
| 2411 __ jmp(&done, Label::kNear); | 2411 __ jmp(&done, Label::kNear); |
| 2412 | 2412 |
| 2413 // Smi case. | 2413 // Smi case. |
| 2414 __ bind(&smi_case); | 2414 __ bind(&smi_case); |
| 2415 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2415 __ mov(eax, edx); // Copy left operand in case of a stub call. |
| 2416 | 2416 |
| 2417 switch (op) { | 2417 switch (op) { |
| 2418 case Token::SAR: | 2418 case Token::SAR: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2542 // prototype | 2542 // prototype |
| 2543 __ CallRuntime(Runtime::kToFastProperties, 1); | 2543 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2544 | 2544 |
| 2545 // constructor | 2545 // constructor |
| 2546 __ CallRuntime(Runtime::kToFastProperties, 1); | 2546 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2547 } | 2547 } |
| 2548 | 2548 |
| 2549 | 2549 |
| 2550 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2550 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2551 __ pop(edx); | 2551 __ pop(edx); |
| 2552 Handle<Code> code = CodeFactory::BinaryOpIC( | 2552 Handle<Code> code = |
| 2553 isolate(), op, language_mode()).code(); | 2553 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2554 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2554 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2555 CallIC(code, expr->BinaryOperationFeedbackId()); | 2555 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2556 patch_site.EmitPatchInfo(); | 2556 patch_site.EmitPatchInfo(); |
| 2557 context()->Plug(eax); | 2557 context()->Plug(eax); |
| 2558 } | 2558 } |
| 2559 | 2559 |
| 2560 | 2560 |
| 2561 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2561 void FullCodeGenerator::EmitAssignment(Expression* expr, |
| 2562 FeedbackVectorICSlot slot) { | 2562 FeedbackVectorICSlot slot) { |
| 2563 DCHECK(expr->IsValidReferenceExpression()); | 2563 DCHECK(expr->IsValidReferenceExpression()); |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4970 } | 4970 } |
| 4971 } | 4971 } |
| 4972 | 4972 |
| 4973 // Record position before stub call. | 4973 // Record position before stub call. |
| 4974 SetSourcePosition(expr->position()); | 4974 SetSourcePosition(expr->position()); |
| 4975 | 4975 |
| 4976 // Call stub for +1/-1. | 4976 // Call stub for +1/-1. |
| 4977 __ bind(&stub_call); | 4977 __ bind(&stub_call); |
| 4978 __ mov(edx, eax); | 4978 __ mov(edx, eax); |
| 4979 __ mov(eax, Immediate(Smi::FromInt(1))); | 4979 __ mov(eax, Immediate(Smi::FromInt(1))); |
| 4980 Handle<Code> code = | 4980 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
| 4981 CodeFactory::BinaryOpIC( | 4981 strength(language_mode())).code(); |
| 4982 isolate(), expr->binary_op(), language_mode()).code(); | |
| 4983 CallIC(code, expr->CountBinOpFeedbackId()); | 4982 CallIC(code, expr->CountBinOpFeedbackId()); |
| 4984 patch_site.EmitPatchInfo(); | 4983 patch_site.EmitPatchInfo(); |
| 4985 __ bind(&done); | 4984 __ bind(&done); |
| 4986 | 4985 |
| 4987 // Store the value returned in eax. | 4986 // Store the value returned in eax. |
| 4988 switch (assign_type) { | 4987 switch (assign_type) { |
| 4989 case VARIABLE: | 4988 case VARIABLE: |
| 4990 if (expr->is_postfix()) { | 4989 if (expr->is_postfix()) { |
| 4991 // Perform the assignment as if via '='. | 4990 // Perform the assignment as if via '='. |
| 4992 { EffectContext context(this); | 4991 { EffectContext context(this); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5239 __ mov(ecx, edx); | 5238 __ mov(ecx, edx); |
| 5240 __ or_(ecx, eax); | 5239 __ or_(ecx, eax); |
| 5241 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 5240 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
| 5242 __ cmp(edx, eax); | 5241 __ cmp(edx, eax); |
| 5243 Split(cc, if_true, if_false, NULL); | 5242 Split(cc, if_true, if_false, NULL); |
| 5244 __ bind(&slow_case); | 5243 __ bind(&slow_case); |
| 5245 } | 5244 } |
| 5246 | 5245 |
| 5247 // Record position and call the compare IC. | 5246 // Record position and call the compare IC. |
| 5248 SetSourcePosition(expr->position()); | 5247 SetSourcePosition(expr->position()); |
| 5249 Handle<Code> ic = | 5248 Handle<Code> ic = CodeFactory::CompareIC( |
| 5250 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5249 isolate(), op, strength(language_mode())).code(); |
| 5251 CallIC(ic, expr->CompareOperationFeedbackId()); | 5250 CallIC(ic, expr->CompareOperationFeedbackId()); |
| 5252 patch_site.EmitPatchInfo(); | 5251 patch_site.EmitPatchInfo(); |
| 5253 | 5252 |
| 5254 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5253 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 5255 __ test(eax, eax); | 5254 __ test(eax, eax); |
| 5256 Split(cc, if_true, if_false, fall_through); | 5255 Split(cc, if_true, if_false, fall_through); |
| 5257 } | 5256 } |
| 5258 } | 5257 } |
| 5259 | 5258 |
| 5260 // Convert the result of the comparison into one expected for this | 5259 // Convert the result of the comparison into one expected for this |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5478 Assembler::target_address_at(call_target_address, | 5477 Assembler::target_address_at(call_target_address, |
| 5479 unoptimized_code)); | 5478 unoptimized_code)); |
| 5480 return OSR_AFTER_STACK_CHECK; | 5479 return OSR_AFTER_STACK_CHECK; |
| 5481 } | 5480 } |
| 5482 | 5481 |
| 5483 | 5482 |
| 5484 } // namespace internal | 5483 } // namespace internal |
| 5485 } // namespace v8 | 5484 } // namespace v8 |
| 5486 | 5485 |
| 5487 #endif // V8_TARGET_ARCH_IA32 | 5486 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |