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

Side by Side Diff: src/mips/ic-mips.cc

Issue 8112008: MIPS: port all relevant commits since the new-gc was landed. (Closed)
Patch Set: rebased on r9598. Created 9 years, 2 months 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
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.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 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 1198
1199 1199
1200 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, 1200 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
1201 StrictModeFlag strict_mode) { 1201 StrictModeFlag strict_mode) {
1202 // ---------- S t a t e -------------- 1202 // ---------- S t a t e --------------
1203 // -- a0 : value 1203 // -- a0 : value
1204 // -- a1 : key 1204 // -- a1 : key
1205 // -- a2 : receiver 1205 // -- a2 : receiver
1206 // -- ra : return address 1206 // -- ra : return address
1207 // ----------------------------------- 1207 // -----------------------------------
1208 1208 Label slow, array, extra, check_if_double_array;
1209 Label slow, fast, array, extra, exit; 1209 Label fast_object_with_map_check, fast_object_without_map_check;
1210 Label fast_double_with_map_check, fast_double_without_map_check;
1210 1211
1211 // Register usage. 1212 // Register usage.
1212 Register value = a0; 1213 Register value = a0;
1213 Register key = a1; 1214 Register key = a1;
1214 Register receiver = a2; 1215 Register receiver = a2;
1215 Register elements = a3; // Elements array of the receiver. 1216 Register elements = a3; // Elements array of the receiver.
1216 // t0 is used as ip in the arm version. 1217 Register elements_map = t2;
1217 // t3-t4 are used as temporaries. 1218 Register receiver_map = t3;
1219 // t0 and t1 are used as general scratch registers.
1218 1220
1219 // Check that the key is a smi. 1221 // Check that the key is a smi.
1220 __ JumpIfNotSmi(key, &slow); 1222 __ JumpIfNotSmi(key, &slow);
1221 // Check that the object isn't a smi. 1223 // Check that the object isn't a smi.
1222 __ JumpIfSmi(receiver, &slow); 1224 __ JumpIfSmi(receiver, &slow);
1223
1224 // Get the map of the object. 1225 // Get the map of the object.
1225 __ lw(t3, FieldMemOperand(receiver, HeapObject::kMapOffset)); 1226 __ lw(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1226 // Check that the receiver does not require access checks. We need 1227 // Check that the receiver does not require access checks. We need
1227 // to do this because this generic stub does not perform map checks. 1228 // to do this because this generic stub does not perform map checks.
1228 __ lbu(t0, FieldMemOperand(t3, Map::kBitFieldOffset)); 1229 __ lbu(t0, FieldMemOperand(receiver_map, Map::kBitFieldOffset));
1229 __ And(t0, t0, Operand(1 << Map::kIsAccessCheckNeeded)); 1230 __ And(t0, t0, Operand(1 << Map::kIsAccessCheckNeeded));
1230 __ Branch(&slow, ne, t0, Operand(zero_reg)); 1231 __ Branch(&slow, ne, t0, Operand(zero_reg));
1231 // Check if the object is a JS array or not. 1232 // Check if the object is a JS array or not.
1232 __ lbu(t3, FieldMemOperand(t3, Map::kInstanceTypeOffset)); 1233 __ lbu(t0, FieldMemOperand(receiver_map, Map::kInstanceTypeOffset));
1233 1234 __ Branch(&array, eq, t0, Operand(JS_ARRAY_TYPE));
1234 __ Branch(&array, eq, t3, Operand(JS_ARRAY_TYPE));
1235 // Check that the object is some kind of JSObject. 1235 // Check that the object is some kind of JSObject.
1236 __ Branch(&slow, lt, t3, Operand(FIRST_JS_RECEIVER_TYPE)); 1236 __ Branch(&slow, lt, t0, Operand(FIRST_JS_OBJECT_TYPE));
1237 __ Branch(&slow, eq, t3, Operand(JS_PROXY_TYPE));
1238 __ Branch(&slow, eq, t3, Operand(JS_FUNCTION_PROXY_TYPE));
1239 1237
1240 // Object case: Check key against length in the elements array. 1238 // Object case: Check key against length in the elements array.
1241 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 1239 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
1242 // Check that the object is in fast mode and writable.
1243 __ lw(t3, FieldMemOperand(elements, HeapObject::kMapOffset));
1244 __ LoadRoot(t0, Heap::kFixedArrayMapRootIndex);
1245 __ Branch(&slow, ne, t3, Operand(t0));
1246 // Check array bounds. Both the key and the length of FixedArray are smis. 1240 // Check array bounds. Both the key and the length of FixedArray are smis.
1247 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1241 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset));
1248 __ Branch(&fast, lo, key, Operand(t0)); 1242 __ Branch(&fast_object_with_map_check, lo, key, Operand(t0));
1249 // Fall thru to slow if un-tagged index >= length.
1250 1243
1251 // Slow case, handle jump to runtime. 1244 // Slow case, handle jump to runtime.
1252 __ bind(&slow); 1245 __ bind(&slow);
1253
1254 // Entry registers are intact. 1246 // Entry registers are intact.
1255 // a0: value. 1247 // a0: value.
1256 // a1: key. 1248 // a1: key.
1257 // a2: receiver. 1249 // a2: receiver.
1258
1259 GenerateRuntimeSetProperty(masm, strict_mode); 1250 GenerateRuntimeSetProperty(masm, strict_mode);
1260 1251
1261 // Extra capacity case: Check if there is extra capacity to 1252 // Extra capacity case: Check if there is extra capacity to
1262 // perform the store and update the length. Used for adding one 1253 // perform the store and update the length. Used for adding one
1263 // element to the array by writing to array[array.length]. 1254 // element to the array by writing to array[array.length].
1264
1265 __ bind(&extra); 1255 __ bind(&extra);
1266 // Only support writing to array[array.length]. 1256 // Condition code from comparing key and array length is still available.
1257 // Only support writing to writing to array[array.length].
1267 __ Branch(&slow, ne, key, Operand(t0)); 1258 __ Branch(&slow, ne, key, Operand(t0));
1268 // Check for room in the elements backing store. 1259 // Check for room in the elements backing store.
1269 // Both the key and the length of FixedArray are smis. 1260 // Both the key and the length of FixedArray are smis.
1270 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1261 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset));
1271 __ Branch(&slow, hs, key, Operand(t0)); 1262 __ Branch(&slow, hs, key, Operand(t0));
1263 __ lw(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
1264 __ Branch(&check_if_double_array, ne, elements_map,
1265 Operand(masm->isolate()->factory()->fixed_array_map()));
1272 // Calculate key + 1 as smi. 1266 // Calculate key + 1 as smi.
1273 STATIC_ASSERT(0 == kSmiTag); 1267 STATIC_ASSERT(kSmiTag == 0);
1274 __ Addu(t3, key, Operand(Smi::FromInt(1))); 1268 __ Addu(t0, key, Operand(Smi::FromInt(1)));
1275 __ sw(t3, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1269 __ sw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1276 __ Branch(&fast); 1270 __ Branch(&fast_object_without_map_check);
1277 1271
1272 __ bind(&check_if_double_array);
1273 __ Branch(&slow, ne, elements_map,
1274 Operand(masm->isolate()->factory()->fixed_double_array_map()));
1275 // Add 1 to key, and go to common element store code for doubles.
1276 STATIC_ASSERT(kSmiTag == 0);
1277 __ Addu(t0, key, Operand(Smi::FromInt(1)));
1278 __ sw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1279 __ jmp(&fast_double_without_map_check);
1278 1280
1279 // Array case: Get the length and the elements array from the JS 1281 // Array case: Get the length and the elements array from the JS
1280 // array. Check that the array is in fast mode (and writable); if it 1282 // array. Check that the array is in fast mode (and writable); if it
1281 // is the length is always a smi. 1283 // is the length is always a smi.
1282
1283 __ bind(&array); 1284 __ bind(&array);
1284 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 1285 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
1285 __ lw(t3, FieldMemOperand(elements, HeapObject::kMapOffset));
1286 __ LoadRoot(t0, Heap::kFixedArrayMapRootIndex);
1287 __ Branch(&slow, ne, t3, Operand(t0));
1288 1286
1289 // Check the key against the length in the array. 1287 // Check the key against the length in the array.
1290 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1288 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1291 __ Branch(&extra, hs, key, Operand(t0)); 1289 __ Branch(&extra, hs, key, Operand(t0));
1292 // Fall through to fast case. 1290 // Fall through to fast case.
1293 1291
1294 __ bind(&fast); 1292 __ bind(&fast_object_with_map_check);
1295 Register scratch_value = t0; 1293 Register scratch_value = t0;
1296 Register address = t1; 1294 Register address = t1;
1297 // Fast case, store the value to the elements backing store. 1295 __ lw(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
1296 __ Branch(&fast_double_with_map_check, ne, elements_map,
1297 Operand(masm->isolate()->factory()->fixed_array_map()));
1298 __ bind(&fast_object_without_map_check);
1299 // Smi stores don't require further checks.
1300 Label non_smi_value;
1301 __ JumpIfNotSmi(value, &non_smi_value);
1302 // It's irrelevant whether array is smi-only or not when writing a smi.
1298 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 1303 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1299 __ sll(scratch_value, key, kPointerSizeLog2 - kSmiTagSize); 1304 __ sll(scratch_value, key, kPointerSizeLog2 - kSmiTagSize);
1300 __ Addu(address, address, scratch_value); 1305 __ Addu(address, address, scratch_value);
1301 __ sw(value, MemOperand(address)); 1306 __ sw(value, MemOperand(address));
1302 // Skip write barrier if the written value is a smi. 1307 __ Ret(USE_DELAY_SLOT);
1303 __ JumpIfSmi(value, &exit); 1308 __ mov(v0, value);
1304 1309
1310 __ bind(&non_smi_value);
1311 // Escape to slow case when writing non-smi into smi-only array.
1312 __ CheckFastObjectElements(receiver_map, scratch_value, &slow);
1313 // Fast elements array, store the value to the elements backing store.
1314 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1315 __ sll(scratch_value, key, kPointerSizeLog2 - kSmiTagSize);
1316 __ Addu(address, address, scratch_value);
1317 __ sw(value, MemOperand(address));
1305 // Update write barrier for the elements array address. 1318 // Update write barrier for the elements array address.
1306 __ mov(scratch_value, value); // Preserve the value which is returned. 1319 __ mov(v0, value); // Preserve the value which is returned.
1307 __ RecordWrite(elements, 1320 __ RecordWrite(elements,
1308 address, 1321 address,
1309 scratch_value, 1322 value,
1310 kRAHasNotBeenSaved, 1323 kRAHasNotBeenSaved,
1311 kDontSaveFPRegs, 1324 kDontSaveFPRegs,
1312 EMIT_REMEMBERED_SET, 1325 EMIT_REMEMBERED_SET,
1313 OMIT_SMI_CHECK); 1326 OMIT_SMI_CHECK);
1314 __ bind(&exit); 1327 __ Ret();
1315 1328
1316 __ mov(v0, a0); // Return the value written. 1329 __ bind(&fast_double_with_map_check);
1317 __ Ret(); 1330 // Check for fast double array case. If this fails, call through to the
1331 // runtime.
1332 __ Branch(&slow, ne, elements_map,
1333 Operand(masm->isolate()->factory()->fixed_double_array_map()));
1334 __ bind(&fast_double_without_map_check);
1335 __ StoreNumberToDoubleElements(value,
1336 key,
1337 receiver,
1338 elements,
1339 t0,
1340 t1,
1341 t2,
1342 t3,
1343 &slow);
1344 __ Ret(USE_DELAY_SLOT);
1345 __ mov(v0, value);
1318 } 1346 }
1319 1347
1320 1348
1321 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { 1349 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
1322 // ---------- S t a t e -------------- 1350 // ---------- S t a t e --------------
1323 // -- ra : return address 1351 // -- ra : return address
1324 // -- a0 : key 1352 // -- a0 : key
1325 // -- a1 : receiver 1353 // -- a1 : receiver
1326 // ----------------------------------- 1354 // -----------------------------------
1327 Label slow; 1355 Label slow;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); 1666 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch));
1639 patcher.masm()->andi(at, reg, kSmiTagMask); 1667 patcher.masm()->andi(at, reg, kSmiTagMask);
1640 patcher.ChangeBranchCondition(eq); 1668 patcher.ChangeBranchCondition(eq);
1641 } 1669 }
1642 } 1670 }
1643 1671
1644 1672
1645 } } // namespace v8::internal 1673 } } // namespace v8::internal
1646 1674
1647 #endif // V8_TARGET_ARCH_MIPS 1675 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698