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

Side by Side Diff: src/mips/simulator-mips.cc

Issue 7781002: MIPS: Fix an invalid stack-check in the simulator. (Closed)
Patch Set: Created 9 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 int32_t func = instr->FunctionFieldRaw(); 1402 int32_t func = instr->FunctionFieldRaw();
1403 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1; 1403 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1;
1404 1404
1405 // We first check if we met a call_rt_redirected. 1405 // We first check if we met a call_rt_redirected.
1406 if (instr->InstructionBits() == rtCallRedirInstr) { 1406 if (instr->InstructionBits() == rtCallRedirInstr) {
1407 Redirection* redirection = Redirection::FromSwiInstruction(instr); 1407 Redirection* redirection = Redirection::FromSwiInstruction(instr);
1408 int32_t arg0 = get_register(a0); 1408 int32_t arg0 = get_register(a0);
1409 int32_t arg1 = get_register(a1); 1409 int32_t arg1 = get_register(a1);
1410 int32_t arg2 = get_register(a2); 1410 int32_t arg2 = get_register(a2);
1411 int32_t arg3 = get_register(a3); 1411 int32_t arg3 = get_register(a3);
1412 int32_t arg4 = 0;
1413 int32_t arg5 = 0;
1414 1412
1415 // Need to check if sp is valid before assigning arg4, arg5.
1416 // This is a fix for cctest test-api/CatchStackOverflow which causes
1417 // the stack to overflow. For some reason arm doesn't need this
1418 // stack check here.
1419 int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp)); 1413 int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp));
1420 int32_t* stack = reinterpret_cast<int32_t*>(stack_); 1414 // Args 4 and 5 are on the stack after the reserved space for args 0..3.
1421 if (stack_pointer >= stack && stack_pointer < stack + stack_size_ - 5) { 1415 int32_t arg4 = stack_pointer[4];
1422 // Args 4 and 5 are on the stack after the reserved space for args 0..3. 1416 int32_t arg5 = stack_pointer[5];
1423 arg4 = stack_pointer[4];
1424 arg5 = stack_pointer[5];
1425 }
1426 1417
1427 bool fp_call = 1418 bool fp_call =
1428 (redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) || 1419 (redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) ||
1429 (redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) || 1420 (redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) ||
1430 (redirection->type() == ExternalReference::BUILTIN_FP_CALL) || 1421 (redirection->type() == ExternalReference::BUILTIN_FP_CALL) ||
1431 (redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL); 1422 (redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL);
1432 1423
1433 if (!IsMipsSoftFloatABI) { 1424 if (!IsMipsSoftFloatABI) {
1434 // With the hard floating point calling convention, double 1425 // With the hard floating point calling convention, double
1435 // arguments are passed in FPU registers. Fetch the arguments 1426 // arguments are passed in FPU registers. Fetch the arguments
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 } 2812 }
2822 2813
2823 2814
2824 #undef UNSUPPORTED 2815 #undef UNSUPPORTED
2825 2816
2826 } } // namespace v8::internal 2817 } } // namespace v8::internal
2827 2818
2828 #endif // USE_SIMULATOR 2819 #endif // USE_SIMULATOR
2829 2820
2830 #endif // V8_TARGET_ARCH_MIPS 2821 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698