OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 } | 877 } |
878 } | 878 } |
879 | 879 |
880 | 880 |
881 void LCodeGen::WriteTranslation(LEnvironment* environment, | 881 void LCodeGen::WriteTranslation(LEnvironment* environment, |
882 Translation* translation) { | 882 Translation* translation) { |
883 if (environment == NULL) return; | 883 if (environment == NULL) return; |
884 | 884 |
885 // The translation includes one command per value in the environment. | 885 // The translation includes one command per value in the environment. |
886 int translation_size = environment->translation_size(); | 886 int translation_size = environment->translation_size(); |
887 // The output frame height does not include the parameters. | |
888 int height = translation_size - environment->parameter_count(); | |
889 | 887 |
890 WriteTranslation(environment->outer(), translation); | 888 WriteTranslation(environment->outer(), translation); |
891 bool has_closure_id = !info()->closure().is_null() && | 889 WriteTranslationFrame(environment, translation); |
892 !info()->closure().is_identical_to(environment->closure()); | |
893 int closure_id = has_closure_id | |
894 ? DefineDeoptimizationLiteral(environment->closure()) | |
895 : Translation::kSelfLiteralId; | |
896 switch (environment->frame_type()) { | |
897 case JS_FUNCTION: | |
898 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | |
899 break; | |
900 case JS_CONSTRUCT: | |
901 translation->BeginConstructStubFrame(closure_id, translation_size); | |
902 break; | |
903 case JS_GETTER: | |
904 DCHECK(translation_size == 1); | |
905 DCHECK(height == 0); | |
906 translation->BeginGetterStubFrame(closure_id); | |
907 break; | |
908 case JS_SETTER: | |
909 DCHECK(translation_size == 2); | |
910 DCHECK(height == 0); | |
911 translation->BeginSetterStubFrame(closure_id); | |
912 break; | |
913 case ARGUMENTS_ADAPTOR: | |
914 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | |
915 break; | |
916 case STUB: | |
917 translation->BeginCompiledStubFrame(translation_size); | |
918 break; | |
919 default: | |
920 UNREACHABLE(); | |
921 } | |
922 | 890 |
923 int object_index = 0; | 891 int object_index = 0; |
924 int dematerialized_index = 0; | 892 int dematerialized_index = 0; |
925 for (int i = 0; i < translation_size; ++i) { | 893 for (int i = 0; i < translation_size; ++i) { |
926 LOperand* value = environment->values()->at(i); | 894 LOperand* value = environment->values()->at(i); |
927 AddToTranslation(environment, | 895 AddToTranslation(environment, |
928 translation, | 896 translation, |
929 value, | 897 value, |
930 environment->HasTaggedValueAt(i), | 898 environment->HasTaggedValueAt(i), |
931 environment->HasUint32ValueAt(i), | 899 environment->HasUint32ValueAt(i), |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 data->SetAstId(i, env->ast_id()); | 1212 data->SetAstId(i, env->ast_id()); |
1245 data->SetTranslationIndex(i, Smi::FromInt(env->translation_index())); | 1213 data->SetTranslationIndex(i, Smi::FromInt(env->translation_index())); |
1246 data->SetArgumentsStackHeight(i, | 1214 data->SetArgumentsStackHeight(i, |
1247 Smi::FromInt(env->arguments_stack_height())); | 1215 Smi::FromInt(env->arguments_stack_height())); |
1248 data->SetPc(i, Smi::FromInt(env->pc_offset())); | 1216 data->SetPc(i, Smi::FromInt(env->pc_offset())); |
1249 } | 1217 } |
1250 code->set_deoptimization_data(*data); | 1218 code->set_deoptimization_data(*data); |
1251 } | 1219 } |
1252 | 1220 |
1253 | 1221 |
1254 int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) { | |
1255 int result = deoptimization_literals_.length(); | |
1256 for (int i = 0; i < deoptimization_literals_.length(); ++i) { | |
1257 if (deoptimization_literals_[i].is_identical_to(literal)) return i; | |
1258 } | |
1259 deoptimization_literals_.Add(literal, zone()); | |
1260 return result; | |
1261 } | |
1262 | |
1263 | |
1264 void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() { | 1222 void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() { |
1265 DCHECK_EQ(0, deoptimization_literals_.length()); | 1223 DCHECK_EQ(0, deoptimization_literals_.length()); |
1266 for (auto function : chunk()->inlined_functions()) { | 1224 for (auto function : chunk()->inlined_functions()) { |
1267 DefineDeoptimizationLiteral(function); | 1225 DefineDeoptimizationLiteral(function); |
1268 } | 1226 } |
1269 inlined_function_count_ = deoptimization_literals_.length(); | 1227 inlined_function_count_ = deoptimization_literals_.length(); |
1270 } | 1228 } |
1271 | 1229 |
1272 | 1230 |
1273 void LCodeGen::RecordSafepointWithLazyDeopt( | 1231 void LCodeGen::RecordSafepointWithLazyDeopt( |
(...skipping 5170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6402 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6445 } | 6403 } |
6446 | 6404 |
6447 | 6405 |
6448 #undef __ | 6406 #undef __ |
6449 | 6407 |
6450 } // namespace internal | 6408 } // namespace internal |
6451 } // namespace v8 | 6409 } // namespace v8 |
6452 | 6410 |
6453 #endif // V8_TARGET_ARCH_X87 | 6411 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |