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

Side by Side Diff: src/arm/stub-cache-arm.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 | « no previous file | src/ia32/stub-cache-ia32.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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #endif 114 #endif
115 115
116 // Jump to the first instruction in the code stub. 116 // Jump to the first instruction in the code stub.
117 __ add(pc, code, Operand(Code::kHeaderSize - kHeapObjectTag)); 117 __ add(pc, code, Operand(Code::kHeaderSize - kHeapObjectTag));
118 118
119 // Miss: fall through. 119 // Miss: fall through.
120 __ bind(&miss); 120 __ bind(&miss);
121 } 121 }
122 122
123 123
124 // Helper function used to check that the dictionary doesn't contain 124 void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
125 // the property. This function may return false negatives, so miss_label 125 Label* miss_label,
126 // must always call a backup property check that is complete. 126 Register receiver,
127 // This function is safe to call if the receiver has fast properties. 127 Handle<Name> name,
128 // Name must be unique and receiver must be a heap object. 128 Register scratch0,
129 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, 129 Register scratch1) {
130 Label* miss_label,
131 Register receiver,
132 Handle<Name> name,
133 Register scratch0,
134 Register scratch1) {
135 ASSERT(name->IsUniqueName()); 130 ASSERT(name->IsUniqueName());
131 ASSERT(!receiver.is(scratch0));
136 Counters* counters = masm->isolate()->counters(); 132 Counters* counters = masm->isolate()->counters();
137 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); 133 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
138 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); 134 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
139 135
140 Label done; 136 Label done;
141 137
142 const int kInterceptorOrAccessCheckNeededMask = 138 const int kInterceptorOrAccessCheckNeededMask =
143 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 139 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
144 140
145 // Bail out if the receiver has a named interceptor or requires access checks. 141 // Bail out if the receiver has a named interceptor or requires access checks.
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 Label* miss_label) { 407 Label* miss_label) {
412 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 408 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
413 __ mov(r0, scratch1); 409 __ mov(r0, scratch1);
414 __ Ret(); 410 __ Ret();
415 } 411 }
416 412
417 413
418 // Generate code to check that a global property cell is empty. Create 414 // Generate code to check that a global property cell is empty. Create
419 // the property cell at compilation time if no cell exists for the 415 // the property cell at compilation time if no cell exists for the
420 // property. 416 // property.
421 static void GenerateCheckPropertyCell(MacroAssembler* masm, 417 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
422 Handle<GlobalObject> global, 418 Handle<GlobalObject> global,
423 Handle<Name> name, 419 Handle<Name> name,
424 Register scratch, 420 Register scratch,
425 Label* miss) { 421 Label* miss) {
426 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name); 422 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name);
427 ASSERT(cell->value()->IsTheHole()); 423 ASSERT(cell->value()->IsTheHole());
428 __ mov(scratch, Operand(cell)); 424 __ mov(scratch, Operand(cell));
429 __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); 425 __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
430 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 426 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
431 __ cmp(scratch, ip); 427 __ cmp(scratch, ip);
432 __ b(ne, miss); 428 __ b(ne, miss);
433 } 429 }
434 430
435 431
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 __ b(ne, interceptor_succeeded); 1145 __ b(ne, interceptor_succeeded);
1150 } 1146 }
1151 1147
1152 StubCompiler* stub_compiler_; 1148 StubCompiler* stub_compiler_;
1153 const ParameterCount& arguments_; 1149 const ParameterCount& arguments_;
1154 Register name_; 1150 Register name_;
1155 Code::ExtraICState extra_ic_state_; 1151 Code::ExtraICState extra_ic_state_;
1156 }; 1152 };
1157 1153
1158 1154
1159 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1155 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1160 // from object to (but not including) holder. 1156 Handle<JSObject> object,
1161 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1157 Handle<JSObject> holder,
1162 Handle<JSObject> object, 1158 Handle<Name> name,
1163 Handle<JSObject> holder, 1159 Register scratch,
1164 Handle<Name> name, 1160 Label* miss) {
1165 Register scratch,
1166 Label* miss) {
1167 Handle<JSObject> current = object; 1161 Handle<JSObject> current = object;
1168 while (!current.is_identical_to(holder)) { 1162 while (!current.is_identical_to(holder)) {
1169 if (current->IsGlobalObject()) { 1163 if (current->IsGlobalObject()) {
1170 GenerateCheckPropertyCell(masm, 1164 GenerateCheckPropertyCell(masm,
1171 Handle<GlobalObject>::cast(current), 1165 Handle<GlobalObject>::cast(current),
1172 name, 1166 name,
1173 scratch, 1167 scratch,
1174 miss); 1168 miss);
1175 } 1169 }
1176 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1170 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 __ ldr(scratch2(), FieldMemOperand(pointer, kValueOffset)); 1360 __ ldr(scratch2(), FieldMemOperand(pointer, kValueOffset));
1367 __ cmp(scratch2(), Operand(callback)); 1361 __ cmp(scratch2(), Operand(callback));
1368 __ b(ne, &miss); 1362 __ b(ne, &miss);
1369 } 1363 }
1370 1364
1371 HandlerFrontendFooter(name, success, &miss); 1365 HandlerFrontendFooter(name, success, &miss);
1372 return reg; 1366 return reg;
1373 } 1367 }
1374 1368
1375 1369
1376 void LoadStubCompiler::NonexistentHandlerFrontend(
1377 Handle<JSObject> object,
1378 Handle<JSObject> last,
1379 Handle<Name> name,
1380 Label* success,
1381 Handle<GlobalObject> global) {
1382 Label miss;
1383
1384 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1385
1386 // If the last object in the prototype chain is a global object,
1387 // check that the global property cell is empty.
1388 if (!global.is_null()) {
1389 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
1390 }
1391
1392 HandlerFrontendFooter(name, success, &miss);
1393 }
1394
1395
1396 void LoadStubCompiler::GenerateLoadField(Register reg, 1370 void LoadStubCompiler::GenerateLoadField(Register reg,
1397 Handle<JSObject> holder, 1371 Handle<JSObject> holder,
1398 PropertyIndex field, 1372 PropertyIndex field,
1399 Representation representation) { 1373 Representation representation) {
1400 if (!reg.is(receiver())) __ mov(receiver(), reg); 1374 if (!reg.is(receiver())) __ mov(receiver(), reg);
1401 if (kind() == Code::LOAD_IC) { 1375 if (kind() == Code::LOAD_IC) {
1402 LoadFieldStub stub(field.is_inobject(holder), 1376 LoadFieldStub stub(field.is_inobject(holder),
1403 field.translate(holder), 1377 field.translate(holder),
1404 representation); 1378 representation);
1405 GenerateTailCall(masm(), stub.GetCode(isolate())); 1379 GenerateTailCall(masm(), stub.GetCode(isolate()));
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
3189 // ----------------------------------- 3163 // -----------------------------------
3190 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3164 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3191 } 3165 }
3192 3166
3193 3167
3194 #undef __ 3168 #undef __
3195 3169
3196 } } // namespace v8::internal 3170 } } // namespace v8::internal
3197 3171
3198 #endif // V8_TARGET_ARCH_ARM 3172 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698