| 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 6888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6899 } | 6899 } |
| 6900 | 6900 |
| 6901 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object); | 6901 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object); |
| 6902 literal = BuildFastLiteral(context, | 6902 literal = BuildFastLiteral(context, |
| 6903 boilerplate_object, | 6903 boilerplate_object, |
| 6904 original_boilerplate_object, | 6904 original_boilerplate_object, |
| 6905 data_size, | 6905 data_size, |
| 6906 pointer_size, | 6906 pointer_size, |
| 6907 mode); | 6907 mode); |
| 6908 } else { | 6908 } else { |
| 6909 NoObservableSideEffectsScope no_effects(this); |
| 6910 // Boilerplate already exists and constant elements are never accessed, |
| 6911 // pass an empty fixed array to the runtime function instead. |
| 6912 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); |
| 6913 int literal_index = expr->literal_index(); |
| 6914 |
| 6915 // TODO(mstarzinger): The following check and deopt is actually obsolete |
| 6916 // but test cases for the tick processor fails because profile differs. |
| 6917 |
| 6918 // Deopt if the array literal boilerplate ElementsKind is of a type |
| 6919 // different than the expected one. The check isn't necessary if the |
| 6920 // boilerplate has already been converted to TERMINAL_FAST_ELEMENTS_KIND. |
| 6921 if (CanTransitionToMoreGeneralFastElementsKind( |
| 6922 boilerplate_elements_kind, true)) { |
| 6923 IfBuilder builder(this); |
| 6924 HValue* boilerplate = AddInstruction(new(zone()) |
| 6925 HConstant(original_boilerplate_object, Representation::Tagged())); |
| 6926 HValue* elements_kind = AddInstruction(new(zone()) |
| 6927 HElementsKind(boilerplate)); |
| 6928 HValue* expected_kind = AddInstruction(new(zone()) |
| 6929 HConstant(boilerplate_elements_kind, Representation::Integer32())); |
| 6930 builder.IfCompare(elements_kind, expected_kind, Token::EQ); |
| 6931 builder.Then(); |
| 6932 builder.ElseDeopt(); |
| 6933 } |
| 6934 |
| 6935 AddInstruction(new(zone()) HPushArgument(AddInstruction( |
| 6936 new(zone()) HConstant(literals, Representation::Tagged())))); |
| 6937 AddInstruction(new(zone()) HPushArgument(AddInstruction( |
| 6938 new(zone()) HConstant(literal_index, Representation::Tagged())))); |
| 6939 AddInstruction(new(zone()) HPushArgument(AddInstruction( |
| 6940 new(zone()) HConstant(constants, Representation::Tagged())))); |
| 6941 |
| 6942 Runtime::FunctionId function_id = (expr->depth() > 1) |
| 6943 ? Runtime::kCreateArrayLiteral : Runtime::kCreateArrayLiteralShallow; |
| 6909 literal = AddInstruction( | 6944 literal = AddInstruction( |
| 6910 new(zone()) HArrayLiteral(context, | 6945 new(zone()) HCallRuntime(context, |
| 6911 original_boilerplate_object, | 6946 isolate()->factory()->empty_string(), |
| 6912 literals, | 6947 Runtime::FunctionForId(function_id), |
| 6913 length, | 6948 3)); |
| 6914 expr->literal_index(), | |
| 6915 expr->depth(), | |
| 6916 mode)); | |
| 6917 } | 6949 } |
| 6918 | 6950 |
| 6919 // The array is expected in the bailout environment during computation | 6951 // The array is expected in the bailout environment during computation |
| 6920 // of the property values and is the value of the entire expression. | 6952 // of the property values and is the value of the entire expression. |
| 6921 Push(literal); | 6953 Push(literal); |
| 6922 | 6954 |
| 6923 HInstruction* elements = NULL; | 6955 HInstruction* elements = NULL; |
| 6924 | 6956 |
| 6925 for (int i = 0; i < length; i++) { | 6957 for (int i = 0; i < length; i++) { |
| 6926 Expression* subexpr = subexprs->at(i); | 6958 Expression* subexpr = subexprs->at(i); |
| (...skipping 5454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12381 } | 12413 } |
| 12382 } | 12414 } |
| 12383 | 12415 |
| 12384 #ifdef DEBUG | 12416 #ifdef DEBUG |
| 12385 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12417 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 12386 if (allocator_ != NULL) allocator_->Verify(); | 12418 if (allocator_ != NULL) allocator_->Verify(); |
| 12387 #endif | 12419 #endif |
| 12388 } | 12420 } |
| 12389 | 12421 |
| 12390 } } // namespace v8::internal | 12422 } } // namespace v8::internal |
| OLD | NEW |