| OLD | NEW |
| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 __ tst(scratch1, Operand(kTypeAndReadOnlyMask)); | 201 __ tst(scratch1, Operand(kTypeAndReadOnlyMask)); |
| 202 __ b(ne, miss); | 202 __ b(ne, miss); |
| 203 | 203 |
| 204 // Store the value at the masked, scaled index and return. | 204 // Store the value at the masked, scaled index and return. |
| 205 const int kValueOffset = kElementsStartOffset + kPointerSize; | 205 const int kValueOffset = kElementsStartOffset + kPointerSize; |
| 206 __ add(scratch2, scratch2, Operand(kValueOffset - kHeapObjectTag)); | 206 __ add(scratch2, scratch2, Operand(kValueOffset - kHeapObjectTag)); |
| 207 __ str(value, MemOperand(scratch2)); | 207 __ str(value, MemOperand(scratch2)); |
| 208 | 208 |
| 209 // Update the write barrier. Make sure not to clobber the value. | 209 // Update the write barrier. Make sure not to clobber the value. |
| 210 __ mov(scratch1, value); | 210 __ mov(scratch1, value); |
| 211 __ RecordWrite(elements, scratch2, scratch1); | 211 __ RecordWrite( |
| 212 elements, scratch2, scratch1, kLRHasNotBeenSaved, kDontSaveFPRegs); |
| 212 } | 213 } |
| 213 | 214 |
| 214 | 215 |
| 215 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 216 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
| 216 // ----------- S t a t e ------------- | 217 // ----------- S t a t e ------------- |
| 217 // -- r2 : name | 218 // -- r2 : name |
| 218 // -- lr : return address | 219 // -- lr : return address |
| 219 // -- r0 : receiver | 220 // -- r0 : receiver |
| 220 // -- sp[0] : receiver | 221 // -- sp[0] : receiver |
| 221 // ----------------------------------- | 222 // ----------------------------------- |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 498 |
| 498 if (id == IC::kCallIC_Miss) { | 499 if (id == IC::kCallIC_Miss) { |
| 499 __ IncrementCounter(isolate->counters()->call_miss(), 1, r3, r4); | 500 __ IncrementCounter(isolate->counters()->call_miss(), 1, r3, r4); |
| 500 } else { | 501 } else { |
| 501 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, r3, r4); | 502 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, r3, r4); |
| 502 } | 503 } |
| 503 | 504 |
| 504 // Get the receiver of the function from the stack. | 505 // Get the receiver of the function from the stack. |
| 505 __ ldr(r3, MemOperand(sp, argc * kPointerSize)); | 506 __ ldr(r3, MemOperand(sp, argc * kPointerSize)); |
| 506 | 507 |
| 507 __ EnterInternalFrame(); | 508 { |
| 509 FrameScope scope(masm, StackFrame::INTERNAL); |
| 508 | 510 |
| 509 // Push the receiver and the name of the function. | 511 // Push the receiver and the name of the function. |
| 510 __ Push(r3, r2); | 512 __ Push(r3, r2); |
| 511 | 513 |
| 512 // Call the entry. | 514 // Call the entry. |
| 513 __ mov(r0, Operand(2)); | 515 __ mov(r0, Operand(2)); |
| 514 __ mov(r1, Operand(ExternalReference(IC_Utility(id), isolate))); | 516 __ mov(r1, Operand(ExternalReference(IC_Utility(id), isolate))); |
| 515 | 517 |
| 516 CEntryStub stub(1); | 518 CEntryStub stub(1); |
| 517 __ CallStub(&stub); | 519 __ CallStub(&stub); |
| 518 | 520 |
| 519 // Move result to r1 and leave the internal frame. | 521 // Move result to r1 and leave the internal frame. |
| 520 __ mov(r1, Operand(r0)); | 522 __ mov(r1, Operand(r0)); |
| 521 __ LeaveInternalFrame(); | 523 } |
| 522 | 524 |
| 523 // Check if the receiver is a global object of some sort. | 525 // Check if the receiver is a global object of some sort. |
| 524 // This can happen only for regular CallIC but not KeyedCallIC. | 526 // This can happen only for regular CallIC but not KeyedCallIC. |
| 525 if (id == IC::kCallIC_Miss) { | 527 if (id == IC::kCallIC_Miss) { |
| 526 Label invoke, global; | 528 Label invoke, global; |
| 527 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); // receiver | 529 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); // receiver |
| 528 __ JumpIfSmi(r2, &invoke); | 530 __ JumpIfSmi(r2, &invoke); |
| 529 __ CompareObjectType(r2, r3, r3, JS_GLOBAL_OBJECT_TYPE); | 531 __ CompareObjectType(r2, r3, r3, JS_GLOBAL_OBJECT_TYPE); |
| 530 __ b(eq, &global); | 532 __ b(eq, &global); |
| 531 __ cmp(r3, Operand(JS_BUILTINS_OBJECT_TYPE)); | 533 __ cmp(r3, Operand(JS_BUILTINS_OBJECT_TYPE)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 __ mov(r0, Operand(r2, ASR, kSmiTagSize)); | 645 __ mov(r0, Operand(r2, ASR, kSmiTagSize)); |
| 644 // r0: untagged index | 646 // r0: untagged index |
| 645 __ LoadFromNumberDictionary(&slow_load, r4, r2, r1, r0, r3, r5); | 647 __ LoadFromNumberDictionary(&slow_load, r4, r2, r1, r0, r3, r5); |
| 646 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1, r0, r3); | 648 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1, r0, r3); |
| 647 __ jmp(&do_call); | 649 __ jmp(&do_call); |
| 648 | 650 |
| 649 __ bind(&slow_load); | 651 __ bind(&slow_load); |
| 650 // This branch is taken when calling KeyedCallIC_Miss is neither required | 652 // This branch is taken when calling KeyedCallIC_Miss is neither required |
| 651 // nor beneficial. | 653 // nor beneficial. |
| 652 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1, r0, r3); | 654 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1, r0, r3); |
| 653 __ EnterInternalFrame(); | 655 { |
| 654 __ push(r2); // save the key | 656 FrameScope scope(masm, StackFrame::INTERNAL); |
| 655 __ Push(r1, r2); // pass the receiver and the key | 657 __ push(r2); // save the key |
| 656 __ CallRuntime(Runtime::kKeyedGetProperty, 2); | 658 __ Push(r1, r2); // pass the receiver and the key |
| 657 __ pop(r2); // restore the key | 659 __ CallRuntime(Runtime::kKeyedGetProperty, 2); |
| 658 __ LeaveInternalFrame(); | 660 __ pop(r2); // restore the key |
| 661 } |
| 659 __ mov(r1, r0); | 662 __ mov(r1, r0); |
| 660 __ jmp(&do_call); | 663 __ jmp(&do_call); |
| 661 | 664 |
| 662 __ bind(&check_string); | 665 __ bind(&check_string); |
| 663 GenerateKeyStringCheck(masm, r2, r0, r3, &index_string, &slow_call); | 666 GenerateKeyStringCheck(masm, r2, r0, r3, &index_string, &slow_call); |
| 664 | 667 |
| 665 // The key is known to be a symbol. | 668 // The key is known to be a symbol. |
| 666 // If the receiver is a regular JS object with slow properties then do | 669 // If the receiver is a regular JS object with slow properties then do |
| 667 // a quick inline probe of the receiver's dictionary. | 670 // a quick inline probe of the receiver's dictionary. |
| 668 // Otherwise do the monomorphic cache probe. | 671 // Otherwise do the monomorphic cache probe. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 // -- r0 : value | 904 // -- r0 : value |
| 902 // -- r1 : key | 905 // -- r1 : key |
| 903 // -- r2 : receiver | 906 // -- r2 : receiver |
| 904 // -- lr : return address | 907 // -- lr : return address |
| 905 // ----------------------------------- | 908 // ----------------------------------- |
| 906 Label slow, notin; | 909 Label slow, notin; |
| 907 MemOperand mapped_location = | 910 MemOperand mapped_location = |
| 908 GenerateMappedArgumentsLookup(masm, r2, r1, r3, r4, r5, ¬in, &slow); | 911 GenerateMappedArgumentsLookup(masm, r2, r1, r3, r4, r5, ¬in, &slow); |
| 909 __ str(r0, mapped_location); | 912 __ str(r0, mapped_location); |
| 910 __ add(r6, r3, r5); | 913 __ add(r6, r3, r5); |
| 911 __ RecordWrite(r3, r6, r9); | 914 __ mov(r9, r0); |
| 915 __ RecordWrite(r3, r6, r9, kLRHasNotBeenSaved, kDontSaveFPRegs); |
| 912 __ Ret(); | 916 __ Ret(); |
| 913 __ bind(¬in); | 917 __ bind(¬in); |
| 914 // The unmapped lookup expects that the parameter map is in r3. | 918 // The unmapped lookup expects that the parameter map is in r3. |
| 915 MemOperand unmapped_location = | 919 MemOperand unmapped_location = |
| 916 GenerateUnmappedArgumentsLookup(masm, r1, r3, r4, &slow); | 920 GenerateUnmappedArgumentsLookup(masm, r1, r3, r4, &slow); |
| 917 __ str(r0, unmapped_location); | 921 __ str(r0, unmapped_location); |
| 918 __ add(r6, r3, r4); | 922 __ add(r6, r3, r4); |
| 919 __ RecordWrite(r3, r6, r9); | 923 __ mov(r9, r0); |
| 924 __ RecordWrite(r3, r6, r9, kLRHasNotBeenSaved, kDontSaveFPRegs); |
| 920 __ Ret(); | 925 __ Ret(); |
| 921 __ bind(&slow); | 926 __ bind(&slow); |
| 922 GenerateMiss(masm, false); | 927 GenerateMiss(masm, false); |
| 923 } | 928 } |
| 924 | 929 |
| 925 | 930 |
| 926 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, | 931 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, |
| 927 int argc) { | 932 int argc) { |
| 928 // ----------- S t a t e ------------- | 933 // ----------- S t a t e ------------- |
| 929 // -- r2 : name | 934 // -- r2 : name |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 // Check that the receiver does not require access checks. We need | 1290 // Check that the receiver does not require access checks. We need |
| 1286 // to do this because this generic stub does not perform map checks. | 1291 // to do this because this generic stub does not perform map checks. |
| 1287 __ ldrb(ip, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1292 __ ldrb(ip, FieldMemOperand(r4, Map::kBitFieldOffset)); |
| 1288 __ tst(ip, Operand(1 << Map::kIsAccessCheckNeeded)); | 1293 __ tst(ip, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 1289 __ b(ne, &slow); | 1294 __ b(ne, &slow); |
| 1290 // Check if the object is a JS array or not. | 1295 // Check if the object is a JS array or not. |
| 1291 __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); | 1296 __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
| 1292 __ cmp(r4, Operand(JS_ARRAY_TYPE)); | 1297 __ cmp(r4, Operand(JS_ARRAY_TYPE)); |
| 1293 __ b(eq, &array); | 1298 __ b(eq, &array); |
| 1294 // Check that the object is some kind of JSObject. | 1299 // Check that the object is some kind of JSObject. |
| 1295 __ cmp(r4, Operand(FIRST_JS_RECEIVER_TYPE)); | 1300 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); |
| 1296 __ b(lt, &slow); | 1301 __ b(lt, &slow); |
| 1297 __ cmp(r4, Operand(JS_PROXY_TYPE)); | |
| 1298 __ b(eq, &slow); | |
| 1299 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); | |
| 1300 __ b(eq, &slow); | |
| 1301 | 1302 |
| 1302 // Object case: Check key against length in the elements array. | 1303 // Object case: Check key against length in the elements array. |
| 1303 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1304 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1304 // Check that the object is in fast mode and writable. | 1305 // Check that the object is in fast mode and writable. |
| 1305 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset)); | 1306 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset)); |
| 1306 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 1307 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
| 1307 __ cmp(r4, ip); | 1308 __ cmp(r4, ip); |
| 1308 __ b(ne, &slow); | 1309 __ b(ne, &slow); |
| 1309 // Check array bounds. Both the key and the length of FixedArray are smis. | 1310 // Check array bounds. Both the key and the length of FixedArray are smis. |
| 1310 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1311 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 __ cmp(r4, ip); | 1347 __ cmp(r4, ip); |
| 1347 __ b(ne, &slow); | 1348 __ b(ne, &slow); |
| 1348 | 1349 |
| 1349 // Check the key against the length in the array. | 1350 // Check the key against the length in the array. |
| 1350 __ ldr(ip, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1351 __ ldr(ip, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1351 __ cmp(key, Operand(ip)); | 1352 __ cmp(key, Operand(ip)); |
| 1352 __ b(hs, &extra); | 1353 __ b(hs, &extra); |
| 1353 // Fall through to fast case. | 1354 // Fall through to fast case. |
| 1354 | 1355 |
| 1355 __ bind(&fast); | 1356 __ bind(&fast); |
| 1356 // Fast case, store the value to the elements backing store. | 1357 Register scratch_value = r4; |
| 1357 __ add(r5, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1358 Register address = r5; |
| 1358 __ add(r5, r5, Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); | 1359 |
| 1359 __ str(value, MemOperand(r5)); | 1360 Label non_smi_value; |
| 1360 // Skip write barrier if the written value is a smi. | 1361 __ JumpIfNotSmi(value, &non_smi_value); |
| 1361 __ tst(value, Operand(kSmiTagMask)); | 1362 // It's irrelevant whether array is smi-only or not when writing a smi. |
| 1362 __ Ret(eq); | 1363 __ add(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 1364 __ add(address, address, Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 1365 __ str(value, MemOperand(address)); |
| 1366 __ Ret(); |
| 1367 |
| 1368 __ bind(&non_smi_value); |
| 1369 if (FLAG_smi_only_arrays) { |
| 1370 // Escape to slow case when writing non-smi into smi-only array. |
| 1371 __ ldr(scratch_value, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 1372 __ CheckFastObjectElements(scratch_value, scratch_value, &slow); |
| 1373 } |
| 1374 // Fast elements array, store the value to the elements backing store. |
| 1375 __ add(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 1376 __ add(address, address, Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 1377 __ str(value, MemOperand(address)); |
| 1363 // Update write barrier for the elements array address. | 1378 // Update write barrier for the elements array address. |
| 1364 __ sub(r4, r5, Operand(elements)); | 1379 __ mov(scratch_value, value); // Preserve the value which is returned. |
| 1365 __ RecordWrite(elements, Operand(r4), r5, r6); | 1380 __ RecordWrite(elements, |
| 1366 | 1381 address, |
| 1382 scratch_value, |
| 1383 kLRHasNotBeenSaved, |
| 1384 kDontSaveFPRegs, |
| 1385 EMIT_REMEMBERED_SET, |
| 1386 OMIT_SMI_CHECK); |
| 1367 __ Ret(); | 1387 __ Ret(); |
| 1368 } | 1388 } |
| 1369 | 1389 |
| 1370 | 1390 |
| 1371 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, | 1391 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, |
| 1372 StrictModeFlag strict_mode) { | 1392 StrictModeFlag strict_mode) { |
| 1373 // ----------- S t a t e ------------- | 1393 // ----------- S t a t e ------------- |
| 1374 // -- r0 : value | 1394 // -- r0 : value |
| 1375 // -- r1 : receiver | 1395 // -- r1 : receiver |
| 1376 // -- r2 : name | 1396 // -- r2 : name |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 Register reg = Assembler::GetRn(instr_at_patch); | 1637 Register reg = Assembler::GetRn(instr_at_patch); |
| 1618 patcher.masm()->tst(reg, Operand(kSmiTagMask)); | 1638 patcher.masm()->tst(reg, Operand(kSmiTagMask)); |
| 1619 patcher.EmitCondition(eq); | 1639 patcher.EmitCondition(eq); |
| 1620 } | 1640 } |
| 1621 } | 1641 } |
| 1622 | 1642 |
| 1623 | 1643 |
| 1624 } } // namespace v8::internal | 1644 } } // namespace v8::internal |
| 1625 | 1645 |
| 1626 #endif // V8_TARGET_ARCH_ARM | 1646 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |