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 2617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 __ b(ne, is_true); | 2628 __ b(ne, is_true); |
2629 } else { | 2629 } else { |
2630 __ b(ne, is_false); | 2630 __ b(ne, is_false); |
2631 } | 2631 } |
2632 | 2632 |
2633 // temp now contains the constructor function. Grab the | 2633 // temp now contains the constructor function. Grab the |
2634 // instance class name from there. | 2634 // instance class name from there. |
2635 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2635 __ ldr(temp, FieldMemOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
2636 __ ldr(temp, FieldMemOperand(temp, | 2636 __ ldr(temp, FieldMemOperand(temp, |
2637 SharedFunctionInfo::kInstanceClassNameOffset)); | 2637 SharedFunctionInfo::kInstanceClassNameOffset)); |
2638 // The class name we are testing against is a symbol because it's a literal. | 2638 // The class name we are testing against is internalized since it's a literal. |
2639 // The name in the constructor is a symbol because of the way the context is | 2639 // The name in the constructor is internalized because of the way the context |
2640 // booted. This routine isn't expected to work for random API-created | 2640 // is booted. This routine isn't expected to work for random API-created |
2641 // classes and it doesn't have to because you can't access it with natives | 2641 // classes and it doesn't have to because you can't access it with natives |
2642 // syntax. Since both sides are symbols it is sufficient to use an identity | 2642 // syntax. Since both sides are internalized it is sufficient to use an |
2643 // comparison. | 2643 // identity comparison. |
2644 __ cmp(temp, Operand(class_name)); | 2644 __ cmp(temp, Operand(class_name)); |
2645 // End with the answer in flags. | 2645 // End with the answer in flags. |
2646 } | 2646 } |
2647 | 2647 |
2648 | 2648 |
2649 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { | 2649 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { |
2650 Register input = ToRegister(instr->value()); | 2650 Register input = ToRegister(instr->value()); |
2651 Register temp = scratch0(); | 2651 Register temp = scratch0(); |
2652 Register temp2 = ToRegister(instr->temp()); | 2652 Register temp2 = ToRegister(instr->temp()); |
2653 Handle<String> class_name = instr->hydrogen()->class_name(); | 2653 Handle<String> class_name = instr->hydrogen()->class_name(); |
(...skipping 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5982 } | 5982 } |
5983 } | 5983 } |
5984 | 5984 |
5985 | 5985 |
5986 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 5986 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
5987 Label* false_label, | 5987 Label* false_label, |
5988 Register input, | 5988 Register input, |
5989 Handle<String> type_name) { | 5989 Handle<String> type_name) { |
5990 Condition final_branch_condition = kNoCondition; | 5990 Condition final_branch_condition = kNoCondition; |
5991 Register scratch = scratch0(); | 5991 Register scratch = scratch0(); |
5992 if (type_name->Equals(heap()->number_symbol())) { | 5992 if (type_name->Equals(heap()->number_string())) { |
5993 __ JumpIfSmi(input, true_label); | 5993 __ JumpIfSmi(input, true_label); |
5994 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 5994 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
5995 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 5995 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
5996 __ cmp(input, Operand(ip)); | 5996 __ cmp(input, Operand(ip)); |
5997 final_branch_condition = eq; | 5997 final_branch_condition = eq; |
5998 | 5998 |
5999 } else if (type_name->Equals(heap()->string_symbol())) { | 5999 } else if (type_name->Equals(heap()->string_string())) { |
6000 __ JumpIfSmi(input, false_label); | 6000 __ JumpIfSmi(input, false_label); |
6001 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); | 6001 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); |
6002 __ b(ge, false_label); | 6002 __ b(ge, false_label); |
6003 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 6003 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
6004 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 6004 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
6005 final_branch_condition = eq; | 6005 final_branch_condition = eq; |
6006 | 6006 |
6007 } else if (type_name->Equals(heap()->boolean_symbol())) { | 6007 } else if (type_name->Equals(heap()->boolean_string())) { |
6008 __ CompareRoot(input, Heap::kTrueValueRootIndex); | 6008 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
6009 __ b(eq, true_label); | 6009 __ b(eq, true_label); |
6010 __ CompareRoot(input, Heap::kFalseValueRootIndex); | 6010 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
6011 final_branch_condition = eq; | 6011 final_branch_condition = eq; |
6012 | 6012 |
6013 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_symbol())) { | 6013 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { |
6014 __ CompareRoot(input, Heap::kNullValueRootIndex); | 6014 __ CompareRoot(input, Heap::kNullValueRootIndex); |
6015 final_branch_condition = eq; | 6015 final_branch_condition = eq; |
6016 | 6016 |
6017 } else if (type_name->Equals(heap()->undefined_symbol())) { | 6017 } else if (type_name->Equals(heap()->undefined_string())) { |
6018 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); | 6018 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); |
6019 __ b(eq, true_label); | 6019 __ b(eq, true_label); |
6020 __ JumpIfSmi(input, false_label); | 6020 __ JumpIfSmi(input, false_label); |
6021 // Check for undetectable objects => true. | 6021 // Check for undetectable objects => true. |
6022 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 6022 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
6023 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 6023 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
6024 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 6024 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
6025 final_branch_condition = ne; | 6025 final_branch_condition = ne; |
6026 | 6026 |
6027 } else if (type_name->Equals(heap()->function_symbol())) { | 6027 } else if (type_name->Equals(heap()->function_string())) { |
6028 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 6028 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
6029 __ JumpIfSmi(input, false_label); | 6029 __ JumpIfSmi(input, false_label); |
6030 __ CompareObjectType(input, scratch, input, JS_FUNCTION_TYPE); | 6030 __ CompareObjectType(input, scratch, input, JS_FUNCTION_TYPE); |
6031 __ b(eq, true_label); | 6031 __ b(eq, true_label); |
6032 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE)); | 6032 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE)); |
6033 final_branch_condition = eq; | 6033 final_branch_condition = eq; |
6034 | 6034 |
6035 } else if (type_name->Equals(heap()->object_symbol())) { | 6035 } else if (type_name->Equals(heap()->object_string())) { |
6036 __ JumpIfSmi(input, false_label); | 6036 __ JumpIfSmi(input, false_label); |
6037 if (!FLAG_harmony_typeof) { | 6037 if (!FLAG_harmony_typeof) { |
6038 __ CompareRoot(input, Heap::kNullValueRootIndex); | 6038 __ CompareRoot(input, Heap::kNullValueRootIndex); |
6039 __ b(eq, true_label); | 6039 __ b(eq, true_label); |
6040 } | 6040 } |
6041 __ CompareObjectType(input, input, scratch, | 6041 __ CompareObjectType(input, input, scratch, |
6042 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | 6042 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); |
6043 __ b(lt, false_label); | 6043 __ b(lt, false_label); |
6044 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 6044 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
6045 __ b(gt, false_label); | 6045 __ b(gt, false_label); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6316 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6316 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
6317 __ ldr(result, FieldMemOperand(scratch, | 6317 __ ldr(result, FieldMemOperand(scratch, |
6318 FixedArray::kHeaderSize - kPointerSize)); | 6318 FixedArray::kHeaderSize - kPointerSize)); |
6319 __ bind(&done); | 6319 __ bind(&done); |
6320 } | 6320 } |
6321 | 6321 |
6322 | 6322 |
6323 #undef __ | 6323 #undef __ |
6324 | 6324 |
6325 } } // namespace v8::internal | 6325 } } // namespace v8::internal |
OLD | NEW |