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()); | |
1101 VisitForAccumulatorValue(stmt->enumerable()); | 1100 VisitForAccumulatorValue(stmt->enumerable()); |
1102 __ mov(a0, result_register()); // Result as param to InvokeBuiltin below. | 1101 __ mov(a0, result_register()); // Result as param to InvokeBuiltin below. |
1103 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 1102 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
1104 __ Branch(&exit, eq, a0, Operand(at)); | 1103 __ Branch(&exit, eq, a0, Operand(at)); |
1105 Register null_value = a5; | 1104 Register null_value = a5; |
1106 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 1105 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
1107 __ Branch(&exit, eq, a0, Operand(null_value)); | 1106 __ Branch(&exit, eq, a0, Operand(null_value)); |
1108 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1107 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); |
1109 __ mov(a0, v0); | 1108 __ mov(a0, v0); |
1110 // Convert the object to a JS object. | 1109 // Convert the object to a JS object. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); | 1231 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); |
1233 __ mov(a3, result_register()); | 1232 __ mov(a3, result_register()); |
1234 __ Branch(loop_statement.continue_label(), eq, a3, Operand(zero_reg)); | 1233 __ Branch(loop_statement.continue_label(), eq, a3, Operand(zero_reg)); |
1235 | 1234 |
1236 // Update the 'each' property or variable from the possibly filtered | 1235 // Update the 'each' property or variable from the possibly filtered |
1237 // entry in register a3. | 1236 // entry in register a3. |
1238 __ bind(&update_each); | 1237 __ bind(&update_each); |
1239 __ mov(result_register(), a3); | 1238 __ mov(result_register(), a3); |
1240 // Perform the assignment as if via '='. | 1239 // Perform the assignment as if via '='. |
1241 { EffectContext context(this); | 1240 { EffectContext context(this); |
1242 SetExpressionPosition(stmt->each()); | |
1243 EmitAssignment(stmt->each()); | 1241 EmitAssignment(stmt->each()); |
1244 } | 1242 } |
1245 | 1243 |
1246 // Generate code for the body of the loop. | 1244 // Generate code for the body of the loop. |
1247 Visit(stmt->body()); | 1245 Visit(stmt->body()); |
1248 | 1246 |
1249 // Generate code for the going to the next element by incrementing | 1247 // Generate code for the going to the next element by incrementing |
1250 // the index (smi) stored on top of the stack. | 1248 // the index (smi) stored on top of the stack. |
1251 __ bind(loop_statement.continue_label()); | 1249 __ bind(loop_statement.continue_label()); |
1252 __ pop(a0); | 1250 __ pop(a0); |
1253 __ Daddu(a0, a0, Operand(Smi::FromInt(1))); | 1251 __ Daddu(a0, a0, Operand(Smi::FromInt(1))); |
1254 __ push(a0); | 1252 __ push(a0); |
1255 | 1253 |
1256 EmitBackEdgeBookkeeping(stmt, &loop); | 1254 EmitBackEdgeBookkeeping(stmt, &loop); |
1257 __ Branch(&loop); | 1255 __ Branch(&loop); |
1258 | 1256 |
1259 // Remove the pointers stored on the stack. | 1257 // Remove the pointers stored on the stack. |
1260 __ bind(loop_statement.break_label()); | 1258 __ bind(loop_statement.break_label()); |
1261 __ Drop(5); | 1259 __ Drop(5); |
1262 | 1260 |
1263 // Exit and decrement the loop depth. | 1261 // Exit and decrement the loop depth. |
1264 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1262 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1265 __ bind(&exit); | 1263 __ bind(&exit); |
1266 decrement_loop_depth(); | 1264 decrement_loop_depth(); |
1267 } | 1265 } |
1268 | 1266 |
1269 | 1267 |
| 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 |
1270 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1310 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1271 bool pretenure) { | 1311 bool pretenure) { |
1272 // Use the fast case closure allocation code that allocates in new | 1312 // Use the fast case closure allocation code that allocates in new |
1273 // space for nested functions that don't need literals cloning. If | 1313 // space for nested functions that don't need literals cloning. If |
1274 // we're running with the --always-opt or the --prepare-always-opt | 1314 // we're running with the --always-opt or the --prepare-always-opt |
1275 // flag, we need to use the runtime function so that the new function | 1315 // flag, we need to use the runtime function so that the new function |
1276 // we are creating here gets a chance to have its code optimized and | 1316 // we are creating here gets a chance to have its code optimized and |
1277 // doesn't just get a copy of the existing unoptimized code. | 1317 // doesn't just get a copy of the existing unoptimized code. |
1278 if (!FLAG_always_opt && | 1318 if (!FLAG_always_opt && |
1279 !FLAG_prepare_always_opt && | 1319 !FLAG_prepare_always_opt && |
(...skipping 3963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5243 Assembler::target_address_at(pc_immediate_load_address)) == | 5283 Assembler::target_address_at(pc_immediate_load_address)) == |
5244 reinterpret_cast<uint64_t>( | 5284 reinterpret_cast<uint64_t>( |
5245 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5285 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5246 return OSR_AFTER_STACK_CHECK; | 5286 return OSR_AFTER_STACK_CHECK; |
5247 } | 5287 } |
5248 | 5288 |
5249 | 5289 |
5250 } } // namespace v8::internal | 5290 } } // namespace v8::internal |
5251 | 5291 |
5252 #endif // V8_TARGET_ARCH_MIPS64 | 5292 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |