OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 5506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5517 Label* false_label, | 5517 Label* false_label, |
5518 Register input, | 5518 Register input, |
5519 Handle<String> type_name, | 5519 Handle<String> type_name, |
5520 Register& cmp1, | 5520 Register& cmp1, |
5521 Operand& cmp2) { | 5521 Operand& cmp2) { |
5522 // This function utilizes the delay slot heavily. This is used to load | 5522 // This function utilizes the delay slot heavily. This is used to load |
5523 // values that are always usable without depending on the type of the input | 5523 // values that are always usable without depending on the type of the input |
5524 // register. | 5524 // register. |
5525 Condition final_branch_condition = kNoCondition; | 5525 Condition final_branch_condition = kNoCondition; |
5526 Register scratch = scratch0(); | 5526 Register scratch = scratch0(); |
5527 if (type_name->Equals(heap()->number_string())) { | 5527 Factory* factory = isolate()->factory();facto |
| 5528 if (String::Equals(type_name, factory->number_string())) { |
5528 __ JumpIfSmi(input, true_label); | 5529 __ JumpIfSmi(input, true_label); |
5529 __ lw(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 5530 __ lw(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
5530 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 5531 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); |
5531 cmp1 = input; | 5532 cmp1 = input; |
5532 cmp2 = Operand(at); | 5533 cmp2 = Operand(at); |
5533 final_branch_condition = eq; | 5534 final_branch_condition = eq; |
5534 | 5535 |
5535 } else if (type_name->Equals(heap()->string_string())) { | 5536 } else if (String::Equals(type_name, factory->string_string())) { |
5536 __ JumpIfSmi(input, false_label); | 5537 __ JumpIfSmi(input, false_label); |
5537 __ GetObjectType(input, input, scratch); | 5538 __ GetObjectType(input, input, scratch); |
5538 __ Branch(USE_DELAY_SLOT, false_label, | 5539 __ Branch(USE_DELAY_SLOT, false_label, |
5539 ge, scratch, Operand(FIRST_NONSTRING_TYPE)); | 5540 ge, scratch, Operand(FIRST_NONSTRING_TYPE)); |
5540 // input is an object so we can load the BitFieldOffset even if we take the | 5541 // input is an object so we can load the BitFieldOffset even if we take the |
5541 // other branch. | 5542 // other branch. |
5542 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); | 5543 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); |
5543 __ And(at, at, 1 << Map::kIsUndetectable); | 5544 __ And(at, at, 1 << Map::kIsUndetectable); |
5544 cmp1 = at; | 5545 cmp1 = at; |
5545 cmp2 = Operand(zero_reg); | 5546 cmp2 = Operand(zero_reg); |
5546 final_branch_condition = eq; | 5547 final_branch_condition = eq; |
5547 | 5548 |
5548 } else if (type_name->Equals(heap()->symbol_string())) { | 5549 } else if (String::Equals(type_name, factory->symbol_string())) { |
5549 __ JumpIfSmi(input, false_label); | 5550 __ JumpIfSmi(input, false_label); |
5550 __ GetObjectType(input, input, scratch); | 5551 __ GetObjectType(input, input, scratch); |
5551 cmp1 = scratch; | 5552 cmp1 = scratch; |
5552 cmp2 = Operand(SYMBOL_TYPE); | 5553 cmp2 = Operand(SYMBOL_TYPE); |
5553 final_branch_condition = eq; | 5554 final_branch_condition = eq; |
5554 | 5555 |
5555 } else if (type_name->Equals(heap()->boolean_string())) { | 5556 } else if (String::Equals(type_name, factory->boolean_string())) { |
5556 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 5557 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
5557 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5558 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
5558 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 5559 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
5559 cmp1 = at; | 5560 cmp1 = at; |
5560 cmp2 = Operand(input); | 5561 cmp2 = Operand(input); |
5561 final_branch_condition = eq; | 5562 final_branch_condition = eq; |
5562 | 5563 |
5563 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { | 5564 } else if (FLAG_harmony_typeof && |
| 5565 String::Equals(type_name, factory->null_string())) { |
5564 __ LoadRoot(at, Heap::kNullValueRootIndex); | 5566 __ LoadRoot(at, Heap::kNullValueRootIndex); |
5565 cmp1 = at; | 5567 cmp1 = at; |
5566 cmp2 = Operand(input); | 5568 cmp2 = Operand(input); |
5567 final_branch_condition = eq; | 5569 final_branch_condition = eq; |
5568 | 5570 |
5569 } else if (type_name->Equals(heap()->undefined_string())) { | 5571 } else if (String::Equals(type_name, factory->undefined_string())) { |
5570 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5572 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
5571 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5573 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
5572 // The first instruction of JumpIfSmi is an And - it is safe in the delay | 5574 // The first instruction of JumpIfSmi is an And - it is safe in the delay |
5573 // slot. | 5575 // slot. |
5574 __ JumpIfSmi(input, false_label); | 5576 __ JumpIfSmi(input, false_label); |
5575 // Check for undetectable objects => true. | 5577 // Check for undetectable objects => true. |
5576 __ lw(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 5578 __ lw(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
5577 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); | 5579 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); |
5578 __ And(at, at, 1 << Map::kIsUndetectable); | 5580 __ And(at, at, 1 << Map::kIsUndetectable); |
5579 cmp1 = at; | 5581 cmp1 = at; |
5580 cmp2 = Operand(zero_reg); | 5582 cmp2 = Operand(zero_reg); |
5581 final_branch_condition = ne; | 5583 final_branch_condition = ne; |
5582 | 5584 |
5583 } else if (type_name->Equals(heap()->function_string())) { | 5585 } else if (String::Equals(type_name, factory->function_string())) { |
5584 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 5586 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
5585 __ JumpIfSmi(input, false_label); | 5587 __ JumpIfSmi(input, false_label); |
5586 __ GetObjectType(input, scratch, input); | 5588 __ GetObjectType(input, scratch, input); |
5587 __ Branch(true_label, eq, input, Operand(JS_FUNCTION_TYPE)); | 5589 __ Branch(true_label, eq, input, Operand(JS_FUNCTION_TYPE)); |
5588 cmp1 = input; | 5590 cmp1 = input; |
5589 cmp2 = Operand(JS_FUNCTION_PROXY_TYPE); | 5591 cmp2 = Operand(JS_FUNCTION_PROXY_TYPE); |
5590 final_branch_condition = eq; | 5592 final_branch_condition = eq; |
5591 | 5593 |
5592 } else if (type_name->Equals(heap()->object_string())) { | 5594 } else if (String::Equals(type_name, factory->object_string())) { |
5593 __ JumpIfSmi(input, false_label); | 5595 __ JumpIfSmi(input, false_label); |
5594 if (!FLAG_harmony_typeof) { | 5596 if (!FLAG_harmony_typeof) { |
5595 __ LoadRoot(at, Heap::kNullValueRootIndex); | 5597 __ LoadRoot(at, Heap::kNullValueRootIndex); |
5596 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5598 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
5597 } | 5599 } |
5598 Register map = input; | 5600 Register map = input; |
5599 __ GetObjectType(input, map, scratch); | 5601 __ GetObjectType(input, map, scratch); |
5600 __ Branch(false_label, | 5602 __ Branch(false_label, |
5601 lt, scratch, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 5603 lt, scratch, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
5602 __ Branch(USE_DELAY_SLOT, false_label, | 5604 __ Branch(USE_DELAY_SLOT, false_label, |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5908 __ lw(result, FieldMemOperand(scratch, | 5910 __ lw(result, FieldMemOperand(scratch, |
5909 FixedArray::kHeaderSize - kPointerSize)); | 5911 FixedArray::kHeaderSize - kPointerSize)); |
5910 __ bind(deferred->exit()); | 5912 __ bind(deferred->exit()); |
5911 __ bind(&done); | 5913 __ bind(&done); |
5912 } | 5914 } |
5913 | 5915 |
5914 | 5916 |
5915 #undef __ | 5917 #undef __ |
5916 | 5918 |
5917 } } // namespace v8::internal | 5919 } } // namespace v8::internal |
OLD | NEW |