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 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3620 Condition is_smi = masm_->CheckSmi(value.reg()); | 3620 Condition is_smi = masm_->CheckSmi(value.reg()); |
3621 destination()->false_target()->Branch(is_smi); | 3621 destination()->false_target()->Branch(is_smi); |
3622 // It is a heap object - get map. | 3622 // It is a heap object - get map. |
3623 // Check if the object is a JS array or not. | 3623 // Check if the object is a JS array or not. |
3624 __ CmpObjectType(value.reg(), JS_ARRAY_TYPE, kScratchRegister); | 3624 __ CmpObjectType(value.reg(), JS_ARRAY_TYPE, kScratchRegister); |
3625 value.Unuse(); | 3625 value.Unuse(); |
3626 destination()->Split(equal); | 3626 destination()->Split(equal); |
3627 } | 3627 } |
3628 | 3628 |
3629 | 3629 |
| 3630 void CodeGenerator::GenerateIsRegExp(ZoneList<Expression*>* args) { |
| 3631 ASSERT(args->length() == 1); |
| 3632 Load(args->at(0)); |
| 3633 Result value = frame_->Pop(); |
| 3634 value.ToRegister(); |
| 3635 ASSERT(value.is_valid()); |
| 3636 Condition is_smi = masm_->CheckSmi(value.reg()); |
| 3637 destination()->false_target()->Branch(is_smi); |
| 3638 // It is a heap object - get map. |
| 3639 // Check if the object is a regexp. |
| 3640 __ CmpObjectType(value.reg(), JS_REGEXP_TYPE, kScratchRegister); |
| 3641 value.Unuse(); |
| 3642 destination()->Split(equal); |
| 3643 } |
| 3644 |
| 3645 |
3630 void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) { | 3646 void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) { |
3631 // This generates a fast version of: | 3647 // This generates a fast version of: |
3632 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp') | 3648 // (typeof(arg) === 'object' || %_ClassOf(arg) == 'RegExp') |
3633 ASSERT(args->length() == 1); | 3649 ASSERT(args->length() == 1); |
3634 Load(args->at(0)); | 3650 Load(args->at(0)); |
3635 Result obj = frame_->Pop(); | 3651 Result obj = frame_->Pop(); |
3636 obj.ToRegister(); | 3652 obj.ToRegister(); |
3637 Condition is_smi = masm_->CheckSmi(obj.reg()); | 3653 Condition is_smi = masm_->CheckSmi(obj.reg()); |
3638 destination()->false_target()->Branch(is_smi); | 3654 destination()->false_target()->Branch(is_smi); |
3639 | 3655 |
(...skipping 5834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9474 // Call the function from C++. | 9490 // Call the function from C++. |
9475 return FUNCTION_CAST<ModuloFunction>(buffer); | 9491 return FUNCTION_CAST<ModuloFunction>(buffer); |
9476 } | 9492 } |
9477 | 9493 |
9478 #endif | 9494 #endif |
9479 | 9495 |
9480 | 9496 |
9481 #undef __ | 9497 #undef __ |
9482 | 9498 |
9483 } } // namespace v8::internal | 9499 } } // namespace v8::internal |
OLD | NEW |