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 6032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6043 data_size, | 6043 data_size, |
6044 pointer_size, | 6044 pointer_size, |
6045 mode); | 6045 mode); |
6046 } else { | 6046 } else { |
6047 NoObservableSideEffectsScope no_effects(this); | 6047 NoObservableSideEffectsScope no_effects(this); |
6048 // Boilerplate already exists and constant elements are never accessed, | 6048 // Boilerplate already exists and constant elements are never accessed, |
6049 // pass an empty fixed array to the runtime function instead. | 6049 // pass an empty fixed array to the runtime function instead. |
6050 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); | 6050 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); |
6051 int literal_index = expr->literal_index(); | 6051 int literal_index = expr->literal_index(); |
6052 | 6052 |
6053 // TODO(mstarzinger): The following check and deopt is actually obsolete | |
6054 // but test cases for the tick processor fails because profile differs. | |
6055 | |
6056 // Deopt if the array literal boilerplate ElementsKind is of a type | |
6057 // different than the expected one. The check isn't necessary if the | |
6058 // boilerplate has already been converted to TERMINAL_FAST_ELEMENTS_KIND. | |
6059 if (CanTransitionToMoreGeneralFastElementsKind( | |
6060 boilerplate_elements_kind, true)) { | |
6061 IfBuilder builder(this); | |
6062 HValue* boilerplate = AddInstruction(new(zone()) | |
6063 HConstant(original_boilerplate_object)); | |
6064 HValue* elements_kind = AddInstruction(new(zone()) | |
6065 HElementsKind(boilerplate)); | |
6066 HValue* expected_kind = AddInstruction(new(zone()) | |
6067 HConstant(boilerplate_elements_kind)); | |
6068 builder.IfCompare(elements_kind, expected_kind, Token::EQ); | |
6069 builder.Then(); | |
6070 builder.ElseDeopt(); | |
6071 } | |
6072 | |
6073 AddInstruction(new(zone()) HPushArgument(AddInstruction( | 6053 AddInstruction(new(zone()) HPushArgument(AddInstruction( |
6074 new(zone()) HConstant(literals)))); | 6054 new(zone()) HConstant(literals)))); |
6075 AddInstruction(new(zone()) HPushArgument(AddInstruction( | 6055 AddInstruction(new(zone()) HPushArgument(AddInstruction( |
6076 new(zone()) HConstant(literal_index)))); | 6056 new(zone()) HConstant(literal_index)))); |
6077 AddInstruction(new(zone()) HPushArgument(AddInstruction( | 6057 AddInstruction(new(zone()) HPushArgument(AddInstruction( |
6078 new(zone()) HConstant(constants)))); | 6058 new(zone()) HConstant(constants)))); |
6079 | 6059 |
6080 Runtime::FunctionId function_id = (expr->depth() > 1) | 6060 Runtime::FunctionId function_id = (expr->depth() > 1) |
6081 ? Runtime::kCreateArrayLiteral : Runtime::kCreateArrayLiteralShallow; | 6061 ? Runtime::kCreateArrayLiteral : Runtime::kCreateArrayLiteralShallow; |
6082 literal = AddInstruction( | 6062 literal = AddInstruction( |
(...skipping 5574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11657 } | 11637 } |
11658 } | 11638 } |
11659 | 11639 |
11660 #ifdef DEBUG | 11640 #ifdef DEBUG |
11661 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11641 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11662 if (allocator_ != NULL) allocator_->Verify(); | 11642 if (allocator_ != NULL) allocator_->Verify(); |
11663 #endif | 11643 #endif |
11664 } | 11644 } |
11665 | 11645 |
11666 } } // namespace v8::internal | 11646 } } // namespace v8::internal |
OLD | NEW |