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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 3026019: Fix bug in r5123, Comparison(), by unusing results before unconditional jump ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 5 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 | « src/x64/codegen-x64.h ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 break; 1194 break;
1195 } 1195 }
1196 if (answer_object == Heap::undefined_value()) { 1196 if (answer_object == Heap::undefined_value()) {
1197 return false; 1197 return false;
1198 } 1198 }
1199 frame_->Push(Handle<Object>(answer_object)); 1199 frame_->Push(Handle<Object>(answer_object));
1200 return true; 1200 return true;
1201 } 1201 }
1202 1202
1203 1203
1204 void CodeGenerator::JumpIfBothSmiUsingTypeInfo(Register left, 1204 void CodeGenerator::JumpIfBothSmiUsingTypeInfo(Result* left,
1205 Register right, 1205 Result* right,
1206 TypeInfo left_info,
1207 TypeInfo right_info,
1208 JumpTarget* both_smi) { 1206 JumpTarget* both_smi) {
1207 TypeInfo left_info = left->type_info();
1208 TypeInfo right_info = right->type_info();
1209 if (left_info.IsDouble() || left_info.IsString() || 1209 if (left_info.IsDouble() || left_info.IsString() ||
1210 right_info.IsDouble() || right_info.IsString()) { 1210 right_info.IsDouble() || right_info.IsString()) {
1211 // We know that left and right are not both smi. Don't do any tests. 1211 // We know that left and right are not both smi. Don't do any tests.
1212 return; 1212 return;
1213 } 1213 }
1214 1214
1215 if (left.is(right)) { 1215 if (left->reg().is(right->reg())) {
1216 if (!left_info.IsSmi()) { 1216 if (!left_info.IsSmi()) {
1217 Condition is_smi = masm()->CheckSmi(left); 1217 Condition is_smi = masm()->CheckSmi(left->reg());
1218 both_smi->Branch(is_smi); 1218 both_smi->Branch(is_smi);
1219 } else { 1219 } else {
1220 if (FLAG_debug_code) __ AbortIfNotSmi(left); 1220 if (FLAG_debug_code) __ AbortIfNotSmi(left->reg());
1221 left->Unuse();
1222 right->Unuse();
1221 both_smi->Jump(); 1223 both_smi->Jump();
1222 } 1224 }
1223 } else if (!left_info.IsSmi()) { 1225 } else if (!left_info.IsSmi()) {
1224 if (!right_info.IsSmi()) { 1226 if (!right_info.IsSmi()) {
1225 Condition is_smi = masm()->CheckBothSmi(left, right); 1227 Condition is_smi = masm()->CheckBothSmi(left->reg(), right->reg());
1226 both_smi->Branch(is_smi); 1228 both_smi->Branch(is_smi);
1227 } else { 1229 } else {
1228 Condition is_smi = masm()->CheckSmi(left); 1230 Condition is_smi = masm()->CheckSmi(left->reg());
1229 both_smi->Branch(is_smi); 1231 both_smi->Branch(is_smi);
1230 } 1232 }
1231 } else { 1233 } else {
1232 if (FLAG_debug_code) __ AbortIfNotSmi(left); 1234 if (FLAG_debug_code) __ AbortIfNotSmi(left->reg());
1233 if (!right_info.IsSmi()) { 1235 if (!right_info.IsSmi()) {
1234 Condition is_smi = masm()->CheckSmi(right); 1236 Condition is_smi = masm()->CheckSmi(right->reg());
1235 both_smi->Branch(is_smi); 1237 both_smi->Branch(is_smi);
1236 } else { 1238 } else {
1237 if (FLAG_debug_code) __ AbortIfNotSmi(right); 1239 if (FLAG_debug_code) __ AbortIfNotSmi(right->reg());
1240 left->Unuse();
1241 right->Unuse();
1238 both_smi->Jump(); 1242 both_smi->Jump();
1239 } 1243 }
1240 } 1244 }
1241 } 1245 }
1242 1246
1243 1247
1244 void CodeGenerator::JumpIfNotSmiUsingTypeInfo(Register reg, 1248 void CodeGenerator::JumpIfNotSmiUsingTypeInfo(Register reg,
1245 TypeInfo type, 1249 TypeInfo type,
1246 DeferredCode* deferred) { 1250 DeferredCode* deferred) {
1247 if (!type.IsSmi()) { 1251 if (!type.IsSmi()) {
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 // Here we split control flow to the stub call and inlined cases 2280 // Here we split control flow to the stub call and inlined cases
2277 // before finally splitting it to the control destination. We use 2281 // before finally splitting it to the control destination. We use
2278 // a jump target and branching to duplicate the virtual frame at 2282 // a jump target and branching to duplicate the virtual frame at
2279 // the first split. We manually handle the off-frame references 2283 // the first split. We manually handle the off-frame references
2280 // by reconstituting them on the non-fall-through path. 2284 // by reconstituting them on the non-fall-through path.
2281 JumpTarget is_smi; 2285 JumpTarget is_smi;
2282 Register left_reg = left_side.reg(); 2286 Register left_reg = left_side.reg();
2283 Register right_reg = right_side.reg(); 2287 Register right_reg = right_side.reg();
2284 2288
2285 // In-line check for comparing two smis. 2289 // In-line check for comparing two smis.
2286 JumpIfBothSmiUsingTypeInfo(left_side.reg(), right_side.reg(), 2290 JumpIfBothSmiUsingTypeInfo(&left_side, &right_side, &is_smi);
2287 left_side.type_info(), right_side.type_info(),
2288 &is_smi);
2289 2291
2290 if (has_valid_frame()) { 2292 if (has_valid_frame()) {
2291 // Inline the equality check if both operands can't be a NaN. If both 2293 // Inline the equality check if both operands can't be a NaN. If both
2292 // objects are the same they are equal. 2294 // objects are the same they are equal.
2293 if (nan_info == kCantBothBeNaN && cc == equal) { 2295 if (nan_info == kCantBothBeNaN && cc == equal) {
2294 __ cmpq(left_side.reg(), right_side.reg()); 2296 __ cmpq(left_side.reg(), right_side.reg());
2295 dest->true_target()->Branch(equal); 2297 dest->true_target()->Branch(equal);
2296 } 2298 }
2297 2299
2298 // Inlined number comparison: 2300 // Inlined number comparison:
(...skipping 10176 matching lines...) Expand 10 before | Expand all | Expand 10 after
12475 #undef __ 12477 #undef __
12476 12478
12477 void RecordWriteStub::Generate(MacroAssembler* masm) { 12479 void RecordWriteStub::Generate(MacroAssembler* masm) {
12478 masm->RecordWriteHelper(object_, addr_, scratch_); 12480 masm->RecordWriteHelper(object_, addr_, scratch_);
12479 masm->ret(0); 12481 masm->ret(0);
12480 } 12482 }
12481 12483
12482 } } // namespace v8::internal 12484 } } // namespace v8::internal
12483 12485
12484 #endif // V8_TARGET_ARCH_X64 12486 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698