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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 __ j(above, &non_proxy); | 1068 __ j(above, &non_proxy); |
1069 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1069 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
1070 __ bind(&non_proxy); | 1070 __ bind(&non_proxy); |
1071 __ push(ebx); // Smi | 1071 __ push(ebx); // Smi |
1072 __ push(eax); // Array | 1072 __ push(eax); // Array |
1073 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1073 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
1074 __ push(eax); // Fixed array length (as smi). | 1074 __ push(eax); // Fixed array length (as smi). |
1075 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1075 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1076 | 1076 |
1077 // Generate code for doing the condition check. | 1077 // Generate code for doing the condition check. |
1078 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | |
1079 __ bind(&loop); | 1078 __ bind(&loop); |
1080 SetExpressionAsStatementPosition(stmt->each()); | 1079 SetExpressionAsStatementPosition(stmt->each()); |
1081 | 1080 |
1082 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. | 1081 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. |
1083 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. | 1082 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. |
1084 __ j(above_equal, loop_statement.break_label()); | 1083 __ j(above_equal, loop_statement.break_label()); |
1085 | 1084 |
1086 // Get the current entry of the array into register ebx. | 1085 // Get the current entry of the array into register ebx. |
1087 __ mov(ebx, Operand(esp, 2 * kPointerSize)); | 1086 __ mov(ebx, Operand(esp, 2 * kPointerSize)); |
1088 __ mov(ebx, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize)); | 1087 __ mov(ebx, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize)); |
(...skipping 29 matching lines...) Expand all Loading... |
1118 // Update the 'each' property or variable from the possibly filtered | 1117 // Update the 'each' property or variable from the possibly filtered |
1119 // entry in register ebx. | 1118 // entry in register ebx. |
1120 __ bind(&update_each); | 1119 __ bind(&update_each); |
1121 __ mov(result_register(), ebx); | 1120 __ mov(result_register(), ebx); |
1122 // Perform the assignment as if via '='. | 1121 // Perform the assignment as if via '='. |
1123 { EffectContext context(this); | 1122 { EffectContext context(this); |
1124 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); | 1123 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |
1125 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); | 1124 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); |
1126 } | 1125 } |
1127 | 1126 |
| 1127 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). |
| 1128 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1128 // Generate code for the body of the loop. | 1129 // Generate code for the body of the loop. |
1129 Visit(stmt->body()); | 1130 Visit(stmt->body()); |
1130 | 1131 |
1131 // Generate code for going to the next element by incrementing the | 1132 // Generate code for going to the next element by incrementing the |
1132 // index (smi) stored on top of the stack. | 1133 // index (smi) stored on top of the stack. |
1133 __ bind(loop_statement.continue_label()); | 1134 __ bind(loop_statement.continue_label()); |
1134 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); | 1135 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); |
1135 | 1136 |
1136 EmitBackEdgeBookkeeping(stmt, &loop); | 1137 EmitBackEdgeBookkeeping(stmt, &loop); |
1137 __ jmp(&loop); | 1138 __ jmp(&loop); |
(...skipping 3922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5060 Assembler::target_address_at(call_target_address, | 5061 Assembler::target_address_at(call_target_address, |
5061 unoptimized_code)); | 5062 unoptimized_code)); |
5062 return OSR_AFTER_STACK_CHECK; | 5063 return OSR_AFTER_STACK_CHECK; |
5063 } | 5064 } |
5064 | 5065 |
5065 | 5066 |
5066 } // namespace internal | 5067 } // namespace internal |
5067 } // namespace v8 | 5068 } // namespace v8 |
5068 | 5069 |
5069 #endif // V8_TARGET_ARCH_IA32 | 5070 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |