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

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

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 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 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 } 1170 }
1171 1171
1172 1172
1173 void HTypeofIsAndBranch::PrintDataTo(StringStream* stream) { 1173 void HTypeofIsAndBranch::PrintDataTo(StringStream* stream) {
1174 value()->PrintNameTo(stream); 1174 value()->PrintNameTo(stream);
1175 stream->Add(" == %o", *type_literal_); 1175 stream->Add(" == %o", *type_literal_);
1176 HControlInstruction::PrintDataTo(stream); 1176 HControlInstruction::PrintDataTo(stream);
1177 } 1177 }
1178 1178
1179 1179
1180 bool HTypeofIsAndBranch::KnownSuccessorBlock(HBasicBlock** block) {
1181 if (value()->representation().IsSpecialization()) {
1182 if (compares_number_type()) {
1183 *block = FirstSuccessor();
1184 } else {
1185 *block = SecondSuccessor();
1186 }
1187 return true;
1188 }
1189 *block = NULL;
1190 return false;
1191 }
1192
1193
1180 void HCheckMapValue::PrintDataTo(StringStream* stream) { 1194 void HCheckMapValue::PrintDataTo(StringStream* stream) {
1181 value()->PrintNameTo(stream); 1195 value()->PrintNameTo(stream);
1182 stream->Add(" "); 1196 stream->Add(" ");
1183 map()->PrintNameTo(stream); 1197 map()->PrintNameTo(stream);
1184 } 1198 }
1185 1199
1186 1200
1187 void HForInPrepareMap::PrintDataTo(StringStream* stream) { 1201 void HForInPrepareMap::PrintDataTo(StringStream* stream) {
1188 enumerable()->PrintNameTo(stream); 1202 enumerable()->PrintNameTo(stream);
1189 } 1203 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 } 1328 }
1315 return this; 1329 return this;
1316 } 1330 }
1317 1331
1318 1332
1319 void HTypeof::PrintDataTo(StringStream* stream) { 1333 void HTypeof::PrintDataTo(StringStream* stream) {
1320 value()->PrintNameTo(stream); 1334 value()->PrintNameTo(stream);
1321 } 1335 }
1322 1336
1323 1337
1338 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context,
1339 HValue* value, Representation required_representation) {
1340 if (FLAG_fold_constants && value->IsConstant()) {
1341 HConstant* c = HConstant::cast(value);
1342 if (c->HasNumberValue()) {
1343 double double_res = c->DoubleValue();
1344 if (TypeInfo::IsInt32Double(double_res)) {
1345 return HConstant::New(zone, context,
1346 static_cast<int32_t>(double_res),
1347 required_representation);
1348 }
1349 }
1350 }
1351 return new(zone) HForceRepresentation(value, required_representation);
1352 }
1353
1354
1324 void HForceRepresentation::PrintDataTo(StringStream* stream) { 1355 void HForceRepresentation::PrintDataTo(StringStream* stream) {
1325 stream->Add("%s ", representation().Mnemonic()); 1356 stream->Add("%s ", representation().Mnemonic());
1326 value()->PrintNameTo(stream); 1357 value()->PrintNameTo(stream);
1327 } 1358 }
1328 1359
1329 1360
1330 void HChange::PrintDataTo(StringStream* stream) { 1361 void HChange::PrintDataTo(StringStream* stream) {
1331 HUnaryOperation::PrintDataTo(stream); 1362 HUnaryOperation::PrintDataTo(stream);
1332 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); 1363 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic());
1333 1364
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 if (MustAllocateDoubleAligned()) { 3421 if (MustAllocateDoubleAligned()) {
3391 if (!dominator_allocate->MustAllocateDoubleAligned()) { 3422 if (!dominator_allocate->MustAllocateDoubleAligned()) {
3392 dominator_allocate->MakeDoubleAligned(); 3423 dominator_allocate->MakeDoubleAligned();
3393 } 3424 }
3394 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { 3425 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) {
3395 dominator_size_constant += kDoubleSize / 2; 3426 dominator_size_constant += kDoubleSize / 2;
3396 new_dominator_size += kDoubleSize / 2; 3427 new_dominator_size += kDoubleSize / 2;
3397 } 3428 }
3398 } 3429 }
3399 3430
3400 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { 3431 if (new_dominator_size > isolate()->heap()->MaxRegularSpaceAllocationSize()) {
3401 if (FLAG_trace_allocation_folding) { 3432 if (FLAG_trace_allocation_folding) {
3402 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", 3433 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n",
3403 id(), Mnemonic(), dominator_allocate->id(), 3434 id(), Mnemonic(), dominator_allocate->id(),
3404 dominator_allocate->Mnemonic(), new_dominator_size); 3435 dominator_allocate->Mnemonic(), new_dominator_size);
3405 } 3436 }
3406 return; 3437 return;
3407 } 3438 }
3408 3439
3409 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore( 3440 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore(
3410 zone, 3441 zone,
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3892 return H_CONSTANT_DOUBLE(OS::nan_value()); 3923 return H_CONSTANT_DOUBLE(OS::nan_value());
3893 } 3924 }
3894 } 3925 }
3895 return new(zone) HMathMinMax(context, left, right, op); 3926 return new(zone) HMathMinMax(context, left, right, op);
3896 } 3927 }
3897 3928
3898 3929
3899 HInstruction* HMod::New(Zone* zone, 3930 HInstruction* HMod::New(Zone* zone,
3900 HValue* context, 3931 HValue* context,
3901 HValue* left, 3932 HValue* left,
3902 HValue* right, 3933 HValue* right) {
3903 Maybe<int> fixed_right_arg) {
3904 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3934 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3905 HConstant* c_left = HConstant::cast(left); 3935 HConstant* c_left = HConstant::cast(left);
3906 HConstant* c_right = HConstant::cast(right); 3936 HConstant* c_right = HConstant::cast(right);
3907 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { 3937 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) {
3908 int32_t dividend = c_left->Integer32Value(); 3938 int32_t dividend = c_left->Integer32Value();
3909 int32_t divisor = c_right->Integer32Value(); 3939 int32_t divisor = c_right->Integer32Value();
3910 if (dividend == kMinInt && divisor == -1) { 3940 if (dividend == kMinInt && divisor == -1) {
3911 return H_CONSTANT_DOUBLE(-0.0); 3941 return H_CONSTANT_DOUBLE(-0.0);
3912 } 3942 }
3913 if (divisor != 0) { 3943 if (divisor != 0) {
3914 int32_t res = dividend % divisor; 3944 int32_t res = dividend % divisor;
3915 if ((res == 0) && (dividend < 0)) { 3945 if ((res == 0) && (dividend < 0)) {
3916 return H_CONSTANT_DOUBLE(-0.0); 3946 return H_CONSTANT_DOUBLE(-0.0);
3917 } 3947 }
3918 return H_CONSTANT_INT(res); 3948 return H_CONSTANT_INT(res);
3919 } 3949 }
3920 } 3950 }
3921 } 3951 }
3922 return new(zone) HMod(context, left, right, fixed_right_arg); 3952 return new(zone) HMod(context, left, right);
3923 } 3953 }
3924 3954
3925 3955
3926 HInstruction* HDiv::New( 3956 HInstruction* HDiv::New(
3927 Zone* zone, HValue* context, HValue* left, HValue* right) { 3957 Zone* zone, HValue* context, HValue* left, HValue* right) {
3928 // If left and right are constant values, try to return a constant value. 3958 // If left and right are constant values, try to return a constant value.
3929 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3959 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3930 HConstant* c_left = HConstant::cast(left); 3960 HConstant* c_left = HConstant::cast(left);
3931 HConstant* c_right = HConstant::cast(right); 3961 HConstant* c_right = HConstant::cast(right);
3932 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { 3962 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4344 break; 4374 break;
4345 case kExternalMemory: 4375 case kExternalMemory:
4346 stream->Add("[external-memory]"); 4376 stream->Add("[external-memory]");
4347 break; 4377 break;
4348 } 4378 }
4349 4379
4350 stream->Add("@%d", offset()); 4380 stream->Add("@%d", offset());
4351 } 4381 }
4352 4382
4353 } } // namespace v8::internal 4383 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698