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 4331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4342 case Token::TYPEOF: { | 4342 case Token::TYPEOF: { |
4343 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 4343 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
4344 { StackValueContext context(this); | 4344 { StackValueContext context(this); |
4345 VisitForTypeofValue(expr->expression()); | 4345 VisitForTypeofValue(expr->expression()); |
4346 } | 4346 } |
4347 __ CallRuntime(Runtime::kTypeof, 1); | 4347 __ CallRuntime(Runtime::kTypeof, 1); |
4348 context()->Plug(r0); | 4348 context()->Plug(r0); |
4349 break; | 4349 break; |
4350 } | 4350 } |
4351 | 4351 |
4352 case Token::SUB: | |
4353 EmitUnaryOperation(expr, "[ UnaryOperation (SUB)"); | |
4354 break; | |
4355 | |
4356 case Token::BIT_NOT: | 4352 case Token::BIT_NOT: |
4357 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); | 4353 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); |
4358 break; | 4354 break; |
4359 | 4355 |
4360 default: | 4356 default: |
4361 UNREACHABLE(); | 4357 UNREACHABLE(); |
4362 } | 4358 } |
4363 } | 4359 } |
4364 | 4360 |
4365 | 4361 |
4366 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | 4362 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
4367 const char* comment) { | 4363 const char* comment) { |
| 4364 ASSERT_EQ(Token::BIT_NOT, expr->op()); |
4368 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | 4365 // TODO(svenpanne): Allowing format strings in Comment would be nice here... |
4369 Comment cmt(masm_, comment); | 4366 Comment cmt(masm_, comment); |
4370 UnaryOpStub stub(expr->op()); | 4367 UnaryOpStub stub(expr->op()); |
4371 // UnaryOpStub expects the argument to be in the | 4368 // UnaryOpStub expects the argument to be in the |
4372 // accumulator register r0. | 4369 // accumulator register r0. |
4373 VisitForAccumulatorValue(expr->expression()); | 4370 VisitForAccumulatorValue(expr->expression()); |
4374 SetSourcePosition(expr->position()); | 4371 SetSourcePosition(expr->position()); |
4375 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 4372 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
4376 expr->UnaryOperationFeedbackId()); | 4373 expr->UnaryOperationFeedbackId()); |
4377 context()->Plug(r0); | 4374 context()->Plug(r0); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4915 *context_length = 0; | 4912 *context_length = 0; |
4916 return previous_; | 4913 return previous_; |
4917 } | 4914 } |
4918 | 4915 |
4919 | 4916 |
4920 #undef __ | 4917 #undef __ |
4921 | 4918 |
4922 } } // namespace v8::internal | 4919 } } // namespace v8::internal |
4923 | 4920 |
4924 #endif // V8_TARGET_ARCH_ARM | 4921 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |