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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 __ cmp(r0, ip); | 885 __ cmp(r0, ip); |
886 __ b(eq, &exit); | 886 __ b(eq, &exit); |
887 Register null_value = r5; | 887 Register null_value = r5; |
888 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 888 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
889 __ cmp(r0, null_value); | 889 __ cmp(r0, null_value); |
890 __ b(eq, &exit); | 890 __ b(eq, &exit); |
891 | 891 |
892 // Convert the object to a JS object. | 892 // Convert the object to a JS object. |
893 Label convert, done_convert; | 893 Label convert, done_convert; |
894 __ JumpIfSmi(r0, &convert); | 894 __ JumpIfSmi(r0, &convert); |
895 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | 895 __ CompareObjectType(r0, r1, r1, FIRST_OBJECT_OR_FUNCTION_CLASS_TYPE); |
896 __ b(hs, &done_convert); | 896 __ b(hs, &done_convert); |
897 __ bind(&convert); | 897 __ bind(&convert); |
898 __ push(r0); | 898 __ push(r0); |
899 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 899 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
900 __ bind(&done_convert); | 900 __ bind(&done_convert); |
901 __ push(r0); | 901 __ push(r0); |
902 | 902 |
903 // Check cache validity in generated code. This is a fast case for | 903 // Check cache validity in generated code. This is a fast case for |
904 // the JSObject::IsSimpleEnum cache validity checks. If we cannot | 904 // the JSObject::IsSimpleEnum cache validity checks. If we cannot |
905 // guarantee cache validity, call the runtime system to check cache | 905 // guarantee cache validity, call the runtime system to check cache |
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2452 __ JumpIfSmi(r0, if_false); | 2452 __ JumpIfSmi(r0, if_false); |
2453 __ LoadRoot(ip, Heap::kNullValueRootIndex); | 2453 __ LoadRoot(ip, Heap::kNullValueRootIndex); |
2454 __ cmp(r0, ip); | 2454 __ cmp(r0, ip); |
2455 __ b(eq, if_true); | 2455 __ b(eq, if_true); |
2456 __ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 2456 __ ldr(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
2457 // Undetectable objects behave like undefined when tested with typeof. | 2457 // Undetectable objects behave like undefined when tested with typeof. |
2458 __ ldrb(r1, FieldMemOperand(r2, Map::kBitFieldOffset)); | 2458 __ ldrb(r1, FieldMemOperand(r2, Map::kBitFieldOffset)); |
2459 __ tst(r1, Operand(1 << Map::kIsUndetectable)); | 2459 __ tst(r1, Operand(1 << Map::kIsUndetectable)); |
2460 __ b(ne, if_false); | 2460 __ b(ne, if_false); |
2461 __ ldrb(r1, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 2461 __ ldrb(r1, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
2462 __ cmp(r1, Operand(FIRST_JS_OBJECT_TYPE)); | 2462 __ cmp(r1, Operand(FIRST_OBJECT_CLASS_TYPE)); |
2463 __ b(lt, if_false); | 2463 __ b(lt, if_false); |
2464 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE)); | 2464 __ cmp(r1, Operand(LAST_OBJECT_CLASS_TYPE)); |
2465 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 2465 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
2466 Split(le, if_true, if_false, fall_through); | 2466 Split(le, if_true, if_false, fall_through); |
2467 | 2467 |
2468 context()->Plug(if_true, if_false); | 2468 context()->Plug(if_true, if_false); |
2469 } | 2469 } |
2470 | 2470 |
2471 | 2471 |
2472 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) { | 2472 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) { |
2473 ASSERT(args->length() == 1); | 2473 ASSERT(args->length() == 1); |
2474 | 2474 |
2475 VisitForAccumulatorValue(args->at(0)); | 2475 VisitForAccumulatorValue(args->at(0)); |
2476 | 2476 |
2477 Label materialize_true, materialize_false; | 2477 Label materialize_true, materialize_false; |
2478 Label* if_true = NULL; | 2478 Label* if_true = NULL; |
2479 Label* if_false = NULL; | 2479 Label* if_false = NULL; |
2480 Label* fall_through = NULL; | 2480 Label* fall_through = NULL; |
2481 context()->PrepareTest(&materialize_true, &materialize_false, | 2481 context()->PrepareTest(&materialize_true, &materialize_false, |
2482 &if_true, &if_false, &fall_through); | 2482 &if_true, &if_false, &fall_through); |
2483 | 2483 |
2484 __ JumpIfSmi(r0, if_false); | 2484 __ JumpIfSmi(r0, if_false); |
2485 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | 2485 __ CompareObjectType(r0, r1, r1, FIRST_OBJECT_OR_FUNCTION_CLASS_TYPE); |
2486 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 2486 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
2487 Split(ge, if_true, if_false, fall_through); | 2487 Split(ge, if_true, if_false, fall_through); |
2488 | 2488 |
2489 context()->Plug(if_true, if_false); | 2489 context()->Plug(if_true, if_false); |
2490 } | 2490 } |
2491 | 2491 |
2492 | 2492 |
2493 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { | 2493 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { |
2494 ASSERT(args->length() == 1); | 2494 ASSERT(args->length() == 1); |
2495 | 2495 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2758 ASSERT(args->length() == 1); | 2758 ASSERT(args->length() == 1); |
2759 Label done, null, function, non_function_constructor; | 2759 Label done, null, function, non_function_constructor; |
2760 | 2760 |
2761 VisitForAccumulatorValue(args->at(0)); | 2761 VisitForAccumulatorValue(args->at(0)); |
2762 | 2762 |
2763 // If the object is a smi, we return null. | 2763 // If the object is a smi, we return null. |
2764 __ JumpIfSmi(r0, &null); | 2764 __ JumpIfSmi(r0, &null); |
2765 | 2765 |
2766 // Check that the object is a JS object but take special care of JS | 2766 // Check that the object is a JS object but take special care of JS |
2767 // functions to make sure they have 'Function' as their class. | 2767 // functions to make sure they have 'Function' as their class. |
2768 __ CompareObjectType(r0, r0, r1, FIRST_JS_OBJECT_TYPE); // Map is now in r0. | 2768 __ CompareObjectType(r0, r0, r1, FIRST_OBJECT_OR_FUNCTION_CLASS_TYPE); |
| 2769 // Map is now in r0. |
2769 __ b(lt, &null); | 2770 __ b(lt, &null); |
2770 | 2771 |
2771 // As long as JS_FUNCTION_TYPE is the last instance type and it is | 2772 // As long as LAST_FUNCTION_CLASS_TYPE is the last instance type, and |
2772 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for | 2773 // FIRST_FUNCTION_CLASS_TYPE comes right after LAST_OBJECT_CLASS_TYPE, |
2773 // LAST_JS_OBJECT_TYPE. | 2774 // we can avoid checking for LAST_OBJECT_CLASS_TYPE. |
2774 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 2775 ASSERT(LAST_TYPE == LAST_FUNCTION_CLASS_TYPE); |
2775 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 2776 ASSERT(FIRST_FUNCTION_CLASS_TYPE == LAST_OBJECT_CLASS_TYPE + 1); |
2776 __ cmp(r1, Operand(JS_FUNCTION_TYPE)); | 2777 __ cmp(r1, Operand(FIRST_FUNCTION_CLASS_TYPE)); |
2777 __ b(eq, &function); | 2778 __ b(hs, &function); |
2778 | 2779 |
2779 // Check if the constructor in the map is a function. | 2780 // Check if the constructor in the map is a function. |
2780 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); | 2781 __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); |
2781 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | 2782 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); |
2782 __ b(ne, &non_function_constructor); | 2783 __ b(ne, &non_function_constructor); |
2783 | 2784 |
2784 // r0 now contains the constructor function. Grab the | 2785 // r0 now contains the constructor function. Grab the |
2785 // instance class name from there. | 2786 // instance class name from there. |
2786 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 2787 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
2787 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); | 2788 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4070 } else if (check->Equals(isolate()->heap()->function_symbol())) { | 4071 } else if (check->Equals(isolate()->heap()->function_symbol())) { |
4071 __ JumpIfSmi(r0, if_false); | 4072 __ JumpIfSmi(r0, if_false); |
4072 __ CompareObjectType(r0, r1, r0, FIRST_FUNCTION_CLASS_TYPE); | 4073 __ CompareObjectType(r0, r1, r0, FIRST_FUNCTION_CLASS_TYPE); |
4073 Split(ge, if_true, if_false, fall_through); | 4074 Split(ge, if_true, if_false, fall_through); |
4074 | 4075 |
4075 } else if (check->Equals(isolate()->heap()->object_symbol())) { | 4076 } else if (check->Equals(isolate()->heap()->object_symbol())) { |
4076 __ JumpIfSmi(r0, if_false); | 4077 __ JumpIfSmi(r0, if_false); |
4077 __ CompareRoot(r0, Heap::kNullValueRootIndex); | 4078 __ CompareRoot(r0, Heap::kNullValueRootIndex); |
4078 __ b(eq, if_true); | 4079 __ b(eq, if_true); |
4079 // Check for JS objects => true. | 4080 // Check for JS objects => true. |
4080 __ CompareObjectType(r0, r0, r1, FIRST_JS_OBJECT_TYPE); | 4081 __ CompareObjectType(r0, r0, r1, FIRST_OBJECT_CLASS_TYPE); |
4081 __ b(lo, if_false); | 4082 __ b(lo, if_false); |
4082 __ CompareInstanceType(r0, r1, FIRST_FUNCTION_CLASS_TYPE); | 4083 __ CompareInstanceType(r0, r1, LAST_OBJECT_CLASS_TYPE); |
4083 __ b(hs, if_false); | 4084 __ b(hi, if_false); |
4084 // Check for undetectable objects => false. | 4085 // Check for undetectable objects => false. |
4085 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); | 4086 __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset)); |
4086 __ tst(r1, Operand(1 << Map::kIsUndetectable)); | 4087 __ tst(r1, Operand(1 << Map::kIsUndetectable)); |
4087 Split(eq, if_true, if_false, fall_through); | 4088 Split(eq, if_true, if_false, fall_through); |
4088 } else { | 4089 } else { |
4089 if (if_false != fall_through) __ jmp(if_false); | 4090 if (if_false != fall_through) __ jmp(if_false); |
4090 } | 4091 } |
4091 | 4092 |
4092 return true; | 4093 return true; |
4093 } | 4094 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4356 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4356 __ add(pc, r1, Operand(masm_->CodeObject())); | 4357 __ add(pc, r1, Operand(masm_->CodeObject())); |
4357 } | 4358 } |
4358 | 4359 |
4359 | 4360 |
4360 #undef __ | 4361 #undef __ |
4361 | 4362 |
4362 } } // namespace v8::internal | 4363 } } // namespace v8::internal |
4363 | 4364 |
4364 #endif // V8_TARGET_ARCH_ARM | 4365 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |