OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 __ cmp(r0, ip); | 910 __ cmp(r0, ip); |
911 __ b(eq, &exit); | 911 __ b(eq, &exit); |
912 Register null_value = r5; | 912 Register null_value = r5; |
913 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 913 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
914 __ cmp(r0, null_value); | 914 __ cmp(r0, null_value); |
915 __ b(eq, &exit); | 915 __ b(eq, &exit); |
916 | 916 |
917 // Convert the object to a JS object. | 917 // Convert the object to a JS object. |
918 Label convert, done_convert; | 918 Label convert, done_convert; |
919 __ JumpIfSmi(r0, &convert); | 919 __ JumpIfSmi(r0, &convert); |
920 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | 920 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); |
921 __ b(hs, &done_convert); | 921 __ b(ge, &done_convert); |
922 __ bind(&convert); | 922 __ bind(&convert); |
923 __ push(r0); | 923 __ push(r0); |
924 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 924 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
925 __ bind(&done_convert); | 925 __ bind(&done_convert); |
926 __ push(r0); | 926 __ push(r0); |
927 | 927 |
928 // Check cache validity in generated code. This is a fast case for | 928 // Check cache validity in generated code. This is a fast case for |
929 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 929 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
930 // guarantee cache validity, call the runtime system to check cache | 930 // guarantee cache validity, call the runtime system to check cache |
931 // validity or get the property names in a fixed array. | 931 // validity or get the property names in a fixed array. |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 __ JumpIfSmi(r0, if_false); | 2466 __ JumpIfSmi(r0, if_false); |
2467 __ LoadRoot(ip, Heap::kNullValueRootIndex); | 2467 __ LoadRoot(ip, Heap::kNullValueRootIndex); |
2468 __ cmp(r0, ip); | 2468 __ cmp(r0, ip); |
2469 __ b(eq, if_true); | 2469 __ b(eq, if_true); |
2470 __ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 2470 __ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
2471 // Undetectable objects behave like undefined when tested with typeof. | 2471 // Undetectable objects behave like undefined when tested with typeof. |
2472 __ ldrb(r1, FieldMemOperand(r2, Map::kBitFieldOffset)); | 2472 __ ldrb(r1, FieldMemOperand(r2, Map::kBitFieldOffset)); |
2473 __ tst(r1, Operand(1 << Map::kIsUndetectable)); | 2473 __ tst(r1, Operand(1 << Map::kIsUndetectable)); |
2474 __ b(ne, if_false); | 2474 __ b(ne, if_false); |
2475 __ ldrb(r1, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 2475 __ ldrb(r1, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
2476 __ cmp(r1, Operand(FIRST_JS_OBJECT_TYPE)); | 2476 __ cmp(r1, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2477 __ b(lt, if_false); | 2477 __ b(lt, if_false); |
2478 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE)); | 2478 __ cmp(r1, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2479 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 2479 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
2480 Split(le, if_true, if_false, fall_through); | 2480 Split(le, if_true, if_false, fall_through); |
2481 | 2481 |
2482 context()->Plug(if_true, if_false); | 2482 context()->Plug(if_true, if_false); |
2483 } | 2483 } |
2484 | 2484 |
2485 | 2485 |
2486 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) { | 2486 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) { |
2487 ASSERT(args->length() == 1); | 2487 ASSERT(args->length() == 1); |
2488 | 2488 |
2489 VisitForAccumulatorValue(args->at(0)); | 2489 VisitForAccumulatorValue(args->at(0)); |
2490 | 2490 |
2491 Label materialize_true, materialize_false; | 2491 Label materialize_true, materialize_false; |
2492 Label* if_true = NULL; | 2492 Label* if_true = NULL; |
2493 Label* if_false = NULL; | 2493 Label* if_false = NULL; |
2494 Label* fall_through = NULL; | 2494 Label* fall_through = NULL; |
2495 context()->PrepareTest(&materialize_true, &materialize_false, | 2495 context()->PrepareTest(&materialize_true, &materialize_false, |
2496 &if_true, &if_false, &fall_through); | 2496 &if_true, &if_false, &fall_through); |
2497 | 2497 |
2498 __ JumpIfSmi(r0, if_false); | 2498 __ JumpIfSmi(r0, if_false); |
2499 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | 2499 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); |
2500 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 2500 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
2501 Split(ge, if_true, if_false, fall_through); | 2501 Split(ge, if_true, if_false, fall_through); |
2502 | 2502 |
2503 context()->Plug(if_true, if_false); | 2503 context()->Plug(if_true, if_false); |
2504 } | 2504 } |
2505 | 2505 |
2506 | 2506 |
2507 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { | 2507 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { |
2508 ASSERT(args->length() == 1); | 2508 ASSERT(args->length() == 1); |
2509 | 2509 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2772 ASSERT(args->length() == 1); | 2772 ASSERT(args->length() == 1); |
2773 Label done, null, function, non_function_constructor; | 2773 Label done, null, function, non_function_constructor; |
2774 | 2774 |
2775 VisitForAccumulatorValue(args->at(0)); | 2775 VisitForAccumulatorValue(args->at(0)); |
2776 | 2776 |
2777 // If the object is a smi, we return null. | 2777 // If the object is a smi, we return null. |
2778 __ JumpIfSmi(r0, &null); | 2778 __ JumpIfSmi(r0, &null); |
2779 | 2779 |
2780 // Check that the object is a JS object but take special care of JS | 2780 // Check that the object is a JS object but take special care of JS |
2781 // functions to make sure they have 'Function' as their class. | 2781 // functions to make sure they have 'Function' as their class. |
2782 __ CompareObjectType(r0, r0, r1, FIRST_JS_OBJECT_TYPE); // Map is now in r0. | 2782 __ CompareObjectType(r0, r0, r1, FIRST_SPEC_OBJECT_TYPE); |
| 2783 // Map is now in r0. |
2783 __ b(lt, &null); | 2784 __ b(lt, &null); |
2784 | 2785 |
2785 // As long as JS_FUNCTION_TYPE is the last instance type and it is | 2786 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and |
2786 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for | 2787 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after |
2787 // LAST_JS_OBJECT_TYPE. | 2788 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter. |
2788 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 2789 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); |
2789 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 2790 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE == |
2790 __ cmp(r1, Operand(JS_FUNCTION_TYPE)); | 2791 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1); |
2791 __ b(eq, &function); | 2792 __ cmp(r1, Operand(FIRST_CALLABLE_SPEC_OBJECT_TYPE)); |
| 2793 __ b(ge, &function); |
2792 | 2794 |
2793 // Check if the constructor in the map is a function. | 2795 // Check if the constructor in the map is a function. |
2794 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); | 2796 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); |
2795 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | 2797 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); |
2796 __ b(ne, &non_function_constructor); | 2798 __ b(ne, &non_function_constructor); |
2797 | 2799 |
2798 // r0 now contains the constructor function. Grab the | 2800 // r0 now contains the constructor function. Grab the |
2799 // instance class name from there. | 2801 // instance class name from there. |
2800 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 2802 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
2801 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); | 2803 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4080 __ b(eq, if_true); | 4082 __ b(eq, if_true); |
4081 __ JumpIfSmi(r0, if_false); | 4083 __ JumpIfSmi(r0, if_false); |
4082 // Check for undetectable objects => true. | 4084 // Check for undetectable objects => true. |
4083 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); | 4085 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset)); |
4084 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); | 4086 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
4085 __ tst(r1, Operand(1 << Map::kIsUndetectable)); | 4087 __ tst(r1, Operand(1 << Map::kIsUndetectable)); |
4086 Split(ne, if_true, if_false, fall_through); | 4088 Split(ne, if_true, if_false, fall_through); |
4087 | 4089 |
4088 } else if (check->Equals(isolate()->heap()->function_symbol())) { | 4090 } else if (check->Equals(isolate()->heap()->function_symbol())) { |
4089 __ JumpIfSmi(r0, if_false); | 4091 __ JumpIfSmi(r0, if_false); |
4090 __ CompareObjectType(r0, r1, r0, FIRST_FUNCTION_CLASS_TYPE); | 4092 __ CompareObjectType(r0, r1, r0, FIRST_CALLABLE_SPEC_OBJECT_TYPE); |
4091 Split(ge, if_true, if_false, fall_through); | 4093 Split(ge, if_true, if_false, fall_through); |
4092 | 4094 |
4093 } else if (check->Equals(isolate()->heap()->object_symbol())) { | 4095 } else if (check->Equals(isolate()->heap()->object_symbol())) { |
4094 __ JumpIfSmi(r0, if_false); | 4096 __ JumpIfSmi(r0, if_false); |
4095 __ CompareRoot(r0, Heap::kNullValueRootIndex); | 4097 __ CompareRoot(r0, Heap::kNullValueRootIndex); |
4096 __ b(eq, if_true); | 4098 __ b(eq, if_true); |
4097 // Check for JS objects => true. | 4099 // Check for JS objects => true. |
4098 __ CompareObjectType(r0, r0, r1, FIRST_JS_OBJECT_TYPE); | 4100 __ CompareObjectType(r0, r0, r1, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); |
4099 __ b(lo, if_false); | 4101 __ b(lt, if_false); |
4100 __ CompareInstanceType(r0, r1, FIRST_FUNCTION_CLASS_TYPE); | 4102 __ CompareInstanceType(r0, r1, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
4101 __ b(hs, if_false); | 4103 __ b(gt, if_false); |
4102 // Check for undetectable objects => false. | 4104 // Check for undetectable objects => false. |
4103 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); | 4105 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
4104 __ tst(r1, Operand(1 << Map::kIsUndetectable)); | 4106 __ tst(r1, Operand(1 << Map::kIsUndetectable)); |
4105 Split(eq, if_true, if_false, fall_through); | 4107 Split(eq, if_true, if_false, fall_through); |
4106 } else { | 4108 } else { |
4107 if (if_false != fall_through) __ jmp(if_false); | 4109 if (if_false != fall_through) __ jmp(if_false); |
4108 } | 4110 } |
4109 | 4111 |
4110 return true; | 4112 return true; |
4111 } | 4113 } |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4372 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4374 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4373 __ add(pc, r1, Operand(masm_->CodeObject())); | 4375 __ add(pc, r1, Operand(masm_->CodeObject())); |
4374 } | 4376 } |
4375 | 4377 |
4376 | 4378 |
4377 #undef __ | 4379 #undef __ |
4378 | 4380 |
4379 } } // namespace v8::internal | 4381 } } // namespace v8::internal |
4380 | 4382 |
4381 #endif // V8_TARGET_ARCH_ARM | 4383 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |