Chromium Code Reviews| 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/runtime_entry.h" | 9 #include "vm/runtime_entry.h" |
| 10 #include "vm/simulator.h" | 10 #include "vm/simulator.h" |
| 11 #include "vm/stub_code.h" | 11 #include "vm/stub_code.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 #if defined(USING_SIMULATOR) | |
| 15 DECLARE_FLAG(bool, trace_sim); | 16 DECLARE_FLAG(bool, trace_sim); |
| 17 #endif | |
| 16 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); | 18 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); |
| 17 | 19 |
| 18 | 20 |
| 19 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { | 21 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { |
| 20 ASSERT(Utils::IsAligned(data, 4)); | 22 ASSERT(Utils::IsAligned(data, 4)); |
| 21 ASSERT(Utils::IsAligned(length, 4)); | 23 ASSERT(Utils::IsAligned(length, 4)); |
| 22 const uword end = data + length; | 24 const uword end = data + length; |
| 23 while (data < end) { | 25 while (data < end) { |
| 24 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction; | 26 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction; |
| 25 data += 4; | 27 data += 4; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 | 455 |
| 454 // Adjust SP for PC pushed in EnterDartFrame, and return. | 456 // Adjust SP for PC pushed in EnterDartFrame, and return. |
| 455 Ret(); | 457 Ret(); |
| 456 delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); | 458 delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); |
| 457 } | 459 } |
| 458 | 460 |
| 459 | 461 |
| 460 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { | 462 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { |
| 461 // Reserve space for arguments and align frame before entering | 463 // Reserve space for arguments and align frame before entering |
| 462 // the C++ world. | 464 // the C++ world. |
| 463 AddImmediate(SP, -frame_space); | 465 if (frame_space != 0) { |
| 466 AddImmediate(SP, -frame_space); | |
|
regis
2013/05/31 16:44:13
On ARM, AddImmediate of 0 to the same register wil
zra
2013/05/31 18:41:17
Done.
| |
| 467 } | |
| 464 if (OS::ActivationFrameAlignment() > 0) { | 468 if (OS::ActivationFrameAlignment() > 0) { |
| 465 LoadImmediate(TMP1, ~(OS::ActivationFrameAlignment() - 1)); | 469 LoadImmediate(TMP1, ~(OS::ActivationFrameAlignment() - 1)); |
| 466 and_(SP, SP, TMP1); | 470 and_(SP, SP, TMP1); |
| 467 } | 471 } |
| 468 } | 472 } |
| 469 | 473 |
| 470 | 474 |
| 471 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { | 475 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { |
| 472 const intptr_t kPushedRegistersSize = | 476 const intptr_t kPushedRegistersSize = |
| 473 kDartVolatileCpuRegCount * kWordSize + | 477 kDartVolatileCpuRegCount * kWordSize + |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 } | 572 } |
| 569 Label stop; | 573 Label stop; |
| 570 b(&stop); | 574 b(&stop); |
| 571 Emit(reinterpret_cast<int32_t>(message)); | 575 Emit(reinterpret_cast<int32_t>(message)); |
| 572 Bind(&stop); | 576 Bind(&stop); |
| 573 break_(Instr::kStopMessageCode); | 577 break_(Instr::kStopMessageCode); |
| 574 } | 578 } |
| 575 | 579 |
| 576 | 580 |
| 577 void Assembler::TraceSimMsg(const char* message) { | 581 void Assembler::TraceSimMsg(const char* message) { |
| 578 // Don't bother adding in the messages unless tracing is enabled. | 582 // Don't bother adding in the messages unless tracing is enabled, and we are |
| 583 // running in the simulator. | |
| 584 #if defined(USING_SIMULATOR) | |
| 579 if (FLAG_trace_sim) { | 585 if (FLAG_trace_sim) { |
| 580 Label msg; | 586 Label msg; |
| 581 b(&msg); | 587 b(&msg); |
| 582 Emit(reinterpret_cast<int32_t>(message)); | 588 Emit(reinterpret_cast<int32_t>(message)); |
| 583 Bind(&msg); | 589 Bind(&msg); |
| 584 break_(Instr::kMsgMessageCode); | 590 break_(Instr::kMsgMessageCode); |
| 585 } | 591 } |
| 592 #endif | |
| 586 } | 593 } |
| 587 | 594 |
| 588 } // namespace dart | 595 } // namespace dart |
| 589 | 596 |
| 590 #endif // defined TARGET_ARCH_MIPS | 597 #endif // defined TARGET_ARCH_MIPS |
| 591 | 598 |
| OLD | NEW |