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

Side by Side Diff: src/mips/stub-cache-mips.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/ia32/stub-cache-ia32.cc ('k') | src/stub-cache.h » ('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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 // Jump to the first instruction in the code stub. 111 // Jump to the first instruction in the code stub.
112 __ Addu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag)); 112 __ Addu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag));
113 __ Jump(at); 113 __ Jump(at);
114 114
115 // Miss: fall through. 115 // Miss: fall through.
116 __ bind(&miss); 116 __ bind(&miss);
117 } 117 }
118 118
119 119
120 // Helper function used to check that the dictionary doesn't contain 120 void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
121 // the property. This function may return false negatives, so miss_label 121 Label* miss_label,
122 // must always call a backup property check that is complete. 122 Register receiver,
123 // This function is safe to call if the receiver has fast properties. 123 Handle<Name> name,
124 // Name must be unique and receiver must be a heap object. 124 Register scratch0,
125 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, 125 Register scratch1) {
126 Label* miss_label,
127 Register receiver,
128 Handle<Name> name,
129 Register scratch0,
130 Register scratch1) {
131 ASSERT(name->IsUniqueName()); 126 ASSERT(name->IsUniqueName());
127 ASSERT(!receiver.is(scratch0));
132 Counters* counters = masm->isolate()->counters(); 128 Counters* counters = masm->isolate()->counters();
133 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); 129 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
134 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); 130 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
135 131
136 Label done; 132 Label done;
137 133
138 const int kInterceptorOrAccessCheckNeededMask = 134 const int kInterceptorOrAccessCheckNeededMask =
139 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 135 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
140 136
141 // Bail out if the receiver has a named interceptor or requires access checks. 137 // Bail out if the receiver has a named interceptor or requires access checks.
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 Register receiver, 397 Register receiver,
402 Register scratch1, 398 Register scratch1,
403 Register scratch2, 399 Register scratch2,
404 Label* miss_label) { 400 Label* miss_label) {
405 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 401 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
406 __ Ret(USE_DELAY_SLOT); 402 __ Ret(USE_DELAY_SLOT);
407 __ mov(v0, scratch1); 403 __ mov(v0, scratch1);
408 } 404 }
409 405
410 406
411 // Generate code to check that a global property cell is empty. Create 407 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
412 // the property cell at compilation time if no cell exists for the 408 Handle<GlobalObject> global,
413 // property. 409 Handle<Name> name,
414 static void GenerateCheckPropertyCell(MacroAssembler* masm, 410 Register scratch,
415 Handle<GlobalObject> global, 411 Label* miss) {
416 Handle<Name> name,
417 Register scratch,
418 Label* miss) {
419 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name); 412 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name);
420 ASSERT(cell->value()->IsTheHole()); 413 ASSERT(cell->value()->IsTheHole());
421 __ li(scratch, Operand(cell)); 414 __ li(scratch, Operand(cell));
422 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); 415 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
423 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 416 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
424 __ Branch(miss, ne, scratch, Operand(at)); 417 __ Branch(miss, ne, scratch, Operand(at));
425 } 418 }
426 419
427 420
428 void StoreStubCompiler::GenerateNegativeHolderLookup( 421 void StoreStubCompiler::GenerateNegativeHolderLookup(
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch)); 1135 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch));
1143 } 1136 }
1144 1137
1145 StubCompiler* stub_compiler_; 1138 StubCompiler* stub_compiler_;
1146 const ParameterCount& arguments_; 1139 const ParameterCount& arguments_;
1147 Register name_; 1140 Register name_;
1148 Code::ExtraICState extra_ic_state_; 1141 Code::ExtraICState extra_ic_state_;
1149 }; 1142 };
1150 1143
1151 1144
1152 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1145 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1153 // from object to (but not including) holder. 1146 Handle<JSObject> object,
1154 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1147 Handle<JSObject> holder,
1155 Handle<JSObject> object, 1148 Handle<Name> name,
1156 Handle<JSObject> holder, 1149 Register scratch,
1157 Handle<Name> name, 1150 Label* miss) {
1158 Register scratch,
1159 Label* miss) {
1160 Handle<JSObject> current = object; 1151 Handle<JSObject> current = object;
1161 while (!current.is_identical_to(holder)) { 1152 while (!current.is_identical_to(holder)) {
1162 if (current->IsGlobalObject()) { 1153 if (current->IsGlobalObject()) {
1163 GenerateCheckPropertyCell(masm, 1154 GenerateCheckPropertyCell(masm,
1164 Handle<GlobalObject>::cast(current), 1155 Handle<GlobalObject>::cast(current),
1165 name, 1156 name,
1166 scratch, 1157 scratch,
1167 miss); 1158 miss);
1168 } 1159 }
1169 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1160 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 const int kValueOffset = kElementsStartOffset + kPointerSize; 1348 const int kValueOffset = kElementsStartOffset + kPointerSize;
1358 __ lw(scratch2(), FieldMemOperand(pointer, kValueOffset)); 1349 __ lw(scratch2(), FieldMemOperand(pointer, kValueOffset));
1359 __ Branch(&miss, ne, scratch2(), Operand(callback)); 1350 __ Branch(&miss, ne, scratch2(), Operand(callback));
1360 } 1351 }
1361 1352
1362 HandlerFrontendFooter(name, success, &miss); 1353 HandlerFrontendFooter(name, success, &miss);
1363 return reg; 1354 return reg;
1364 } 1355 }
1365 1356
1366 1357
1367 void LoadStubCompiler::NonexistentHandlerFrontend(
1368 Handle<JSObject> object,
1369 Handle<JSObject> last,
1370 Handle<Name> name,
1371 Label* success,
1372 Handle<GlobalObject> global) {
1373 Label miss;
1374
1375 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1376
1377 // If the last object in the prototype chain is a global object,
1378 // check that the global property cell is empty.
1379 if (!global.is_null()) {
1380 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
1381 }
1382
1383 HandlerFrontendFooter(name, success, &miss);
1384 }
1385
1386
1387 void LoadStubCompiler::GenerateLoadField(Register reg, 1358 void LoadStubCompiler::GenerateLoadField(Register reg,
1388 Handle<JSObject> holder, 1359 Handle<JSObject> holder,
1389 PropertyIndex field, 1360 PropertyIndex field,
1390 Representation representation) { 1361 Representation representation) {
1391 if (!reg.is(receiver())) __ mov(receiver(), reg); 1362 if (!reg.is(receiver())) __ mov(receiver(), reg);
1392 if (kind() == Code::LOAD_IC) { 1363 if (kind() == Code::LOAD_IC) {
1393 LoadFieldStub stub(field.is_inobject(holder), 1364 LoadFieldStub stub(field.is_inobject(holder),
1394 field.translate(holder), 1365 field.translate(holder),
1395 representation); 1366 representation);
1396 GenerateTailCall(masm(), stub.GetCode(isolate())); 1367 GenerateTailCall(masm(), stub.GetCode(isolate()));
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 // ----------------------------------- 3174 // -----------------------------------
3204 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3175 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3205 } 3176 }
3206 3177
3207 3178
3208 #undef __ 3179 #undef __
3209 3180
3210 } } // namespace v8::internal 3181 } } // namespace v8::internal
3211 3182
3212 #endif // V8_TARGET_ARCH_MIPS 3183 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698