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::BIT_NOT: | |
4386 EmitUnaryOperation(expr, "[ UnaryOperation (BIT_NOT)"); | |
4387 break; | |
4388 | |
4389 default: | 4385 default: |
4390 UNREACHABLE(); | 4386 UNREACHABLE(); |
4391 } | 4387 } |
4392 } | 4388 } |
4393 | 4389 |
4394 | 4390 |
4395 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | |
4396 const char* comment) { | |
4397 ASSERT_EQ(Token::BIT_NOT, expr->op()); | |
4398 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | |
4399 Comment cmt(masm_, comment); | |
4400 UnaryOpStub stub(expr->op()); | |
4401 // GenericUnaryOpStub expects the argument to be in a0. | |
4402 VisitForAccumulatorValue(expr->expression()); | |
4403 SetSourcePosition(expr->position()); | |
4404 __ mov(a0, result_register()); | |
4405 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | |
4406 expr->UnaryOperationFeedbackId()); | |
4407 context()->Plug(v0); | |
4408 } | |
4409 | |
4410 | |
4411 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4391 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
4412 Comment cmnt(masm_, "[ CountOperation"); | 4392 Comment cmnt(masm_, "[ CountOperation"); |
4413 SetSourcePosition(expr->position()); | 4393 SetSourcePosition(expr->position()); |
4414 | 4394 |
4415 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 4395 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
4416 // as the left-hand side. | 4396 // as the left-hand side. |
4417 if (!expr->expression()->IsValidLeftHandSide()) { | 4397 if (!expr->expression()->IsValidLeftHandSide()) { |
4418 VisitForEffect(expr->expression()); | 4398 VisitForEffect(expr->expression()); |
4419 return; | 4399 return; |
4420 } | 4400 } |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4944 *context_length = 0; | 4924 *context_length = 0; |
4945 return previous_; | 4925 return previous_; |
4946 } | 4926 } |
4947 | 4927 |
4948 | 4928 |
4949 #undef __ | 4929 #undef __ |
4950 | 4930 |
4951 } } // namespace v8::internal | 4931 } } // namespace v8::internal |
4952 | 4932 |
4953 #endif // V8_TARGET_ARCH_MIPS | 4933 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |