Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 3026019: Fix bug in r5123, Comparison(), by unusing results before unconditional jump ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 break; 1438 break;
1439 } 1439 }
1440 if (answer_object == Heap::undefined_value()) { 1440 if (answer_object == Heap::undefined_value()) {
1441 return false; 1441 return false;
1442 } 1442 }
1443 frame_->Push(Handle<Object>(answer_object)); 1443 frame_->Push(Handle<Object>(answer_object));
1444 return true; 1444 return true;
1445 } 1445 }
1446 1446
1447 1447
1448 void CodeGenerator::JumpIfBothSmiUsingTypeInfo(Register left, 1448 void CodeGenerator::JumpIfBothSmiUsingTypeInfo(Result* left,
1449 Register right, 1449 Result* right,
1450 TypeInfo left_info,
1451 TypeInfo right_info,
1452 JumpTarget* both_smi) { 1450 JumpTarget* both_smi) {
1451 TypeInfo left_info = left->type_info();
1452 TypeInfo right_info = right->type_info();
1453 if (left_info.IsDouble() || left_info.IsString() || 1453 if (left_info.IsDouble() || left_info.IsString() ||
1454 right_info.IsDouble() || right_info.IsString()) { 1454 right_info.IsDouble() || right_info.IsString()) {
1455 // We know that left and right are not both smi. Don't do any tests. 1455 // We know that left and right are not both smi. Don't do any tests.
1456 return; 1456 return;
1457 } 1457 }
1458 1458
1459 if (left.is(right)) { 1459 if (left->reg().is(right->reg())) {
1460 if (!left_info.IsSmi()) { 1460 if (!left_info.IsSmi()) {
1461 __ test(left, Immediate(kSmiTagMask)); 1461 __ test(left->reg(), Immediate(kSmiTagMask));
1462 both_smi->Branch(zero); 1462 both_smi->Branch(zero);
1463 } else { 1463 } else {
1464 if (FLAG_debug_code) __ AbortIfNotSmi(left); 1464 if (FLAG_debug_code) __ AbortIfNotSmi(left->reg());
1465 left->Unuse();
1466 right->Unuse();
1465 both_smi->Jump(); 1467 both_smi->Jump();
1466 } 1468 }
1467 } else if (!left_info.IsSmi()) { 1469 } else if (!left_info.IsSmi()) {
1468 if (!right_info.IsSmi()) { 1470 if (!right_info.IsSmi()) {
1469 Result temp = allocator_->Allocate(); 1471 Result temp = allocator_->Allocate();
1470 ASSERT(temp.is_valid()); 1472 ASSERT(temp.is_valid());
1471 __ mov(temp.reg(), left); 1473 __ mov(temp.reg(), left->reg());
1472 __ or_(temp.reg(), Operand(right)); 1474 __ or_(temp.reg(), Operand(right->reg()));
1473 __ test(temp.reg(), Immediate(kSmiTagMask)); 1475 __ test(temp.reg(), Immediate(kSmiTagMask));
1474 temp.Unuse(); 1476 temp.Unuse();
1475 both_smi->Branch(zero); 1477 both_smi->Branch(zero);
1476 } else { 1478 } else {
1477 __ test(left, Immediate(kSmiTagMask)); 1479 __ test(left->reg(), Immediate(kSmiTagMask));
1478 both_smi->Branch(zero); 1480 both_smi->Branch(zero);
1479 } 1481 }
1480 } else { 1482 } else {
1481 if (FLAG_debug_code) __ AbortIfNotSmi(left); 1483 if (FLAG_debug_code) __ AbortIfNotSmi(left->reg());
1482 if (!right_info.IsSmi()) { 1484 if (!right_info.IsSmi()) {
1483 __ test(right, Immediate(kSmiTagMask)); 1485 __ test(right->reg(), Immediate(kSmiTagMask));
1484 both_smi->Branch(zero); 1486 both_smi->Branch(zero);
1485 } else { 1487 } else {
1486 if (FLAG_debug_code) __ AbortIfNotSmi(right); 1488 if (FLAG_debug_code) __ AbortIfNotSmi(right->reg());
1489 left->Unuse();
1490 right->Unuse();
1487 both_smi->Jump(); 1491 both_smi->Jump();
1488 } 1492 }
1489 } 1493 }
1490 } 1494 }
1491 1495
1492 1496
1493 void CodeGenerator::JumpIfNotBothSmiUsingTypeInfo(Register left, 1497 void CodeGenerator::JumpIfNotBothSmiUsingTypeInfo(Register left,
1494 Register right, 1498 Register right,
1495 Register scratch, 1499 Register scratch,
1496 TypeInfo left_info, 1500 TypeInfo left_info,
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 // Here we split control flow to the stub call and inlined cases 2777 // Here we split control flow to the stub call and inlined cases
2774 // before finally splitting it to the control destination. We use 2778 // before finally splitting it to the control destination. We use
2775 // a jump target and branching to duplicate the virtual frame at 2779 // a jump target and branching to duplicate the virtual frame at
2776 // the first split. We manually handle the off-frame references 2780 // the first split. We manually handle the off-frame references
2777 // by reconstituting them on the non-fall-through path. 2781 // by reconstituting them on the non-fall-through path.
2778 JumpTarget is_smi; 2782 JumpTarget is_smi;
2779 Register left_reg = left_side.reg(); 2783 Register left_reg = left_side.reg();
2780 Register right_reg = right_side.reg(); 2784 Register right_reg = right_side.reg();
2781 2785
2782 // In-line check for comparing two smis. 2786 // In-line check for comparing two smis.
2783 JumpIfBothSmiUsingTypeInfo(left_side.reg(), right_side.reg(), 2787 JumpIfBothSmiUsingTypeInfo(&left_side, &right_side, &is_smi);
2784 left_side.type_info(), right_side.type_info(),
2785 &is_smi);
2786 2788
2787 if (has_valid_frame()) { 2789 if (has_valid_frame()) {
2788 // Inline the equality check if both operands can't be a NaN. If both 2790 // Inline the equality check if both operands can't be a NaN. If both
2789 // objects are the same they are equal. 2791 // objects are the same they are equal.
2790 if (nan_info == kCantBothBeNaN && cc == equal) { 2792 if (nan_info == kCantBothBeNaN && cc == equal) {
2791 __ cmp(left_side.reg(), Operand(right_side.reg())); 2793 __ cmp(left_side.reg(), Operand(right_side.reg()));
2792 dest->true_target()->Branch(equal); 2794 dest->true_target()->Branch(equal);
2793 } 2795 }
2794 2796
2795 // Inlined number comparison: 2797 // Inlined number comparison:
(...skipping 11156 matching lines...) Expand 10 before | Expand all | Expand 10 after
13952 masm.GetCode(&desc); 13954 masm.GetCode(&desc);
13953 // Call the function from C++. 13955 // Call the function from C++.
13954 return FUNCTION_CAST<MemCopyFunction>(buffer); 13956 return FUNCTION_CAST<MemCopyFunction>(buffer);
13955 } 13957 }
13956 13958
13957 #undef __ 13959 #undef __
13958 13960
13959 } } // namespace v8::internal 13961 } } // namespace v8::internal
13960 13962
13961 #endif // V8_TARGET_ARCH_IA32 13963 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698