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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Condition cond) { | 67 Condition cond) { |
68 ASSERT(!RelocInfo::IsCodeTarget(rmode)); | 68 ASSERT(!RelocInfo::IsCodeTarget(rmode)); |
69 Jump(reinterpret_cast<intptr_t>(target), rmode, cond); | 69 Jump(reinterpret_cast<intptr_t>(target), rmode, cond); |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 void MacroAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, | 73 void MacroAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, |
74 Condition cond) { | 74 Condition cond) { |
75 ASSERT(RelocInfo::IsCodeTarget(rmode)); | 75 ASSERT(RelocInfo::IsCodeTarget(rmode)); |
76 // 'code' is always generated ARM code, never THUMB code | 76 // 'code' is always generated ARM code, never THUMB code |
| 77 ALLOW_HANDLE_DEREF(isolate(), "embedding raw address"); |
77 Jump(reinterpret_cast<intptr_t>(code.location()), rmode, cond); | 78 Jump(reinterpret_cast<intptr_t>(code.location()), rmode, cond); |
78 } | 79 } |
79 | 80 |
80 | 81 |
81 int MacroAssembler::CallSize(Register target, Condition cond) { | 82 int MacroAssembler::CallSize(Register target, Condition cond) { |
82 return kInstrSize; | 83 return kInstrSize; |
83 } | 84 } |
84 | 85 |
85 | 86 |
86 void MacroAssembler::Call(Register target, Condition cond) { | 87 void MacroAssembler::Call(Register target, Condition cond) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (mode == NEVER_INLINE_TARGET_ADDRESS) { | 156 if (mode == NEVER_INLINE_TARGET_ADDRESS) { |
156 set_predictable_code_size(old_predictable_code_size); | 157 set_predictable_code_size(old_predictable_code_size); |
157 } | 158 } |
158 } | 159 } |
159 | 160 |
160 | 161 |
161 int MacroAssembler::CallSize(Handle<Code> code, | 162 int MacroAssembler::CallSize(Handle<Code> code, |
162 RelocInfo::Mode rmode, | 163 RelocInfo::Mode rmode, |
163 TypeFeedbackId ast_id, | 164 TypeFeedbackId ast_id, |
164 Condition cond) { | 165 Condition cond) { |
| 166 ALLOW_HANDLE_DEREF(isolate(), "using raw address"); |
165 return CallSize(reinterpret_cast<Address>(code.location()), rmode, cond); | 167 return CallSize(reinterpret_cast<Address>(code.location()), rmode, cond); |
166 } | 168 } |
167 | 169 |
168 | 170 |
169 void MacroAssembler::Call(Handle<Code> code, | 171 void MacroAssembler::Call(Handle<Code> code, |
170 RelocInfo::Mode rmode, | 172 RelocInfo::Mode rmode, |
171 TypeFeedbackId ast_id, | 173 TypeFeedbackId ast_id, |
172 Condition cond, | 174 Condition cond, |
173 TargetAddressStorageMode mode) { | 175 TargetAddressStorageMode mode) { |
174 Label start; | 176 Label start; |
175 bind(&start); | 177 bind(&start); |
176 ASSERT(RelocInfo::IsCodeTarget(rmode)); | 178 ASSERT(RelocInfo::IsCodeTarget(rmode)); |
177 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { | 179 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { |
178 SetRecordedAstId(ast_id); | 180 SetRecordedAstId(ast_id); |
179 rmode = RelocInfo::CODE_TARGET_WITH_ID; | 181 rmode = RelocInfo::CODE_TARGET_WITH_ID; |
180 } | 182 } |
181 // 'code' is always generated ARM code, never THUMB code | 183 // 'code' is always generated ARM code, never THUMB code |
| 184 ALLOW_HANDLE_DEREF(isolate(), "embedding raw address"); |
182 Call(reinterpret_cast<Address>(code.location()), rmode, cond, mode); | 185 Call(reinterpret_cast<Address>(code.location()), rmode, cond, mode); |
183 } | 186 } |
184 | 187 |
185 | 188 |
186 void MacroAssembler::Ret(Condition cond) { | 189 void MacroAssembler::Ret(Condition cond) { |
187 bx(lr, cond); | 190 bx(lr, cond); |
188 } | 191 } |
189 | 192 |
190 | 193 |
191 void MacroAssembler::Drop(int count, Condition cond) { | 194 void MacroAssembler::Drop(int count, Condition cond) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 391 |
389 void MacroAssembler::StoreRoot(Register source, | 392 void MacroAssembler::StoreRoot(Register source, |
390 Heap::RootListIndex index, | 393 Heap::RootListIndex index, |
391 Condition cond) { | 394 Condition cond) { |
392 str(source, MemOperand(kRootRegister, index << kPointerSizeLog2), cond); | 395 str(source, MemOperand(kRootRegister, index << kPointerSizeLog2), cond); |
393 } | 396 } |
394 | 397 |
395 | 398 |
396 void MacroAssembler::LoadHeapObject(Register result, | 399 void MacroAssembler::LoadHeapObject(Register result, |
397 Handle<HeapObject> object) { | 400 Handle<HeapObject> object) { |
| 401 ALLOW_HANDLE_DEREF(isolate(), "using raw address"); |
398 if (isolate()->heap()->InNewSpace(*object)) { | 402 if (isolate()->heap()->InNewSpace(*object)) { |
399 Handle<JSGlobalPropertyCell> cell = | 403 Handle<JSGlobalPropertyCell> cell = |
400 isolate()->factory()->NewJSGlobalPropertyCell(object); | 404 isolate()->factory()->NewJSGlobalPropertyCell(object); |
401 mov(result, Operand(cell)); | 405 mov(result, Operand(cell)); |
402 ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); | 406 ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); |
403 } else { | 407 } else { |
404 mov(result, Operand(object)); | 408 mov(result, Operand(object)); |
405 } | 409 } |
406 } | 410 } |
407 | 411 |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); | 1114 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); |
1111 ldr(code_reg, | 1115 ldr(code_reg, |
1112 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1116 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1113 | 1117 |
1114 ParameterCount expected(expected_reg); | 1118 ParameterCount expected(expected_reg); |
1115 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); | 1119 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); |
1116 } | 1120 } |
1117 | 1121 |
1118 | 1122 |
1119 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 1123 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
| 1124 const ParameterCount& expected, |
1120 const ParameterCount& actual, | 1125 const ParameterCount& actual, |
1121 InvokeFlag flag, | 1126 InvokeFlag flag, |
1122 const CallWrapper& call_wrapper, | 1127 const CallWrapper& call_wrapper, |
1123 CallKind call_kind) { | 1128 CallKind call_kind) { |
1124 // You can't call a function without a valid frame. | 1129 // You can't call a function without a valid frame. |
1125 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 1130 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
1126 | 1131 |
1127 // Get the function and setup the context. | 1132 // Get the function and setup the context. |
1128 LoadHeapObject(r1, function); | 1133 LoadHeapObject(r1, function); |
1129 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1134 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
1130 | 1135 |
1131 ParameterCount expected(function->shared()->formal_parameter_count()); | |
1132 // We call indirectly through the code field in the function to | 1136 // We call indirectly through the code field in the function to |
1133 // allow recompilation to take effect without changing any of the | 1137 // allow recompilation to take effect without changing any of the |
1134 // call sites. | 1138 // call sites. |
1135 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1139 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1136 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); | 1140 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); |
1137 } | 1141 } |
1138 | 1142 |
1139 | 1143 |
1140 void MacroAssembler::IsObjectJSObjectType(Register heap_object, | 1144 void MacroAssembler::IsObjectJSObjectType(Register heap_object, |
1141 Register map, | 1145 Register map, |
(...skipping 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3749 void CodePatcher::EmitCondition(Condition cond) { | 3753 void CodePatcher::EmitCondition(Condition cond) { |
3750 Instr instr = Assembler::instr_at(masm_.pc_); | 3754 Instr instr = Assembler::instr_at(masm_.pc_); |
3751 instr = (instr & ~kCondMask) | cond; | 3755 instr = (instr & ~kCondMask) | cond; |
3752 masm_.emit(instr); | 3756 masm_.emit(instr); |
3753 } | 3757 } |
3754 | 3758 |
3755 | 3759 |
3756 } } // namespace v8::internal | 3760 } } // namespace v8::internal |
3757 | 3761 |
3758 #endif // V8_TARGET_ARCH_ARM | 3762 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |