| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 __ pop(offset); | 100 __ pop(offset); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 // Helper function used to check that the dictionary doesn't contain | 105 // Helper function used to check that the dictionary doesn't contain |
| 106 // the property. This function may return false negatives, so miss_label | 106 // the property. This function may return false negatives, so miss_label |
| 107 // must always call a backup property check that is complete. | 107 // must always call a backup property check that is complete. |
| 108 // This function is safe to call if the receiver has fast properties. | 108 // This function is safe to call if the receiver has fast properties. |
| 109 // Name must be a symbol and receiver must be a heap object. | 109 // Name must be a symbol and receiver must be a heap object. |
| 110 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, | 110 static MaybeObject* GenerateDictionaryNegativeLookup(MacroAssembler* masm, |
| 111 Label* miss_label, | 111 Label* miss_label, |
| 112 Register receiver, | 112 Register receiver, |
| 113 String* name, | 113 String* name, |
| 114 Register r0, | 114 Register r0, |
| 115 Register r1) { | 115 Register r1) { |
| 116 ASSERT(name->IsSymbol()); | 116 ASSERT(name->IsSymbol()); |
| 117 Counters* counters = masm->isolate()->counters(); | 117 Counters* counters = masm->isolate()->counters(); |
| 118 __ IncrementCounter(counters->negative_lookups(), 1); | 118 __ IncrementCounter(counters->negative_lookups(), 1); |
| 119 __ IncrementCounter(counters->negative_lookups_miss(), 1); | 119 __ IncrementCounter(counters->negative_lookups_miss(), 1); |
| 120 | 120 |
| 121 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset)); | 121 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset)); |
| 122 | 122 |
| 123 const int kInterceptorOrAccessCheckNeededMask = | 123 const int kInterceptorOrAccessCheckNeededMask = |
| 124 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); | 124 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); |
| 125 | 125 |
| 126 // Bail out if the receiver has a named interceptor or requires access checks. | 126 // Bail out if the receiver has a named interceptor or requires access checks. |
| 127 __ test_b(FieldOperand(r0, Map::kBitFieldOffset), | 127 __ test_b(FieldOperand(r0, Map::kBitFieldOffset), |
| 128 kInterceptorOrAccessCheckNeededMask); | 128 kInterceptorOrAccessCheckNeededMask); |
| 129 __ j(not_zero, miss_label, not_taken); | 129 __ j(not_zero, miss_label, not_taken); |
| 130 | 130 |
| 131 // Check that receiver is a JSObject. | 131 // Check that receiver is a JSObject. |
| 132 __ CmpInstanceType(r0, FIRST_JS_OBJECT_TYPE); | 132 __ CmpInstanceType(r0, FIRST_JS_OBJECT_TYPE); |
| 133 __ j(below, miss_label, not_taken); | 133 __ j(below, miss_label, not_taken); |
| 134 | 134 |
| 135 // Load properties array. | 135 // Load properties array. |
| 136 Register properties = r0; | 136 Register properties = r0; |
| 137 __ mov(properties, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 137 __ mov(properties, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
| 138 | 138 |
| 139 // Check that the properties array is a dictionary. | 139 // Check that the properties array is a dictionary. |
| 140 __ cmp(FieldOperand(properties, HeapObject::kMapOffset), | 140 __ cmp(FieldOperand(properties, HeapObject::kMapOffset), |
| 141 Immediate(masm->isolate()->factory()->hash_table_map())); | 141 Immediate(masm->isolate()->factory()->hash_table_map())); |
| 142 __ j(not_equal, miss_label); | 142 __ j(not_equal, miss_label); |
| 143 | 143 |
| 144 Label done; | 144 Label done; |
| 145 StringDictionaryLookupStub::GenerateNegativeLookup(masm, | 145 MaybeObject* result = |
| 146 miss_label, | 146 StringDictionaryLookupStub::GenerateNegativeLookup(masm, |
| 147 &done, | 147 miss_label, |
| 148 properties, | 148 &done, |
| 149 name, | 149 properties, |
| 150 r1); | 150 name, |
| 151 r1); |
| 152 if(result->IsFailure()) return result; |
| 153 |
| 151 __ bind(&done); | 154 __ bind(&done); |
| 152 __ DecrementCounter(counters->negative_lookups_miss(), 1); | 155 __ DecrementCounter(counters->negative_lookups_miss(), 1); |
| 156 |
| 157 return result; |
| 153 } | 158 } |
| 154 | 159 |
| 155 | 160 |
| 156 void StubCache::GenerateProbe(MacroAssembler* masm, | 161 void StubCache::GenerateProbe(MacroAssembler* masm, |
| 157 Code::Flags flags, | 162 Code::Flags flags, |
| 158 Register receiver, | 163 Register receiver, |
| 159 Register name, | 164 Register name, |
| 160 Register scratch, | 165 Register scratch, |
| 161 Register extra, | 166 Register extra, |
| 162 Register extra2) { | 167 Register extra2) { |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 Object* lookup_result = NULL; // Initialization to please compiler. | 899 Object* lookup_result = NULL; // Initialization to please compiler. |
| 895 if (!maybe_lookup_result->ToObject(&lookup_result)) { | 900 if (!maybe_lookup_result->ToObject(&lookup_result)) { |
| 896 set_failure(Failure::cast(maybe_lookup_result)); | 901 set_failure(Failure::cast(maybe_lookup_result)); |
| 897 return reg; | 902 return reg; |
| 898 } | 903 } |
| 899 name = String::cast(lookup_result); | 904 name = String::cast(lookup_result); |
| 900 } | 905 } |
| 901 ASSERT(current->property_dictionary()->FindEntry(name) == | 906 ASSERT(current->property_dictionary()->FindEntry(name) == |
| 902 StringDictionary::kNotFound); | 907 StringDictionary::kNotFound); |
| 903 | 908 |
| 904 GenerateDictionaryNegativeLookup(masm(), | 909 MaybeObject* negative_lookup = GenerateDictionaryNegativeLookup(masm(), |
| 905 miss, | 910 miss, |
| 906 reg, | 911 reg, |
| 907 name, | 912 name, |
| 908 scratch1, | 913 scratch1, |
| 909 scratch2); | 914 scratch2); |
| 915 if (negative_lookup->IsFailure()) { |
| 916 set_failure(Failure::cast(negative_lookup)); |
| 917 return reg; |
| 918 } |
| 919 |
| 910 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 920 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 911 reg = holder_reg; // from now the object is in holder_reg | 921 reg = holder_reg; // from now the object is in holder_reg |
| 912 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 922 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 913 } else if (heap()->InNewSpace(prototype)) { | 923 } else if (heap()->InNewSpace(prototype)) { |
| 914 // Get the map of the current object. | 924 // Get the map of the current object. |
| 915 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 925 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 916 __ cmp(Operand(scratch1), Immediate(Handle<Map>(current->map()))); | 926 __ cmp(Operand(scratch1), Immediate(Handle<Map>(current->map()))); |
| 917 // Branch on the result of the map check. | 927 // Branch on the result of the map check. |
| 918 __ j(not_equal, miss, not_taken); | 928 __ j(not_equal, miss, not_taken); |
| 919 // Check access rights to the global object. This has to happen | 929 // Check access rights to the global object. This has to happen |
| (...skipping 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3665 | 3675 |
| 3666 return GetCode(flags); | 3676 return GetCode(flags); |
| 3667 } | 3677 } |
| 3668 | 3678 |
| 3669 | 3679 |
| 3670 #undef __ | 3680 #undef __ |
| 3671 | 3681 |
| 3672 } } // namespace v8::internal | 3682 } } // namespace v8::internal |
| 3673 | 3683 |
| 3674 #endif // V8_TARGET_ARCH_IA32 | 3684 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |