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

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

Issue 1576093004: [Interpreter] Add ForInPrepare runtime function which returns a ObjectTriple. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add MIPS port Created 4 years, 11 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 | « src/arm/macro-assembler-arm.h ('k') | src/arm64/code-stubs-arm64.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdarg.h> 5 #include <stdarg.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <cmath> 7 #include <cmath>
8 8
9 #if V8_TARGET_ARCH_ARM 9 #if V8_TARGET_ARCH_ARM
10 10
11 #include "src/arm/constants-arm.h" 11 #include "src/arm/constants-arm.h"
12 #include "src/arm/simulator-arm.h" 12 #include "src/arm/simulator-arm.h"
13 #include "src/assembler.h" 13 #include "src/assembler.h"
14 #include "src/base/bits.h" 14 #include "src/base/bits.h"
15 #include "src/codegen.h" 15 #include "src/codegen.h"
16 #include "src/disasm.h" 16 #include "src/disasm.h"
17 #include "src/runtime/runtime-utils.h"
17 18
18 #if defined(USE_SIMULATOR) 19 #if defined(USE_SIMULATOR)
19 20
20 // Only build the simulator if not compiling for real ARM hardware. 21 // Only build the simulator if not compiling for real ARM hardware.
21 namespace v8 { 22 namespace v8 {
22 namespace internal { 23 namespace internal {
23 24
24 // This macro provides a platform independent use of sscanf. The reason for 25 // This macro provides a platform independent use of sscanf. The reason for
25 // SScanF not being implemented in a platform independent way through 26 // SScanF not being implemented in a platform independent way through
26 // ::v8::internal::OS in the same way as SNPrintF is that the 27 // ::v8::internal::OS in the same way as SNPrintF is that the
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 // 64-bit value. With the code below we assume that all runtime calls return 1711 // 64-bit value. With the code below we assume that all runtime calls return
1711 // 64 bits of result. If they don't, the r1 result register contains a bogus 1712 // 64 bits of result. If they don't, the r1 result register contains a bogus
1712 // value, which is fine because it is caller-saved. 1713 // value, which is fine because it is caller-saved.
1713 typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0, 1714 typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0,
1714 int32_t arg1, 1715 int32_t arg1,
1715 int32_t arg2, 1716 int32_t arg2,
1716 int32_t arg3, 1717 int32_t arg3,
1717 int32_t arg4, 1718 int32_t arg4,
1718 int32_t arg5); 1719 int32_t arg5);
1719 1720
1721 typedef ObjectTriple (*SimulatorRuntimeTripleCall)(int32_t arg0, int32_t arg1,
1722 int32_t arg2, int32_t arg3,
1723 int32_t arg4);
1724
1720 // These prototypes handle the four types of FP calls. 1725 // These prototypes handle the four types of FP calls.
1721 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); 1726 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1);
1722 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); 1727 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1);
1723 typedef double (*SimulatorRuntimeFPCall)(double darg0); 1728 typedef double (*SimulatorRuntimeFPCall)(double darg0);
1724 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); 1729 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0);
1725 1730
1726 // This signature supports direct call in to API function native callback 1731 // This signature supports direct call in to API function native callback
1727 // (refer to InvocationCallback in v8.h). 1732 // (refer to InvocationCallback in v8.h).
1728 typedef void (*SimulatorRuntimeDirectApiCall)(int32_t arg0); 1733 typedef void (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
1729 typedef void (*SimulatorRuntimeProfilingApiCall)(int32_t arg0, void* arg1); 1734 typedef void (*SimulatorRuntimeProfilingApiCall)(int32_t arg0, void* arg1);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 if (!stack_aligned) { 1898 if (!stack_aligned) {
1894 PrintF(" with unaligned stack %08x\n", get_register(sp)); 1899 PrintF(" with unaligned stack %08x\n", get_register(sp));
1895 } 1900 }
1896 PrintF("\n"); 1901 PrintF("\n");
1897 } 1902 }
1898 CHECK(stack_aligned); 1903 CHECK(stack_aligned);
1899 SimulatorRuntimeProfilingGetterCall target = 1904 SimulatorRuntimeProfilingGetterCall target =
1900 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>( 1905 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(
1901 external); 1906 external);
1902 target(arg0, arg1, Redirection::ReverseRedirection(arg2)); 1907 target(arg0, arg1, Redirection::ReverseRedirection(arg2));
1908 } else if (redirection->type() ==
1909 ExternalReference::BUILTIN_CALL_TRIPLE) {
1910 // builtin call returning ObjectTriple.
1911 SimulatorRuntimeTripleCall target =
1912 reinterpret_cast<SimulatorRuntimeTripleCall>(external);
1913 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1914 PrintF(
1915 "Call to host triple returning runtime function %p "
1916 "args %08x, %08x, %08x, %08x, %08x",
1917 FUNCTION_ADDR(target), arg1, arg2, arg3, arg4, arg5);
1918 if (!stack_aligned) {
1919 PrintF(" with unaligned stack %08x\n", get_register(sp));
1920 }
1921 PrintF("\n");
1922 }
1923 CHECK(stack_aligned);
1924 // arg0 is a hidden argument pointing to the return location, so don't
1925 // pass it to the target function.
1926 ObjectTriple result = target(arg1, arg2, arg3, arg4, arg5);
1927 if (::v8::internal::FLAG_trace_sim) {
1928 PrintF("Returned { %p, %p, %p }\n", result.x, result.y, result.z);
1929 }
1930 // Return is passed back in address pointed to by hidden first argument.
1931 ObjectTriple* sim_result = reinterpret_cast<ObjectTriple*>(arg0);
1932 *sim_result = result;
1933 set_register(r0, arg0);
1903 } else { 1934 } else {
1904 // builtin call. 1935 // builtin call.
1905 DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL); 1936 DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL);
1906 SimulatorRuntimeCall target = 1937 SimulatorRuntimeCall target =
1907 reinterpret_cast<SimulatorRuntimeCall>(external); 1938 reinterpret_cast<SimulatorRuntimeCall>(external);
1908 if (::v8::internal::FLAG_trace_sim || !stack_aligned) { 1939 if (::v8::internal::FLAG_trace_sim || !stack_aligned) {
1909 PrintF( 1940 PrintF(
1910 "Call to host function at %p " 1941 "Call to host function at %p "
1911 "args %08x, %08x, %08x, %08x, %08x, %08x", 1942 "args %08x, %08x, %08x, %08x, %08x, %08x",
1912 FUNCTION_ADDR(target), 1943 FUNCTION_ADDR(target),
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
4182 set_register(sp, current_sp + sizeof(uintptr_t)); 4213 set_register(sp, current_sp + sizeof(uintptr_t));
4183 return address; 4214 return address;
4184 } 4215 }
4185 4216
4186 } // namespace internal 4217 } // namespace internal
4187 } // namespace v8 4218 } // namespace v8
4188 4219
4189 #endif // USE_SIMULATOR 4220 #endif // USE_SIMULATOR
4190 4221
4191 #endif // V8_TARGET_ARCH_ARM 4222 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698