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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 | 1418 |
1419 void FullCodeGenerator::ExitTryBlock(int handler_index) { | 1419 void FullCodeGenerator::ExitTryBlock(int handler_index) { |
1420 HandlerTableEntry* entry = &handler_table_[handler_index]; | 1420 HandlerTableEntry* entry = &handler_table_[handler_index]; |
1421 entry->range_end = masm()->pc_offset(); | 1421 entry->range_end = masm()->pc_offset(); |
1422 | 1422 |
1423 // Drop context from operand stack. | 1423 // Drop context from operand stack. |
1424 __ Drop(TryBlockConstant::kElementCount); | 1424 __ Drop(TryBlockConstant::kElementCount); |
1425 } | 1425 } |
1426 | 1426 |
1427 | 1427 |
| 1428 void FullCodeGenerator::VisitCall(Call* expr) { |
| 1429 #ifdef DEBUG |
| 1430 // We want to verify that RecordJSReturnSite gets called on all paths |
| 1431 // through this function. Avoid early returns. |
| 1432 expr->return_is_recorded_ = false; |
| 1433 #endif |
| 1434 |
| 1435 Comment cmnt(masm_, "[ Call"); |
| 1436 Expression* callee = expr->expression(); |
| 1437 Call::CallType call_type = expr->GetCallType(isolate()); |
| 1438 |
| 1439 switch (call_type) { |
| 1440 case Call::POSSIBLY_EVAL_CALL: |
| 1441 EmitPossiblyEvalCall(expr); |
| 1442 break; |
| 1443 case Call::GLOBAL_CALL: |
| 1444 EmitCallWithLoadIC(expr); |
| 1445 break; |
| 1446 case Call::LOOKUP_SLOT_CALL: |
| 1447 // Call to a lookup slot (dynamically introduced variable). |
| 1448 PushCalleeAndWithBaseObject(expr); |
| 1449 EmitCall(expr); |
| 1450 break; |
| 1451 case Call::NAMED_PROPERTY_CALL: { |
| 1452 Property* property = callee->AsProperty(); |
| 1453 VisitForStackValue(property->obj()); |
| 1454 EmitCallWithLoadIC(expr); |
| 1455 break; |
| 1456 } |
| 1457 case Call::KEYED_PROPERTY_CALL: { |
| 1458 Property* property = callee->AsProperty(); |
| 1459 VisitForStackValue(property->obj()); |
| 1460 EmitKeyedCallWithLoadIC(expr, property->key()); |
| 1461 break; |
| 1462 } |
| 1463 case Call::NAMED_SUPER_PROPERTY_CALL: |
| 1464 EmitSuperCallWithLoadIC(expr); |
| 1465 break; |
| 1466 case Call::KEYED_SUPER_PROPERTY_CALL: |
| 1467 EmitKeyedSuperCallWithLoadIC(expr); |
| 1468 break; |
| 1469 case Call::SUPER_CALL: |
| 1470 EmitSuperConstructorCall(expr); |
| 1471 break; |
| 1472 case Call::OTHER_CALL: |
| 1473 // Call to an arbitrary expression not handled specially above. |
| 1474 VisitForStackValue(callee); |
| 1475 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 1476 // Emit function call. |
| 1477 EmitCall(expr); |
| 1478 break; |
| 1479 } |
| 1480 |
| 1481 #ifdef DEBUG |
| 1482 // RecordJSReturnSite should have been called. |
| 1483 DCHECK(expr->return_is_recorded_); |
| 1484 #endif |
| 1485 } |
| 1486 |
| 1487 |
1428 void FullCodeGenerator::VisitSpread(Spread* expr) { UNREACHABLE(); } | 1488 void FullCodeGenerator::VisitSpread(Spread* expr) { UNREACHABLE(); } |
1429 | 1489 |
1430 | 1490 |
1431 void FullCodeGenerator::VisitEmptyParentheses(EmptyParentheses* expr) { | 1491 void FullCodeGenerator::VisitEmptyParentheses(EmptyParentheses* expr) { |
1432 UNREACHABLE(); | 1492 UNREACHABLE(); |
1433 } | 1493 } |
1434 | 1494 |
1435 | 1495 |
1436 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit( | 1496 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit( |
1437 int* stack_depth, int* context_length) { | 1497 int* stack_depth, int* context_length) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1736 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1677 var->initializer_position() >= proxy->position(); | 1737 var->initializer_position() >= proxy->position(); |
1678 } | 1738 } |
1679 | 1739 |
1680 | 1740 |
1681 #undef __ | 1741 #undef __ |
1682 | 1742 |
1683 | 1743 |
1684 } // namespace internal | 1744 } // namespace internal |
1685 } // namespace v8 | 1745 } // namespace v8 |
OLD | NEW |