| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 3477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3488 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset), | 3488 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset), |
| 3489 Immediate(1 << Map::kIsUndetectable)); | 3489 Immediate(1 << Map::kIsUndetectable)); |
| 3490 answer.Unuse(); | 3490 answer.Unuse(); |
| 3491 destination()->Split(not_zero); | 3491 destination()->Split(not_zero); |
| 3492 | 3492 |
| 3493 } else if (check->Equals(Heap::function_symbol())) { | 3493 } else if (check->Equals(Heap::function_symbol())) { |
| 3494 Condition is_smi = masm_->CheckSmi(answer.reg()); | 3494 Condition is_smi = masm_->CheckSmi(answer.reg()); |
| 3495 destination()->false_target()->Branch(is_smi); | 3495 destination()->false_target()->Branch(is_smi); |
| 3496 frame_->Spill(answer.reg()); | 3496 frame_->Spill(answer.reg()); |
| 3497 __ CmpObjectType(answer.reg(), JS_FUNCTION_TYPE, answer.reg()); | 3497 __ CmpObjectType(answer.reg(), JS_FUNCTION_TYPE, answer.reg()); |
| 3498 destination()->true_target()->Branch(equal); |
| 3499 // Regular expressions are callable so typeof == 'function'. |
| 3500 __ CmpInstanceType(answer.reg(), JS_REGEXP_TYPE); |
| 3498 answer.Unuse(); | 3501 answer.Unuse(); |
| 3499 destination()->Split(equal); | 3502 destination()->Split(equal); |
| 3500 | 3503 |
| 3501 } else if (check->Equals(Heap::object_symbol())) { | 3504 } else if (check->Equals(Heap::object_symbol())) { |
| 3502 Condition is_smi = masm_->CheckSmi(answer.reg()); | 3505 Condition is_smi = masm_->CheckSmi(answer.reg()); |
| 3503 destination()->false_target()->Branch(is_smi); | 3506 destination()->false_target()->Branch(is_smi); |
| 3504 __ CompareRoot(answer.reg(), Heap::kNullValueRootIndex); | 3507 __ CompareRoot(answer.reg(), Heap::kNullValueRootIndex); |
| 3505 destination()->true_target()->Branch(equal); | 3508 destination()->true_target()->Branch(equal); |
| 3506 | 3509 |
| 3510 // Regular expressions are typeof == 'function', not 'object'. |
| 3511 __ CmpObjectType(answer.reg(), JS_REGEXP_TYPE, kScratchRegister); |
| 3512 destination()->false_target()->Branch(equal); |
| 3513 |
| 3507 // It can be an undetectable object. | 3514 // It can be an undetectable object. |
| 3508 __ movq(kScratchRegister, | |
| 3509 FieldOperand(answer.reg(), HeapObject::kMapOffset)); | |
| 3510 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset), | 3515 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset), |
| 3511 Immediate(1 << Map::kIsUndetectable)); | 3516 Immediate(1 << Map::kIsUndetectable)); |
| 3512 destination()->false_target()->Branch(not_zero); | 3517 destination()->false_target()->Branch(not_zero); |
| 3513 __ CmpInstanceType(kScratchRegister, FIRST_JS_OBJECT_TYPE); | 3518 __ CmpInstanceType(kScratchRegister, FIRST_JS_OBJECT_TYPE); |
| 3514 destination()->false_target()->Branch(below); | 3519 destination()->false_target()->Branch(below); |
| 3515 __ CmpInstanceType(kScratchRegister, LAST_JS_OBJECT_TYPE); | 3520 __ CmpInstanceType(kScratchRegister, LAST_JS_OBJECT_TYPE); |
| 3516 answer.Unuse(); | 3521 answer.Unuse(); |
| 3517 destination()->Split(below_equal); | 3522 destination()->Split(below_equal); |
| 3518 } else { | 3523 } else { |
| 3519 // Uncommon case: typeof testing against a string literal that is | 3524 // Uncommon case: typeof testing against a string literal that is |
| (...skipping 4322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7842 masm.GetCode(&desc); | 7847 masm.GetCode(&desc); |
| 7843 // Call the function from C++. | 7848 // Call the function from C++. |
| 7844 return FUNCTION_CAST<ModuloFunction>(buffer); | 7849 return FUNCTION_CAST<ModuloFunction>(buffer); |
| 7845 } | 7850 } |
| 7846 | 7851 |
| 7847 #endif | 7852 #endif |
| 7848 | 7853 |
| 7849 #undef __ | 7854 #undef __ |
| 7850 | 7855 |
| 7851 } } // namespace v8::internal | 7856 } } // namespace v8::internal |
| OLD | NEW |