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