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