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