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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 // Check that the maps haven't changed. | 1227 // Check that the maps haven't changed. |
1228 CheckPrototypes(object, receiver, holder, | 1228 CheckPrototypes(object, receiver, holder, |
1229 scratch1, scratch2, scratch3, name, miss); | 1229 scratch1, scratch2, scratch3, name, miss); |
1230 | 1230 |
1231 // Return the constant value. | 1231 // Return the constant value. |
1232 __ LoadHeapObject(v0, value); | 1232 __ LoadHeapObject(v0, value); |
1233 __ Ret(); | 1233 __ Ret(); |
1234 } | 1234 } |
1235 | 1235 |
1236 | 1236 |
| 1237 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, |
| 1238 Register name_reg, |
| 1239 Register scratch1, |
| 1240 Register scratch2, |
| 1241 Register scratch3, |
| 1242 Handle<AccessorInfo> callback, |
| 1243 Handle<String> name, |
| 1244 Label* miss) { |
| 1245 Register dictionary = scratch1; |
| 1246 Register index = scratch2; |
| 1247 __ lw(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
| 1248 |
| 1249 // Probe the dictionary. |
| 1250 Label probe_done; |
| 1251 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), |
| 1252 miss, |
| 1253 &probe_done, |
| 1254 dictionary, |
| 1255 name_reg, |
| 1256 index, // Set if we hit. |
| 1257 scratch3); |
| 1258 __ bind(&probe_done); |
| 1259 |
| 1260 // If probing finds an entry in the dictionary, check that the value is the |
| 1261 // callback. |
| 1262 const int kElementsStartOffset = |
| 1263 StringDictionary::kHeaderSize + |
| 1264 StringDictionary::kElementsStartIndex * kPointerSize; |
| 1265 const int kValueOffset = kElementsStartOffset + kPointerSize; |
| 1266 __ Addu(scratch1, dictionary, Operand(kValueOffset - kHeapObjectTag)); |
| 1267 __ sll(scratch3, index, kPointerSizeLog2); |
| 1268 __ addu(scratch1, scratch1, scratch3); |
| 1269 __ lw(scratch3, MemOperand(scratch1)); |
| 1270 __ Branch(miss, ne, scratch3, Operand(callback)); |
| 1271 } |
| 1272 |
| 1273 |
1237 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, | 1274 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, |
1238 Handle<JSObject> holder, | 1275 Handle<JSObject> holder, |
1239 Register receiver, | 1276 Register receiver, |
1240 Register name_reg, | 1277 Register name_reg, |
1241 Register scratch1, | 1278 Register scratch1, |
1242 Register scratch2, | 1279 Register scratch2, |
1243 Register scratch3, | 1280 Register scratch3, |
1244 Handle<AccessorInfo> callback, | 1281 Handle<AccessorInfo> callback, |
1245 Handle<String> name, | 1282 Handle<String> name, |
1246 Label* miss) { | 1283 Label* miss) { |
1247 // Check that the receiver isn't a smi. | 1284 // Check that the receiver isn't a smi. |
1248 __ JumpIfSmi(receiver, miss, scratch1); | 1285 __ JumpIfSmi(receiver, miss, scratch1); |
1249 | 1286 |
1250 // Check that the maps haven't changed. | 1287 // Check that the maps haven't changed. |
1251 Register reg = CheckPrototypes(object, receiver, holder, scratch1, | 1288 Register reg = CheckPrototypes(object, receiver, holder, scratch1, |
1252 scratch2, scratch3, name, miss); | 1289 scratch2, scratch3, name, miss); |
1253 | 1290 |
| 1291 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
| 1292 GenerateDictionaryLoadCallback( |
| 1293 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); |
| 1294 } |
| 1295 |
1254 // Build AccessorInfo::args_ list on the stack and push property name below | 1296 // Build AccessorInfo::args_ list on the stack and push property name below |
1255 // the exit frame to make GC aware of them and store pointers to them. | 1297 // the exit frame to make GC aware of them and store pointers to them. |
1256 __ push(receiver); | 1298 __ push(receiver); |
1257 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ | 1299 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ |
1258 if (heap()->InNewSpace(callback->data())) { | 1300 if (heap()->InNewSpace(callback->data())) { |
1259 __ li(scratch3, callback); | 1301 __ li(scratch3, callback); |
1260 __ lw(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); | 1302 __ lw(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); |
1261 } else { | 1303 } else { |
1262 __ li(scratch3, Handle<Object>(callback->data())); | 1304 __ li(scratch3, Handle<Object>(callback->data())); |
1263 } | 1305 } |
(...skipping 3478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4742 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4784 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4743 } | 4785 } |
4744 } | 4786 } |
4745 | 4787 |
4746 | 4788 |
4747 #undef __ | 4789 #undef __ |
4748 | 4790 |
4749 } } // namespace v8::internal | 4791 } } // namespace v8::internal |
4750 | 4792 |
4751 #endif // V8_TARGET_ARCH_MIPS | 4793 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |