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

Side by Side Diff: src/x64/codegen-x64.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 | « src/x64/code-stubs-x64.h ('k') | src/x64/full-codegen-x64.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 4991 matching lines...) Expand 10 before | Expand all | Expand 10 after
5002 ASSERT(slot != NULL); 5002 ASSERT(slot != NULL);
5003 5003
5004 // Evaluate the right-hand side. 5004 // Evaluate the right-hand side.
5005 if (node->is_compound()) { 5005 if (node->is_compound()) {
5006 // For a compound assignment the right-hand side is a binary operation 5006 // For a compound assignment the right-hand side is a binary operation
5007 // between the current property value and the actual right-hand side. 5007 // between the current property value and the actual right-hand side.
5008 LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF); 5008 LoadFromSlotCheckForArguments(slot, NOT_INSIDE_TYPEOF);
5009 Load(node->value()); 5009 Load(node->value());
5010 5010
5011 // Perform the binary operation. 5011 // Perform the binary operation.
5012 bool overwrite_value = 5012 bool overwrite_value = node->value()->ResultOverwriteAllowed();
5013 (node->value()->AsBinaryOperation() != NULL &&
5014 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
5015 // Construct the implicit binary operation. 5013 // Construct the implicit binary operation.
5016 BinaryOperation expr(node); 5014 BinaryOperation expr(node);
5017 GenericBinaryOperation(&expr, 5015 GenericBinaryOperation(&expr,
5018 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 5016 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
5019 } else { 5017 } else {
5020 // For non-compound assignment just load the right-hand side. 5018 // For non-compound assignment just load the right-hand side.
5021 Load(node->value()); 5019 Load(node->value());
5022 } 5020 }
5023 5021
5024 // Perform the assignment. 5022 // Perform the assignment.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
5093 // Freeing rax causes the code generator to load the global into it. 5091 // Freeing rax causes the code generator to load the global into it.
5094 frame_->Spill(rax); 5092 frame_->Spill(rax);
5095 LoadGlobal(); 5093 LoadGlobal();
5096 } else { 5094 } else {
5097 frame()->Dup(); 5095 frame()->Dup();
5098 } 5096 }
5099 Result value = EmitNamedLoad(name, var != NULL); 5097 Result value = EmitNamedLoad(name, var != NULL);
5100 frame()->Push(&value); 5098 frame()->Push(&value);
5101 Load(node->value()); 5099 Load(node->value());
5102 5100
5103 bool overwrite_value = 5101 bool overwrite_value = node->value()->ResultOverwriteAllowed();
5104 (node->value()->AsBinaryOperation() != NULL &&
5105 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
5106 // Construct the implicit binary operation. 5102 // Construct the implicit binary operation.
5107 BinaryOperation expr(node); 5103 BinaryOperation expr(node);
5108 GenericBinaryOperation(&expr, 5104 GenericBinaryOperation(&expr,
5109 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 5105 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
5110 } else { 5106 } else {
5111 // For non-compound assignment just load the right-hand side. 5107 // For non-compound assignment just load the right-hand side.
5112 Load(node->value()); 5108 Load(node->value());
5113 } 5109 }
5114 5110
5115 // Stack layout: 5111 // Stack layout:
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
5195 // For a compound assignment the right-hand side is a binary operation 5191 // For a compound assignment the right-hand side is a binary operation
5196 // between the current property value and the actual right-hand side. 5192 // between the current property value and the actual right-hand side.
5197 // Duplicate receiver and key for loading the current property value. 5193 // Duplicate receiver and key for loading the current property value.
5198 frame()->PushElementAt(1); 5194 frame()->PushElementAt(1);
5199 frame()->PushElementAt(1); 5195 frame()->PushElementAt(1);
5200 Result value = EmitKeyedLoad(); 5196 Result value = EmitKeyedLoad();
5201 frame()->Push(&value); 5197 frame()->Push(&value);
5202 Load(node->value()); 5198 Load(node->value());
5203 5199
5204 // Perform the binary operation. 5200 // Perform the binary operation.
5205 bool overwrite_value = 5201 bool overwrite_value = node->value()->ResultOverwriteAllowed();
5206 (node->value()->AsBinaryOperation() != NULL &&
5207 node->value()->AsBinaryOperation()->ResultOverwriteAllowed());
5208 BinaryOperation expr(node); 5202 BinaryOperation expr(node);
5209 GenericBinaryOperation(&expr, 5203 GenericBinaryOperation(&expr,
5210 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); 5204 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
5211 } else { 5205 } else {
5212 // For non-compound assignment just load the right-hand side. 5206 // For non-compound assignment just load the right-hand side.
5213 Load(node->value()); 5207 Load(node->value());
5214 } 5208 }
5215 5209
5216 // Stack layout: 5210 // Stack layout:
5217 // [tos] : value 5211 // [tos] : value
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
7350 expression->AsLiteral()->IsNull())) { 7344 expression->AsLiteral()->IsNull())) {
7351 // Omit evaluating the value of the primitive literal. 7345 // Omit evaluating the value of the primitive literal.
7352 // It will be discarded anyway, and can have no side effect. 7346 // It will be discarded anyway, and can have no side effect.
7353 frame_->Push(Factory::undefined_value()); 7347 frame_->Push(Factory::undefined_value());
7354 } else { 7348 } else {
7355 Load(node->expression()); 7349 Load(node->expression());
7356 frame_->SetElementAt(0, Factory::undefined_value()); 7350 frame_->SetElementAt(0, Factory::undefined_value());
7357 } 7351 }
7358 7352
7359 } else { 7353 } else {
7360 bool can_overwrite = 7354 bool can_overwrite = node->expression()->ResultOverwriteAllowed();
7361 (node->expression()->AsBinaryOperation() != NULL &&
7362 node->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
7363 UnaryOverwriteMode overwrite = 7355 UnaryOverwriteMode overwrite =
7364 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; 7356 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
7365 bool no_negative_zero = node->expression()->no_negative_zero(); 7357 bool no_negative_zero = node->expression()->no_negative_zero();
7366 Load(node->expression()); 7358 Load(node->expression());
7367 switch (op) { 7359 switch (op) {
7368 case Token::NOT: 7360 case Token::NOT:
7369 case Token::DELETE: 7361 case Token::DELETE:
7370 case Token::TYPEOF: 7362 case Token::TYPEOF:
7371 UNREACHABLE(); // handled above 7363 UNREACHABLE(); // handled above
7372 break; 7364 break;
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
7770 7762
7771 void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) { 7763 void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
7772 Comment cmnt(masm_, "[ BinaryOperation"); 7764 Comment cmnt(masm_, "[ BinaryOperation");
7773 7765
7774 if (node->op() == Token::AND || node->op() == Token::OR) { 7766 if (node->op() == Token::AND || node->op() == Token::OR) {
7775 GenerateLogicalBooleanOperation(node); 7767 GenerateLogicalBooleanOperation(node);
7776 } else { 7768 } else {
7777 // NOTE: The code below assumes that the slow cases (calls to runtime) 7769 // NOTE: The code below assumes that the slow cases (calls to runtime)
7778 // never return a constant/immutable object. 7770 // never return a constant/immutable object.
7779 OverwriteMode overwrite_mode = NO_OVERWRITE; 7771 OverwriteMode overwrite_mode = NO_OVERWRITE;
7780 if (node->left()->AsBinaryOperation() != NULL && 7772 if (node->left()->ResultOverwriteAllowed()) {
7781 node->left()->AsBinaryOperation()->ResultOverwriteAllowed()) {
7782 overwrite_mode = OVERWRITE_LEFT; 7773 overwrite_mode = OVERWRITE_LEFT;
7783 } else if (node->right()->AsBinaryOperation() != NULL && 7774 } else if (node->right()->ResultOverwriteAllowed()) {
7784 node->right()->AsBinaryOperation()->ResultOverwriteAllowed()) {
7785 overwrite_mode = OVERWRITE_RIGHT; 7775 overwrite_mode = OVERWRITE_RIGHT;
7786 } 7776 }
7787 7777
7788 if (node->left()->IsTrivial()) { 7778 if (node->left()->IsTrivial()) {
7789 Load(node->right()); 7779 Load(node->right());
7790 Result right = frame_->Pop(); 7780 Result right = frame_->Pop();
7791 frame_->Push(node->left()); 7781 frame_->Push(node->left());
7792 frame_->Push(&right); 7782 frame_->Push(&right);
7793 } else { 7783 } else {
7794 Load(node->left()); 7784 Load(node->left());
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
8882 #undef __ 8872 #undef __
8883 8873
8884 void RecordWriteStub::Generate(MacroAssembler* masm) { 8874 void RecordWriteStub::Generate(MacroAssembler* masm) {
8885 masm->RecordWriteHelper(object_, addr_, scratch_); 8875 masm->RecordWriteHelper(object_, addr_, scratch_);
8886 masm->ret(0); 8876 masm->ret(0);
8887 } 8877 }
8888 8878
8889 } } // namespace v8::internal 8879 } } // namespace v8::internal
8890 8880
8891 #endif // V8_TARGET_ARCH_X64 8881 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698