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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 void MacroAssembler::StoreRoot(Register source, | 75 void MacroAssembler::StoreRoot(Register source, |
76 Heap::RootListIndex index, | 76 Heap::RootListIndex index, |
77 Condition cond, | 77 Condition cond, |
78 Register src1, const Operand& src2) { | 78 Register src1, const Operand& src2) { |
79 Branch(2, NegateCondition(cond), src1, src2); | 79 Branch(2, NegateCondition(cond), src1, src2); |
80 sw(source, MemOperand(s6, index << kPointerSizeLog2)); | 80 sw(source, MemOperand(s6, index << kPointerSizeLog2)); |
81 } | 81 } |
82 | 82 |
83 | 83 |
| 84 void MacroAssembler::LoadHeapObject(Register result, |
| 85 Handle<HeapObject> object) { |
| 86 if (isolate()->heap()->InNewSpace(*object)) { |
| 87 Handle<JSGlobalPropertyCell> cell = |
| 88 isolate()->factory()->NewJSGlobalPropertyCell(object); |
| 89 li(result, Operand(cell)); |
| 90 lw(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); |
| 91 } else { |
| 92 li(result, Operand(object)); |
| 93 } |
| 94 } |
| 95 |
| 96 |
84 // Push and pop all registers that can hold pointers. | 97 // Push and pop all registers that can hold pointers. |
85 void MacroAssembler::PushSafepointRegisters() { | 98 void MacroAssembler::PushSafepointRegisters() { |
86 // Safepoints expect a block of kNumSafepointRegisters values on the | 99 // Safepoints expect a block of kNumSafepointRegisters values on the |
87 // stack, so adjust the stack for unsaved registers. | 100 // stack, so adjust the stack for unsaved registers. |
88 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; | 101 const int num_unsaved = kNumSafepointRegisters - kNumSafepointSavedRegisters; |
89 ASSERT(num_unsaved >= 0); | 102 ASSERT(num_unsaved >= 0); |
90 if (num_unsaved > 0) { | 103 if (num_unsaved > 0) { |
91 Subu(sp, sp, Operand(num_unsaved * kPointerSize)); | 104 Subu(sp, sp, Operand(num_unsaved * kPointerSize)); |
92 } | 105 } |
93 MultiPush(kSafepointSavedRegisters); | 106 MultiPush(kSafepointSavedRegisters); |
(...skipping 3454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 | 3561 |
3549 | 3562 |
3550 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 3563 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
3551 const ParameterCount& actual, | 3564 const ParameterCount& actual, |
3552 InvokeFlag flag, | 3565 InvokeFlag flag, |
3553 CallKind call_kind) { | 3566 CallKind call_kind) { |
3554 // You can't call a function without a valid frame. | 3567 // You can't call a function without a valid frame. |
3555 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 3568 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
3556 | 3569 |
3557 // Get the function and setup the context. | 3570 // Get the function and setup the context. |
3558 li(a1, Operand(function)); | 3571 LoadHeapObject(a1, function); |
3559 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 3572 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
3560 | 3573 |
3561 ParameterCount expected(function->shared()->formal_parameter_count()); | 3574 ParameterCount expected(function->shared()->formal_parameter_count()); |
3562 // We call indirectly through the code field in the function to | 3575 // We call indirectly through the code field in the function to |
3563 // allow recompilation to take effect without changing any of the | 3576 // allow recompilation to take effect without changing any of the |
3564 // call sites. | 3577 // call sites. |
3565 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 3578 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
3566 InvokeCode(a3, expected, actual, flag, NullCallWrapper(), call_kind); | 3579 InvokeCode(a3, expected, actual, flag, NullCallWrapper(), call_kind); |
3567 } | 3580 } |
3568 | 3581 |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5014 opcode == BGTZL); | 5027 opcode == BGTZL); |
5015 opcode = (cond == eq) ? BEQ : BNE; | 5028 opcode = (cond == eq) ? BEQ : BNE; |
5016 instr = (instr & ~kOpcodeMask) | opcode; | 5029 instr = (instr & ~kOpcodeMask) | opcode; |
5017 masm_.emit(instr); | 5030 masm_.emit(instr); |
5018 } | 5031 } |
5019 | 5032 |
5020 | 5033 |
5021 } } // namespace v8::internal | 5034 } } // namespace v8::internal |
5022 | 5035 |
5023 #endif // V8_TARGET_ARCH_MIPS | 5036 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |