| 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::BIT_NOT: | |
| 4353 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); | |
| 4354 break; | |
| 4355 | |
| 4356 default: | 4352 default: |
| 4357 UNREACHABLE(); | 4353 UNREACHABLE(); |
| 4358 } | 4354 } |
| 4359 } | 4355 } |
| 4360 | 4356 |
| 4361 | 4357 |
| 4362 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | |
| 4363 const char* comment) { | |
| 4364 ASSERT_EQ(Token::BIT_NOT, expr->op()); | |
| 4365 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | |
| 4366 Comment cmt(masm_, comment); | |
| 4367 UnaryOpStub stub(expr->op()); | |
| 4368 // UnaryOpStub expects the argument to be in the | |
| 4369 // accumulator register r0. | |
| 4370 VisitForAccumulatorValue(expr->expression()); | |
| 4371 SetSourcePosition(expr->position()); | |
| 4372 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | |
| 4373 expr->UnaryOperationFeedbackId()); | |
| 4374 context()->Plug(r0); | |
| 4375 } | |
| 4376 | |
| 4377 | |
| 4378 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4358 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 4379 Comment cmnt(masm_, "[ CountOperation"); | 4359 Comment cmnt(masm_, "[ CountOperation"); |
| 4380 SetSourcePosition(expr->position()); | 4360 SetSourcePosition(expr->position()); |
| 4381 | 4361 |
| 4382 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 4362 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
| 4383 // as the left-hand side. | 4363 // as the left-hand side. |
| 4384 if (!expr->expression()->IsValidLeftHandSide()) { | 4364 if (!expr->expression()->IsValidLeftHandSide()) { |
| 4385 VisitForEffect(expr->expression()); | 4365 VisitForEffect(expr->expression()); |
| 4386 return; | 4366 return; |
| 4387 } | 4367 } |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4912 *context_length = 0; | 4892 *context_length = 0; |
| 4913 return previous_; | 4893 return previous_; |
| 4914 } | 4894 } |
| 4915 | 4895 |
| 4916 | 4896 |
| 4917 #undef __ | 4897 #undef __ |
| 4918 | 4898 |
| 4919 } } // namespace v8::internal | 4899 } } // namespace v8::internal |
| 4920 | 4900 |
| 4921 #endif // V8_TARGET_ARCH_ARM | 4901 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |