OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 void FullCodeGenerator::RecordTypeFeedbackCell( | 467 void FullCodeGenerator::RecordTypeFeedbackCell( |
468 TypeFeedbackId id, Handle<JSGlobalPropertyCell> cell) { | 468 TypeFeedbackId id, Handle<JSGlobalPropertyCell> cell) { |
469 TypeFeedbackCellEntry entry = { id, cell }; | 469 TypeFeedbackCellEntry entry = { id, cell }; |
470 type_feedback_cells_.Add(entry, zone()); | 470 type_feedback_cells_.Add(entry, zone()); |
471 } | 471 } |
472 | 472 |
473 | 473 |
474 void FullCodeGenerator::RecordStackCheck(BailoutId ast_id) { | 474 void FullCodeGenerator::RecordBackEdge(BailoutId ast_id) { |
475 // The pc offset does not need to be encoded and packed together with a | 475 // The pc offset does not need to be encoded and packed together with a state. |
476 // state. | |
477 ASSERT(masm_->pc_offset() > 0); | 476 ASSERT(masm_->pc_offset() > 0); |
478 BailoutEntry entry = { ast_id, static_cast<unsigned>(masm_->pc_offset()) }; | 477 BailoutEntry entry = { ast_id, static_cast<unsigned>(masm_->pc_offset()) }; |
479 stack_checks_.Add(entry, zone()); | 478 stack_checks_.Add(entry, zone()); |
480 } | 479 } |
481 | 480 |
482 | 481 |
483 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { | 482 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { |
484 // Inline smi case inside loops, but not division and modulo which | 483 // Inline smi case inside loops, but not division and modulo which |
485 // are too complicated and take up too much space. | 484 // are too complicated and take up too much space. |
486 if (op == Token::DIV ||op == Token::MOD) return false; | 485 if (op == Token::DIV ||op == Token::MOD) return false; |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS); | 1261 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS); |
1263 SetExpressionPosition(stmt->cond(), stmt->condition_position()); | 1262 SetExpressionPosition(stmt->cond(), stmt->condition_position()); |
1264 VisitForControl(stmt->cond(), | 1263 VisitForControl(stmt->cond(), |
1265 &stack_check, | 1264 &stack_check, |
1266 loop_statement.break_label(), | 1265 loop_statement.break_label(), |
1267 &stack_check); | 1266 &stack_check); |
1268 | 1267 |
1269 // Check stack before looping. | 1268 // Check stack before looping. |
1270 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); | 1269 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); |
1271 __ bind(&stack_check); | 1270 __ bind(&stack_check); |
1272 EmitStackCheck(stmt, &body); | 1271 EmitBackEdgeBookkeeping(stmt, &body); |
1273 __ jmp(&body); | 1272 __ jmp(&body); |
1274 | 1273 |
1275 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1274 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1276 __ bind(loop_statement.break_label()); | 1275 __ bind(loop_statement.break_label()); |
1277 decrement_loop_depth(); | 1276 decrement_loop_depth(); |
1278 } | 1277 } |
1279 | 1278 |
1280 | 1279 |
1281 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { | 1280 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { |
1282 Comment cmnt(masm_, "[ WhileStatement"); | 1281 Comment cmnt(masm_, "[ WhileStatement"); |
1283 Label test, body; | 1282 Label test, body; |
1284 | 1283 |
1285 Iteration loop_statement(this, stmt); | 1284 Iteration loop_statement(this, stmt); |
1286 increment_loop_depth(); | 1285 increment_loop_depth(); |
1287 | 1286 |
1288 // Emit the test at the bottom of the loop. | 1287 // Emit the test at the bottom of the loop. |
1289 __ jmp(&test); | 1288 __ jmp(&test); |
1290 | 1289 |
1291 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1290 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1292 __ bind(&body); | 1291 __ bind(&body); |
1293 Visit(stmt->body()); | 1292 Visit(stmt->body()); |
1294 | 1293 |
1295 // Emit the statement position here as this is where the while | 1294 // Emit the statement position here as this is where the while |
1296 // statement code starts. | 1295 // statement code starts. |
1297 __ bind(loop_statement.continue_label()); | 1296 __ bind(loop_statement.continue_label()); |
1298 SetStatementPosition(stmt); | 1297 SetStatementPosition(stmt); |
1299 | 1298 |
1300 // Check stack before looping. | 1299 // Check stack before looping. |
1301 EmitStackCheck(stmt, &body); | 1300 EmitBackEdgeBookkeeping(stmt, &body); |
1302 | 1301 |
1303 __ bind(&test); | 1302 __ bind(&test); |
1304 VisitForControl(stmt->cond(), | 1303 VisitForControl(stmt->cond(), |
1305 &body, | 1304 &body, |
1306 loop_statement.break_label(), | 1305 loop_statement.break_label(), |
1307 loop_statement.break_label()); | 1306 loop_statement.break_label()); |
1308 | 1307 |
1309 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1308 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1310 __ bind(loop_statement.break_label()); | 1309 __ bind(loop_statement.break_label()); |
1311 decrement_loop_depth(); | 1310 decrement_loop_depth(); |
(...skipping 25 matching lines...) Expand all Loading... |
1337 __ bind(loop_statement.continue_label()); | 1336 __ bind(loop_statement.continue_label()); |
1338 if (stmt->next() != NULL) { | 1337 if (stmt->next() != NULL) { |
1339 Visit(stmt->next()); | 1338 Visit(stmt->next()); |
1340 } | 1339 } |
1341 | 1340 |
1342 // Emit the statement position here as this is where the for | 1341 // Emit the statement position here as this is where the for |
1343 // statement code starts. | 1342 // statement code starts. |
1344 SetStatementPosition(stmt); | 1343 SetStatementPosition(stmt); |
1345 | 1344 |
1346 // Check stack before looping. | 1345 // Check stack before looping. |
1347 EmitStackCheck(stmt, &body); | 1346 EmitBackEdgeBookkeeping(stmt, &body); |
1348 | 1347 |
1349 __ bind(&test); | 1348 __ bind(&test); |
1350 if (stmt->cond() != NULL) { | 1349 if (stmt->cond() != NULL) { |
1351 VisitForControl(stmt->cond(), | 1350 VisitForControl(stmt->cond(), |
1352 &body, | 1351 &body, |
1353 loop_statement.break_label(), | 1352 loop_statement.break_label(), |
1354 loop_statement.break_label()); | 1353 loop_statement.break_label()); |
1355 } else { | 1354 } else { |
1356 __ jmp(&body); | 1355 __ jmp(&body); |
1357 } | 1356 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 } | 1578 } |
1580 | 1579 |
1581 return false; | 1580 return false; |
1582 } | 1581 } |
1583 | 1582 |
1584 | 1583 |
1585 #undef __ | 1584 #undef __ |
1586 | 1585 |
1587 | 1586 |
1588 } } // namespace v8::internal | 1587 } } // namespace v8::internal |
OLD | NEW |