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