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 4364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4375 case Token::TYPEOF: { | 4375 case Token::TYPEOF: { |
4376 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 4376 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
4377 { StackValueContext context(this); | 4377 { StackValueContext context(this); |
4378 VisitForTypeofValue(expr->expression()); | 4378 VisitForTypeofValue(expr->expression()); |
4379 } | 4379 } |
4380 __ CallRuntime(Runtime::kTypeof, 1); | 4380 __ CallRuntime(Runtime::kTypeof, 1); |
4381 context()->Plug(v0); | 4381 context()->Plug(v0); |
4382 break; | 4382 break; |
4383 } | 4383 } |
4384 | 4384 |
4385 case Token::SUB: | |
4386 EmitUnaryOperation(expr, "[ UnaryOperation (SUB)"); | |
4387 break; | |
4388 | |
4389 case Token::BIT_NOT: | 4385 case Token::BIT_NOT: |
4390 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); | 4386 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); |
4391 break; | 4387 break; |
4392 | 4388 |
4393 default: | 4389 default: |
4394 UNREACHABLE(); | 4390 UNREACHABLE(); |
4395 } | 4391 } |
4396 } | 4392 } |
4397 | 4393 |
4398 | 4394 |
4399 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | 4395 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
4400 const char* comment) { | 4396 const char* comment) { |
| 4397 ASSERT_EQ(Token::BIT_NOT, expr->op()); |
4401 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | 4398 // TODO(svenpanne): Allowing format strings in Comment would be nice here... |
4402 Comment cmt(masm_, comment); | 4399 Comment cmt(masm_, comment); |
4403 UnaryOpStub stub(expr->op()); | 4400 UnaryOpStub stub(expr->op()); |
4404 // GenericUnaryOpStub expects the argument to be in a0. | 4401 // GenericUnaryOpStub expects the argument to be in a0. |
4405 VisitForAccumulatorValue(expr->expression()); | 4402 VisitForAccumulatorValue(expr->expression()); |
4406 SetSourcePosition(expr->position()); | 4403 SetSourcePosition(expr->position()); |
4407 __ mov(a0, result_register()); | 4404 __ mov(a0, result_register()); |
4408 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 4405 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
4409 expr->UnaryOperationFeedbackId()); | 4406 expr->UnaryOperationFeedbackId()); |
4410 context()->Plug(v0); | 4407 context()->Plug(v0); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4947 *context_length = 0; | 4944 *context_length = 0; |
4948 return previous_; | 4945 return previous_; |
4949 } | 4946 } |
4950 | 4947 |
4951 | 4948 |
4952 #undef __ | 4949 #undef __ |
4953 | 4950 |
4954 } } // namespace v8::internal | 4951 } } // namespace v8::internal |
4955 | 4952 |
4956 #endif // V8_TARGET_ARCH_MIPS | 4953 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |