| 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 17 matching lines...) Expand all Loading... |
| 28 #include <limits.h> // For LONG_MIN, LONG_MAX. | 28 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #if V8_TARGET_ARCH_ARM | 32 #if V8_TARGET_ARCH_ARM |
| 33 | 33 |
| 34 #include "bootstrapper.h" | 34 #include "bootstrapper.h" |
| 35 #include "codegen.h" | 35 #include "codegen.h" |
| 36 #include "cpu-profiler.h" | 36 #include "cpu-profiler.h" |
| 37 #include "debug.h" | 37 #include "debug.h" |
| 38 #include "isolate-inl.h" |
| 38 #include "runtime.h" | 39 #include "runtime.h" |
| 39 | 40 |
| 40 namespace v8 { | 41 namespace v8 { |
| 41 namespace internal { | 42 namespace internal { |
| 42 | 43 |
| 43 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 44 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
| 44 : Assembler(arg_isolate, buffer, size), | 45 : Assembler(arg_isolate, buffer, size), |
| 45 generating_stub_(false), | 46 generating_stub_(false), |
| 46 allow_stub_calls_(true), | 47 allow_stub_calls_(true), |
| 47 has_frame_(false) { | 48 has_frame_(false) { |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 if (frame_mode == BUILD_STUB_FRAME) { | 920 if (frame_mode == BUILD_STUB_FRAME) { |
| 920 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 921 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
| 921 Push(Smi::FromInt(StackFrame::STUB)); | 922 Push(Smi::FromInt(StackFrame::STUB)); |
| 922 // Adjust FP to point to saved FP. | 923 // Adjust FP to point to saved FP. |
| 923 add(fp, sp, Operand(2 * kPointerSize)); | 924 add(fp, sp, Operand(2 * kPointerSize)); |
| 924 } else { | 925 } else { |
| 925 PredictableCodeSizeScope predictible_code_size_scope( | 926 PredictableCodeSizeScope predictible_code_size_scope( |
| 926 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); | 927 this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); |
| 927 // The following three instructions must remain together and unmodified | 928 // The following three instructions must remain together and unmodified |
| 928 // for code aging to work properly. | 929 // for code aging to work properly. |
| 929 if (FLAG_optimize_for_size && FLAG_age_code) { | 930 if (isolate()->IsCodePreAgingActive()) { |
| 930 // Pre-age the code. | 931 // Pre-age the code. |
| 931 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); | 932 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
| 932 add(r0, pc, Operand(-8)); | 933 add(r0, pc, Operand(-8)); |
| 933 ldr(pc, MemOperand(pc, -4)); | 934 ldr(pc, MemOperand(pc, -4)); |
| 934 dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 935 emit_code_stub_address(stub); |
| 935 } else { | 936 } else { |
| 936 stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); | 937 stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); |
| 937 nop(ip.code()); | 938 nop(ip.code()); |
| 938 // Adjust FP to point to saved FP. | 939 // Adjust FP to point to saved FP. |
| 939 add(fp, sp, Operand(2 * kPointerSize)); | 940 add(fp, sp, Operand(2 * kPointerSize)); |
| 940 } | 941 } |
| 941 } | 942 } |
| 942 } | 943 } |
| 943 | 944 |
| 944 | 945 |
| (...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3921 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { | 3922 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { |
| 3922 Register candidate = Register::FromAllocationIndex(i); | 3923 Register candidate = Register::FromAllocationIndex(i); |
| 3923 if (regs & candidate.bit()) continue; | 3924 if (regs & candidate.bit()) continue; |
| 3924 return candidate; | 3925 return candidate; |
| 3925 } | 3926 } |
| 3926 UNREACHABLE(); | 3927 UNREACHABLE(); |
| 3927 return no_reg; | 3928 return no_reg; |
| 3928 } | 3929 } |
| 3929 | 3930 |
| 3930 | 3931 |
| 3932 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
| 3933 Register object, |
| 3934 Register scratch0, |
| 3935 Register scratch1, |
| 3936 Label* found) { |
| 3937 ASSERT(!scratch1.is(scratch0)); |
| 3938 Factory* factory = isolate()->factory(); |
| 3939 Register current = scratch0; |
| 3940 Label loop_again; |
| 3941 |
| 3942 // scratch contained elements pointer. |
| 3943 mov(current, object); |
| 3944 |
| 3945 // Loop based on the map going up the prototype chain. |
| 3946 bind(&loop_again); |
| 3947 ldr(current, FieldMemOperand(current, HeapObject::kMapOffset)); |
| 3948 ldr(scratch1, FieldMemOperand(current, Map::kBitField2Offset)); |
| 3949 Ubfx(scratch1, scratch1, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 3950 cmp(scratch1, Operand(DICTIONARY_ELEMENTS)); |
| 3951 b(eq, found); |
| 3952 ldr(current, FieldMemOperand(current, Map::kPrototypeOffset)); |
| 3953 cmp(current, Operand(factory->null_value())); |
| 3954 b(ne, &loop_again); |
| 3955 } |
| 3956 |
| 3957 |
| 3931 #ifdef DEBUG | 3958 #ifdef DEBUG |
| 3932 bool AreAliased(Register reg1, | 3959 bool AreAliased(Register reg1, |
| 3933 Register reg2, | 3960 Register reg2, |
| 3934 Register reg3, | 3961 Register reg3, |
| 3935 Register reg4, | 3962 Register reg4, |
| 3936 Register reg5, | 3963 Register reg5, |
| 3937 Register reg6) { | 3964 Register reg6) { |
| 3938 int n_of_valid_regs = reg1.is_valid() + reg2.is_valid() + | 3965 int n_of_valid_regs = reg1.is_valid() + reg2.is_valid() + |
| 3939 reg3.is_valid() + reg4.is_valid() + reg5.is_valid() + reg6.is_valid(); | 3966 reg3.is_valid() + reg4.is_valid() + reg5.is_valid() + reg6.is_valid(); |
| 3940 | 3967 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3991 void CodePatcher::EmitCondition(Condition cond) { | 4018 void CodePatcher::EmitCondition(Condition cond) { |
| 3992 Instr instr = Assembler::instr_at(masm_.pc_); | 4019 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3993 instr = (instr & ~kCondMask) | cond; | 4020 instr = (instr & ~kCondMask) | cond; |
| 3994 masm_.emit(instr); | 4021 masm_.emit(instr); |
| 3995 } | 4022 } |
| 3996 | 4023 |
| 3997 | 4024 |
| 3998 } } // namespace v8::internal | 4025 } } // namespace v8::internal |
| 3999 | 4026 |
| 4000 #endif // V8_TARGET_ARCH_ARM | 4027 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |