| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 212 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| 213 ASSERT(argc_tag_offset == 1 * kWordSize); | 213 ASSERT(argc_tag_offset == 1 * kWordSize); |
| 214 // Set argc in NativeArguments: A1 already contains argc. | 214 // Set argc in NativeArguments: A1 already contains argc. |
| 215 | 215 |
| 216 ASSERT(argv_offset == 2 * kWordSize); | 216 ASSERT(argv_offset == 2 * kWordSize); |
| 217 // Set argv in NativeArguments: A2 already contains argv. | 217 // Set argv in NativeArguments: A2 already contains argv. |
| 218 | 218 |
| 219 ASSERT(retval_offset == 3 * kWordSize); | 219 ASSERT(retval_offset == 3 * kWordSize); |
| 220 __ addiu(A3, FP, Immediate(3 * kWordSize)); // Set retval in NativeArgs. | 220 __ addiu(A3, FP, Immediate(3 * kWordSize)); // Set retval in NativeArgs. |
| 221 | 221 |
| 222 // TODO(regis): Should we pass the structure by value as in runtime calls? | 222 // Passing the structure by value as in runtime calls would require changing |
| 223 // It would require changing Dart API for native functions. | 223 // Dart API for native functions. |
| 224 // For now, space is reserved on the stack and we pass a pointer to it. | 224 // For now, space is reserved on the stack and we pass a pointer to it. |
| 225 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | 225 __ addiu(SP, SP, Immediate(-4 * kWordSize)); |
| 226 __ sw(A3, Address(SP, 3 * kWordSize)); | 226 __ sw(A3, Address(SP, 3 * kWordSize)); |
| 227 __ sw(A2, Address(SP, 2 * kWordSize)); | 227 __ sw(A2, Address(SP, 2 * kWordSize)); |
| 228 __ sw(A1, Address(SP, 1 * kWordSize)); | 228 __ sw(A1, Address(SP, 1 * kWordSize)); |
| 229 __ sw(A0, Address(SP, 0 * kWordSize)); | 229 __ sw(A0, Address(SP, 0 * kWordSize)); |
| 230 __ mov(A0, SP); // Pass the pointer to the NativeArguments. | 230 __ mov(A0, SP); // Pass the pointer to the NativeArguments. |
| 231 | 231 |
| 232 // Call native function (setup scope if not leaf function). | 232 // Call native function (setup scope if not leaf function). |
| 233 Label leaf_call; | 233 Label leaf_call; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 345 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| 346 ASSERT(argc_tag_offset == 1 * kWordSize); | 346 ASSERT(argc_tag_offset == 1 * kWordSize); |
| 347 // Set argc in NativeArguments: A1 already contains argc. | 347 // Set argc in NativeArguments: A1 already contains argc. |
| 348 | 348 |
| 349 ASSERT(argv_offset == 2 * kWordSize); | 349 ASSERT(argv_offset == 2 * kWordSize); |
| 350 // Set argv in NativeArguments: A2 already contains argv. | 350 // Set argv in NativeArguments: A2 already contains argv. |
| 351 | 351 |
| 352 ASSERT(retval_offset == 3 * kWordSize); | 352 ASSERT(retval_offset == 3 * kWordSize); |
| 353 __ addiu(A3, FP, Immediate(3 * kWordSize)); // Set retval in NativeArgs. | 353 __ addiu(A3, FP, Immediate(3 * kWordSize)); // Set retval in NativeArgs. |
| 354 | 354 |
| 355 // TODO(regis): Should we pass the structure by value as in runtime calls? | 355 // Passing the structure by value as in runtime calls would require changing |
| 356 // It would require changing Dart API for native functions. | 356 // Dart API for native functions. |
| 357 // For now, space is reserved on the stack and we pass a pointer to it. | 357 // For now, space is reserved on the stack and we pass a pointer to it. |
| 358 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | 358 __ addiu(SP, SP, Immediate(-4 * kWordSize)); |
| 359 __ sw(A3, Address(SP, 3 * kWordSize)); | 359 __ sw(A3, Address(SP, 3 * kWordSize)); |
| 360 __ sw(A2, Address(SP, 2 * kWordSize)); | 360 __ sw(A2, Address(SP, 2 * kWordSize)); |
| 361 __ sw(A1, Address(SP, 1 * kWordSize)); | 361 __ sw(A1, Address(SP, 1 * kWordSize)); |
| 362 __ sw(A0, Address(SP, 0 * kWordSize)); | 362 __ sw(A0, Address(SP, 0 * kWordSize)); |
| 363 __ mov(A0, SP); // Pass the pointer to the NativeArguments. | 363 __ mov(A0, SP); // Pass the pointer to the NativeArguments. |
| 364 | 364 |
| 365 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. | 365 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. |
| 366 | 366 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 __ sw(FP, Address(SP, kPushedRegistersSize - 3 * kWordSize)); | 538 __ sw(FP, Address(SP, kPushedRegistersSize - 3 * kWordSize)); |
| 539 __ sw(PP, Address(SP, kPushedRegistersSize - 4 * kWordSize)); | 539 __ sw(PP, Address(SP, kPushedRegistersSize - 4 * kWordSize)); |
| 540 __ addiu(FP, SP, Immediate(kPushedRegistersSize - 3 * kWordSize)); | 540 __ addiu(FP, SP, Immediate(kPushedRegistersSize - 3 * kWordSize)); |
| 541 | 541 |
| 542 // The code in this frame may not cause GC. kDeoptimizeCopyFrameRuntimeEntry | 542 // The code in this frame may not cause GC. kDeoptimizeCopyFrameRuntimeEntry |
| 543 // and kDeoptimizeFillFrameRuntimeEntry are leaf runtime calls. | 543 // and kDeoptimizeFillFrameRuntimeEntry are leaf runtime calls. |
| 544 const intptr_t saved_result_slot_from_fp = | 544 const intptr_t saved_result_slot_from_fp = |
| 545 kFirstLocalSlotFromFp + 1 - (kNumberOfCpuRegisters - V0); | 545 kFirstLocalSlotFromFp + 1 - (kNumberOfCpuRegisters - V0); |
| 546 // Result in V0 is preserved as part of pushing all registers below. | 546 // Result in V0 is preserved as part of pushing all registers below. |
| 547 | 547 |
| 548 // TODO(regis): Should we align the stack before pushing the fpu registers? | |
| 549 // If we do, saved_result_slot_from_fp is not constant anymore. | |
| 550 | |
| 551 // Push registers in their enumeration order: lowest register number at | 548 // Push registers in their enumeration order: lowest register number at |
| 552 // lowest address. | 549 // lowest address. |
| 553 for (int i = 0; i < kNumberOfCpuRegisters; i++) { | 550 for (int i = 0; i < kNumberOfCpuRegisters; i++) { |
| 554 const int slot = 4 + kNumberOfCpuRegisters - i; | 551 const int slot = 4 + kNumberOfCpuRegisters - i; |
| 555 Register reg = static_cast<Register>(i); | 552 Register reg = static_cast<Register>(i); |
| 556 __ sw(reg, Address(SP, kPushedRegistersSize - slot * kWordSize)); | 553 __ sw(reg, Address(SP, kPushedRegistersSize - slot * kWordSize)); |
| 557 } | 554 } |
| 558 for (int i = 0; i < kNumberOfFRegisters; i++) { | 555 for (int i = 0; i < kNumberOfFRegisters; i++) { |
| 559 // These go below the CPU registers. | 556 // These go below the CPU registers. |
| 560 const int slot = 4 + kNumberOfCpuRegisters + kNumberOfFRegisters - i; | 557 const int slot = 4 + kNumberOfCpuRegisters + kNumberOfFRegisters - i; |
| (...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 const Register right = T0; | 2096 const Register right = T0; |
| 2100 __ lw(left, Address(SP, 1 * kWordSize)); | 2097 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2101 __ lw(right, Address(SP, 0 * kWordSize)); | 2098 __ lw(right, Address(SP, 0 * kWordSize)); |
| 2102 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2099 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
| 2103 __ Ret(); | 2100 __ Ret(); |
| 2104 } | 2101 } |
| 2105 | 2102 |
| 2106 } // namespace dart | 2103 } // namespace dart |
| 2107 | 2104 |
| 2108 #endif // defined TARGET_ARCH_MIPS | 2105 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |