Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 57433003: Add missing negative dictionary lookup to NonexistentHandlerFrontend (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: also upload test case Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); 130 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag));
131 __ jmp(offset); 131 __ jmp(offset);
132 132
133 // Pop at miss. 133 // Pop at miss.
134 __ bind(&miss); 134 __ bind(&miss);
135 __ pop(offset); 135 __ pop(offset);
136 } 136 }
137 } 137 }
138 138
139 139
140 // Helper function used to check that the dictionary doesn't contain 140 void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
141 // the property. This function may return false negatives, so miss_label 141 Label* miss_label,
142 // must always call a backup property check that is complete. 142 Register receiver,
143 // This function is safe to call if the receiver has fast properties. 143 Handle<Name> name,
144 // Name must be unique and receiver must be a heap object. 144 Register scratch0,
145 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, 145 Register scratch1) {
146 Label* miss_label,
147 Register receiver,
148 Handle<Name> name,
149 Register r0,
150 Register r1) {
151 ASSERT(name->IsUniqueName()); 146 ASSERT(name->IsUniqueName());
147 ASSERT(!receiver.is(scratch0));
152 Counters* counters = masm->isolate()->counters(); 148 Counters* counters = masm->isolate()->counters();
153 __ IncrementCounter(counters->negative_lookups(), 1); 149 __ IncrementCounter(counters->negative_lookups(), 1);
154 __ IncrementCounter(counters->negative_lookups_miss(), 1); 150 __ IncrementCounter(counters->negative_lookups_miss(), 1);
155 151
156 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset)); 152 __ mov(scratch0, FieldOperand(receiver, HeapObject::kMapOffset));
157 153
158 const int kInterceptorOrAccessCheckNeededMask = 154 const int kInterceptorOrAccessCheckNeededMask =
159 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 155 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
160 156
161 // Bail out if the receiver has a named interceptor or requires access checks. 157 // Bail out if the receiver has a named interceptor or requires access checks.
162 __ test_b(FieldOperand(r0, Map::kBitFieldOffset), 158 __ test_b(FieldOperand(scratch0, Map::kBitFieldOffset),
163 kInterceptorOrAccessCheckNeededMask); 159 kInterceptorOrAccessCheckNeededMask);
164 __ j(not_zero, miss_label); 160 __ j(not_zero, miss_label);
165 161
166 // Check that receiver is a JSObject. 162 // Check that receiver is a JSObject.
167 __ CmpInstanceType(r0, FIRST_SPEC_OBJECT_TYPE); 163 __ CmpInstanceType(scratch0, FIRST_SPEC_OBJECT_TYPE);
168 __ j(below, miss_label); 164 __ j(below, miss_label);
169 165
170 // Load properties array. 166 // Load properties array.
171 Register properties = r0; 167 Register properties = scratch0;
172 __ mov(properties, FieldOperand(receiver, JSObject::kPropertiesOffset)); 168 __ mov(properties, FieldOperand(receiver, JSObject::kPropertiesOffset));
173 169
174 // Check that the properties array is a dictionary. 170 // Check that the properties array is a dictionary.
175 __ cmp(FieldOperand(properties, HeapObject::kMapOffset), 171 __ cmp(FieldOperand(properties, HeapObject::kMapOffset),
176 Immediate(masm->isolate()->factory()->hash_table_map())); 172 Immediate(masm->isolate()->factory()->hash_table_map()));
177 __ j(not_equal, miss_label); 173 __ j(not_equal, miss_label);
178 174
179 Label done; 175 Label done;
180 NameDictionaryLookupStub::GenerateNegativeLookup(masm, 176 NameDictionaryLookupStub::GenerateNegativeLookup(masm,
181 miss_label, 177 miss_label,
182 &done, 178 &done,
183 properties, 179 properties,
184 name, 180 name,
185 r1); 181 scratch1);
186 __ bind(&done); 182 __ bind(&done);
187 __ DecrementCounter(counters->negative_lookups_miss(), 1); 183 __ DecrementCounter(counters->negative_lookups_miss(), 1);
188 } 184 }
189 185
190 186
191 void StubCache::GenerateProbe(MacroAssembler* masm, 187 void StubCache::GenerateProbe(MacroAssembler* masm,
192 Code::Flags flags, 188 Code::Flags flags,
193 Register receiver, 189 Register receiver,
194 Register name, 190 Register name,
195 Register scratch, 191 Register scratch,
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 if (!label->is_unused()) { 781 if (!label->is_unused()) {
786 __ bind(label); 782 __ bind(label);
787 __ mov(this->name(), Immediate(name)); 783 __ mov(this->name(), Immediate(name));
788 } 784 }
789 } 785 }
790 786
791 787
792 // Generate code to check that a global property cell is empty. Create 788 // Generate code to check that a global property cell is empty. Create
793 // the property cell at compilation time if no cell exists for the 789 // the property cell at compilation time if no cell exists for the
794 // property. 790 // property.
795 static void GenerateCheckPropertyCell(MacroAssembler* masm, 791 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
796 Handle<GlobalObject> global, 792 Handle<GlobalObject> global,
797 Handle<Name> name, 793 Handle<Name> name,
798 Register scratch, 794 Register scratch,
799 Label* miss) { 795 Label* miss) {
800 Handle<PropertyCell> cell = 796 Handle<PropertyCell> cell =
801 GlobalObject::EnsurePropertyCell(global, name); 797 GlobalObject::EnsurePropertyCell(global, name);
802 ASSERT(cell->value()->IsTheHole()); 798 ASSERT(cell->value()->IsTheHole());
803 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); 799 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value();
804 if (Serializer::enabled()) { 800 if (Serializer::enabled()) {
805 __ mov(scratch, Immediate(cell)); 801 __ mov(scratch, Immediate(cell));
806 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), 802 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
807 Immediate(the_hole)); 803 Immediate(the_hole));
808 } else { 804 } else {
809 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); 805 __ cmp(Operand::ForCell(cell), Immediate(the_hole));
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 smi_check); 1111 smi_check);
1116 } 1112 }
1117 } 1113 }
1118 1114
1119 // Return the value (register eax). 1115 // Return the value (register eax).
1120 ASSERT(value_reg.is(eax)); 1116 ASSERT(value_reg.is(eax));
1121 __ ret(0); 1117 __ ret(0);
1122 } 1118 }
1123 1119
1124 1120
1125 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1121 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1126 // from object to (but not including) holder. 1122 Handle<JSObject> object,
1127 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1123 Handle<JSObject> holder,
1128 Handle<JSObject> object, 1124 Handle<Name> name,
1129 Handle<JSObject> holder, 1125 Register scratch,
1130 Handle<Name> name, 1126 Label* miss) {
1131 Register scratch,
1132 Label* miss) {
1133 Handle<JSObject> current = object; 1127 Handle<JSObject> current = object;
1134 while (!current.is_identical_to(holder)) { 1128 while (!current.is_identical_to(holder)) {
1135 if (current->IsGlobalObject()) { 1129 if (current->IsGlobalObject()) {
1136 GenerateCheckPropertyCell(masm, 1130 GenerateCheckPropertyCell(masm,
1137 Handle<GlobalObject>::cast(current), 1131 Handle<GlobalObject>::cast(current),
1138 name, 1132 name,
1139 scratch, 1133 scratch,
1140 miss); 1134 miss);
1141 } 1135 }
1142 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1136 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 } 1342 }
1349 __ cmp(scratch3(), callback); 1343 __ cmp(scratch3(), callback);
1350 __ j(not_equal, &miss); 1344 __ j(not_equal, &miss);
1351 } 1345 }
1352 1346
1353 HandlerFrontendFooter(name, success, &miss); 1347 HandlerFrontendFooter(name, success, &miss);
1354 return reg; 1348 return reg;
1355 } 1349 }
1356 1350
1357 1351
1358 void LoadStubCompiler::NonexistentHandlerFrontend(
1359 Handle<JSObject> object,
1360 Handle<JSObject> last,
1361 Handle<Name> name,
1362 Label* success,
1363 Handle<GlobalObject> global) {
1364 Label miss;
1365
1366 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1367
1368 // If the last object in the prototype chain is a global object,
1369 // check that the global property cell is empty.
1370 if (!global.is_null()) {
1371 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
1372 }
1373
1374 HandlerFrontendFooter(name, success, &miss);
1375 }
1376
1377
1378 void LoadStubCompiler::GenerateLoadField(Register reg, 1352 void LoadStubCompiler::GenerateLoadField(Register reg,
1379 Handle<JSObject> holder, 1353 Handle<JSObject> holder,
1380 PropertyIndex field, 1354 PropertyIndex field,
1381 Representation representation) { 1355 Representation representation) {
1382 if (!reg.is(receiver())) __ mov(receiver(), reg); 1356 if (!reg.is(receiver())) __ mov(receiver(), reg);
1383 if (kind() == Code::LOAD_IC) { 1357 if (kind() == Code::LOAD_IC) {
1384 LoadFieldStub stub(field.is_inobject(holder), 1358 LoadFieldStub stub(field.is_inobject(holder),
1385 field.translate(holder), 1359 field.translate(holder),
1386 representation); 1360 representation);
1387 GenerateTailCall(masm(), stub.GetCode(isolate())); 1361 GenerateTailCall(masm(), stub.GetCode(isolate()));
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 // ----------------------------------- 3241 // -----------------------------------
3268 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3242 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3269 } 3243 }
3270 3244
3271 3245
3272 #undef __ 3246 #undef __
3273 3247
3274 } } // namespace v8::internal 3248 } } // namespace v8::internal
3275 3249
3276 #endif // V8_TARGET_ARCH_IA32 3250 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698