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 8998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9009 // Our implementation of arguments (based on this stack frame or an | 9009 // Our implementation of arguments (based on this stack frame or an |
9010 // adapter below it) does not work for inlined functions. This runtime | 9010 // adapter below it) does not work for inlined functions. This runtime |
9011 // function is blacklisted by AstNode::IsInlineable. | 9011 // function is blacklisted by AstNode::IsInlineable. |
9012 ASSERT(function_state()->outer() == NULL); | 9012 ASSERT(function_state()->outer() == NULL); |
9013 ASSERT(call->arguments()->length() == 1); | 9013 ASSERT(call->arguments()->length() == 1); |
9014 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 9014 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
9015 HValue* index = Pop(); | 9015 HValue* index = Pop(); |
9016 HInstruction* elements = AddInstruction( | 9016 HInstruction* elements = AddInstruction( |
9017 new(zone()) HArgumentsElements(false)); | 9017 new(zone()) HArgumentsElements(false)); |
9018 HInstruction* length = AddInstruction(new(zone()) HArgumentsLength(elements)); | 9018 HInstruction* length = AddInstruction(new(zone()) HArgumentsLength(elements)); |
| 9019 HInstruction* checked_index = |
| 9020 AddInstruction(new(zone()) HBoundsCheck(index, length)); |
9019 HAccessArgumentsAt* result = | 9021 HAccessArgumentsAt* result = |
9020 new(zone()) HAccessArgumentsAt(elements, length, index); | 9022 new(zone()) HAccessArgumentsAt(elements, length, checked_index); |
9021 return ast_context()->ReturnInstruction(result, call->id()); | 9023 return ast_context()->ReturnInstruction(result, call->id()); |
9022 } | 9024 } |
9023 | 9025 |
9024 | 9026 |
9025 // Support for accessing the class and value fields of an object. | 9027 // Support for accessing the class and value fields of an object. |
9026 void HGraphBuilder::GenerateClassOf(CallRuntime* call) { | 9028 void HGraphBuilder::GenerateClassOf(CallRuntime* call) { |
9027 // The special form detected by IsClassOfTest is detected before we get here | 9029 // The special form detected by IsClassOfTest is detected before we get here |
9028 // and does not cause a bailout. | 9030 // and does not cause a bailout. |
9029 return Bailout("inlined runtime function: ClassOf"); | 9031 return Bailout("inlined runtime function: ClassOf"); |
9030 } | 9032 } |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9971 } | 9973 } |
9972 } | 9974 } |
9973 | 9975 |
9974 #ifdef DEBUG | 9976 #ifdef DEBUG |
9975 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9977 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9976 if (allocator_ != NULL) allocator_->Verify(); | 9978 if (allocator_ != NULL) allocator_->Verify(); |
9977 #endif | 9979 #endif |
9978 } | 9980 } |
9979 | 9981 |
9980 } } // namespace v8::internal | 9982 } } // namespace v8::internal |
OLD | NEW |