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 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 } | 3003 } |
3004 | 3004 |
3005 | 3005 |
3006 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( | 3006 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( |
3007 CallRuntime* expr) { | 3007 CallRuntime* expr) { |
3008 ZoneList<Expression*>* args = expr->arguments(); | 3008 ZoneList<Expression*>* args = expr->arguments(); |
3009 ASSERT(args->length() == 1); | 3009 ASSERT(args->length() == 1); |
3010 | 3010 |
3011 VisitForAccumulatorValue(args->at(0)); | 3011 VisitForAccumulatorValue(args->at(0)); |
3012 | 3012 |
3013 Label materialize_true, materialize_false; | 3013 Label materialize_true, materialize_false, skip_lookup; |
3014 Label* if_true = NULL; | 3014 Label* if_true = NULL; |
3015 Label* if_false = NULL; | 3015 Label* if_false = NULL; |
3016 Label* fall_through = NULL; | 3016 Label* fall_through = NULL; |
3017 context()->PrepareTest(&materialize_true, &materialize_false, | 3017 context()->PrepareTest(&materialize_true, &materialize_false, |
3018 &if_true, &if_false, &fall_through); | 3018 &if_true, &if_false, &fall_through); |
3019 | 3019 |
3020 __ AssertNotSmi(r0); | 3020 __ AssertNotSmi(r0); |
3021 | 3021 |
3022 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | 3022 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); |
3023 __ ldrb(ip, FieldMemOperand(r1, Map::kBitField2Offset)); | 3023 __ ldrb(ip, FieldMemOperand(r1, Map::kBitField2Offset)); |
3024 __ tst(ip, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 3024 __ tst(ip, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
3025 __ b(ne, if_true); | 3025 __ b(ne, &skip_lookup); |
3026 | 3026 |
3027 // Check for fast case object. Generate false result for slow case object. | 3027 // Check for fast case object. Generate false result for slow case object. |
3028 __ ldr(r2, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | 3028 __ ldr(r2, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
3029 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); | 3029 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); |
3030 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | 3030 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); |
3031 __ cmp(r2, ip); | 3031 __ cmp(r2, ip); |
3032 __ b(eq, if_false); | 3032 __ b(eq, if_false); |
3033 | 3033 |
3034 // Look for valueOf name in the descriptor array, and indicate false if | 3034 // Look for valueOf name in the descriptor array, and indicate false if |
3035 // found. Since we omit an enumeration index check, if it is added via a | 3035 // found. Since we omit an enumeration index check, if it is added via a |
(...skipping 25 matching lines...) Expand all Loading... |
3061 __ bind(&loop); | 3061 __ bind(&loop); |
3062 __ ldr(r3, MemOperand(r4, 0)); | 3062 __ ldr(r3, MemOperand(r4, 0)); |
3063 __ cmp(r3, ip); | 3063 __ cmp(r3, ip); |
3064 __ b(eq, if_false); | 3064 __ b(eq, if_false); |
3065 __ add(r4, r4, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); | 3065 __ add(r4, r4, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); |
3066 __ bind(&entry); | 3066 __ bind(&entry); |
3067 __ cmp(r4, Operand(r2)); | 3067 __ cmp(r4, Operand(r2)); |
3068 __ b(ne, &loop); | 3068 __ b(ne, &loop); |
3069 | 3069 |
3070 __ bind(&done); | 3070 __ bind(&done); |
| 3071 |
| 3072 // Set the bit in the map to indicate that there is no local valueOf field. |
| 3073 __ ldrb(r2, FieldMemOperand(r1, Map::kBitField2Offset)); |
| 3074 __ orr(r2, r2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
| 3075 __ strb(r2, FieldMemOperand(r1, Map::kBitField2Offset)); |
| 3076 |
| 3077 __ bind(&skip_lookup); |
| 3078 |
3071 // If a valueOf property is not found on the object check that its | 3079 // If a valueOf property is not found on the object check that its |
3072 // prototype is the un-modified String prototype. If not result is false. | 3080 // prototype is the un-modified String prototype. If not result is false. |
3073 __ ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset)); | 3081 __ ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset)); |
3074 __ JumpIfSmi(r2, if_false); | 3082 __ JumpIfSmi(r2, if_false); |
3075 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); | 3083 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); |
3076 __ ldr(r3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 3084 __ ldr(r3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
3077 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); | 3085 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); |
3078 __ ldr(r3, ContextOperand(r3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 3086 __ ldr(r3, ContextOperand(r3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |
3079 __ cmp(r2, r3); | 3087 __ cmp(r2, r3); |
3080 __ b(ne, if_false); | 3088 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3089 Split(eq, if_true, if_false, fall_through); |
3081 | 3090 |
3082 __ jmp(if_true); | |
3083 | |
3084 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
3085 context()->Plug(if_true, if_false); | 3091 context()->Plug(if_true, if_false); |
3086 } | 3092 } |
3087 | 3093 |
3088 | 3094 |
3089 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 3095 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
3090 ZoneList<Expression*>* args = expr->arguments(); | 3096 ZoneList<Expression*>* args = expr->arguments(); |
3091 ASSERT(args->length() == 1); | 3097 ASSERT(args->length() == 1); |
3092 | 3098 |
3093 VisitForAccumulatorValue(args->at(0)); | 3099 VisitForAccumulatorValue(args->at(0)); |
3094 | 3100 |
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4887 *context_length = 0; | 4893 *context_length = 0; |
4888 return previous_; | 4894 return previous_; |
4889 } | 4895 } |
4890 | 4896 |
4891 | 4897 |
4892 #undef __ | 4898 #undef __ |
4893 | 4899 |
4894 } } // namespace v8::internal | 4900 } } // namespace v8::internal |
4895 | 4901 |
4896 #endif // V8_TARGET_ARCH_ARM | 4902 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |