| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4328 case Token::TYPEOF: { | 4328 case Token::TYPEOF: { |
| 4329 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 4329 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
| 4330 { StackValueContext context(this); | 4330 { StackValueContext context(this); |
| 4331 VisitForTypeofValue(expr->expression()); | 4331 VisitForTypeofValue(expr->expression()); |
| 4332 } | 4332 } |
| 4333 __ CallRuntime(Runtime::kTypeof, 1); | 4333 __ CallRuntime(Runtime::kTypeof, 1); |
| 4334 context()->Plug(rax); | 4334 context()->Plug(rax); |
| 4335 break; | 4335 break; |
| 4336 } | 4336 } |
| 4337 | 4337 |
| 4338 case Token::BIT_NOT: | |
| 4339 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); | |
| 4340 break; | |
| 4341 | |
| 4342 default: | 4338 default: |
| 4343 UNREACHABLE(); | 4339 UNREACHABLE(); |
| 4344 } | 4340 } |
| 4345 } | 4341 } |
| 4346 | 4342 |
| 4347 | 4343 |
| 4348 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | |
| 4349 const char* comment) { | |
| 4350 ASSERT_EQ(Token::BIT_NOT, expr->op()); | |
| 4351 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | |
| 4352 Comment cmt(masm_, comment); | |
| 4353 UnaryOpStub stub(expr->op()); | |
| 4354 // UnaryOpStub expects the argument to be in the | |
| 4355 // accumulator register rax. | |
| 4356 VisitForAccumulatorValue(expr->expression()); | |
| 4357 SetSourcePosition(expr->position()); | |
| 4358 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | |
| 4359 expr->UnaryOperationFeedbackId()); | |
| 4360 context()->Plug(rax); | |
| 4361 } | |
| 4362 | |
| 4363 | |
| 4364 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4344 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 4365 Comment cmnt(masm_, "[ CountOperation"); | 4345 Comment cmnt(masm_, "[ CountOperation"); |
| 4366 SetSourcePosition(expr->position()); | 4346 SetSourcePosition(expr->position()); |
| 4367 | 4347 |
| 4368 // Invalid left-hand-sides are rewritten to have a 'throw | 4348 // Invalid left-hand-sides are rewritten to have a 'throw |
| 4369 // ReferenceError' as the left-hand side. | 4349 // ReferenceError' as the left-hand side. |
| 4370 if (!expr->expression()->IsValidLeftHandSide()) { | 4350 if (!expr->expression()->IsValidLeftHandSide()) { |
| 4371 VisitForEffect(expr->expression()); | 4351 VisitForEffect(expr->expression()); |
| 4372 return; | 4352 return; |
| 4373 } | 4353 } |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4902 *context_length = 0; | 4882 *context_length = 0; |
| 4903 return previous_; | 4883 return previous_; |
| 4904 } | 4884 } |
| 4905 | 4885 |
| 4906 | 4886 |
| 4907 #undef __ | 4887 #undef __ |
| 4908 | 4888 |
| 4909 } } // namespace v8::internal | 4889 } } // namespace v8::internal |
| 4910 | 4890 |
| 4911 #endif // V8_TARGET_ARCH_X64 | 4891 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |