OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3413 __ and_(r1, r0, Operand(kSmiTagMask)); | 3413 __ and_(r1, r0, Operand(kSmiTagMask)); |
3414 __ eor(r1, r1, Operand(kSmiTagMask), SetCC); | 3414 __ eor(r1, r1, Operand(kSmiTagMask), SetCC); |
3415 answer.Branch(ne); | 3415 answer.Branch(ne); |
3416 // It is a heap object - get the map. Check if the object is a JS array. | 3416 // It is a heap object - get the map. Check if the object is a JS array. |
3417 __ CompareObjectType(r0, r1, r1, JS_ARRAY_TYPE); | 3417 __ CompareObjectType(r0, r1, r1, JS_ARRAY_TYPE); |
3418 answer.Bind(); | 3418 answer.Bind(); |
3419 cc_reg_ = eq; | 3419 cc_reg_ = eq; |
3420 } | 3420 } |
3421 | 3421 |
3422 | 3422 |
| 3423 void CodeGenerator::GenerateIsRegExp(ZoneList<Expression*>* args) { |
| 3424 VirtualFrame::SpilledScope spilled_scope; |
| 3425 ASSERT(args->length() == 1); |
| 3426 LoadAndSpill(args->at(0)); |
| 3427 JumpTarget answer; |
| 3428 // We need the CC bits to come out as not_equal in the case where the |
| 3429 // object is a smi. This can't be done with the usual test opcode so |
| 3430 // we use XOR to get the right CC bits. |
| 3431 frame_->EmitPop(r0); |
| 3432 __ and_(r1, r0, Operand(kSmiTagMask)); |
| 3433 __ eor(r1, r1, Operand(kSmiTagMask), SetCC); |
| 3434 answer.Branch(ne); |
| 3435 // It is a heap object - get the map. Check if the object is a regexp. |
| 3436 __ CompareObjectType(r0, r1, r1, JS_REGEXP_TYPE); |
| 3437 answer.Bind(); |
| 3438 cc_reg_ = eq; |
| 3439 } |
| 3440 |
| 3441 |
3423 void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) { | 3442 void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) { |
3424 // This generates a fast version of: | 3443 // This generates a fast version of: |
3425 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp') | 3444 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp') |
3426 VirtualFrame::SpilledScope spilled_scope; | 3445 VirtualFrame::SpilledScope spilled_scope; |
3427 ASSERT(args->length() == 1); | 3446 ASSERT(args->length() == 1); |
3428 LoadAndSpill(args->at(0)); | 3447 LoadAndSpill(args->at(0)); |
3429 frame_->EmitPop(r1); | 3448 frame_->EmitPop(r1); |
3430 __ tst(r1, Operand(kSmiTagMask)); | 3449 __ tst(r1, Operand(kSmiTagMask)); |
3431 false_target()->Branch(eq); | 3450 false_target()->Branch(eq); |
3432 | 3451 |
(...skipping 4181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7614 | 7633 |
7615 // Just jump to runtime to add the two strings. | 7634 // Just jump to runtime to add the two strings. |
7616 __ bind(&string_add_runtime); | 7635 __ bind(&string_add_runtime); |
7617 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2, 1); | 7636 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2, 1); |
7618 } | 7637 } |
7619 | 7638 |
7620 | 7639 |
7621 #undef __ | 7640 #undef __ |
7622 | 7641 |
7623 } } // namespace v8::internal | 7642 } } // namespace v8::internal |
OLD | NEW |