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

Side by Side Diff: src/ia32/codegen-ia32.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, 4 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/code-stubs-ia32.h ('k') | src/ia32/full-codegen-ia32.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 5674 matching lines...) Expand 10 before | Expand all | Expand 10 after
5685 ASSERT(slot != NULL); 5685 ASSERT(slot != NULL);
5686 5686
5687 // Evaluate the right-hand side. 5687 // Evaluate the right-hand side.
5688 if (node->is_compound()) { 5688 if (node->is_compound()) {
5689 // For a compound assignment the right-hand side is a binary operation 5689 // For a compound assignment the right-hand side is a binary operation
5690 // between the current property value and the actual right-hand side. 5690 // between the current property value and the actual right-hand side.
5691 LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF); 5691 LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
5692 Load(node->value()); 5692 Load(node->value());
5693 5693
5694 // Perform the binary operation. 5694 // Perform the binary operation.
5695 bool overwrite_value = 5695 bool overwrite_value = node->value()->ResultOverwriteAllowed();
5696 (node->value()->AsBinaryOperation() != NULL &&
5697 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
5698 // Construct the implicit binary operation. 5696 // Construct the implicit binary operation.
5699 BinaryOperation expr(node); 5697 BinaryOperation expr(node);
5700 GenericBinaryOperation(&expr, 5698 GenericBinaryOperation(&expr,
5701 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 5699 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
5702 } else { 5700 } else {
5703 // For non-compound assignment just load the right-hand side. 5701 // For non-compound assignment just load the right-hand side.
5704 Load(node->value()); 5702 Load(node->value());
5705 } 5703 }
5706 5704
5707 // Perform the assignment. 5705 // Perform the assignment.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
5776 // Freeing eax causes the code generator to load the global into it. 5774 // Freeing eax causes the code generator to load the global into it.
5777 frame_->Spill(eax); 5775 frame_->Spill(eax);
5778 LoadGlobal(); 5776 LoadGlobal();
5779 } else { 5777 } else {
5780 frame()->Dup(); 5778 frame()->Dup();
5781 } 5779 }
5782 Result value = EmitNamedLoad(name, var != NULL); 5780 Result value = EmitNamedLoad(name, var != NULL);
5783 frame()->Push(&value); 5781 frame()->Push(&value);
5784 Load(node->value()); 5782 Load(node->value());
5785 5783
5786 bool overwrite_value = 5784 bool overwrite_value = node->value()->ResultOverwriteAllowed();
5787 (node->value()->AsBinaryOperation() != NULL &&
5788 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
5789 // Construct the implicit binary operation. 5785 // Construct the implicit binary operation.
5790 BinaryOperation expr(node); 5786 BinaryOperation expr(node);
5791 GenericBinaryOperation(&expr, 5787 GenericBinaryOperation(&expr,
5792 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 5788 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
5793 } else { 5789 } else {
5794 // For non-compound assignment just load the right-hand side. 5790 // For non-compound assignment just load the right-hand side.
5795 Load(node->value()); 5791 Load(node->value());
5796 } 5792 }
5797 5793
5798 // Stack layout: 5794 // Stack layout:
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
5878 // For a compound assignment the right-hand side is a binary operation 5874 // For a compound assignment the right-hand side is a binary operation
5879 // between the current property value and the actual right-hand side. 5875 // between the current property value and the actual right-hand side.
5880 // Duplicate receiver and key for loading the current property value. 5876 // Duplicate receiver and key for loading the current property value.
5881 frame()->PushElementAt(1); 5877 frame()->PushElementAt(1);
5882 frame()->PushElementAt(1); 5878 frame()->PushElementAt(1);
5883 Result value = EmitKeyedLoad(); 5879 Result value = EmitKeyedLoad();
5884 frame()->Push(&value); 5880 frame()->Push(&value);
5885 Load(node->value()); 5881 Load(node->value());
5886 5882
5887 // Perform the binary operation. 5883 // Perform the binary operation.
5888 bool overwrite_value = 5884 bool overwrite_value = node->value()->ResultOverwriteAllowed();
5889 (node->value()->AsBinaryOperation() != NULL &&
5890 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
5891 BinaryOperation expr(node); 5885 BinaryOperation expr(node);
5892 GenericBinaryOperation(&expr, 5886 GenericBinaryOperation(&expr,
5893 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 5887 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
5894 } else { 5888 } else {
5895 // For non-compound assignment just load the right-hand side. 5889 // For non-compound assignment just load the right-hand side.
5896 Load(node->value()); 5890 Load(node->value());
5897 } 5891 }
5898 5892
5899 // Stack layout: 5893 // Stack layout:
5900 // [tos] : value 5894 // [tos] : value
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
8080 // Unary plus has no effect on int32 values. 8074 // Unary plus has no effect on int32 values.
8081 break; 8075 break;
8082 } 8076 }
8083 default: 8077 default:
8084 UNREACHABLE(); 8078 UNREACHABLE();
8085 break; 8079 break;
8086 } 8080 }
8087 frame_->Push(&value); 8081 frame_->Push(&value);
8088 } else { 8082 } else {
8089 Load(node->expression()); 8083 Load(node->expression());
8090 bool can_overwrite = 8084 bool can_overwrite = node->expression()->ResultOverwriteAllowed();
8091 (node->expression()->AsBinaryOperation() != NULL &&
8092 node->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
8093 UnaryOverwriteMode overwrite = 8085 UnaryOverwriteMode overwrite =
8094 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; 8086 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
8095 bool no_negative_zero = node->expression()->no_negative_zero(); 8087 bool no_negative_zero = node->expression()->no_negative_zero();
8096 switch (op) { 8088 switch (op) {
8097 case Token::NOT: 8089 case Token::NOT:
8098 case Token::DELETE: 8090 case Token::DELETE:
8099 case Token::TYPEOF: 8091 case Token::TYPEOF:
8100 UNREACHABLE(); // handled above 8092 UNREACHABLE(); // handled above
8101 break; 8093 break;
8102 8094
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
8787 if (node->op() == Token::AND || node->op() == Token::OR) { 8779 if (node->op() == Token::AND || node->op() == Token::OR) {
8788 GenerateLogicalBooleanOperation(node); 8780 GenerateLogicalBooleanOperation(node);
8789 } else if (in_safe_int32_mode()) { 8781 } else if (in_safe_int32_mode()) {
8790 Visit(node->left()); 8782 Visit(node->left());
8791 Visit(node->right()); 8783 Visit(node->right());
8792 Int32BinaryOperation(node); 8784 Int32BinaryOperation(node);
8793 } else { 8785 } else {
8794 // NOTE: The code below assumes that the slow cases (calls to runtime) 8786 // NOTE: The code below assumes that the slow cases (calls to runtime)
8795 // never return a constant/immutable object. 8787 // never return a constant/immutable object.
8796 OverwriteMode overwrite_mode = NO_OVERWRITE; 8788 OverwriteMode overwrite_mode = NO_OVERWRITE;
8797 if (node->left()->AsBinaryOperation() != NULL && 8789 if (node->left()->ResultOverwriteAllowed()) {
8798 node->left()->AsBinaryOperation()->ResultOverwriteAllowed()) {
8799 overwrite_mode = OVERWRITE_LEFT; 8790 overwrite_mode = OVERWRITE_LEFT;
8800 } else if (node->right()->AsBinaryOperation() != NULL && 8791 } else if (node->right()->ResultOverwriteAllowed()) {
8801 node->right()->AsBinaryOperation()->ResultOverwriteAllowed()) {
8802 overwrite_mode = OVERWRITE_RIGHT; 8792 overwrite_mode = OVERWRITE_RIGHT;
8803 } 8793 }
8804 8794
8805 if (node->left()->IsTrivial()) { 8795 if (node->left()->IsTrivial()) {
8806 Load(node->right()); 8796 Load(node->right());
8807 Result right = frame_->Pop(); 8797 Result right = frame_->Pop();
8808 frame_->Push(node->left()); 8798 frame_->Push(node->left());
8809 frame_->Push(&right); 8799 frame_->Push(&right);
8810 } else { 8800 } else {
8811 Load(node->left()); 8801 Load(node->left());
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
10008 masm.GetCode(&desc); 9998 masm.GetCode(&desc);
10009 // Call the function from C++. 9999 // Call the function from C++.
10010 return FUNCTION_CAST<MemCopyFunction>(buffer); 10000 return FUNCTION_CAST<MemCopyFunction>(buffer);
10011 } 10001 }
10012 10002
10013 #undef __ 10003 #undef __
10014 10004
10015 } } // namespace v8::internal 10005 } } // namespace v8::internal
10016 10006
10017 #endif // V8_TARGET_ARCH_IA32 10007 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698