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

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

Issue 155213: X64: Fix bug in for-in iteration. (Closed)
Patch Set: Created 11 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
« no previous file with comments | « no previous file | 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 // rax: map (result from call to Runtime::kGetPropertyNamesFast) 1260 // rax: map (result from call to Runtime::kGetPropertyNamesFast)
1261 __ movq(rcx, rax); 1261 __ movq(rcx, rax);
1262 __ movq(rcx, FieldOperand(rcx, Map::kInstanceDescriptorsOffset)); 1262 __ movq(rcx, FieldOperand(rcx, Map::kInstanceDescriptorsOffset));
1263 // Get the bridge array held in the enumeration index field. 1263 // Get the bridge array held in the enumeration index field.
1264 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumerationIndexOffset)); 1264 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumerationIndexOffset));
1265 // Get the cache from the bridge array. 1265 // Get the cache from the bridge array.
1266 __ movq(rdx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); 1266 __ movq(rdx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset));
1267 1267
1268 frame_->EmitPush(rax); // <- slot 3 1268 frame_->EmitPush(rax); // <- slot 3
1269 frame_->EmitPush(rdx); // <- slot 2 1269 frame_->EmitPush(rdx); // <- slot 2
1270 __ movq(rax, FieldOperand(rdx, FixedArray::kLengthOffset)); 1270 __ movsxlq(rax, FieldOperand(rdx, FixedArray::kLengthOffset));
1271 __ shl(rax, Immediate(kSmiTagSize)); 1271 __ shl(rax, Immediate(kSmiTagSize));
1272 frame_->EmitPush(rax); // <- slot 1 1272 frame_->EmitPush(rax); // <- slot 1
1273 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0 1273 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0
1274 entry.Jump(); 1274 entry.Jump();
1275 1275
1276 fixed_array.Bind(); 1276 fixed_array.Bind();
1277 // rax: fixed array (result from call to Runtime::kGetPropertyNamesFast) 1277 // rax: fixed array (result from call to Runtime::kGetPropertyNamesFast)
1278 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 3 1278 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 3
1279 frame_->EmitPush(rax); // <- slot 2 1279 frame_->EmitPush(rax); // <- slot 2
1280 1280
1281 // Push the length of the array and the initial index onto the stack. 1281 // Push the length of the array and the initial index onto the stack.
1282 __ movq(rax, FieldOperand(rax, FixedArray::kLengthOffset)); 1282 __ movsxlq(rax, FieldOperand(rax, FixedArray::kLengthOffset));
1283 __ shl(rax, Immediate(kSmiTagSize)); 1283 __ shl(rax, Immediate(kSmiTagSize));
1284 frame_->EmitPush(rax); // <- slot 1 1284 frame_->EmitPush(rax); // <- slot 1
1285 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0 1285 frame_->EmitPush(Immediate(Smi::FromInt(0))); // <- slot 0
1286 1286
1287 // Condition. 1287 // Condition.
1288 entry.Bind(); 1288 entry.Bind();
1289 // Grab the current frame's height for the break and continue 1289 // Grab the current frame's height for the break and continue
1290 // targets only after all the state is pushed on the frame. 1290 // targets only after all the state is pushed on the frame.
1291 node->break_target()->set_direction(JumpTarget::FORWARD_ONLY); 1291 node->break_target()->set_direction(JumpTarget::FORWARD_ONLY);
1292 node->continue_target()->set_direction(JumpTarget::FORWARD_ONLY); 1292 node->continue_target()->set_direction(JumpTarget::FORWARD_ONLY);
1293 1293
1294 __ movq(rax, frame_->ElementAt(0)); // load the current count 1294 __ movq(rax, frame_->ElementAt(0)); // load the current count
1295 __ cmpq(rax, frame_->ElementAt(1)); // compare to the array length 1295 __ cmpq(rax, frame_->ElementAt(1)); // compare to the array length
1296 node->break_target()->Branch(above_equal); 1296 node->break_target()->Branch(above_equal);
1297 1297
1298 // Get the i'th entry of the array. 1298 // Get the i'th entry of the array.
1299 __ movq(rdx, frame_->ElementAt(2)); 1299 __ movq(rdx, frame_->ElementAt(2));
1300 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 1300 ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
1301 // Multiplier is times_4 since rax is already a Smi. 1301 // Multiplier is times_4 since rax is already a Smi.
1302 __ movq(rbx, Operand(rdx, rax, times_4, 1302 __ movq(rbx, FieldOperand(rdx, rax, times_4,
1303 FixedArray::kHeaderSize - kHeapObjectTag)); 1303 FixedArray::kHeaderSize));
1304 1304
1305 // Get the expected map from the stack or a zero map in the 1305 // Get the expected map from the stack or a zero map in the
1306 // permanent slow case rax: current iteration count rbx: i'th entry 1306 // permanent slow case rax: current iteration count rbx: i'th entry
1307 // of the enum cache 1307 // of the enum cache
1308 __ movq(rdx, frame_->ElementAt(3)); 1308 __ movq(rdx, frame_->ElementAt(3));
1309 // Check if the expected map still matches that of the enumerable. 1309 // Check if the expected map still matches that of the enumerable.
1310 // If not, we have to filter the key. 1310 // If not, we have to filter the key.
1311 // rax: current iteration count 1311 // rax: current iteration count
1312 // rbx: i'th entry of the enum cache 1312 // rbx: i'th entry of the enum cache
1313 // rdx: expected map value 1313 // rdx: expected map value
(...skipping 5653 matching lines...) Expand 10 before | Expand all | Expand 10 after
6967 int CompareStub::MinorKey() { 6967 int CompareStub::MinorKey() {
6968 // Encode the two parameters in a unique 16 bit value. 6968 // Encode the two parameters in a unique 16 bit value.
6969 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 6969 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
6970 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 6970 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
6971 } 6971 }
6972 6972
6973 6973
6974 #undef __ 6974 #undef __
6975 6975
6976 } } // namespace v8::internal 6976 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698