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

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

Issue 1404001: Land http://codereview.chromium.org/1311003/diff/8001/9001 to allows us to pu... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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 7406 matching lines...) Expand 10 before | Expand all | Expand 10 after
7417 frame_->Push(&eax_result); 7417 frame_->Push(&eax_result);
7418 } 7418 }
7419 break; 7419 break;
7420 } 7420 }
7421 default: 7421 default:
7422 UNREACHABLE(); 7422 UNREACHABLE();
7423 break; 7423 break;
7424 } 7424 }
7425 } 7425 }
7426 7426
7427 void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
7428 Comment cmnt(masm_, "[ BinaryOperation");
7429 Token::Value op = node->op();
7430 7427
7428 void CodeGenerator::GenerateLogicalBooleanOperation(BinaryOperation* node) {
7431 // According to ECMA-262 section 11.11, page 58, the binary logical 7429 // According to ECMA-262 section 11.11, page 58, the binary logical
7432 // operators must yield the result of one of the two expressions 7430 // operators must yield the result of one of the two expressions
7433 // before any ToBoolean() conversions. This means that the value 7431 // before any ToBoolean() conversions. This means that the value
7434 // produced by a && or || operator is not necessarily a boolean. 7432 // produced by a && or || operator is not necessarily a boolean.
7435 7433
7436 // NOTE: If the left hand side produces a materialized value (not 7434 // NOTE: If the left hand side produces a materialized value (not
7437 // control flow), we force the right hand side to do the same. This 7435 // control flow), we force the right hand side to do the same. This
7438 // is necessary because we assume that if we get control flow on the 7436 // is necessary because we assume that if we get control flow on the
7439 // last path out of an expression we got it on all paths. 7437 // last path out of an expression we got it on all paths.
7440 if (op == Token::AND) { 7438 if (node->op() == Token::AND) {
7441 ASSERT(!in_safe_int32_mode()); 7439 ASSERT(!in_safe_int32_mode());
7442 JumpTarget is_true; 7440 JumpTarget is_true;
7443 ControlDestination dest(&is_true, destination()->false_target(), true); 7441 ControlDestination dest(&is_true, destination()->false_target(), true);
7444 LoadCondition(node->left(), &dest, false); 7442 LoadCondition(node->left(), &dest, false);
7445 7443
7446 if (dest.false_was_fall_through()) { 7444 if (dest.false_was_fall_through()) {
7447 // The current false target was used as the fall-through. If 7445 // The current false target was used as the fall-through. If
7448 // there are no dangling jumps to is_true then the left 7446 // there are no dangling jumps to is_true then the left
7449 // subexpression was unconditionally false. Otherwise we have 7447 // subexpression was unconditionally false. Otherwise we have
7450 // paths where we do have to evaluate the right subexpression. 7448 // paths where we do have to evaluate the right subexpression.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
7494 frame_->Drop(); 7492 frame_->Drop();
7495 7493
7496 // Compile right side expression. 7494 // Compile right side expression.
7497 is_true.Bind(); 7495 is_true.Bind();
7498 Load(node->right()); 7496 Load(node->right());
7499 7497
7500 // Exit (always with a materialized value). 7498 // Exit (always with a materialized value).
7501 exit.Bind(); 7499 exit.Bind();
7502 } 7500 }
7503 7501
7504 } else if (op == Token::OR) { 7502 } else {
7503 ASSERT(node->op() == Token::OR);
7505 ASSERT(!in_safe_int32_mode()); 7504 ASSERT(!in_safe_int32_mode());
7506 JumpTarget is_false; 7505 JumpTarget is_false;
7507 ControlDestination dest(destination()->true_target(), &is_false, false); 7506 ControlDestination dest(destination()->true_target(), &is_false, false);
7508 LoadCondition(node->left(), &dest, false); 7507 LoadCondition(node->left(), &dest, false);
7509 7508
7510 if (dest.true_was_fall_through()) { 7509 if (dest.true_was_fall_through()) {
7511 // The current true target was used as the fall-through. If 7510 // The current true target was used as the fall-through. If
7512 // there are no dangling jumps to is_false then the left 7511 // there are no dangling jumps to is_false then the left
7513 // subexpression was unconditionally true. Otherwise we have 7512 // subexpression was unconditionally true. Otherwise we have
7514 // paths where we do have to evaluate the right subexpression. 7513 // paths where we do have to evaluate the right subexpression.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
7556 // Pop the result of evaluating the first part. 7555 // Pop the result of evaluating the first part.
7557 frame_->Drop(); 7556 frame_->Drop();
7558 7557
7559 // Compile right side expression. 7558 // Compile right side expression.
7560 is_false.Bind(); 7559 is_false.Bind();
7561 Load(node->right()); 7560 Load(node->right());
7562 7561
7563 // Exit (always with a materialized value). 7562 // Exit (always with a materialized value).
7564 exit.Bind(); 7563 exit.Bind();
7565 } 7564 }
7565 }
7566 }
7566 7567
7568
7569 void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
7570 Comment cmnt(masm_, "[ BinaryOperation");
7571
7572 if (node->op() == Token::AND || node->op() == Token::OR) {
7573 GenerateLogicalBooleanOperation(node);
7567 } else if (in_safe_int32_mode()) { 7574 } else if (in_safe_int32_mode()) {
7568 Visit(node->left()); 7575 Visit(node->left());
7569 Visit(node->right()); 7576 Visit(node->right());
7570 Int32BinaryOperation(node); 7577 Int32BinaryOperation(node);
7571 } else { 7578 } else {
7572 // NOTE: The code below assumes that the slow cases (calls to runtime) 7579 // NOTE: The code below assumes that the slow cases (calls to runtime)
7573 // never return a constant/immutable object. 7580 // never return a constant/immutable object.
7574 OverwriteMode overwrite_mode = NO_OVERWRITE; 7581 OverwriteMode overwrite_mode = NO_OVERWRITE;
7575 if (node->left()->AsBinaryOperation() != NULL && 7582 if (node->left()->AsBinaryOperation() != NULL &&
7576 node->left()->AsBinaryOperation()->ResultOverwriteAllowed()) { 7583 node->left()->AsBinaryOperation()->ResultOverwriteAllowed()) {
(...skipping 4980 matching lines...) Expand 10 before | Expand all | Expand 10 after
12557 12564
12558 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 12565 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
12559 // tagged as a small integer. 12566 // tagged as a small integer.
12560 __ bind(&runtime); 12567 __ bind(&runtime);
12561 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 12568 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
12562 } 12569 }
12563 12570
12564 #undef __ 12571 #undef __
12565 12572
12566 } } // namespace v8::internal 12573 } } // namespace v8::internal
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