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

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

Issue 3203005: Start using the overwrite mode from the full codegens to generate... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 3 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 | « no previous file | src/arm/full-codegen-arm.cc » ('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 3532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3543 ASSERT(slot != NULL); 3543 ASSERT(slot != NULL);
3544 3544
3545 // Evaluate the right-hand side. 3545 // Evaluate the right-hand side.
3546 if (node->is_compound()) { 3546 if (node->is_compound()) {
3547 // For a compound assignment the right-hand side is a binary operation 3547 // For a compound assignment the right-hand side is a binary operation
3548 // between the current property value and the actual right-hand side. 3548 // between the current property value and the actual right-hand side.
3549 LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF); 3549 LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
3550 3550
3551 // Perform the binary operation. 3551 // Perform the binary operation.
3552 Literal* literal = node->value()->AsLiteral(); 3552 Literal* literal = node->value()->AsLiteral();
3553 bool overwrite_value = 3553 bool overwrite_value = node->value()->ResultOverwriteAllowed();
3554 (node->value()->AsBinaryOperation() != NULL &&
3555 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
3556 if (literal != NULL && literal->handle()->IsSmi()) { 3554 if (literal != NULL && literal->handle()->IsSmi()) {
3557 SmiOperation(node->binary_op(), 3555 SmiOperation(node->binary_op(),
3558 literal->handle(), 3556 literal->handle(),
3559 false, 3557 false,
3560 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 3558 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
3561 } else { 3559 } else {
3562 GenerateInlineSmi inline_smi = 3560 GenerateInlineSmi inline_smi =
3563 loop_nesting() > 0 ? GENERATE_INLINE_SMI : DONT_GENERATE_INLINE_SMI; 3561 loop_nesting() > 0 ? GENERATE_INLINE_SMI : DONT_GENERATE_INLINE_SMI;
3564 if (literal != NULL) { 3562 if (literal != NULL) {
3565 ASSERT(!literal->handle()->IsSmi()); 3563 ASSERT(!literal->handle()->IsSmi());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3643 Load(prop->obj()); 3641 Load(prop->obj());
3644 } else if (var != NULL) { 3642 } else if (var != NULL) {
3645 LoadGlobal(); 3643 LoadGlobal();
3646 } else { 3644 } else {
3647 frame_->Dup(); 3645 frame_->Dup();
3648 } 3646 }
3649 EmitNamedLoad(name, var != NULL); 3647 EmitNamedLoad(name, var != NULL);
3650 3648
3651 // Perform the binary operation. 3649 // Perform the binary operation.
3652 Literal* literal = node->value()->AsLiteral(); 3650 Literal* literal = node->value()->AsLiteral();
3653 bool overwrite_value = 3651 bool overwrite_value = node->value()->ResultOverwriteAllowed();
3654 (node->value()->AsBinaryOperation() != NULL &&
3655 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
3656 if (literal != NULL && literal->handle()->IsSmi()) { 3652 if (literal != NULL && literal->handle()->IsSmi()) {
3657 SmiOperation(node->binary_op(), 3653 SmiOperation(node->binary_op(),
3658 literal->handle(), 3654 literal->handle(),
3659 false, 3655 false,
3660 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 3656 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
3661 } else { 3657 } else {
3662 GenerateInlineSmi inline_smi = 3658 GenerateInlineSmi inline_smi =
3663 loop_nesting() > 0 ? GENERATE_INLINE_SMI : DONT_GENERATE_INLINE_SMI; 3659 loop_nesting() > 0 ? GENERATE_INLINE_SMI : DONT_GENERATE_INLINE_SMI;
3664 if (literal != NULL) { 3660 if (literal != NULL) {
3665 ASSERT(!literal->handle()->IsSmi()); 3661 ASSERT(!literal->handle()->IsSmi());
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3759 if (node->is_compound()) { 3755 if (node->is_compound()) {
3760 // For a compound assignment the right-hand side is a binary operation 3756 // For a compound assignment the right-hand side is a binary operation
3761 // between the current property value and the actual right-hand side. 3757 // between the current property value and the actual right-hand side.
3762 // Duplicate receiver and key for loading the current property value. 3758 // Duplicate receiver and key for loading the current property value.
3763 frame_->Dup2(); 3759 frame_->Dup2();
3764 EmitKeyedLoad(); 3760 EmitKeyedLoad();
3765 frame_->EmitPush(r0); 3761 frame_->EmitPush(r0);
3766 3762
3767 // Perform the binary operation. 3763 // Perform the binary operation.
3768 Literal* literal = node->value()->AsLiteral(); 3764 Literal* literal = node->value()->AsLiteral();
3769 bool overwrite_value = 3765 bool overwrite_value = node->value()->ResultOverwriteAllowed();
3770 (node->value()->AsBinaryOperation() != NULL &&
3771 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
3772 if (literal != NULL && literal->handle()->IsSmi()) { 3766 if (literal != NULL && literal->handle()->IsSmi()) {
3773 SmiOperation(node->binary_op(), 3767 SmiOperation(node->binary_op(),
3774 literal->handle(), 3768 literal->handle(),
3775 false, 3769 false,
3776 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 3770 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
3777 } else { 3771 } else {
3778 GenerateInlineSmi inline_smi = 3772 GenerateInlineSmi inline_smi =
3779 loop_nesting() > 0 ? GENERATE_INLINE_SMI : DONT_GENERATE_INLINE_SMI; 3773 loop_nesting() > 0 ? GENERATE_INLINE_SMI : DONT_GENERATE_INLINE_SMI;
3780 if (literal != NULL) { 3774 if (literal != NULL) {
3781 ASSERT(!literal->handle()->IsSmi()); 3775 ASSERT(!literal->handle()->IsSmi());
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
5748 } 5742 }
5749 5743
5750 } else if (op == Token::TYPEOF) { 5744 } else if (op == Token::TYPEOF) {
5751 // Special case for loading the typeof expression; see comment on 5745 // Special case for loading the typeof expression; see comment on
5752 // LoadTypeofExpression(). 5746 // LoadTypeofExpression().
5753 LoadTypeofExpression(node->expression()); 5747 LoadTypeofExpression(node->expression());
5754 frame_->CallRuntime(Runtime::kTypeof, 1); 5748 frame_->CallRuntime(Runtime::kTypeof, 1);
5755 frame_->EmitPush(r0); // r0 has result 5749 frame_->EmitPush(r0); // r0 has result
5756 5750
5757 } else { 5751 } else {
5758 bool can_overwrite = 5752 bool can_overwrite = node->expression()->ResultOverwriteAllowed();
5759 (node->expression()->AsBinaryOperation() != NULL &&
5760 node->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
5761 UnaryOverwriteMode overwrite = 5753 UnaryOverwriteMode overwrite =
5762 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; 5754 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
5763 5755
5764 bool no_negative_zero = node->expression()->no_negative_zero(); 5756 bool no_negative_zero = node->expression()->no_negative_zero();
5765 Load(node->expression()); 5757 Load(node->expression());
5766 switch (op) { 5758 switch (op) {
5767 case Token::NOT: 5759 case Token::NOT:
5768 case Token::DELETE: 5760 case Token::DELETE:
5769 case Token::TYPEOF: 5761 case Token::TYPEOF:
5770 UNREACHABLE(); // handled above 5762 UNREACHABLE(); // handled above
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
6074 6066
6075 if (node->op() == Token::AND || node->op() == Token::OR) { 6067 if (node->op() == Token::AND || node->op() == Token::OR) {
6076 GenerateLogicalBooleanOperation(node); 6068 GenerateLogicalBooleanOperation(node);
6077 } else { 6069 } else {
6078 // Optimize for the case where (at least) one of the expressions 6070 // Optimize for the case where (at least) one of the expressions
6079 // is a literal small integer. 6071 // is a literal small integer.
6080 Literal* lliteral = node->left()->AsLiteral(); 6072 Literal* lliteral = node->left()->AsLiteral();
6081 Literal* rliteral = node->right()->AsLiteral(); 6073 Literal* rliteral = node->right()->AsLiteral();
6082 // NOTE: The code below assumes that the slow cases (calls to runtime) 6074 // NOTE: The code below assumes that the slow cases (calls to runtime)
6083 // never return a constant/immutable object. 6075 // never return a constant/immutable object.
6084 bool overwrite_left = 6076 bool overwrite_left = node->left()->ResultOverwriteAllowed();
6085 (node->left()->AsBinaryOperation() != NULL && 6077 bool overwrite_right = node->right()->ResultOverwriteAllowed();
6086 node->left()->AsBinaryOperation()->ResultOverwriteAllowed());
6087 bool overwrite_right =
6088 (node->right()->AsBinaryOperation() != NULL &&
6089 node->right()->AsBinaryOperation()->ResultOverwriteAllowed());
6090 6078
6091 if (rliteral != NULL && rliteral->handle()->IsSmi()) { 6079 if (rliteral != NULL && rliteral->handle()->IsSmi()) {
6092 VirtualFrame::RegisterAllocationScope scope(this); 6080 VirtualFrame::RegisterAllocationScope scope(this);
6093 Load(node->left()); 6081 Load(node->left());
6094 if (frame_->KnownSmiAt(0)) overwrite_left = false; 6082 if (frame_->KnownSmiAt(0)) overwrite_left = false;
6095 SmiOperation(node->op(), 6083 SmiOperation(node->op(),
6096 rliteral->handle(), 6084 rliteral->handle(),
6097 false, 6085 false,
6098 overwrite_left ? OVERWRITE_LEFT : NO_OVERWRITE); 6086 overwrite_left ? OVERWRITE_LEFT : NO_OVERWRITE);
6099 } else if (lliteral != NULL && lliteral->handle()->IsSmi()) { 6087 } else if (lliteral != NULL && lliteral->handle()->IsSmi()) {
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
7095 BinaryOpIC::GetName(runtime_operands_type_)); 7083 BinaryOpIC::GetName(runtime_operands_type_));
7096 return name_; 7084 return name_;
7097 } 7085 }
7098 7086
7099 7087
7100 #undef __ 7088 #undef __
7101 7089
7102 } } // namespace v8::internal 7090 } } // namespace v8::internal
7103 7091
7104 #endif // V8_TARGET_ARCH_ARM 7092 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698