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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 2302283002: Forking the type system between Crankshaft & Turbofan. (Closed)
Patch Set: Nits. Created 4 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 | « src/code-stubs.cc ('k') | src/crankshaft/hydrogen.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 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 "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/crankshaft/hydrogen.h" 10 #include "src/crankshaft/hydrogen.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl; 328 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl;
329 } 329 }
330 return code; 330 return code;
331 } 331 }
332 332
333 333
334 template <> 334 template <>
335 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { 335 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() {
336 info()->MarkAsSavesCallerDoubles(); 336 info()->MarkAsSavesCallerDoubles();
337 HValue* number = GetParameter(Descriptor::kArgument); 337 HValue* number = GetParameter(Descriptor::kArgument);
338 return BuildNumberToString(number, Type::Number()); 338 return BuildNumberToString(number, AstType::Number());
339 } 339 }
340 340
341 341
342 Handle<Code> NumberToStringStub::GenerateCode() { 342 Handle<Code> NumberToStringStub::GenerateCode() {
343 return DoGenerateCode(this); 343 return DoGenerateCode(this);
344 } 344 }
345 345
346 346
347 template <> 347 template <>
348 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 348 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 return DoGenerateCode(this); 1256 return DoGenerateCode(this);
1257 } 1257 }
1258 1258
1259 template <> 1259 template <>
1260 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { 1260 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
1261 BinaryOpICState state = casted_stub()->state(); 1261 BinaryOpICState state = casted_stub()->state();
1262 1262
1263 HValue* left = GetParameter(Descriptor::kLeft); 1263 HValue* left = GetParameter(Descriptor::kLeft);
1264 HValue* right = GetParameter(Descriptor::kRight); 1264 HValue* right = GetParameter(Descriptor::kRight);
1265 1265
1266 Type* left_type = state.GetLeftType(); 1266 AstType* left_type = state.GetLeftType();
1267 Type* right_type = state.GetRightType(); 1267 AstType* right_type = state.GetRightType();
1268 Type* result_type = state.GetResultType(); 1268 AstType* result_type = state.GetResultType();
1269 1269
1270 DCHECK(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) && 1270 DCHECK(!left_type->Is(AstType::None()) && !right_type->Is(AstType::None()) &&
1271 (state.HasSideEffects() || !result_type->Is(Type::None()))); 1271 (state.HasSideEffects() || !result_type->Is(AstType::None())));
1272 1272
1273 HValue* result = NULL; 1273 HValue* result = NULL;
1274 HAllocationMode allocation_mode(NOT_TENURED); 1274 HAllocationMode allocation_mode(NOT_TENURED);
1275 if (state.op() == Token::ADD && 1275 if (state.op() == Token::ADD && (left_type->Maybe(AstType::String()) ||
1276 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && 1276 right_type->Maybe(AstType::String())) &&
1277 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { 1277 !left_type->Is(AstType::String()) && !right_type->Is(AstType::String())) {
1278 // For the generic add stub a fast case for string addition is performance 1278 // For the generic add stub a fast case for string addition is performance
1279 // critical. 1279 // critical.
1280 if (left_type->Maybe(Type::String())) { 1280 if (left_type->Maybe(AstType::String())) {
1281 IfBuilder if_leftisstring(this); 1281 IfBuilder if_leftisstring(this);
1282 if_leftisstring.If<HIsStringAndBranch>(left); 1282 if_leftisstring.If<HIsStringAndBranch>(left);
1283 if_leftisstring.Then(); 1283 if_leftisstring.Then();
1284 { 1284 {
1285 Push(BuildBinaryOperation(state.op(), left, right, Type::String(), 1285 Push(BuildBinaryOperation(state.op(), left, right, AstType::String(),
1286 right_type, result_type, 1286 right_type, result_type,
1287 state.fixed_right_arg(), allocation_mode)); 1287 state.fixed_right_arg(), allocation_mode));
1288 } 1288 }
1289 if_leftisstring.Else(); 1289 if_leftisstring.Else();
1290 { 1290 {
1291 Push(BuildBinaryOperation(state.op(), left, right, left_type, 1291 Push(BuildBinaryOperation(state.op(), left, right, left_type,
1292 right_type, result_type, 1292 right_type, result_type,
1293 state.fixed_right_arg(), allocation_mode)); 1293 state.fixed_right_arg(), allocation_mode));
1294 } 1294 }
1295 if_leftisstring.End(); 1295 if_leftisstring.End();
1296 result = Pop(); 1296 result = Pop();
1297 } else { 1297 } else {
1298 IfBuilder if_rightisstring(this); 1298 IfBuilder if_rightisstring(this);
1299 if_rightisstring.If<HIsStringAndBranch>(right); 1299 if_rightisstring.If<HIsStringAndBranch>(right);
1300 if_rightisstring.Then(); 1300 if_rightisstring.Then();
1301 { 1301 {
1302 Push(BuildBinaryOperation(state.op(), left, right, left_type, 1302 Push(BuildBinaryOperation(state.op(), left, right, left_type,
1303 Type::String(), result_type, 1303 AstType::String(), result_type,
1304 state.fixed_right_arg(), allocation_mode)); 1304 state.fixed_right_arg(), allocation_mode));
1305 } 1305 }
1306 if_rightisstring.Else(); 1306 if_rightisstring.Else();
1307 { 1307 {
1308 Push(BuildBinaryOperation(state.op(), left, right, left_type, 1308 Push(BuildBinaryOperation(state.op(), left, right, left_type,
1309 right_type, result_type, 1309 right_type, result_type,
1310 state.fixed_right_arg(), allocation_mode)); 1310 state.fixed_right_arg(), allocation_mode));
1311 } 1311 }
1312 if_rightisstring.End(); 1312 if_rightisstring.End();
1313 result = Pop(); 1313 result = Pop();
(...skipping 20 matching lines...) Expand all
1334 1334
1335 1335
1336 template <> 1336 template <>
1337 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() { 1337 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() {
1338 BinaryOpICState state = casted_stub()->state(); 1338 BinaryOpICState state = casted_stub()->state();
1339 1339
1340 HValue* allocation_site = GetParameter(Descriptor::kAllocationSite); 1340 HValue* allocation_site = GetParameter(Descriptor::kAllocationSite);
1341 HValue* left = GetParameter(Descriptor::kLeft); 1341 HValue* left = GetParameter(Descriptor::kLeft);
1342 HValue* right = GetParameter(Descriptor::kRight); 1342 HValue* right = GetParameter(Descriptor::kRight);
1343 1343
1344 Type* left_type = state.GetLeftType(); 1344 AstType* left_type = state.GetLeftType();
1345 Type* right_type = state.GetRightType(); 1345 AstType* right_type = state.GetRightType();
1346 Type* result_type = state.GetResultType(); 1346 AstType* result_type = state.GetResultType();
1347 HAllocationMode allocation_mode(allocation_site); 1347 HAllocationMode allocation_mode(allocation_site);
1348 1348
1349 return BuildBinaryOperation(state.op(), left, right, left_type, right_type, 1349 return BuildBinaryOperation(state.op(), left, right, left_type, right_type,
1350 result_type, state.fixed_right_arg(), 1350 result_type, state.fixed_right_arg(),
1351 allocation_mode); 1351 allocation_mode);
1352 } 1352 }
1353 1353
1354 1354
1355 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode() { 1355 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode() {
1356 return DoGenerateCode(this); 1356 return DoGenerateCode(this);
1357 } 1357 }
1358 1358
1359 1359
1360 HValue* CodeStubGraphBuilderBase::BuildToString(HValue* input, bool convert) { 1360 HValue* CodeStubGraphBuilderBase::BuildToString(HValue* input, bool convert) {
1361 if (!convert) return BuildCheckString(input); 1361 if (!convert) return BuildCheckString(input);
1362 IfBuilder if_inputissmi(this); 1362 IfBuilder if_inputissmi(this);
1363 HValue* inputissmi = if_inputissmi.If<HIsSmiAndBranch>(input); 1363 HValue* inputissmi = if_inputissmi.If<HIsSmiAndBranch>(input);
1364 if_inputissmi.Then(); 1364 if_inputissmi.Then();
1365 { 1365 {
1366 // Convert the input smi to a string. 1366 // Convert the input smi to a string.
1367 Push(BuildNumberToString(input, Type::SignedSmall())); 1367 Push(BuildNumberToString(input, AstType::SignedSmall()));
1368 } 1368 }
1369 if_inputissmi.Else(); 1369 if_inputissmi.Else();
1370 { 1370 {
1371 HValue* input_map = 1371 HValue* input_map =
1372 Add<HLoadNamedField>(input, inputissmi, HObjectAccess::ForMap()); 1372 Add<HLoadNamedField>(input, inputissmi, HObjectAccess::ForMap());
1373 HValue* input_instance_type = Add<HLoadNamedField>( 1373 HValue* input_instance_type = Add<HLoadNamedField>(
1374 input_map, inputissmi, HObjectAccess::ForMapInstanceType()); 1374 input_map, inputissmi, HObjectAccess::ForMapInstanceType());
1375 IfBuilder if_inputisstring(this); 1375 IfBuilder if_inputisstring(this);
1376 if_inputisstring.If<HCompareNumericAndBranch>( 1376 if_inputisstring.If<HCompareNumericAndBranch>(
1377 input_instance_type, Add<HConstant>(FIRST_NONSTRING_TYPE), Token::LT); 1377 input_instance_type, Add<HConstant>(FIRST_NONSTRING_TYPE), Token::LT);
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 return Pop(); 1944 return Pop();
1945 } 1945 }
1946 1946
1947 1947
1948 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 1948 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
1949 return DoGenerateCode(this); 1949 return DoGenerateCode(this);
1950 } 1950 }
1951 1951
1952 } // namespace internal 1952 } // namespace internal
1953 } // namespace v8 1953 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/crankshaft/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698