| OLD | NEW | 
|     1 // Copyright 2011 the V8 project authors. All rights reserved. |     1 // Copyright 2011 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   644 } |   644 } | 
|   645  |   645  | 
|   646  |   646  | 
|   647 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |   647 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 
|   648   HEnvironment* hydrogen_env = current_block_->last_environment(); |   648   HEnvironment* hydrogen_env = current_block_->last_environment(); | 
|   649   instr->set_environment(CreateEnvironment(hydrogen_env)); |   649   instr->set_environment(CreateEnvironment(hydrogen_env)); | 
|   650   return instr; |   650   return instr; | 
|   651 } |   651 } | 
|   652  |   652  | 
|   653  |   653  | 
 |   654 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | 
 |   655     LInstruction* instr, int ast_id) { | 
 |   656   ASSERT(instructions_pending_deoptimization_environment_ == NULL); | 
 |   657   ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | 
 |   658   instructions_pending_deoptimization_environment_ = instr; | 
 |   659   pending_deoptimization_ast_id_ = ast_id; | 
 |   660   return instr; | 
 |   661 } | 
 |   662  | 
 |   663  | 
 |   664 void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() { | 
 |   665   instructions_pending_deoptimization_environment_ = NULL; | 
 |   666   pending_deoptimization_ast_id_ = AstNode::kNoNumber; | 
 |   667 } | 
 |   668  | 
 |   669  | 
|   654 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |   670 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 
|   655                                         HInstruction* hinstr, |   671                                         HInstruction* hinstr, | 
|   656                                         CanDeoptimize can_deoptimize) { |   672                                         CanDeoptimize can_deoptimize) { | 
|   657   allocator_->MarkAsCall(); |   673   allocator_->MarkAsCall(); | 
|   658   instr = AssignPointerMap(instr); |   674   instr = AssignPointerMap(instr); | 
|   659  |   675  | 
|   660   if (hinstr->HasSideEffects()) { |   676   if (hinstr->HasSideEffects()) { | 
|   661     ASSERT(hinstr->next()->IsSimulate()); |   677     ASSERT(hinstr->next()->IsSimulate()); | 
|   662     HSimulate* sim = HSimulate::cast(hinstr->next()); |   678     HSimulate* sim = HSimulate::cast(hinstr->next()); | 
|   663     ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |   679     instr = SetInstructionPendingDeoptimizationEnvironment( | 
|   664     pending_deoptimization_ast_id_ = sim->ast_id(); |   680         instr, sim->ast_id()); | 
|   665   } |   681   } | 
|   666  |   682  | 
|   667   // If instruction does not have side-effects lazy deoptimization |   683   // If instruction does not have side-effects lazy deoptimization | 
|   668   // after the call will try to deoptimize to the point before the call. |   684   // after the call will try to deoptimize to the point before the call. | 
|   669   // Thus we still need to attach environment to this call even if |   685   // Thus we still need to attach environment to this call even if | 
|   670   // call sequence can not deoptimize eagerly. |   686   // call sequence can not deoptimize eagerly. | 
|   671   bool needs_environment = |   687   bool needs_environment = | 
|   672       (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || !hinstr->HasSideEffects(); |   688       (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || !hinstr->HasSideEffects(); | 
|   673   if (needs_environment && !instr->HasEnvironment()) { |   689   if (needs_environment && !instr->HasEnvironment()) { | 
|   674     instr = AssignEnvironment(instr); |   690     instr = AssignEnvironment(instr); | 
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1618     if (instr->HasAssignedIndexAt(i)) { |  1634     if (instr->HasAssignedIndexAt(i)) { | 
|  1619       env->Bind(instr->GetAssignedIndexAt(i), value); |  1635       env->Bind(instr->GetAssignedIndexAt(i), value); | 
|  1620     } else { |  1636     } else { | 
|  1621       env->Push(value); |  1637       env->Push(value); | 
|  1622     } |  1638     } | 
|  1623   } |  1639   } | 
|  1624   ASSERT(env->length() == instr->environment_length()); |  1640   ASSERT(env->length() == instr->environment_length()); | 
|  1625  |  1641  | 
|  1626   // If there is an instruction pending deoptimization environment create a |  1642   // If there is an instruction pending deoptimization environment create a | 
|  1627   // lazy bailout instruction to capture the environment. |  1643   // lazy bailout instruction to capture the environment. | 
|  1628   if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) { |  1644   if (pending_deoptimization_ast_id_ == instr->ast_id()) { | 
|  1629     ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); |  | 
|  1630     LLazyBailout* lazy_bailout = new LLazyBailout; |  1645     LLazyBailout* lazy_bailout = new LLazyBailout; | 
|  1631     LInstruction* result = AssignEnvironment(lazy_bailout); |  1646     LInstruction* result = AssignEnvironment(lazy_bailout); | 
|  1632     pending_deoptimization_ast_id_ = AstNode::kNoNumber; |  1647     instructions_pending_deoptimization_environment_-> | 
 |  1648         set_deoptimization_environment(result->environment()); | 
 |  1649     ClearInstructionPendingDeoptimizationEnvironment(); | 
|  1633     return result; |  1650     return result; | 
|  1634   } |  1651   } | 
|  1635  |  1652  | 
|  1636   return NULL; |  1653   return NULL; | 
|  1637 } |  1654 } | 
|  1638  |  1655  | 
|  1639  |  1656  | 
|  1640 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |  1657 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 
|  1641   return MarkAsCall(new LStackCheck, instr); |  1658   return MarkAsCall(new LStackCheck, instr); | 
|  1642 } |  1659 } | 
|  1643  |  1660  | 
|  1644  |  1661  | 
|  1645 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |  1662 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 
|  1646   Abort("Unimplemented: %s", "DoEnterInlined"); |  1663   Abort("Unimplemented: %s", "DoEnterInlined"); | 
|  1647   return NULL; |  1664   return NULL; | 
|  1648 } |  1665 } | 
|  1649  |  1666  | 
|  1650  |  1667  | 
|  1651 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |  1668 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 
|  1652   Abort("Unimplemented: %s", "DoLeaveInlined"); |  1669   Abort("Unimplemented: %s", "DoLeaveInlined"); | 
|  1653   return NULL; |  1670   return NULL; | 
|  1654 } |  1671 } | 
|  1655  |  1672  | 
|  1656 } }  // namespace v8::internal |  1673 } }  // namespace v8::internal | 
|  1657  |  1674  | 
|  1658 #endif  // V8_TARGET_ARCH_X64 |  1675 #endif  // V8_TARGET_ARCH_X64 | 
| OLD | NEW |