Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: runtime/vm/simulator_arm.cc

Issue 13502002: Support FrameLookup vm test on ARM, requiring among other things: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/simulator_arm.h ('k') | runtime/vm/simulator_mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <math.h> // for isnan. 5 #include <math.h> // for isnan.
6 #include <setjmp.h> 6 #include <setjmp.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #if defined(TARGET_ARCH_ARM) 10 #if defined(TARGET_ARCH_ARM)
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 // shell when hit. 489 // shell when hit.
490 RedoBreakpoints(); 490 RedoBreakpoints();
491 491
492 #undef COMMAND_SIZE 492 #undef COMMAND_SIZE
493 #undef ARG_SIZE 493 #undef ARG_SIZE
494 494
495 #undef STR 495 #undef STR
496 #undef XSTR 496 #undef XSTR
497 } 497 }
498 498
499
499 char* SimulatorDebugger::ReadLine(const char* prompt) { 500 char* SimulatorDebugger::ReadLine(const char* prompt) {
500 char* result = NULL; 501 char* result = NULL;
501 char line_buf[256]; 502 char line_buf[256];
502 int offset = 0; 503 int offset = 0;
503 bool keep_going = true; 504 bool keep_going = true;
504 fprintf(stdout, "%s", prompt); 505 fprintf(stdout, "%s", prompt);
505 fflush(stdout); 506 fflush(stdout);
506 while (keep_going) { 507 while (keep_going) {
507 if (fgets(line_buf, sizeof(line_buf), stdin) == NULL) { 508 if (fgets(line_buf, sizeof(line_buf), stdin) == NULL) {
508 // fgets got an error. Just give up. 509 // fgets got an error. Just give up.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // handling stack overflow exceptions. To be safe in potential 621 // handling stack overflow exceptions. To be safe in potential
621 // stack underflows we also add some underflow buffer space. 622 // stack underflows we also add some underflow buffer space.
622 stack_ = new char[(Isolate::GetSpecifiedStackSize() + 623 stack_ = new char[(Isolate::GetSpecifiedStackSize() +
623 Isolate::kStackSizeBuffer + 624 Isolate::kStackSizeBuffer +
624 kSimulatorStackUnderflowSize)]; 625 kSimulatorStackUnderflowSize)];
625 pc_modified_ = false; 626 pc_modified_ = false;
626 icount_ = 0; 627 icount_ = 0;
627 break_pc_ = NULL; 628 break_pc_ = NULL;
628 break_instr_ = 0; 629 break_instr_ = 0;
629 last_setjmp_buffer_ = NULL; 630 last_setjmp_buffer_ = NULL;
631 top_exit_frame_info_ = 0;
630 632
631 // Setup architecture state. 633 // Setup architecture state.
632 // All registers are initialized to zero to start with. 634 // All registers are initialized to zero to start with.
633 for (int i = 0; i < kNumberOfCpuRegisters; i++) { 635 for (int i = 0; i < kNumberOfCpuRegisters; i++) {
634 registers_[i] = 0; 636 registers_[i] = 0;
635 } 637 }
636 n_flag_ = false; 638 n_flag_ = false;
637 z_flag_ = false; 639 z_flag_ = false;
638 c_flag_ = false; 640 c_flag_ = false;
639 v_flag_ = false; 641 v_flag_ = false;
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 case kRedirectionSvcCode: { 1330 case kRedirectionSvcCode: {
1329 SimulatorSetjmpBuffer buffer(this); 1331 SimulatorSetjmpBuffer buffer(this);
1330 1332
1331 if (!setjmp(buffer.buffer_)) { 1333 if (!setjmp(buffer.buffer_)) {
1332 int32_t saved_lr = get_register(LR); 1334 int32_t saved_lr = get_register(LR);
1333 Redirection* redirection = Redirection::FromSvcInstruction(instr); 1335 Redirection* redirection = Redirection::FromSvcInstruction(instr);
1334 uword external = redirection->external_function(); 1336 uword external = redirection->external_function();
1335 if (FLAG_trace_sim) { 1337 if (FLAG_trace_sim) {
1336 OS::Print("Call to host function at 0x%"Pd"\n", external); 1338 OS::Print("Call to host function at 0x%"Pd"\n", external);
1337 } 1339 }
1340
1341 if (redirection->call_kind() != kLeafRuntimeCall) {
1342 // The top_exit_frame_info of the current isolate points to the top of
1343 // the simulator stack.
1344 ASSERT((StackTop() - Isolate::Current()->top_exit_frame_info()) <
1345 Isolate::GetSpecifiedStackSize());
1346 // Set the top_exit_frame_info of this simulator to the native stack.
1347 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer));
1348 }
1338 if (redirection->call_kind() == kRuntimeCall) { 1349 if (redirection->call_kind() == kRuntimeCall) {
1339 NativeArguments arguments; 1350 NativeArguments arguments;
1340 ASSERT(sizeof(NativeArguments) == 4*kWordSize); 1351 ASSERT(sizeof(NativeArguments) == 4*kWordSize);
1341 arguments.isolate_ = reinterpret_cast<Isolate*>(get_register(R0)); 1352 arguments.isolate_ = reinterpret_cast<Isolate*>(get_register(R0));
1342 arguments.argc_tag_ = get_register(R1); 1353 arguments.argc_tag_ = get_register(R1);
1343 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(R2)); 1354 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(R2));
1344 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(R3)); 1355 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(R3));
1345 SimulatorRuntimeCall target = 1356 SimulatorRuntimeCall target =
1346 reinterpret_cast<SimulatorRuntimeCall>(external); 1357 reinterpret_cast<SimulatorRuntimeCall>(external);
1347 target(arguments); 1358 target(arguments);
1348 set_register(R0, icount_); // Zap result register from void function. 1359 set_register(R0, icount_); // Zap result register from void function.
1349 } else if (redirection->call_kind() == kLeafRuntimeCall) { 1360 } else if (redirection->call_kind() == kLeafRuntimeCall) {
1350 int32_t r0 = get_register(R0); 1361 int32_t r0 = get_register(R0);
1351 int32_t r1 = get_register(R1); 1362 int32_t r1 = get_register(R1);
1352 int32_t r2 = get_register(R2); 1363 int32_t r2 = get_register(R2);
1353 int32_t r3 = get_register(R3); 1364 int32_t r3 = get_register(R3);
1354 SimulatorLeafRuntimeCall target = 1365 SimulatorLeafRuntimeCall target =
1355 reinterpret_cast<SimulatorLeafRuntimeCall>(external); 1366 reinterpret_cast<SimulatorLeafRuntimeCall>(external);
1356 r0 = target(r0, r1, r2, r3); 1367 r0 = target(r0, r1, r2, r3);
1357 set_register(R0, r0); // Set returned result from function. 1368 set_register(R0, r0); // Set returned result from function.
1358 } else { 1369 } else {
1359 ASSERT(redirection->call_kind() == kNativeCall); 1370 ASSERT(redirection->call_kind() == kNativeCall);
1360 NativeArguments* arguments; 1371 NativeArguments* arguments;
1361 arguments = reinterpret_cast<NativeArguments*>(get_register(R0)); 1372 arguments = reinterpret_cast<NativeArguments*>(get_register(R0));
1362 SimulatorNativeCall target = 1373 SimulatorNativeCall target =
1363 reinterpret_cast<SimulatorNativeCall>(external); 1374 reinterpret_cast<SimulatorNativeCall>(external);
1364 target(arguments); 1375 target(arguments);
1365 set_register(R0, icount_); // Zap result register from void function. 1376 set_register(R0, icount_); // Zap result register from void function.
1366 } 1377 }
1378 set_top_exit_frame_info(0);
1367 1379
1368 // Zap caller-saved registers, since the actual runtime call could have 1380 // Zap caller-saved registers, since the actual runtime call could have
1369 // used them. 1381 // used them.
1370 set_register(R1, icount_); 1382 set_register(R1, icount_);
1371 set_register(R2, icount_); 1383 set_register(R2, icount_);
1372 set_register(R3, icount_); 1384 set_register(R3, icount_);
1373 set_register(IP, icount_); 1385 set_register(IP, icount_);
1374 set_register(LR, icount_); 1386 set_register(LR, icount_);
1375 float zap_fvalue = static_cast<float>(icount_); 1387 float zap_fvalue = static_cast<float>(icount_);
1376 for (int i = S0; i <= S15; i++) { 1388 for (int i = S0; i <= S15; i++) {
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 set_register(PC, pc); 2870 set_register(PC, pc);
2859 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 2871 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
2860 2872
2861 // Walk over all setjmp buffers (simulated --> C++ transitions) 2873 // Walk over all setjmp buffers (simulated --> C++ transitions)
2862 // and try to find the setjmp associated with the stack pointer. 2874 // and try to find the setjmp associated with the stack pointer.
2863 while (buf->link() != NULL && buf->link()->sp() <= sp) { 2875 while (buf->link() != NULL && buf->link()->sp() <= sp) {
2864 buf = buf->link(); 2876 buf = buf->link();
2865 } 2877 }
2866 ASSERT(buf != NULL); 2878 ASSERT(buf != NULL);
2867 2879
2868 // Clean up stack memory of C++ frames. 2880 // The caller has already cleaned up the stack memory of C++ frames.
2869 // TODO(regis): Revisit.
2870 // isolate->PrepareForUnwinding(reinterpret_cast<uword>(buf));
2871 // isolate->ChangeStateToGeneratedCode();
2872 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw())); 2881 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw()));
2873 buf->Longjmp(); 2882 buf->Longjmp();
2874 } 2883 }
2875 2884
2876 } // namespace dart 2885 } // namespace dart
2877 2886
2878 #endif // !defined(HOST_ARCH_ARM) 2887 #endif // !defined(HOST_ARCH_ARM)
2879 2888
2880 #endif // defined TARGET_ARCH_ARM 2889 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm.h ('k') | runtime/vm/simulator_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698