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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 Comment cmnt(masm_, "[ ForInStatement"); | 1104 Comment cmnt(masm_, "[ ForInStatement"); |
1105 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); | 1105 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
1106 SetStatementPosition(stmt); | 1106 SetStatementPosition(stmt); |
1107 | 1107 |
1108 Label loop, exit; | 1108 Label loop, exit; |
1109 ForIn loop_statement(this, stmt); | 1109 ForIn loop_statement(this, stmt); |
1110 increment_loop_depth(); | 1110 increment_loop_depth(); |
1111 | 1111 |
1112 // Get the object to enumerate over. If the object is null or undefined, skip | 1112 // Get the object to enumerate over. If the object is null or undefined, skip |
1113 // over the loop. See ECMA-262 version 5, section 12.6.4. | 1113 // over the loop. See ECMA-262 version 5, section 12.6.4. |
| 1114 SetExpressionPosition(stmt->enumerable()); |
1114 VisitForAccumulatorValue(stmt->enumerable()); | 1115 VisitForAccumulatorValue(stmt->enumerable()); |
1115 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 1116 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
1116 __ cmp(r0, ip); | 1117 __ cmp(r0, ip); |
1117 __ b(eq, &exit); | 1118 __ b(eq, &exit); |
1118 Register null_value = r5; | 1119 Register null_value = r5; |
1119 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 1120 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
1120 __ cmp(r0, null_value); | 1121 __ cmp(r0, null_value); |
1121 __ b(eq, &exit); | 1122 __ b(eq, &exit); |
1122 | 1123 |
1123 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1124 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1208 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1208 __ bind(&non_proxy); | 1209 __ bind(&non_proxy); |
1209 __ Push(r1, r0); // Smi and array | 1210 __ Push(r1, r0); // Smi and array |
1210 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 1211 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
1211 __ mov(r0, Operand(Smi::FromInt(0))); | 1212 __ mov(r0, Operand(Smi::FromInt(0))); |
1212 __ Push(r1, r0); // Fixed array length (as smi) and initial index. | 1213 __ Push(r1, r0); // Fixed array length (as smi) and initial index. |
1213 | 1214 |
1214 // Generate code for doing the condition check. | 1215 // Generate code for doing the condition check. |
1215 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1216 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1216 __ bind(&loop); | 1217 __ bind(&loop); |
| 1218 SetExpressionPosition(stmt->each()); |
| 1219 |
1217 // Load the current count to r0, load the length to r1. | 1220 // Load the current count to r0, load the length to r1. |
1218 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); | 1221 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); |
1219 __ cmp(r0, r1); // Compare to the array length. | 1222 __ cmp(r0, r1); // Compare to the array length. |
1220 __ b(hs, loop_statement.break_label()); | 1223 __ b(hs, loop_statement.break_label()); |
1221 | 1224 |
1222 // Get the current entry of the array into register r3. | 1225 // Get the current entry of the array into register r3. |
1223 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); | 1226 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); |
1224 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1227 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
1225 __ ldr(r3, MemOperand::PointerAddressFromSmiKey(r2, r0)); | 1228 __ ldr(r3, MemOperand::PointerAddressFromSmiKey(r2, r0)); |
1226 | 1229 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 __ bind(loop_statement.break_label()); | 1279 __ bind(loop_statement.break_label()); |
1277 __ Drop(5); | 1280 __ Drop(5); |
1278 | 1281 |
1279 // Exit and decrement the loop depth. | 1282 // Exit and decrement the loop depth. |
1280 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1283 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1281 __ bind(&exit); | 1284 __ bind(&exit); |
1282 decrement_loop_depth(); | 1285 decrement_loop_depth(); |
1283 } | 1286 } |
1284 | 1287 |
1285 | 1288 |
1286 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { | |
1287 Comment cmnt(masm_, "[ ForOfStatement"); | |
1288 SetStatementPosition(stmt); | |
1289 | |
1290 Iteration loop_statement(this, stmt); | |
1291 increment_loop_depth(); | |
1292 | |
1293 // var iterator = iterable[Symbol.iterator](); | |
1294 VisitForEffect(stmt->assign_iterator()); | |
1295 | |
1296 // Loop entry. | |
1297 __ bind(loop_statement.continue_label()); | |
1298 | |
1299 // result = iterator.next() | |
1300 VisitForEffect(stmt->next_result()); | |
1301 | |
1302 // if (result.done) break; | |
1303 Label result_not_done; | |
1304 VisitForControl(stmt->result_done(), | |
1305 loop_statement.break_label(), | |
1306 &result_not_done, | |
1307 &result_not_done); | |
1308 __ bind(&result_not_done); | |
1309 | |
1310 // each = result.value | |
1311 VisitForEffect(stmt->assign_each()); | |
1312 | |
1313 // Generate code for the body of the loop. | |
1314 Visit(stmt->body()); | |
1315 | |
1316 // Check stack before looping. | |
1317 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); | |
1318 EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label()); | |
1319 __ jmp(loop_statement.continue_label()); | |
1320 | |
1321 // Exit and decrement the loop depth. | |
1322 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | |
1323 __ bind(loop_statement.break_label()); | |
1324 decrement_loop_depth(); | |
1325 } | |
1326 | |
1327 | |
1328 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1289 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1329 bool pretenure) { | 1290 bool pretenure) { |
1330 // Use the fast case closure allocation code that allocates in new | 1291 // Use the fast case closure allocation code that allocates in new |
1331 // space for nested functions that don't need literals cloning. If | 1292 // space for nested functions that don't need literals cloning. If |
1332 // we're running with the --always-opt or the --prepare-always-opt | 1293 // we're running with the --always-opt or the --prepare-always-opt |
1333 // flag, we need to use the runtime function so that the new function | 1294 // flag, we need to use the runtime function so that the new function |
1334 // we are creating here gets a chance to have its code optimized and | 1295 // we are creating here gets a chance to have its code optimized and |
1335 // doesn't just get a copy of the existing unoptimized code. | 1296 // doesn't just get a copy of the existing unoptimized code. |
1336 if (!FLAG_always_opt && | 1297 if (!FLAG_always_opt && |
1337 !FLAG_prepare_always_opt && | 1298 !FLAG_prepare_always_opt && |
(...skipping 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5341 | 5302 |
5342 DCHECK(interrupt_address == | 5303 DCHECK(interrupt_address == |
5343 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5304 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5344 return OSR_AFTER_STACK_CHECK; | 5305 return OSR_AFTER_STACK_CHECK; |
5345 } | 5306 } |
5346 | 5307 |
5347 | 5308 |
5348 } } // namespace v8::internal | 5309 } } // namespace v8::internal |
5349 | 5310 |
5350 #endif // V8_TARGET_ARCH_ARM | 5311 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |