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 3013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 } | 3024 } |
3025 | 3025 |
3026 | 3026 |
3027 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( | 3027 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( |
3028 CallRuntime* expr) { | 3028 CallRuntime* expr) { |
3029 ZoneList<Expression*>* args = expr->arguments(); | 3029 ZoneList<Expression*>* args = expr->arguments(); |
3030 ASSERT(args->length() == 1); | 3030 ASSERT(args->length() == 1); |
3031 | 3031 |
3032 VisitForAccumulatorValue(args->at(0)); | 3032 VisitForAccumulatorValue(args->at(0)); |
3033 | 3033 |
3034 Label materialize_true, materialize_false; | 3034 Label materialize_true, materialize_false, skip_lookup; |
3035 Label* if_true = NULL; | 3035 Label* if_true = NULL; |
3036 Label* if_false = NULL; | 3036 Label* if_false = NULL; |
3037 Label* fall_through = NULL; | 3037 Label* fall_through = NULL; |
3038 context()->PrepareTest(&materialize_true, &materialize_false, | 3038 context()->PrepareTest(&materialize_true, &materialize_false, |
3039 &if_true, &if_false, &fall_through); | 3039 &if_true, &if_false, &fall_through); |
3040 | 3040 |
3041 __ AssertNotSmi(v0); | 3041 __ AssertNotSmi(v0); |
3042 | 3042 |
3043 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); | 3043 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); |
3044 __ lbu(t0, FieldMemOperand(a1, Map::kBitField2Offset)); | 3044 __ lbu(t0, FieldMemOperand(a1, Map::kBitField2Offset)); |
3045 __ And(t0, t0, 1 << Map::kStringWrapperSafeForDefaultValueOf); | 3045 __ And(t0, t0, 1 << Map::kStringWrapperSafeForDefaultValueOf); |
3046 __ Branch(if_true, ne, t0, Operand(zero_reg)); | 3046 __ Branch(&skip_lookup, ne, t0, Operand(zero_reg)); |
3047 | 3047 |
3048 // Check for fast case object. Generate false result for slow case object. | 3048 // Check for fast case object. Generate false result for slow case object. |
3049 __ lw(a2, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | 3049 __ lw(a2, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
3050 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); | 3050 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); |
3051 __ LoadRoot(t0, Heap::kHashTableMapRootIndex); | 3051 __ LoadRoot(t0, Heap::kHashTableMapRootIndex); |
3052 __ Branch(if_false, eq, a2, Operand(t0)); | 3052 __ Branch(if_false, eq, a2, Operand(t0)); |
3053 | 3053 |
3054 // Look for valueOf name in the descriptor array, and indicate false if | 3054 // Look for valueOf name in the descriptor array, and indicate false if |
3055 // found. Since we omit an enumeration index check, if it is added via a | 3055 // found. Since we omit an enumeration index check, if it is added via a |
3056 // transition that shares its descriptor array, this is a false positive. | 3056 // transition that shares its descriptor array, this is a false positive. |
(...skipping 25 matching lines...) Expand all Loading... |
3082 __ li(t2, Operand(isolate()->factory()->value_of_string())); | 3082 __ li(t2, Operand(isolate()->factory()->value_of_string())); |
3083 __ jmp(&entry); | 3083 __ jmp(&entry); |
3084 __ bind(&loop); | 3084 __ bind(&loop); |
3085 __ lw(a3, MemOperand(t0, 0)); | 3085 __ lw(a3, MemOperand(t0, 0)); |
3086 __ Branch(if_false, eq, a3, Operand(t2)); | 3086 __ Branch(if_false, eq, a3, Operand(t2)); |
3087 __ Addu(t0, t0, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); | 3087 __ Addu(t0, t0, Operand(DescriptorArray::kDescriptorSize * kPointerSize)); |
3088 __ bind(&entry); | 3088 __ bind(&entry); |
3089 __ Branch(&loop, ne, t0, Operand(a2)); | 3089 __ Branch(&loop, ne, t0, Operand(a2)); |
3090 | 3090 |
3091 __ bind(&done); | 3091 __ bind(&done); |
| 3092 |
| 3093 // Set the bit in the map to indicate that there is no local valueOf field. |
| 3094 __ lbu(a2, FieldMemOperand(a1, Map::kBitField2Offset)); |
| 3095 __ Or(a2, a2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
| 3096 __ sb(a2, FieldMemOperand(a1, Map::kBitField2Offset)); |
| 3097 |
| 3098 __ bind(&skip_lookup); |
| 3099 |
3092 // If a valueOf property is not found on the object check that its | 3100 // If a valueOf property is not found on the object check that its |
3093 // prototype is the un-modified String prototype. If not result is false. | 3101 // prototype is the un-modified String prototype. If not result is false. |
3094 __ lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset)); | 3102 __ lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset)); |
3095 __ JumpIfSmi(a2, if_false); | 3103 __ JumpIfSmi(a2, if_false); |
3096 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); | 3104 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); |
3097 __ lw(a3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 3105 __ lw(a3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
3098 __ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset)); | 3106 __ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset)); |
3099 __ lw(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 3107 __ lw(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |
3100 __ Branch(if_false, ne, a2, Operand(a3)); | 3108 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 3109 Split(eq, a2, Operand(a3), if_true, if_false, fall_through); |
3101 | 3110 |
3102 __ jmp(if_true); | |
3103 | |
3104 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
3105 context()->Plug(if_true, if_false); | 3111 context()->Plug(if_true, if_false); |
3106 } | 3112 } |
3107 | 3113 |
3108 | 3114 |
3109 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 3115 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
3110 ZoneList<Expression*>* args = expr->arguments(); | 3116 ZoneList<Expression*>* args = expr->arguments(); |
3111 ASSERT(args->length() == 1); | 3117 ASSERT(args->length() == 1); |
3112 | 3118 |
3113 VisitForAccumulatorValue(args->at(0)); | 3119 VisitForAccumulatorValue(args->at(0)); |
3114 | 3120 |
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4919 *context_length = 0; | 4925 *context_length = 0; |
4920 return previous_; | 4926 return previous_; |
4921 } | 4927 } |
4922 | 4928 |
4923 | 4929 |
4924 #undef __ | 4930 #undef __ |
4925 | 4931 |
4926 } } // namespace v8::internal | 4932 } } // namespace v8::internal |
4927 | 4933 |
4928 #endif // V8_TARGET_ARCH_MIPS | 4934 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |