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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 84 void MacroAssembler::LoadHeapObject(Register result, |
85 Handle<HeapObject> object) { | 85 Handle<HeapObject> object) { |
| 86 ALLOW_HANDLE_DEREF(isolate(), "using raw address"); |
86 if (isolate()->heap()->InNewSpace(*object)) { | 87 if (isolate()->heap()->InNewSpace(*object)) { |
87 Handle<JSGlobalPropertyCell> cell = | 88 Handle<JSGlobalPropertyCell> cell = |
88 isolate()->factory()->NewJSGlobalPropertyCell(object); | 89 isolate()->factory()->NewJSGlobalPropertyCell(object); |
89 li(result, Operand(cell)); | 90 li(result, Operand(cell)); |
90 lw(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); | 91 lw(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); |
91 } else { | 92 } else { |
92 li(result, Operand(object)); | 93 li(result, Operand(object)); |
93 } | 94 } |
94 } | 95 } |
95 | 96 |
(...skipping 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 } | 2451 } |
2451 | 2452 |
2452 | 2453 |
2453 void MacroAssembler::Jump(Handle<Code> code, | 2454 void MacroAssembler::Jump(Handle<Code> code, |
2454 RelocInfo::Mode rmode, | 2455 RelocInfo::Mode rmode, |
2455 Condition cond, | 2456 Condition cond, |
2456 Register rs, | 2457 Register rs, |
2457 const Operand& rt, | 2458 const Operand& rt, |
2458 BranchDelaySlot bd) { | 2459 BranchDelaySlot bd) { |
2459 ASSERT(RelocInfo::IsCodeTarget(rmode)); | 2460 ASSERT(RelocInfo::IsCodeTarget(rmode)); |
| 2461 ALLOW_HANDLE_DEREF(isolate(), "embedding raw address"); |
2460 Jump(reinterpret_cast<intptr_t>(code.location()), rmode, cond, rs, rt, bd); | 2462 Jump(reinterpret_cast<intptr_t>(code.location()), rmode, cond, rs, rt, bd); |
2461 } | 2463 } |
2462 | 2464 |
2463 | 2465 |
2464 int MacroAssembler::CallSize(Register target, | 2466 int MacroAssembler::CallSize(Register target, |
2465 Condition cond, | 2467 Condition cond, |
2466 Register rs, | 2468 Register rs, |
2467 const Operand& rt, | 2469 const Operand& rt, |
2468 BranchDelaySlot bd) { | 2470 BranchDelaySlot bd) { |
2469 int size = 0; | 2471 int size = 0; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 } | 2539 } |
2538 | 2540 |
2539 | 2541 |
2540 int MacroAssembler::CallSize(Handle<Code> code, | 2542 int MacroAssembler::CallSize(Handle<Code> code, |
2541 RelocInfo::Mode rmode, | 2543 RelocInfo::Mode rmode, |
2542 TypeFeedbackId ast_id, | 2544 TypeFeedbackId ast_id, |
2543 Condition cond, | 2545 Condition cond, |
2544 Register rs, | 2546 Register rs, |
2545 const Operand& rt, | 2547 const Operand& rt, |
2546 BranchDelaySlot bd) { | 2548 BranchDelaySlot bd) { |
| 2549 ALLOW_HANDLE_DEREF(isolate(), "using raw address"); |
2547 return CallSize(reinterpret_cast<Address>(code.location()), | 2550 return CallSize(reinterpret_cast<Address>(code.location()), |
2548 rmode, cond, rs, rt, bd); | 2551 rmode, cond, rs, rt, bd); |
2549 } | 2552 } |
2550 | 2553 |
2551 | 2554 |
2552 void MacroAssembler::Call(Handle<Code> code, | 2555 void MacroAssembler::Call(Handle<Code> code, |
2553 RelocInfo::Mode rmode, | 2556 RelocInfo::Mode rmode, |
2554 TypeFeedbackId ast_id, | 2557 TypeFeedbackId ast_id, |
2555 Condition cond, | 2558 Condition cond, |
2556 Register rs, | 2559 Register rs, |
2557 const Operand& rt, | 2560 const Operand& rt, |
2558 BranchDelaySlot bd) { | 2561 BranchDelaySlot bd) { |
2559 BlockTrampolinePoolScope block_trampoline_pool(this); | 2562 BlockTrampolinePoolScope block_trampoline_pool(this); |
2560 Label start; | 2563 Label start; |
2561 bind(&start); | 2564 bind(&start); |
2562 ASSERT(RelocInfo::IsCodeTarget(rmode)); | 2565 ASSERT(RelocInfo::IsCodeTarget(rmode)); |
2563 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { | 2566 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { |
2564 SetRecordedAstId(ast_id); | 2567 SetRecordedAstId(ast_id); |
2565 rmode = RelocInfo::CODE_TARGET_WITH_ID; | 2568 rmode = RelocInfo::CODE_TARGET_WITH_ID; |
2566 } | 2569 } |
| 2570 ALLOW_HANDLE_DEREF(isolate(), "embedding raw address"); |
2567 Call(reinterpret_cast<Address>(code.location()), rmode, cond, rs, rt, bd); | 2571 Call(reinterpret_cast<Address>(code.location()), rmode, cond, rs, rt, bd); |
2568 ASSERT_EQ(CallSize(code, rmode, ast_id, cond, rs, rt, bd), | 2572 ASSERT_EQ(CallSize(code, rmode, ast_id, cond, rs, rt, bd), |
2569 SizeOfCodeGeneratedSince(&start)); | 2573 SizeOfCodeGeneratedSince(&start)); |
2570 } | 2574 } |
2571 | 2575 |
2572 | 2576 |
2573 void MacroAssembler::Ret(Condition cond, | 2577 void MacroAssembler::Ret(Condition cond, |
2574 Register rs, | 2578 Register rs, |
2575 const Operand& rt, | 2579 const Operand& rt, |
2576 BranchDelaySlot bd) { | 2580 BranchDelaySlot bd) { |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3736 SharedFunctionInfo::kFormalParameterCountOffset)); | 3740 SharedFunctionInfo::kFormalParameterCountOffset)); |
3737 sra(expected_reg, expected_reg, kSmiTagSize); | 3741 sra(expected_reg, expected_reg, kSmiTagSize); |
3738 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 3742 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
3739 | 3743 |
3740 ParameterCount expected(expected_reg); | 3744 ParameterCount expected(expected_reg); |
3741 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); | 3745 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); |
3742 } | 3746 } |
3743 | 3747 |
3744 | 3748 |
3745 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 3749 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
| 3750 const ParameterCount& expected, |
3746 const ParameterCount& actual, | 3751 const ParameterCount& actual, |
3747 InvokeFlag flag, | 3752 InvokeFlag flag, |
3748 const CallWrapper& call_wrapper, | 3753 const CallWrapper& call_wrapper, |
3749 CallKind call_kind) { | 3754 CallKind call_kind) { |
3750 // You can't call a function without a valid frame. | 3755 // You can't call a function without a valid frame. |
3751 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 3756 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
3752 | 3757 |
3753 // Get the function and setup the context. | 3758 // Get the function and setup the context. |
3754 LoadHeapObject(a1, function); | 3759 LoadHeapObject(a1, function); |
3755 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 3760 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
3756 | 3761 |
3757 ParameterCount expected(function->shared()->formal_parameter_count()); | |
3758 // We call indirectly through the code field in the function to | 3762 // We call indirectly through the code field in the function to |
3759 // allow recompilation to take effect without changing any of the | 3763 // allow recompilation to take effect without changing any of the |
3760 // call sites. | 3764 // call sites. |
3761 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 3765 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
3762 InvokeCode(a3, expected, actual, flag, call_wrapper, call_kind); | 3766 InvokeCode(a3, expected, actual, flag, call_wrapper, call_kind); |
3763 } | 3767 } |
3764 | 3768 |
3765 | 3769 |
3766 void MacroAssembler::IsObjectJSObjectType(Register heap_object, | 3770 void MacroAssembler::IsObjectJSObjectType(Register heap_object, |
3767 Register map, | 3771 Register map, |
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5493 opcode == BGTZL); | 5497 opcode == BGTZL); |
5494 opcode = (cond == eq) ? BEQ : BNE; | 5498 opcode = (cond == eq) ? BEQ : BNE; |
5495 instr = (instr & ~kOpcodeMask) | opcode; | 5499 instr = (instr & ~kOpcodeMask) | opcode; |
5496 masm_.emit(instr); | 5500 masm_.emit(instr); |
5497 } | 5501 } |
5498 | 5502 |
5499 | 5503 |
5500 } } // namespace v8::internal | 5504 } } // namespace v8::internal |
5501 | 5505 |
5502 #endif // V8_TARGET_ARCH_MIPS | 5506 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |