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 2527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 Subu(length, length, Operand(1)); | 2538 Subu(length, length, Operand(1)); |
2539 Branch(&byte_loop_1, ne, length, Operand(zero_reg)); | 2539 Branch(&byte_loop_1, ne, length, Operand(zero_reg)); |
2540 bind(&done); | 2540 bind(&done); |
2541 } | 2541 } |
2542 | 2542 |
2543 | 2543 |
2544 void MacroAssembler::CheckMap(Register obj, | 2544 void MacroAssembler::CheckMap(Register obj, |
2545 Register scratch, | 2545 Register scratch, |
2546 Handle<Map> map, | 2546 Handle<Map> map, |
2547 Label* fail, | 2547 Label* fail, |
2548 bool is_heap_object) { | 2548 SmiCheckType smi_check_type) { |
2549 if (!is_heap_object) { | 2549 if (smi_check_type == DO_SMI_CHECK) { |
2550 JumpIfSmi(obj, fail); | 2550 JumpIfSmi(obj, fail); |
2551 } | 2551 } |
2552 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 2552 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
2553 li(at, Operand(map)); | 2553 li(at, Operand(map)); |
2554 Branch(fail, ne, scratch, Operand(at)); | 2554 Branch(fail, ne, scratch, Operand(at)); |
2555 } | 2555 } |
2556 | 2556 |
2557 | 2557 |
| 2558 void MacroAssembler::DispatchMap(Register obj, |
| 2559 Register scratch, |
| 2560 Handle<Map> map, |
| 2561 Handle<Code> success, |
| 2562 SmiCheckType smi_check_type) { |
| 2563 Label fail; |
| 2564 if (smi_check_type == DO_SMI_CHECK) { |
| 2565 JumpIfSmi(obj, &fail); |
| 2566 } |
| 2567 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
| 2568 Jump(success, RelocInfo::CODE_TARGET, eq, scratch, Operand(map)); |
| 2569 bind(&fail); |
| 2570 } |
| 2571 |
| 2572 |
2558 void MacroAssembler::CheckMap(Register obj, | 2573 void MacroAssembler::CheckMap(Register obj, |
2559 Register scratch, | 2574 Register scratch, |
2560 Heap::RootListIndex index, | 2575 Heap::RootListIndex index, |
2561 Label* fail, | 2576 Label* fail, |
2562 bool is_heap_object) { | 2577 SmiCheckType smi_check_type) { |
2563 if (!is_heap_object) { | 2578 if (smi_check_type == DO_SMI_CHECK) { |
2564 JumpIfSmi(obj, fail); | 2579 JumpIfSmi(obj, fail); |
2565 } | 2580 } |
2566 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 2581 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
2567 LoadRoot(at, index); | 2582 LoadRoot(at, index); |
2568 Branch(fail, ne, scratch, Operand(at)); | 2583 Branch(fail, ne, scratch, Operand(at)); |
2569 } | 2584 } |
2570 | 2585 |
2571 | 2586 |
2572 void MacroAssembler::GetCFunctionDoubleResult(const DoubleRegister dst) { | 2587 void MacroAssembler::GetCFunctionDoubleResult(const DoubleRegister dst) { |
2573 if (IsMipsSoftFloatABI) { | 2588 if (IsMipsSoftFloatABI) { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2853 | 2868 |
2854 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, | 2869 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, |
2855 Condition cond, | 2870 Condition cond, |
2856 Register r1, | 2871 Register r1, |
2857 const Operand& r2) { | 2872 const Operand& r2) { |
2858 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. | 2873 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. |
2859 Object* result; | 2874 Object* result; |
2860 { MaybeObject* maybe_result = stub->TryGetCode(); | 2875 { MaybeObject* maybe_result = stub->TryGetCode(); |
2861 if (!maybe_result->ToObject(&result)) return maybe_result; | 2876 if (!maybe_result->ToObject(&result)) return maybe_result; |
2862 } | 2877 } |
2863 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2); | 2878 Jump(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond, r1, r2); |
2864 return result; | 2879 return result; |
2865 } | 2880 } |
2866 | 2881 |
2867 | 2882 |
2868 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 2883 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
2869 return ref0.address() - ref1.address(); | 2884 return ref0.address() - ref1.address(); |
2870 } | 2885 } |
2871 | 2886 |
2872 | 2887 |
2873 MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn( | 2888 MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn( |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 } | 3418 } |
3404 | 3419 |
3405 | 3420 |
3406 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 3421 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
3407 Register map, | 3422 Register map, |
3408 Register scratch) { | 3423 Register scratch) { |
3409 // Load the initial map. The global functions all have initial maps. | 3424 // Load the initial map. The global functions all have initial maps. |
3410 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 3425 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
3411 if (emit_debug_code()) { | 3426 if (emit_debug_code()) { |
3412 Label ok, fail; | 3427 Label ok, fail; |
3413 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, false); | 3428 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, DO_SMI_CHECK); |
3414 Branch(&ok); | 3429 Branch(&ok); |
3415 bind(&fail); | 3430 bind(&fail); |
3416 Abort("Global functions must have initial map"); | 3431 Abort("Global functions must have initial map"); |
3417 bind(&ok); | 3432 bind(&ok); |
3418 } | 3433 } |
3419 } | 3434 } |
3420 | 3435 |
3421 | 3436 |
3422 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 3437 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
3423 addiu(sp, sp, -5 * kPointerSize); | 3438 addiu(sp, sp, -5 * kPointerSize); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3872 opcode == BGTZL); | 3887 opcode == BGTZL); |
3873 opcode = (cond == eq) ? BEQ : BNE; | 3888 opcode = (cond == eq) ? BEQ : BNE; |
3874 instr = (instr & ~kOpcodeMask) | opcode; | 3889 instr = (instr & ~kOpcodeMask) | opcode; |
3875 masm_.emit(instr); | 3890 masm_.emit(instr); |
3876 } | 3891 } |
3877 | 3892 |
3878 | 3893 |
3879 } } // namespace v8::internal | 3894 } } // namespace v8::internal |
3880 | 3895 |
3881 #endif // V8_TARGET_ARCH_MIPS | 3896 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |