| 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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 LEnvironment* LChunkBuilder::CreateEnvironment( | 922 LEnvironment* LChunkBuilder::CreateEnvironment( |
| 923 HEnvironment* hydrogen_env, | 923 HEnvironment* hydrogen_env, |
| 924 int* argument_index_accumulator) { | 924 int* argument_index_accumulator) { |
| 925 if (hydrogen_env == NULL) return NULL; | 925 if (hydrogen_env == NULL) return NULL; |
| 926 | 926 |
| 927 LEnvironment* outer = | 927 LEnvironment* outer = |
| 928 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); | 928 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
| 929 BailoutId ast_id = hydrogen_env->ast_id(); | 929 BailoutId ast_id = hydrogen_env->ast_id(); |
| 930 ASSERT(!ast_id.IsNone() || | 930 ASSERT(!ast_id.IsNone() || |
| 931 hydrogen_env->frame_type() != JS_FUNCTION); | 931 hydrogen_env->frame_type() != JS_FUNCTION); |
| 932 int value_count = hydrogen_env->length(); | 932 int value_count = hydrogen_env->length() - hydrogen_env->specials_count(); |
| 933 LEnvironment* result = new(zone()) LEnvironment( | 933 LEnvironment* result = new(zone()) LEnvironment( |
| 934 hydrogen_env->closure(), | 934 hydrogen_env->closure(), |
| 935 hydrogen_env->frame_type(), | 935 hydrogen_env->frame_type(), |
| 936 ast_id, | 936 ast_id, |
| 937 hydrogen_env->parameter_count(), | 937 hydrogen_env->parameter_count(), |
| 938 argument_count_, | 938 argument_count_, |
| 939 value_count, | 939 value_count, |
| 940 outer, | 940 outer, |
| 941 hydrogen_env->entry(), | 941 hydrogen_env->entry(), |
| 942 zone()); | 942 zone()); |
| 943 bool needs_arguments_object_materialization = false; |
| 943 int argument_index = *argument_index_accumulator; | 944 int argument_index = *argument_index_accumulator; |
| 944 for (int i = 0; i < value_count; ++i) { | 945 for (int i = 0; i < hydrogen_env->length(); ++i) { |
| 945 if (hydrogen_env->is_special_index(i)) continue; | 946 if (hydrogen_env->is_special_index(i)) continue; |
| 946 | 947 |
| 947 HValue* value = hydrogen_env->values()->at(i); | 948 HValue* value = hydrogen_env->values()->at(i); |
| 948 LOperand* op = NULL; | 949 LOperand* op = NULL; |
| 949 if (value->IsArgumentsObject()) { | 950 if (value->IsArgumentsObject()) { |
| 951 needs_arguments_object_materialization = true; |
| 950 op = NULL; | 952 op = NULL; |
| 951 } else if (value->IsPushArgument()) { | 953 } else if (value->IsPushArgument()) { |
| 952 op = new(zone()) LArgument(argument_index++); | 954 op = new(zone()) LArgument(argument_index++); |
| 953 } else { | 955 } else { |
| 954 op = UseAny(value); | 956 op = UseAny(value); |
| 955 } | 957 } |
| 956 result->AddValue(op, | 958 result->AddValue(op, |
| 957 value->representation(), | 959 value->representation(), |
| 958 value->CheckFlag(HInstruction::kUint32)); | 960 value->CheckFlag(HInstruction::kUint32)); |
| 959 } | 961 } |
| 960 | 962 |
| 963 if (needs_arguments_object_materialization) { |
| 964 HArgumentsObject* arguments = hydrogen_env->entry() == NULL |
| 965 ? graph()->GetArgumentsObject() |
| 966 : hydrogen_env->entry()->arguments_object(); |
| 967 ASSERT(arguments->IsLinked()); |
| 968 for (int i = 1; i < arguments->arguments_count(); ++i) { |
| 969 HValue* value = arguments->arguments_values()->at(i); |
| 970 ASSERT(!value->IsArgumentsObject() && !value->IsPushArgument()); |
| 971 ASSERT(HInstruction::cast(value)->IsLinked()); |
| 972 LOperand* op = UseAny(value); |
| 973 result->AddValue(op, |
| 974 value->representation(), |
| 975 value->CheckFlag(HInstruction::kUint32)); |
| 976 } |
| 977 } |
| 978 |
| 961 if (hydrogen_env->frame_type() == JS_FUNCTION) { | 979 if (hydrogen_env->frame_type() == JS_FUNCTION) { |
| 962 *argument_index_accumulator = argument_index; | 980 *argument_index_accumulator = argument_index; |
| 963 } | 981 } |
| 964 | 982 |
| 965 return result; | 983 return result; |
| 966 } | 984 } |
| 967 | 985 |
| 968 | 986 |
| 969 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 987 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 970 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); | 988 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 | 2664 |
| 2647 | 2665 |
| 2648 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2666 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2649 LOperand* object = UseRegister(instr->object()); | 2667 LOperand* object = UseRegister(instr->object()); |
| 2650 LOperand* index = UseRegister(instr->index()); | 2668 LOperand* index = UseRegister(instr->index()); |
| 2651 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2669 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2652 } | 2670 } |
| 2653 | 2671 |
| 2654 | 2672 |
| 2655 } } // namespace v8::internal | 2673 } } // namespace v8::internal |
| OLD | NEW |