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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 | 401 |
402 | 402 |
403 void MacroAssembler::StoreRoot(Register source, | 403 void MacroAssembler::StoreRoot(Register source, |
404 Heap::RootListIndex index, | 404 Heap::RootListIndex index, |
405 Condition cond) { | 405 Condition cond) { |
406 str(source, MemOperand(roots, index << kPointerSizeLog2), cond); | 406 str(source, MemOperand(roots, index << kPointerSizeLog2), cond); |
407 } | 407 } |
408 | 408 |
409 | 409 |
| 410 void MacroAssembler::LoadHeapObject(Register result, |
| 411 Handle<HeapObject> object) { |
| 412 if (isolate()->heap()->InNewSpace(*object)) { |
| 413 Handle<JSGlobalPropertyCell> cell = |
| 414 isolate()->factory()->NewJSGlobalPropertyCell(object); |
| 415 mov(result, Operand(cell)); |
| 416 ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); |
| 417 } else { |
| 418 mov(result, Operand(object)); |
| 419 } |
| 420 } |
| 421 |
| 422 |
410 void MacroAssembler::InNewSpace(Register object, | 423 void MacroAssembler::InNewSpace(Register object, |
411 Register scratch, | 424 Register scratch, |
412 Condition cond, | 425 Condition cond, |
413 Label* branch) { | 426 Label* branch) { |
414 ASSERT(cond == eq || cond == ne); | 427 ASSERT(cond == eq || cond == ne); |
415 and_(scratch, object, Operand(ExternalReference::new_space_mask(isolate()))); | 428 and_(scratch, object, Operand(ExternalReference::new_space_mask(isolate()))); |
416 cmp(scratch, Operand(ExternalReference::new_space_start(isolate()))); | 429 cmp(scratch, Operand(ExternalReference::new_space_start(isolate()))); |
417 b(cond, branch); | 430 b(cond, branch); |
418 } | 431 } |
419 | 432 |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 | 1117 |
1105 | 1118 |
1106 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 1119 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
1107 const ParameterCount& actual, | 1120 const ParameterCount& actual, |
1108 InvokeFlag flag, | 1121 InvokeFlag flag, |
1109 CallKind call_kind) { | 1122 CallKind call_kind) { |
1110 // You can't call a function without a valid frame. | 1123 // You can't call a function without a valid frame. |
1111 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 1124 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
1112 | 1125 |
1113 // Get the function and setup the context. | 1126 // Get the function and setup the context. |
1114 mov(r1, Operand(function)); | 1127 LoadHeapObject(r1, function); |
1115 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1128 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
1116 | 1129 |
1117 ParameterCount expected(function->shared()->formal_parameter_count()); | 1130 ParameterCount expected(function->shared()->formal_parameter_count()); |
1118 // We call indirectly through the code field in the function to | 1131 // We call indirectly through the code field in the function to |
1119 // allow recompilation to take effect without changing any of the | 1132 // allow recompilation to take effect without changing any of the |
1120 // call sites. | 1133 // call sites. |
1121 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1134 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1122 InvokeCode(r3, expected, actual, flag, NullCallWrapper(), call_kind); | 1135 InvokeCode(r3, expected, actual, flag, NullCallWrapper(), call_kind); |
1123 } | 1136 } |
1124 | 1137 |
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3612 void CodePatcher::EmitCondition(Condition cond) { | 3625 void CodePatcher::EmitCondition(Condition cond) { |
3613 Instr instr = Assembler::instr_at(masm_.pc_); | 3626 Instr instr = Assembler::instr_at(masm_.pc_); |
3614 instr = (instr & ~kCondMask) | cond; | 3627 instr = (instr & ~kCondMask) | cond; |
3615 masm_.emit(instr); | 3628 masm_.emit(instr); |
3616 } | 3629 } |
3617 | 3630 |
3618 | 3631 |
3619 } } // namespace v8::internal | 3632 } } // namespace v8::internal |
3620 | 3633 |
3621 #endif // V8_TARGET_ARCH_ARM | 3634 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |