| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, | 1379 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, |
| 1380 NOT_IN_LOOP, | 1380 NOT_IN_LOOP, |
| 1381 MONOMORPHIC); | 1381 MONOMORPHIC); |
| 1382 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); | 1382 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); |
| 1383 | 1383 |
| 1384 // Cache miss: Jump to runtime. | 1384 // Cache miss: Jump to runtime. |
| 1385 GenerateMiss(masm); | 1385 GenerateMiss(masm); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 | 1388 |
| 1389 void StoreIC::GenerateArrayLength(MacroAssembler* masm) { | |
| 1390 // ----------- S t a t e ------------- | |
| 1391 // -- rax : value | |
| 1392 // -- rcx : name | |
| 1393 // -- rdx : receiver | |
| 1394 // -- rsp[0] : return address | |
| 1395 // ----------------------------------- | |
| 1396 // | |
| 1397 // This accepts as a receiver anything JSObject::SetElementsLength accepts | |
| 1398 // (currently anything except for external and pixel arrays which means | |
| 1399 // anything with elements of FixedArray type.), but currently is restricted | |
| 1400 // to JSArray. | |
| 1401 // Value must be a number, but only smis are accepted as the most common case. | |
| 1402 | |
| 1403 Label miss; | |
| 1404 | |
| 1405 Register receiver = rdx; | |
| 1406 Register value = rax; | |
| 1407 Register scratch = rbx; | |
| 1408 | |
| 1409 // Check that the receiver isn't a smi. | |
| 1410 __ JumpIfSmi(receiver, &miss); | |
| 1411 | |
| 1412 // Check that the object is a JS array. | |
| 1413 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch); | |
| 1414 __ j(not_equal, &miss); | |
| 1415 | |
| 1416 // Check that elements are FixedArray. | |
| 1417 __ movq(scratch, FieldOperand(receiver, JSArray::kElementsOffset)); | |
| 1418 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch); | |
| 1419 __ j(not_equal, &miss); | |
| 1420 | |
| 1421 // Check that value is a smi. | |
| 1422 __ JumpIfNotSmi(value, &miss); | |
| 1423 | |
| 1424 // Prepare tail call to StoreIC_ArrayLength. | |
| 1425 __ pop(scratch); | |
| 1426 __ push(receiver); | |
| 1427 __ push(value); | |
| 1428 __ push(scratch); // return address | |
| 1429 | |
| 1430 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_ArrayLength)), 2, 1); | |
| 1431 | |
| 1432 __ bind(&miss); | |
| 1433 | |
| 1434 GenerateMiss(masm); | |
| 1435 } | |
| 1436 | |
| 1437 | |
| 1438 #undef __ | 1389 #undef __ |
| 1439 | 1390 |
| 1440 | 1391 |
| 1441 } } // namespace v8::internal | 1392 } } // namespace v8::internal |
| OLD | NEW |