| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 478 |
| 479 void MacroAssembler::PopSafepointRegistersAndDoubles() { | 479 void MacroAssembler::PopSafepointRegistersAndDoubles() { |
| 480 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { | 480 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { |
| 481 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); | 481 vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
| 482 } | 482 } |
| 483 add(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * | 483 add(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * |
| 484 kDoubleSize)); | 484 kDoubleSize)); |
| 485 PopSafepointRegisters(); | 485 PopSafepointRegisters(); |
| 486 } | 486 } |
| 487 | 487 |
| 488 void MacroAssembler::StoreToSafepointRegistersAndDoublesSlot(Register reg) { |
| 489 str(reg, SafepointRegistersAndDoublesSlot(reg)); |
| 490 } |
| 491 |
| 492 |
| 488 void MacroAssembler::StoreToSafepointRegisterSlot(Register reg) { | 493 void MacroAssembler::StoreToSafepointRegisterSlot(Register reg) { |
| 489 str(reg, SafepointRegisterSlot(reg)); | 494 str(reg, SafepointRegisterSlot(reg)); |
| 490 } | 495 } |
| 491 | 496 |
| 492 | 497 |
| 498 void MacroAssembler::LoadFromSafepointRegisterSlot(Register reg) { |
| 499 ldr(reg, SafepointRegisterSlot(reg)); |
| 500 } |
| 501 |
| 502 |
| 493 int MacroAssembler::SafepointRegisterStackIndex(int reg_code) { | 503 int MacroAssembler::SafepointRegisterStackIndex(int reg_code) { |
| 494 // The registers are pushed starting with the highest encoding, | 504 // The registers are pushed starting with the highest encoding, |
| 495 // which means that lowest encodings are closest to the stack pointer. | 505 // which means that lowest encodings are closest to the stack pointer. |
| 496 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); | 506 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); |
| 497 return reg_code; | 507 return reg_code; |
| 498 } | 508 } |
| 499 | 509 |
| 500 | 510 |
| 501 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { | 511 MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
| 502 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 512 return MemOperand(sp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
| 503 } | 513 } |
| 504 | 514 |
| 505 | 515 |
| 516 MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
| 517 // General purpose registers are pushed last on the stack. |
| 518 int doubles_size = DwVfpRegister::kNumAllocatableRegisters * kDoubleSize; |
| 519 int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
| 520 return MemOperand(sp, doubles_size + register_offset); |
| 521 } |
| 522 |
| 523 |
| 506 void MacroAssembler::Ldrd(Register dst1, Register dst2, | 524 void MacroAssembler::Ldrd(Register dst1, Register dst2, |
| 507 const MemOperand& src, Condition cond) { | 525 const MemOperand& src, Condition cond) { |
| 508 ASSERT(src.rm().is(no_reg)); | 526 ASSERT(src.rm().is(no_reg)); |
| 509 ASSERT(!dst1.is(lr)); // r14. | 527 ASSERT(!dst1.is(lr)); // r14. |
| 510 ASSERT_EQ(0, dst1.code() % 2); | 528 ASSERT_EQ(0, dst1.code() % 2); |
| 511 ASSERT_EQ(dst1.code() + 1, dst2.code()); | 529 ASSERT_EQ(dst1.code() + 1, dst2.code()); |
| 512 | 530 |
| 513 // Generate two ldr instructions if ldrd is not available. | 531 // Generate two ldr instructions if ldrd is not available. |
| 514 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { | 532 if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
| 515 CpuFeatures::Scope scope(ARMv7); | 533 CpuFeatures::Scope scope(ARMv7); |
| (...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 Label ok, fail; | 1949 Label ok, fail; |
| 1932 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, false); | 1950 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, false); |
| 1933 b(&ok); | 1951 b(&ok); |
| 1934 bind(&fail); | 1952 bind(&fail); |
| 1935 Abort("Global functions must have initial map"); | 1953 Abort("Global functions must have initial map"); |
| 1936 bind(&ok); | 1954 bind(&ok); |
| 1937 } | 1955 } |
| 1938 } | 1956 } |
| 1939 | 1957 |
| 1940 | 1958 |
| 1959 void MacroAssembler::JumpIfNotPowerOfTwoOrZero( |
| 1960 Register reg, |
| 1961 Register scratch, |
| 1962 Label* not_power_of_two_or_zero) { |
| 1963 sub(scratch, reg, Operand(1), SetCC); |
| 1964 b(mi, not_power_of_two_or_zero); |
| 1965 tst(scratch, reg); |
| 1966 b(ne, not_power_of_two_or_zero); |
| 1967 } |
| 1968 |
| 1969 |
| 1941 void MacroAssembler::JumpIfNotBothSmi(Register reg1, | 1970 void MacroAssembler::JumpIfNotBothSmi(Register reg1, |
| 1942 Register reg2, | 1971 Register reg2, |
| 1943 Label* on_not_both_smi) { | 1972 Label* on_not_both_smi) { |
| 1944 STATIC_ASSERT(kSmiTag == 0); | 1973 STATIC_ASSERT(kSmiTag == 0); |
| 1945 tst(reg1, Operand(kSmiTagMask)); | 1974 tst(reg1, Operand(kSmiTagMask)); |
| 1946 tst(reg2, Operand(kSmiTagMask), eq); | 1975 tst(reg2, Operand(kSmiTagMask), eq); |
| 1947 b(ne, on_not_both_smi); | 1976 b(ne, on_not_both_smi); |
| 1948 } | 1977 } |
| 1949 | 1978 |
| 1950 | 1979 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 for (int i = 0; i < field_count; i++) { | 2108 for (int i = 0; i < field_count; i++) { |
| 2080 ldr(tmp, FieldMemOperand(src, i * kPointerSize)); | 2109 ldr(tmp, FieldMemOperand(src, i * kPointerSize)); |
| 2081 str(tmp, FieldMemOperand(dst, i * kPointerSize)); | 2110 str(tmp, FieldMemOperand(dst, i * kPointerSize)); |
| 2082 } | 2111 } |
| 2083 } | 2112 } |
| 2084 | 2113 |
| 2085 | 2114 |
| 2086 void MacroAssembler::CountLeadingZeros(Register zeros, // Answer. | 2115 void MacroAssembler::CountLeadingZeros(Register zeros, // Answer. |
| 2087 Register source, // Input. | 2116 Register source, // Input. |
| 2088 Register scratch) { | 2117 Register scratch) { |
| 2089 ASSERT(!zeros.is(source) || !source.is(zeros)); | 2118 ASSERT(!zeros.is(source) || !source.is(scratch)); |
| 2090 ASSERT(!zeros.is(scratch)); | 2119 ASSERT(!zeros.is(scratch)); |
| 2091 ASSERT(!scratch.is(ip)); | 2120 ASSERT(!scratch.is(ip)); |
| 2092 ASSERT(!source.is(ip)); | 2121 ASSERT(!source.is(ip)); |
| 2093 ASSERT(!zeros.is(ip)); | 2122 ASSERT(!zeros.is(ip)); |
| 2094 #ifdef CAN_USE_ARMV5_INSTRUCTIONS | 2123 #ifdef CAN_USE_ARMV5_INSTRUCTIONS |
| 2095 clz(zeros, source); // This instruction is only supported after ARM5. | 2124 clz(zeros, source); // This instruction is only supported after ARM5. |
| 2096 #else | 2125 #else |
| 2097 mov(zeros, Operand(0, RelocInfo::NONE)); | 2126 mov(zeros, Operand(0, RelocInfo::NONE)); |
| 2098 Move(scratch, source); | 2127 Move(scratch, source); |
| 2099 // Top 16. | 2128 // Top 16. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2293 | 2322 |
| 2294 void CodePatcher::Emit(Address addr) { | 2323 void CodePatcher::Emit(Address addr) { |
| 2295 masm()->emit(reinterpret_cast<Instr>(addr)); | 2324 masm()->emit(reinterpret_cast<Instr>(addr)); |
| 2296 } | 2325 } |
| 2297 #endif // ENABLE_DEBUGGER_SUPPORT | 2326 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2298 | 2327 |
| 2299 | 2328 |
| 2300 } } // namespace v8::internal | 2329 } } // namespace v8::internal |
| 2301 | 2330 |
| 2302 #endif // V8_TARGET_ARCH_ARM | 2331 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |