| 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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 __ cmp(edx, eax); | 1009 __ cmp(edx, eax); |
| 1010 __ j(not_equal, &next_test); | 1010 __ j(not_equal, &next_test); |
| 1011 __ Drop(1); // Switch value is no longer needed. | 1011 __ Drop(1); // Switch value is no longer needed. |
| 1012 __ jmp(clause->body_target()); | 1012 __ jmp(clause->body_target()); |
| 1013 __ bind(&slow_case); | 1013 __ bind(&slow_case); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 // Record position before stub call for type feedback. | 1016 // Record position before stub call for type feedback. |
| 1017 SetSourcePosition(clause->position()); | 1017 SetSourcePosition(clause->position()); |
| 1018 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 1018 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
| 1019 language_mode()).code(); | 1019 strength(language_mode())).code(); |
| 1020 CallIC(ic, clause->CompareId()); | 1020 CallIC(ic, clause->CompareId()); |
| 1021 patch_site.EmitPatchInfo(); | 1021 patch_site.EmitPatchInfo(); |
| 1022 | 1022 |
| 1023 Label skip; | 1023 Label skip; |
| 1024 __ jmp(&skip, Label::kNear); | 1024 __ jmp(&skip, Label::kNear); |
| 1025 PrepareForBailout(clause, TOS_REG); | 1025 PrepareForBailout(clause, TOS_REG); |
| 1026 __ cmp(eax, isolate()->factory()->true_value()); | 1026 __ cmp(eax, isolate()->factory()->true_value()); |
| 1027 __ j(not_equal, &next_test); | 1027 __ j(not_equal, &next_test); |
| 1028 __ Drop(1); | 1028 __ Drop(1); |
| 1029 __ jmp(clause->body_target()); | 1029 __ jmp(clause->body_target()); |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 // stack. Right operand is in eax. | 2379 // stack. Right operand is in eax. |
| 2380 Label smi_case, done, stub_call; | 2380 Label smi_case, done, stub_call; |
| 2381 __ pop(edx); | 2381 __ pop(edx); |
| 2382 __ mov(ecx, eax); | 2382 __ mov(ecx, eax); |
| 2383 __ or_(eax, edx); | 2383 __ or_(eax, edx); |
| 2384 JumpPatchSite patch_site(masm_); | 2384 JumpPatchSite patch_site(masm_); |
| 2385 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); | 2385 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); |
| 2386 | 2386 |
| 2387 __ bind(&stub_call); | 2387 __ bind(&stub_call); |
| 2388 __ mov(eax, ecx); | 2388 __ mov(eax, ecx); |
| 2389 Handle<Code> code = CodeFactory::BinaryOpIC( | 2389 Handle<Code> code = |
| 2390 isolate(), op, language_mode()).code(); | 2390 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2391 CallIC(code, expr->BinaryOperationFeedbackId()); | 2391 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2392 patch_site.EmitPatchInfo(); | 2392 patch_site.EmitPatchInfo(); |
| 2393 __ jmp(&done, Label::kNear); | 2393 __ jmp(&done, Label::kNear); |
| 2394 | 2394 |
| 2395 // Smi case. | 2395 // Smi case. |
| 2396 __ bind(&smi_case); | 2396 __ bind(&smi_case); |
| 2397 __ mov(eax, edx); // Copy left operand in case of a stub call. | 2397 __ mov(eax, edx); // Copy left operand in case of a stub call. |
| 2398 | 2398 |
| 2399 switch (op) { | 2399 switch (op) { |
| 2400 case Token::SAR: | 2400 case Token::SAR: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 // prototype | 2524 // prototype |
| 2525 __ CallRuntime(Runtime::kToFastProperties, 1); | 2525 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2526 | 2526 |
| 2527 // constructor | 2527 // constructor |
| 2528 __ CallRuntime(Runtime::kToFastProperties, 1); | 2528 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2529 } | 2529 } |
| 2530 | 2530 |
| 2531 | 2531 |
| 2532 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2532 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2533 __ pop(edx); | 2533 __ pop(edx); |
| 2534 Handle<Code> code = CodeFactory::BinaryOpIC( | 2534 Handle<Code> code = |
| 2535 isolate(), op, language_mode()).code(); | 2535 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
| 2536 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2536 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2537 CallIC(code, expr->BinaryOperationFeedbackId()); | 2537 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2538 patch_site.EmitPatchInfo(); | 2538 patch_site.EmitPatchInfo(); |
| 2539 context()->Plug(eax); | 2539 context()->Plug(eax); |
| 2540 } | 2540 } |
| 2541 | 2541 |
| 2542 | 2542 |
| 2543 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2543 void FullCodeGenerator::EmitAssignment(Expression* expr, |
| 2544 FeedbackVectorICSlot slot) { | 2544 FeedbackVectorICSlot slot) { |
| 2545 DCHECK(expr->IsValidReferenceExpression()); | 2545 DCHECK(expr->IsValidReferenceExpression()); |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4952 } | 4952 } |
| 4953 } | 4953 } |
| 4954 | 4954 |
| 4955 // Record position before stub call. | 4955 // Record position before stub call. |
| 4956 SetSourcePosition(expr->position()); | 4956 SetSourcePosition(expr->position()); |
| 4957 | 4957 |
| 4958 // Call stub for +1/-1. | 4958 // Call stub for +1/-1. |
| 4959 __ bind(&stub_call); | 4959 __ bind(&stub_call); |
| 4960 __ mov(edx, eax); | 4960 __ mov(edx, eax); |
| 4961 __ mov(eax, Immediate(Smi::FromInt(1))); | 4961 __ mov(eax, Immediate(Smi::FromInt(1))); |
| 4962 Handle<Code> code = | 4962 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), |
| 4963 CodeFactory::BinaryOpIC( | 4963 strength(language_mode())).code(); |
| 4964 isolate(), expr->binary_op(), language_mode()).code(); | |
| 4965 CallIC(code, expr->CountBinOpFeedbackId()); | 4964 CallIC(code, expr->CountBinOpFeedbackId()); |
| 4966 patch_site.EmitPatchInfo(); | 4965 patch_site.EmitPatchInfo(); |
| 4967 __ bind(&done); | 4966 __ bind(&done); |
| 4968 | 4967 |
| 4969 // Store the value returned in eax. | 4968 // Store the value returned in eax. |
| 4970 switch (assign_type) { | 4969 switch (assign_type) { |
| 4971 case VARIABLE: | 4970 case VARIABLE: |
| 4972 if (expr->is_postfix()) { | 4971 if (expr->is_postfix()) { |
| 4973 // Perform the assignment as if via '='. | 4972 // Perform the assignment as if via '='. |
| 4974 { EffectContext context(this); | 4973 { EffectContext context(this); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5221 __ mov(ecx, edx); | 5220 __ mov(ecx, edx); |
| 5222 __ or_(ecx, eax); | 5221 __ or_(ecx, eax); |
| 5223 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 5222 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
| 5224 __ cmp(edx, eax); | 5223 __ cmp(edx, eax); |
| 5225 Split(cc, if_true, if_false, NULL); | 5224 Split(cc, if_true, if_false, NULL); |
| 5226 __ bind(&slow_case); | 5225 __ bind(&slow_case); |
| 5227 } | 5226 } |
| 5228 | 5227 |
| 5229 // Record position and call the compare IC. | 5228 // Record position and call the compare IC. |
| 5230 SetSourcePosition(expr->position()); | 5229 SetSourcePosition(expr->position()); |
| 5231 Handle<Code> ic = | 5230 Handle<Code> ic = CodeFactory::CompareIC( |
| 5232 CodeFactory::CompareIC(isolate(), op, language_mode()).code(); | 5231 isolate(), op, strength(language_mode())).code(); |
| 5233 CallIC(ic, expr->CompareOperationFeedbackId()); | 5232 CallIC(ic, expr->CompareOperationFeedbackId()); |
| 5234 patch_site.EmitPatchInfo(); | 5233 patch_site.EmitPatchInfo(); |
| 5235 | 5234 |
| 5236 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5235 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 5237 __ test(eax, eax); | 5236 __ test(eax, eax); |
| 5238 Split(cc, if_true, if_false, fall_through); | 5237 Split(cc, if_true, if_false, fall_through); |
| 5239 } | 5238 } |
| 5240 } | 5239 } |
| 5241 | 5240 |
| 5242 // Convert the result of the comparison into one expected for this | 5241 // Convert the result of the comparison into one expected for this |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5460 Assembler::target_address_at(call_target_address, | 5459 Assembler::target_address_at(call_target_address, |
| 5461 unoptimized_code)); | 5460 unoptimized_code)); |
| 5462 return OSR_AFTER_STACK_CHECK; | 5461 return OSR_AFTER_STACK_CHECK; |
| 5463 } | 5462 } |
| 5464 | 5463 |
| 5465 | 5464 |
| 5466 } // namespace internal | 5465 } // namespace internal |
| 5467 } // namespace v8 | 5466 } // namespace v8 |
| 5468 | 5467 |
| 5469 #endif // V8_TARGET_ARCH_IA32 | 5468 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |