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

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

Issue 11098009: Implement SmiToInt and DoubleToInt. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 RawAbstractType* DoubleToDoubleInstr::CompileType() const { 1291 RawAbstractType* DoubleToDoubleInstr::CompileType() const {
1292 return Type::Double(); 1292 return Type::Double();
1293 } 1293 }
1294 1294
1295 1295
1296 RawAbstractType* SmiToDoubleInstr::CompileType() const { 1296 RawAbstractType* SmiToDoubleInstr::CompileType() const {
1297 return Type::Double(); 1297 return Type::Double();
1298 } 1298 }
1299 1299
1300 1300
1301 RawAbstractType* IntegerToIntegerInstr::CompileType() const {
1302 return Type::IntType();
1303 }
1304
1305
1306 RawAbstractType* DoubleToIntegerInstr::CompileType() const {
1307 return Type::IntType();
1308 }
1309
1310
1301 RawAbstractType* CheckClassInstr::CompileType() const { 1311 RawAbstractType* CheckClassInstr::CompileType() const {
1302 return AbstractType::null(); 1312 return AbstractType::null();
1303 } 1313 }
1304 1314
1305 1315
1306 RawAbstractType* CheckSmiInstr::CompileType() const { 1316 RawAbstractType* CheckSmiInstr::CompileType() const {
1307 return AbstractType::null(); 1317 return AbstractType::null();
1308 } 1318 }
1309 1319
1310 1320
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode 1866 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
1857 // where PushArgument is handled by BindInstr::EmitNativeCode. 1867 // where PushArgument is handled by BindInstr::EmitNativeCode.
1858 // TODO(fschneider): Avoid special-casing for SSA mode here. 1868 // TODO(fschneider): Avoid special-casing for SSA mode here.
1859 if (compiler->is_optimizing()) { 1869 if (compiler->is_optimizing()) {
1860 ASSERT(locs()->in(0).IsRegister()); 1870 ASSERT(locs()->in(0).IsRegister());
1861 __ PushRegister(locs()->in(0).reg()); 1871 __ PushRegister(locs()->in(0).reg());
1862 } 1872 }
1863 } 1873 }
1864 1874
1865 1875
1876 LocationSummary* IntegerToIntegerInstr::MakeLocationSummary() const {
1877 const intptr_t kNumInputs = 1;
1878 const intptr_t kNumTemps = 0;
1879 LocationSummary* locs =
1880 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1881 locs->set_in(0, Location::RequiresRegister());
1882 locs->set_out(Location::SameAsFirstInput());
1883 return locs;
1884 }
1885
1886
1887 void IntegerToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1888 Register value = locs()->in(0).reg();
1889 Register result = locs()->out().reg();
1890 ASSERT(value == result);
1891 }
1892
1893
1866 Environment* Environment::From(const GrowableArray<Definition*>& definitions, 1894 Environment* Environment::From(const GrowableArray<Definition*>& definitions,
1867 intptr_t fixed_parameter_count, 1895 intptr_t fixed_parameter_count,
1868 const Function& function) { 1896 const Function& function) {
1869 Environment* env = 1897 Environment* env =
1870 new Environment(definitions.length(), 1898 new Environment(definitions.length(),
1871 fixed_parameter_count, 1899 fixed_parameter_count,
1872 Isolate::kNoDeoptId, 1900 Isolate::kNoDeoptId,
1873 function, 1901 function,
1874 NULL); 1902 NULL);
1875 for (intptr_t i = 0; i < definitions.length(); ++i) { 1903 for (intptr_t i = 0; i < definitions.length(); ++i) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 new_max = new_max.Clamp(); 2107 new_max = new_max.Clamp();
2080 } 2108 }
2081 2109
2082 return Range::Update(&range_, new_min, new_max); 2110 return Range::Update(&range_, new_min, new_max);
2083 } 2111 }
2084 2112
2085 2113
2086 #undef __ 2114 #undef __
2087 2115
2088 } // namespace dart 2116 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698