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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 __ j(above, &non_proxy); | 1060 __ j(above, &non_proxy); |
1061 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1061 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
1062 __ bind(&non_proxy); | 1062 __ bind(&non_proxy); |
1063 __ push(ebx); // Smi | 1063 __ push(ebx); // Smi |
1064 __ push(eax); // Array | 1064 __ push(eax); // Array |
1065 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1065 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
1066 __ push(eax); // Fixed array length (as smi). | 1066 __ push(eax); // Fixed array length (as smi). |
1067 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1067 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1068 | 1068 |
1069 // Generate code for doing the condition check. | 1069 // Generate code for doing the condition check. |
1070 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | |
1071 __ bind(&loop); | 1070 __ bind(&loop); |
1072 SetExpressionAsStatementPosition(stmt->each()); | 1071 SetExpressionAsStatementPosition(stmt->each()); |
1073 | 1072 |
1074 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. | 1073 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. |
1075 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. | 1074 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. |
1076 __ j(above_equal, loop_statement.break_label()); | 1075 __ j(above_equal, loop_statement.break_label()); |
1077 | 1076 |
1078 // Get the current entry of the array into register ebx. | 1077 // Get the current entry of the array into register ebx. |
1079 __ mov(ebx, Operand(esp, 2 * kPointerSize)); | 1078 __ mov(ebx, Operand(esp, 2 * kPointerSize)); |
1080 __ mov(ebx, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize)); | 1079 __ mov(ebx, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize)); |
(...skipping 29 matching lines...) Expand all Loading... |
1110 // Update the 'each' property or variable from the possibly filtered | 1109 // Update the 'each' property or variable from the possibly filtered |
1111 // entry in register ebx. | 1110 // entry in register ebx. |
1112 __ bind(&update_each); | 1111 __ bind(&update_each); |
1113 __ mov(result_register(), ebx); | 1112 __ mov(result_register(), ebx); |
1114 // Perform the assignment as if via '='. | 1113 // Perform the assignment as if via '='. |
1115 { EffectContext context(this); | 1114 { EffectContext context(this); |
1116 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); | 1115 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |
1117 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); | 1116 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); |
1118 } | 1117 } |
1119 | 1118 |
| 1119 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). |
| 1120 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1120 // Generate code for the body of the loop. | 1121 // Generate code for the body of the loop. |
1121 Visit(stmt->body()); | 1122 Visit(stmt->body()); |
1122 | 1123 |
1123 // Generate code for going to the next element by incrementing the | 1124 // Generate code for going to the next element by incrementing the |
1124 // index (smi) stored on top of the stack. | 1125 // index (smi) stored on top of the stack. |
1125 __ bind(loop_statement.continue_label()); | 1126 __ bind(loop_statement.continue_label()); |
1126 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); | 1127 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); |
1127 | 1128 |
1128 EmitBackEdgeBookkeeping(stmt, &loop); | 1129 EmitBackEdgeBookkeeping(stmt, &loop); |
1129 __ jmp(&loop); | 1130 __ jmp(&loop); |
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5053 Assembler::target_address_at(call_target_address, | 5054 Assembler::target_address_at(call_target_address, |
5054 unoptimized_code)); | 5055 unoptimized_code)); |
5055 return OSR_AFTER_STACK_CHECK; | 5056 return OSR_AFTER_STACK_CHECK; |
5056 } | 5057 } |
5057 | 5058 |
5058 | 5059 |
5059 } // namespace internal | 5060 } // namespace internal |
5060 } // namespace v8 | 5061 } // namespace v8 |
5061 | 5062 |
5062 #endif // V8_TARGET_ARCH_X87 | 5063 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |