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 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 li(scratch1, 0x7191); | 2866 li(scratch1, 0x7191); |
2867 li(scratch2, 0x7291); | 2867 li(scratch2, 0x7291); |
2868 } | 2868 } |
2869 jmp(gc_required); | 2869 jmp(gc_required); |
2870 return; | 2870 return; |
2871 } | 2871 } |
2872 | 2872 |
2873 ASSERT(!result.is(scratch1)); | 2873 ASSERT(!result.is(scratch1)); |
2874 ASSERT(!result.is(scratch2)); | 2874 ASSERT(!result.is(scratch2)); |
2875 ASSERT(!scratch1.is(scratch2)); | 2875 ASSERT(!scratch1.is(scratch2)); |
| 2876 ASSERT(!object_size.is(t9)); |
2876 ASSERT(!scratch1.is(t9) && !scratch2.is(t9) && !result.is(t9)); | 2877 ASSERT(!scratch1.is(t9) && !scratch2.is(t9) && !result.is(t9)); |
2877 | 2878 |
2878 // Check relative positions of allocation top and limit addresses. | 2879 // Check relative positions of allocation top and limit addresses. |
2879 // ARM adds additional checks to make sure the ldm instruction can be | 2880 // ARM adds additional checks to make sure the ldm instruction can be |
2880 // used. On MIPS we don't have ldm so we don't need additional checks either. | 2881 // used. On MIPS we don't have ldm so we don't need additional checks either. |
2881 ExternalReference new_space_allocation_top = | 2882 ExternalReference new_space_allocation_top = |
2882 ExternalReference::new_space_allocation_top_address(isolate()); | 2883 ExternalReference::new_space_allocation_top_address(isolate()); |
2883 ExternalReference new_space_allocation_limit = | 2884 ExternalReference new_space_allocation_limit = |
2884 ExternalReference::new_space_allocation_limit_address(isolate()); | 2885 ExternalReference::new_space_allocation_limit_address(isolate()); |
2885 intptr_t top = | 2886 intptr_t top = |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3609 } | 3610 } |
3610 | 3611 |
3611 | 3612 |
3612 void MacroAssembler::InvokeFunction(JSFunction* function, | 3613 void MacroAssembler::InvokeFunction(JSFunction* function, |
3613 const ParameterCount& actual, | 3614 const ParameterCount& actual, |
3614 InvokeFlag flag, | 3615 InvokeFlag flag, |
3615 CallKind call_kind) { | 3616 CallKind call_kind) { |
3616 // You can't call a function without a valid frame. | 3617 // You can't call a function without a valid frame. |
3617 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 3618 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
3618 | 3619 |
3619 ASSERT(function->is_compiled()); | |
3620 | |
3621 // Get the function and setup the context. | 3620 // Get the function and setup the context. |
3622 li(a1, Operand(Handle<JSFunction>(function))); | 3621 li(a1, Operand(Handle<JSFunction>(function))); |
3623 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 3622 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
3624 | 3623 |
3625 // Invoke the cached code. | |
3626 Handle<Code> code(function->code()); | |
3627 ParameterCount expected(function->shared()->formal_parameter_count()); | 3624 ParameterCount expected(function->shared()->formal_parameter_count()); |
3628 if (V8::UseCrankshaft()) { | 3625 // We call indirectly through the code field in the function to |
3629 // TODO(kasperl): For now, we always call indirectly through the | 3626 // allow recompilation to take effect without changing any of the |
3630 // code field in the function to allow recompilation to take effect | 3627 // call sites. |
3631 // without changing any of the call sites. | 3628 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
3632 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 3629 InvokeCode(a3, expected, actual, flag, NullCallWrapper(), call_kind); |
3633 InvokeCode(a3, expected, actual, flag, NullCallWrapper(), call_kind); | |
3634 } else { | |
3635 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET, flag, call_kind); | |
3636 } | |
3637 } | 3630 } |
3638 | 3631 |
3639 | 3632 |
3640 void MacroAssembler::IsObjectJSObjectType(Register heap_object, | 3633 void MacroAssembler::IsObjectJSObjectType(Register heap_object, |
3641 Register map, | 3634 Register map, |
3642 Register scratch, | 3635 Register scratch, |
3643 Label* fail) { | 3636 Label* fail) { |
3644 lw(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); | 3637 lw(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); |
3645 IsInstanceJSObjectType(map, scratch, fail); | 3638 IsInstanceJSObjectType(map, scratch, fail); |
3646 } | 3639 } |
(...skipping 20 matching lines...) Expand all Loading... |
3667 } | 3660 } |
3668 | 3661 |
3669 | 3662 |
3670 // --------------------------------------------------------------------------- | 3663 // --------------------------------------------------------------------------- |
3671 // Support functions. | 3664 // Support functions. |
3672 | 3665 |
3673 | 3666 |
3674 void MacroAssembler::TryGetFunctionPrototype(Register function, | 3667 void MacroAssembler::TryGetFunctionPrototype(Register function, |
3675 Register result, | 3668 Register result, |
3676 Register scratch, | 3669 Register scratch, |
3677 Label* miss) { | 3670 Label* miss, |
| 3671 bool miss_on_bound_function) { |
3678 // Check that the receiver isn't a smi. | 3672 // Check that the receiver isn't a smi. |
3679 JumpIfSmi(function, miss); | 3673 JumpIfSmi(function, miss); |
3680 | 3674 |
3681 // Check that the function really is a function. Load map into result reg. | 3675 // Check that the function really is a function. Load map into result reg. |
3682 GetObjectType(function, result, scratch); | 3676 GetObjectType(function, result, scratch); |
3683 Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); | 3677 Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); |
3684 | 3678 |
| 3679 if (miss_on_bound_function) { |
| 3680 lw(scratch, |
| 3681 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 3682 lw(scratch, |
| 3683 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); |
| 3684 And(scratch, scratch, |
| 3685 Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction))); |
| 3686 Branch(miss, ne, scratch, Operand(zero_reg)); |
| 3687 } |
| 3688 |
3685 // Make sure that the function has an instance prototype. | 3689 // Make sure that the function has an instance prototype. |
3686 Label non_instance; | 3690 Label non_instance; |
3687 lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); | 3691 lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); |
3688 And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype)); | 3692 And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype)); |
3689 Branch(&non_instance, ne, scratch, Operand(zero_reg)); | 3693 Branch(&non_instance, ne, scratch, Operand(zero_reg)); |
3690 | 3694 |
3691 // Get the prototype or initial map from the function. | 3695 // Get the prototype or initial map from the function. |
3692 lw(result, | 3696 lw(result, |
3693 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 3697 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
3694 | 3698 |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5124 opcode == BGTZL); | 5128 opcode == BGTZL); |
5125 opcode = (cond == eq) ? BEQ : BNE; | 5129 opcode = (cond == eq) ? BEQ : BNE; |
5126 instr = (instr & ~kOpcodeMask) | opcode; | 5130 instr = (instr & ~kOpcodeMask) | opcode; |
5127 masm_.emit(instr); | 5131 masm_.emit(instr); |
5128 } | 5132 } |
5129 | 5133 |
5130 | 5134 |
5131 } } // namespace v8::internal | 5135 } } // namespace v8::internal |
5132 | 5136 |
5133 #endif // V8_TARGET_ARCH_MIPS | 5137 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |