| OLD | NEW |
| 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 __ j(above, &non_proxy); | 1090 __ j(above, &non_proxy); |
| 1091 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy | 1091 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy |
| 1092 __ bind(&non_proxy); | 1092 __ bind(&non_proxy); |
| 1093 __ Push(rbx); // Smi | 1093 __ Push(rbx); // Smi |
| 1094 __ Push(rax); // Array | 1094 __ Push(rax); // Array |
| 1095 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); | 1095 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); |
| 1096 __ Push(rax); // Fixed array length (as smi). | 1096 __ Push(rax); // Fixed array length (as smi). |
| 1097 __ Push(Smi::FromInt(0)); // Initial index. | 1097 __ Push(Smi::FromInt(0)); // Initial index. |
| 1098 | 1098 |
| 1099 // Generate code for doing the condition check. | 1099 // Generate code for doing the condition check. |
| 1100 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | |
| 1101 __ bind(&loop); | 1100 __ bind(&loop); |
| 1102 SetExpressionAsStatementPosition(stmt->each()); | 1101 SetExpressionAsStatementPosition(stmt->each()); |
| 1103 | 1102 |
| 1104 __ movp(rax, Operand(rsp, 0 * kPointerSize)); // Get the current index. | 1103 __ movp(rax, Operand(rsp, 0 * kPointerSize)); // Get the current index. |
| 1105 __ cmpp(rax, Operand(rsp, 1 * kPointerSize)); // Compare to the array length. | 1104 __ cmpp(rax, Operand(rsp, 1 * kPointerSize)); // Compare to the array length. |
| 1106 __ j(above_equal, loop_statement.break_label()); | 1105 __ j(above_equal, loop_statement.break_label()); |
| 1107 | 1106 |
| 1108 // Get the current entry of the array into register rbx. | 1107 // Get the current entry of the array into register rbx. |
| 1109 __ movp(rbx, Operand(rsp, 2 * kPointerSize)); | 1108 __ movp(rbx, Operand(rsp, 2 * kPointerSize)); |
| 1110 SmiIndex index = masm()->SmiToIndex(rax, rax, kPointerSizeLog2); | 1109 SmiIndex index = masm()->SmiToIndex(rax, rax, kPointerSizeLog2); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 // Update the 'each' property or variable from the possibly filtered | 1142 // Update the 'each' property or variable from the possibly filtered |
| 1144 // entry in register rbx. | 1143 // entry in register rbx. |
| 1145 __ bind(&update_each); | 1144 __ bind(&update_each); |
| 1146 __ movp(result_register(), rbx); | 1145 __ movp(result_register(), rbx); |
| 1147 // Perform the assignment as if via '='. | 1146 // Perform the assignment as if via '='. |
| 1148 { EffectContext context(this); | 1147 { EffectContext context(this); |
| 1149 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); | 1148 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |
| 1150 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); | 1149 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); |
| 1151 } | 1150 } |
| 1152 | 1151 |
| 1152 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). |
| 1153 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
| 1153 // Generate code for the body of the loop. | 1154 // Generate code for the body of the loop. |
| 1154 Visit(stmt->body()); | 1155 Visit(stmt->body()); |
| 1155 | 1156 |
| 1156 // Generate code for going to the next element by incrementing the | 1157 // Generate code for going to the next element by incrementing the |
| 1157 // index (smi) stored on top of the stack. | 1158 // index (smi) stored on top of the stack. |
| 1158 __ bind(loop_statement.continue_label()); | 1159 __ bind(loop_statement.continue_label()); |
| 1159 __ SmiAddConstant(Operand(rsp, 0 * kPointerSize), Smi::FromInt(1)); | 1160 __ SmiAddConstant(Operand(rsp, 0 * kPointerSize), Smi::FromInt(1)); |
| 1160 | 1161 |
| 1161 EmitBackEdgeBookkeeping(stmt, &loop); | 1162 EmitBackEdgeBookkeeping(stmt, &loop); |
| 1162 __ jmp(&loop); | 1163 __ jmp(&loop); |
| (...skipping 3913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5076 Assembler::target_address_at(call_target_address, | 5077 Assembler::target_address_at(call_target_address, |
| 5077 unoptimized_code)); | 5078 unoptimized_code)); |
| 5078 return OSR_AFTER_STACK_CHECK; | 5079 return OSR_AFTER_STACK_CHECK; |
| 5079 } | 5080 } |
| 5080 | 5081 |
| 5081 | 5082 |
| 5082 } // namespace internal | 5083 } // namespace internal |
| 5083 } // namespace v8 | 5084 } // namespace v8 |
| 5084 | 5085 |
| 5085 #endif // V8_TARGET_ARCH_X64 | 5086 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |