Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 936 chunk()->inlined_closures(); | 936 chunk()->inlined_closures(); |
| 937 | 937 |
| 938 for (int i = 0, length = inlined_closures->length(); i < length; i++) { | 938 for (int i = 0, length = inlined_closures->length(); i < length; i++) { |
| 939 DefineDeoptimizationLiteral(inlined_closures->at(i)); | 939 DefineDeoptimizationLiteral(inlined_closures->at(i)); |
| 940 } | 940 } |
| 941 | 941 |
| 942 inlined_function_count_ = deoptimization_literals_.length(); | 942 inlined_function_count_ = deoptimization_literals_.length(); |
| 943 } | 943 } |
| 944 | 944 |
| 945 | 945 |
| 946 void LCodeGen::Deoptimize(LEnvironment* environment, | 946 bool LCodeGen::DeoptimizeHeader(LEnvironment* environment) { |
| 947 Deoptimizer::BailoutType bailout_type) { | |
| 948 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 947 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 949 ASSERT(environment->HasBeenRegistered()); | 948 ASSERT(environment->HasBeenRegistered()); |
| 950 ASSERT(info()->IsOptimizing() || info()->IsStub()); | 949 ASSERT(info()->IsOptimizing() || info()->IsStub()); |
| 951 int id = environment->deoptimization_index(); | 950 int id = environment->deoptimization_index(); |
| 951 Deoptimizer::BailoutType bailout_type = info()->IsStub() ? Deoptimizer::LAZY | |
| 952 : Deoptimizer::EAGER; | |
| 952 Address entry = | 953 Address entry = |
| 953 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); | 954 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); |
| 954 | 955 |
| 955 if (entry == NULL) { | 956 if (entry == NULL) { |
| 956 Abort(kBailoutWasNotPrepared); | 957 Abort(kBailoutWasNotPrepared); |
| 957 return; | 958 return false; |
| 958 } | 959 } |
| 959 | 960 |
| 960 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on A64. | 961 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on A64. |
| 961 TODO_UNIMPLEMENTED("Support for FLAG_deopt_every_n_times >= 2."); | 962 TODO_UNIMPLEMENTED("Support for FLAG_deopt_every_n_times >= 2."); |
| 962 if (FLAG_deopt_every_n_times == 1 && | 963 if (FLAG_deopt_every_n_times == 1 && |
| 963 !info()->IsStub() && | 964 !info()->IsStub() && |
| 964 info()->opt_count() == id) { | 965 info()->opt_count() == id) { |
| 965 ASSERT(frame_is_built_); | 966 ASSERT(frame_is_built_); |
| 966 __ Call(entry, RelocInfo::RUNTIME_ENTRY); | 967 __ Call(entry, RelocInfo::RUNTIME_ENTRY); |
| 968 return false; | |
| 969 } | |
| 970 | |
| 971 return true; | |
| 972 } | |
| 973 | |
| 974 | |
| 975 void LCodeGen::Deoptimize(LEnvironment* environment, | |
| 976 Deoptimizer::BailoutType bailout_type) { | |
| 977 if (!DeoptimizeHeader(environment)) | |
|
ulan
2014/02/10 14:22:46
V8 style nit: either put "return" in the same line
| |
| 967 return; | 978 return; |
| 968 } | 979 |
| 980 ASSERT(environment->HasBeenRegistered()); | |
| 981 ASSERT(info()->IsOptimizing() || info()->IsStub()); | |
| 982 int id = environment->deoptimization_index(); | |
| 983 Address entry = | |
| 984 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); | |
| 969 | 985 |
| 970 if (info()->ShouldTrapOnDeopt()) { | 986 if (info()->ShouldTrapOnDeopt()) { |
| 971 __ Debug("trap_on_deopt", __LINE__, BREAK); | 987 __ Debug("trap_on_deopt", __LINE__, BREAK); |
| 972 } | 988 } |
| 973 | 989 |
| 974 | |
| 975 ASSERT(info()->IsStub() || frame_is_built_); | 990 ASSERT(info()->IsStub() || frame_is_built_); |
| 976 // Go through jump table if we need to build frame, or restore caller doubles. | 991 // Go through jump table if we need to build frame, or restore caller doubles. |
| 977 if (frame_is_built_ && !info()->saves_caller_doubles()) { | 992 if (frame_is_built_ && !info()->saves_caller_doubles()) { |
| 978 __ Call(entry, RelocInfo::RUNTIME_ENTRY); | 993 __ Call(entry, RelocInfo::RUNTIME_ENTRY); |
| 979 } else { | 994 } else { |
| 980 // We often have several deopts to the same entry, reuse the last | 995 // We often have several deopts to the same entry, reuse the last |
| 981 // jump entry if this is the case. | 996 // jump entry if this is the case. |
| 982 if (deopt_jump_table_.is_empty() || | 997 if (deopt_jump_table_.is_empty() || |
| 983 (deopt_jump_table_.last().address != entry) || | 998 (deopt_jump_table_.last().address != entry) || |
| 984 (deopt_jump_table_.last().bailout_type != bailout_type) || | 999 (deopt_jump_table_.last().bailout_type != bailout_type) || |
| (...skipping 4686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5671 __ Bind(&out_of_object); | 5686 __ Bind(&out_of_object); |
| 5672 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5687 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5673 // Index is equal to negated out of object property index plus 1. | 5688 // Index is equal to negated out of object property index plus 1. |
| 5674 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5689 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5675 __ Ldr(result, FieldMemOperand(result, | 5690 __ Ldr(result, FieldMemOperand(result, |
| 5676 FixedArray::kHeaderSize - kPointerSize)); | 5691 FixedArray::kHeaderSize - kPointerSize)); |
| 5677 __ Bind(&done); | 5692 __ Bind(&done); |
| 5678 } | 5693 } |
| 5679 | 5694 |
| 5680 } } // namespace v8::internal | 5695 } } // namespace v8::internal |
| OLD | NEW |