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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 Comment cmnt(masm_, "[ ForInStatement"); | 1090 Comment cmnt(masm_, "[ ForInStatement"); |
1091 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); | 1091 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
1092 SetStatementPosition(stmt); | 1092 SetStatementPosition(stmt); |
1093 | 1093 |
1094 Label loop, exit; | 1094 Label loop, exit; |
1095 ForIn loop_statement(this, stmt); | 1095 ForIn loop_statement(this, stmt); |
1096 increment_loop_depth(); | 1096 increment_loop_depth(); |
1097 | 1097 |
1098 // Get the object to enumerate over. If the object is null or undefined, skip | 1098 // Get the object to enumerate over. If the object is null or undefined, skip |
1099 // over the loop. See ECMA-262 version 5, section 12.6.4. | 1099 // over the loop. See ECMA-262 version 5, section 12.6.4. |
| 1100 SetExpressionPosition(stmt->enumerable()); |
1100 VisitForAccumulatorValue(stmt->enumerable()); | 1101 VisitForAccumulatorValue(stmt->enumerable()); |
1101 __ mov(a0, result_register()); // Result as param to InvokeBuiltin below. | 1102 __ mov(a0, result_register()); // Result as param to InvokeBuiltin below. |
1102 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 1103 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
1103 __ Branch(&exit, eq, a0, Operand(at)); | 1104 __ Branch(&exit, eq, a0, Operand(at)); |
1104 Register null_value = a5; | 1105 Register null_value = a5; |
1105 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 1106 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
1106 __ Branch(&exit, eq, a0, Operand(null_value)); | 1107 __ Branch(&exit, eq, a0, Operand(null_value)); |
1107 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1108 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); |
1108 __ mov(a0, v0); | 1109 __ mov(a0, v0); |
1109 // Convert the object to a JS object. | 1110 // Convert the object to a JS object. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1190 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1190 __ bind(&non_proxy); | 1191 __ bind(&non_proxy); |
1191 __ Push(a1, v0); // Smi and array | 1192 __ Push(a1, v0); // Smi and array |
1192 __ ld(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 1193 __ ld(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
1193 __ li(a0, Operand(Smi::FromInt(0))); | 1194 __ li(a0, Operand(Smi::FromInt(0))); |
1194 __ Push(a1, a0); // Fixed array length (as smi) and initial index. | 1195 __ Push(a1, a0); // Fixed array length (as smi) and initial index. |
1195 | 1196 |
1196 // Generate code for doing the condition check. | 1197 // Generate code for doing the condition check. |
1197 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1198 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1198 __ bind(&loop); | 1199 __ bind(&loop); |
| 1200 SetExpressionPosition(stmt->each()); |
| 1201 |
1199 // Load the current count to a0, load the length to a1. | 1202 // Load the current count to a0, load the length to a1. |
1200 __ ld(a0, MemOperand(sp, 0 * kPointerSize)); | 1203 __ ld(a0, MemOperand(sp, 0 * kPointerSize)); |
1201 __ ld(a1, MemOperand(sp, 1 * kPointerSize)); | 1204 __ ld(a1, MemOperand(sp, 1 * kPointerSize)); |
1202 __ Branch(loop_statement.break_label(), hs, a0, Operand(a1)); | 1205 __ Branch(loop_statement.break_label(), hs, a0, Operand(a1)); |
1203 | 1206 |
1204 // Get the current entry of the array into register a3. | 1207 // Get the current entry of the array into register a3. |
1205 __ ld(a2, MemOperand(sp, 2 * kPointerSize)); | 1208 __ ld(a2, MemOperand(sp, 2 * kPointerSize)); |
1206 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1209 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
1207 __ SmiScale(a4, a0, kPointerSizeLog2); | 1210 __ SmiScale(a4, a0, kPointerSizeLog2); |
1208 __ daddu(a4, a2, a4); // Array base + scaled (smi) index. | 1211 __ daddu(a4, a2, a4); // Array base + scaled (smi) index. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 __ bind(loop_statement.break_label()); | 1261 __ bind(loop_statement.break_label()); |
1259 __ Drop(5); | 1262 __ Drop(5); |
1260 | 1263 |
1261 // Exit and decrement the loop depth. | 1264 // Exit and decrement the loop depth. |
1262 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1265 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1263 __ bind(&exit); | 1266 __ bind(&exit); |
1264 decrement_loop_depth(); | 1267 decrement_loop_depth(); |
1265 } | 1268 } |
1266 | 1269 |
1267 | 1270 |
1268 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { | |
1269 Comment cmnt(masm_, "[ ForOfStatement"); | |
1270 SetStatementPosition(stmt); | |
1271 | |
1272 Iteration loop_statement(this, stmt); | |
1273 increment_loop_depth(); | |
1274 | |
1275 // var iterator = iterable[Symbol.iterator](); | |
1276 VisitForEffect(stmt->assign_iterator()); | |
1277 | |
1278 // Loop entry. | |
1279 __ bind(loop_statement.continue_label()); | |
1280 | |
1281 // result = iterator.next() | |
1282 VisitForEffect(stmt->next_result()); | |
1283 | |
1284 // if (result.done) break; | |
1285 Label result_not_done; | |
1286 VisitForControl(stmt->result_done(), | |
1287 loop_statement.break_label(), | |
1288 &result_not_done, | |
1289 &result_not_done); | |
1290 __ bind(&result_not_done); | |
1291 | |
1292 // each = result.value | |
1293 VisitForEffect(stmt->assign_each()); | |
1294 | |
1295 // Generate code for the body of the loop. | |
1296 Visit(stmt->body()); | |
1297 | |
1298 // Check stack before looping. | |
1299 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); | |
1300 EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label()); | |
1301 __ jmp(loop_statement.continue_label()); | |
1302 | |
1303 // Exit and decrement the loop depth. | |
1304 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | |
1305 __ bind(loop_statement.break_label()); | |
1306 decrement_loop_depth(); | |
1307 } | |
1308 | |
1309 | |
1310 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1271 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1311 bool pretenure) { | 1272 bool pretenure) { |
1312 // Use the fast case closure allocation code that allocates in new | 1273 // Use the fast case closure allocation code that allocates in new |
1313 // space for nested functions that don't need literals cloning. If | 1274 // space for nested functions that don't need literals cloning. If |
1314 // we're running with the --always-opt or the --prepare-always-opt | 1275 // we're running with the --always-opt or the --prepare-always-opt |
1315 // flag, we need to use the runtime function so that the new function | 1276 // flag, we need to use the runtime function so that the new function |
1316 // we are creating here gets a chance to have its code optimized and | 1277 // we are creating here gets a chance to have its code optimized and |
1317 // doesn't just get a copy of the existing unoptimized code. | 1278 // doesn't just get a copy of the existing unoptimized code. |
1318 if (!FLAG_always_opt && | 1279 if (!FLAG_always_opt && |
1319 !FLAG_prepare_always_opt && | 1280 !FLAG_prepare_always_opt && |
(...skipping 3963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5283 Assembler::target_address_at(pc_immediate_load_address)) == | 5244 Assembler::target_address_at(pc_immediate_load_address)) == |
5284 reinterpret_cast<uint64_t>( | 5245 reinterpret_cast<uint64_t>( |
5285 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5246 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5286 return OSR_AFTER_STACK_CHECK; | 5247 return OSR_AFTER_STACK_CHECK; |
5287 } | 5248 } |
5288 | 5249 |
5289 | 5250 |
5290 } } // namespace v8::internal | 5251 } } // namespace v8::internal |
5291 | 5252 |
5292 #endif // V8_TARGET_ARCH_MIPS64 | 5253 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |