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

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

Issue 2076773002: DBC: Adds UnarySmiOp instruction, etc. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Change back to Drop1 Created 4 years, 6 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 | « runtime/vm/intermediate_language_dbc.cc ('k') | 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 (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 <setjmp.h> // NOLINT 5 #include <setjmp.h> // NOLINT
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_DBC) 9 #if defined(TARGET_ARCH_DBC)
10 10
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 BYTECODE(Sub, A_B_C); 1573 BYTECODE(Sub, A_B_C);
1574 SMI_OP_CHECK(intptr_t, SignedSubWithOverflow); 1574 SMI_OP_CHECK(intptr_t, SignedSubWithOverflow);
1575 DISPATCH(); 1575 DISPATCH();
1576 } 1576 }
1577 { 1577 {
1578 BYTECODE(Mul, A_B_C); 1578 BYTECODE(Mul, A_B_C);
1579 SMI_OP_CHECK(intptr_t, SMI_MUL); 1579 SMI_OP_CHECK(intptr_t, SMI_MUL);
1580 DISPATCH(); 1580 DISPATCH();
1581 } 1581 }
1582 { 1582 {
1583 BYTECODE(Neg, A_D);
1584 const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]);
1585 intptr_t* out = reinterpret_cast<intptr_t*>(&FP[rA]);
1586 if (LIKELY(!SignedSubWithOverflow(0, value, out))) {
1587 pc++;
1588 }
1589 DISPATCH();
1590 }
1591 {
1583 BYTECODE(BitOr, A_B_C); 1592 BYTECODE(BitOr, A_B_C);
1584 SMI_OP_NOCHECK(intptr_t, SMI_BITOR); 1593 SMI_OP_NOCHECK(intptr_t, SMI_BITOR);
1585 DISPATCH(); 1594 DISPATCH();
1586 } 1595 }
1587 { 1596 {
1588 BYTECODE(BitAnd, A_B_C); 1597 BYTECODE(BitAnd, A_B_C);
1589 SMI_OP_NOCHECK(intptr_t, SMI_BITAND); 1598 SMI_OP_NOCHECK(intptr_t, SMI_BITAND);
1590 DISPATCH(); 1599 DISPATCH();
1591 } 1600 }
1592 { 1601 {
1593 BYTECODE(BitXor, A_B_C); 1602 BYTECODE(BitXor, A_B_C);
1594 SMI_OP_NOCHECK(intptr_t, SMI_BITXOR); 1603 SMI_OP_NOCHECK(intptr_t, SMI_BITXOR);
1595 DISPATCH(); 1604 DISPATCH();
1596 } 1605 }
1606 {
1607 BYTECODE(BitNot, A_D);
1608 const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]);
1609 *reinterpret_cast<intptr_t*>(&FP[rA]) = ~value & (~kSmiTagMask);
1610 DISPATCH();
1611 }
1597 1612
1598 { 1613 {
1599 BYTECODE(Div, A_B_C); 1614 BYTECODE(Div, A_B_C);
1600 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]); 1615 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]);
1601 if (rhs != 0) { 1616 if (rhs != 0) {
1602 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]); 1617 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
1603 const intptr_t res = (lhs >> kSmiTagSize) / (rhs >> kSmiTagSize); 1618 const intptr_t res = (lhs >> kSmiTagSize) / (rhs >> kSmiTagSize);
1604 #if defined(ARCH_IS_64_BIT) 1619 #if defined(ARCH_IS_64_BIT)
1605 const intptr_t untaggable = 0x4000000000000000LL; 1620 const intptr_t untaggable = 0x4000000000000000LL;
1606 #else 1621 #else
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 BYTECODE(AssertAssignable, A_D); // Stack: instance, type args, type, name 1857 BYTECODE(AssertAssignable, A_D); // Stack: instance, type args, type, name
1843 RawObject** args = SP - 3; 1858 RawObject** args = SP - 3;
1844 if (args[0] != null_value) { 1859 if (args[0] != null_value) {
1845 const AbstractType& dst_type = 1860 const AbstractType& dst_type =
1846 AbstractType::Handle(static_cast<RawAbstractType*>(args[2])); 1861 AbstractType::Handle(static_cast<RawAbstractType*>(args[2]));
1847 if (dst_type.IsMalformedOrMalbounded()) { 1862 if (dst_type.IsMalformedOrMalbounded()) {
1848 SP[1] = args[0]; // instance. 1863 SP[1] = args[0]; // instance.
1849 SP[2] = args[3]; // name. 1864 SP[2] = args[3]; // name.
1850 SP[3] = args[2]; // type. 1865 SP[3] = args[2]; // type.
1851 Exit(thread, FP, SP + 4, pc); 1866 Exit(thread, FP, SP + 4, pc);
1852 NativeArguments args(thread, 3, SP + 1, SP - 3); 1867 NativeArguments native_args(thread, 3, SP + 1, SP - 3);
1853 INVOKE_RUNTIME(DRT_BadTypeError, args); 1868 INVOKE_RUNTIME(DRT_BadTypeError, native_args);
1854 UNREACHABLE(); 1869 UNREACHABLE();
1855 } 1870 }
1856 1871
1857 RawSubtypeTestCache* cache = 1872 RawSubtypeTestCache* cache =
1858 static_cast<RawSubtypeTestCache*>(LOAD_CONSTANT(rD)); 1873 static_cast<RawSubtypeTestCache*>(LOAD_CONSTANT(rD));
1859 if (cache != null_value) { 1874 if (cache != null_value) {
1860 RawInstance* instance = static_cast<RawInstance*>(args[0]); 1875 RawInstance* instance = static_cast<RawInstance*>(args[0]);
1861 RawTypeArguments* instantiator_type_arguments = 1876 RawTypeArguments* instantiator_type_arguments =
1862 static_cast<RawTypeArguments*>(args[1]); 1877 static_cast<RawTypeArguments*>(args[1]);
1863 1878
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 } 1918 }
1904 } 1919 }
1905 1920
1906 AssertAssignableCallRuntime: 1921 AssertAssignableCallRuntime:
1907 SP[1] = args[0]; // instance 1922 SP[1] = args[0]; // instance
1908 SP[2] = args[2]; // type 1923 SP[2] = args[2]; // type
1909 SP[3] = args[1]; // type args 1924 SP[3] = args[1]; // type args
1910 SP[4] = args[3]; // name 1925 SP[4] = args[3]; // name
1911 SP[5] = cache; 1926 SP[5] = cache;
1912 Exit(thread, FP, SP + 6, pc); 1927 Exit(thread, FP, SP + 6, pc);
1913 NativeArguments args(thread, 5, SP + 1, SP - 3); 1928 NativeArguments native_args(thread, 5, SP + 1, SP - 3);
1914 INVOKE_RUNTIME(DRT_TypeCheck, args); 1929 INVOKE_RUNTIME(DRT_TypeCheck, native_args);
1915 } 1930 }
1916 1931
1917 AssertAssignableOk: 1932 AssertAssignableOk:
1918 SP -= 3; 1933 SP -= 3;
1919 DISPATCH(); 1934 DISPATCH();
1920 } 1935 }
1921 1936
1922 { 1937 {
1923 BYTECODE(AssertBoolean, A); 1938 BYTECODE(AssertBoolean, A);
1924 RawObject* value = SP[0]; 1939 RawObject* value = SP[0];
(...skipping 20 matching lines...) Expand all
1945 { 1960 {
1946 BYTECODE(CheckSmi, 0); 1961 BYTECODE(CheckSmi, 0);
1947 intptr_t obj = reinterpret_cast<intptr_t>(FP[rA]); 1962 intptr_t obj = reinterpret_cast<intptr_t>(FP[rA]);
1948 if ((obj & kSmiTagMask) == kSmiTag) { 1963 if ((obj & kSmiTagMask) == kSmiTag) {
1949 pc++; 1964 pc++;
1950 } 1965 }
1951 DISPATCH(); 1966 DISPATCH();
1952 } 1967 }
1953 1968
1954 { 1969 {
1970 BYTECODE(CheckClassId, A_D);
1971 const RawSmi* actual_cid =
1972 SimulatorHelpers::GetClassIdAsSmi(static_cast<RawObject*>(FP[rA]));
1973 const RawSmi* desired_cid = RAW_CAST(Smi, LOAD_CONSTANT(rD));
1974 if (actual_cid == desired_cid) {
1975 pc++;
1976 }
1977 DISPATCH();
1978 }
1979
1980 {
1955 BYTECODE(IfEqStrictTOS, 0); 1981 BYTECODE(IfEqStrictTOS, 0);
1956 SP -= 2; 1982 SP -= 2;
1957 if (SP[1] != SP[2]) { 1983 if (SP[1] != SP[2]) {
1958 pc++; 1984 pc++;
1959 } 1985 }
1960 DISPATCH(); 1986 DISPATCH();
1961 } 1987 }
1962 1988
1963 { 1989 {
1964 BYTECODE(IfNeStrictTOS, 0); 1990 BYTECODE(IfNeStrictTOS, 0);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 special_[kExceptionSpecialIndex] = raw_exception; 2290 special_[kExceptionSpecialIndex] = raw_exception;
2265 special_[kStacktraceSpecialIndex] = raw_stacktrace; 2291 special_[kStacktraceSpecialIndex] = raw_stacktrace;
2266 buf->Longjmp(); 2292 buf->Longjmp();
2267 UNREACHABLE(); 2293 UNREACHABLE();
2268 } 2294 }
2269 2295
2270 } // namespace dart 2296 } // namespace dart
2271 2297
2272 2298
2273 #endif // defined TARGET_ARCH_DBC 2299 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698