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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 196353004: Fixed handling of polymorphic array accesses with constant index (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-351319.js » ('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 // 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 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 } 1425 }
1426 return this; 1426 return this;
1427 } 1427 }
1428 1428
1429 1429
1430 void HTypeof::PrintDataTo(StringStream* stream) { 1430 void HTypeof::PrintDataTo(StringStream* stream) {
1431 value()->PrintNameTo(stream); 1431 value()->PrintNameTo(stream);
1432 } 1432 }
1433 1433
1434 1434
1435 static bool CanRepresentationContainDouble(Representation rep, double value) {
Jakob Kummerow 2014/03/12 09:16:24 nit: How about moving this to Representation::CanR
1436 if (rep.IsDouble() || rep.is_more_general_than(Representation::Double())) {
1437 return true;
1438 }
1439 if (IsInt32Double(value)) {
1440 if (rep.IsInteger32()) return true;
1441 if (rep.IsSmi()) return Smi::IsValid(static_cast<int32_t>(value));
1442 }
1443 return false;
1444 }
1445
1446
1435 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, 1447 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context,
1436 HValue* value, Representation required_representation) { 1448 HValue* value, Representation representation) {
1437 if (FLAG_fold_constants && value->IsConstant()) { 1449 if (FLAG_fold_constants && value->IsConstant()) {
1438 HConstant* c = HConstant::cast(value); 1450 HConstant* c = HConstant::cast(value);
1439 if (c->HasNumberValue()) { 1451 if (c->HasNumberValue()) {
1440 double double_res = c->DoubleValue(); 1452 double double_res = c->DoubleValue();
1441 if (IsInt32Double(double_res)) { 1453 if (CanRepresentationContainDouble(representation, double_res)) {
1442 return HConstant::New(zone, context, 1454 return HConstant::New(zone, context,
1443 static_cast<int32_t>(double_res), 1455 static_cast<int32_t>(double_res),
1444 required_representation); 1456 representation);
1445 } 1457 }
1446 } 1458 }
1447 } 1459 }
1448 return new(zone) HForceRepresentation(value, required_representation); 1460 return new(zone) HForceRepresentation(value, representation);
1449 } 1461 }
1450 1462
1451 1463
1452 void HForceRepresentation::PrintDataTo(StringStream* stream) { 1464 void HForceRepresentation::PrintDataTo(StringStream* stream) {
1453 stream->Add("%s ", representation().Mnemonic()); 1465 stream->Add("%s ", representation().Mnemonic());
1454 value()->PrintNameTo(stream); 1466 value()->PrintNameTo(stream);
1455 } 1467 }
1456 1468
1457 1469
1458 void HChange::PrintDataTo(StringStream* stream) { 1470 void HChange::PrintDataTo(StringStream* stream) {
(...skipping 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 break; 4565 break;
4554 case kExternalMemory: 4566 case kExternalMemory:
4555 stream->Add("[external-memory]"); 4567 stream->Add("[external-memory]");
4556 break; 4568 break;
4557 } 4569 }
4558 4570
4559 stream->Add("@%d", offset()); 4571 stream->Add("@%d", offset());
4560 } 4572 }
4561 4573
4562 } } // namespace v8::internal 4574 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-351319.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698