Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 1175963002: Make writing of frame translation platform independent. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x87/lithium-codegen-x87.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 7 #if V8_TARGET_ARCH_X64
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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 530 }
531 } 531 }
532 532
533 533
534 void LCodeGen::WriteTranslation(LEnvironment* environment, 534 void LCodeGen::WriteTranslation(LEnvironment* environment,
535 Translation* translation) { 535 Translation* translation) {
536 if (environment == NULL) return; 536 if (environment == NULL) return;
537 537
538 // The translation includes one command per value in the environment. 538 // The translation includes one command per value in the environment.
539 int translation_size = environment->translation_size(); 539 int translation_size = environment->translation_size();
540 // The output frame height does not include the parameters.
541 int height = translation_size - environment->parameter_count();
542 540
543 WriteTranslation(environment->outer(), translation); 541 WriteTranslation(environment->outer(), translation);
544 542 WriteTranslationFrame(environment, translation);
545 switch (environment->frame_type()) {
546 case JS_FUNCTION: {
547 int shared_id = DefineDeoptimizationLiteral(
548 environment->entry() ? environment->entry()->shared()
549 : info()->shared_info());
550 translation->BeginJSFrame(environment->ast_id(), shared_id, height);
551 if (info()->closure().is_identical_to(environment->closure())) {
552 translation->StoreJSFrameFunction();
553 } else {
554 int closure_id = DefineDeoptimizationLiteral(environment->closure());
555 translation->StoreLiteral(closure_id);
556 }
557 break;
558 }
559 case JS_CONSTRUCT: {
560 int shared_id = DefineDeoptimizationLiteral(
561 environment->entry() ? environment->entry()->shared()
562 : info()->shared_info());
563 translation->BeginConstructStubFrame(shared_id, translation_size);
564 if (info()->closure().is_identical_to(environment->closure())) {
565 translation->StoreJSFrameFunction();
566 } else {
567 int closure_id = DefineDeoptimizationLiteral(environment->closure());
568 translation->StoreLiteral(closure_id);
569 }
570 break;
571 }
572 case JS_GETTER: {
573 DCHECK(translation_size == 1);
574 DCHECK(height == 0);
575 int shared_id = DefineDeoptimizationLiteral(
576 environment->entry() ? environment->entry()->shared()
577 : info()->shared_info());
578 translation->BeginGetterStubFrame(shared_id);
579 if (info()->closure().is_identical_to(environment->closure())) {
580 translation->StoreJSFrameFunction();
581 } else {
582 int closure_id = DefineDeoptimizationLiteral(environment->closure());
583 translation->StoreLiteral(closure_id);
584 }
585 break;
586 }
587 case JS_SETTER: {
588 DCHECK(translation_size == 2);
589 DCHECK(height == 0);
590 int shared_id = DefineDeoptimizationLiteral(
591 environment->entry() ? environment->entry()->shared()
592 : info()->shared_info());
593 translation->BeginSetterStubFrame(shared_id);
594 if (info()->closure().is_identical_to(environment->closure())) {
595 translation->StoreJSFrameFunction();
596 } else {
597 int closure_id = DefineDeoptimizationLiteral(environment->closure());
598 translation->StoreLiteral(closure_id);
599 }
600 break;
601 }
602 case ARGUMENTS_ADAPTOR: {
603 int shared_id = DefineDeoptimizationLiteral(
604 environment->entry() ? environment->entry()->shared()
605 : info()->shared_info());
606 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size);
607 if (info()->closure().is_identical_to(environment->closure())) {
608 translation->StoreJSFrameFunction();
609 } else {
610 int closure_id = DefineDeoptimizationLiteral(environment->closure());
611 translation->StoreLiteral(closure_id);
612 }
613 break;
614 }
615 case STUB:
616 translation->BeginCompiledStubFrame(translation_size);
617 break;
618 }
619 543
620 int object_index = 0; 544 int object_index = 0;
621 int dematerialized_index = 0; 545 int dematerialized_index = 0;
622 for (int i = 0; i < translation_size; ++i) { 546 for (int i = 0; i < translation_size; ++i) {
623 LOperand* value = environment->values()->at(i); 547 LOperand* value = environment->values()->at(i);
624 AddToTranslation( 548 AddToTranslation(
625 environment, translation, value, environment->HasTaggedValueAt(i), 549 environment, translation, value, environment->HasTaggedValueAt(i),
626 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); 550 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index);
627 } 551 }
628 } 552 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 data->SetAstId(i, env->ast_id()); 847 data->SetAstId(i, env->ast_id());
924 data->SetTranslationIndex(i, Smi::FromInt(env->translation_index())); 848 data->SetTranslationIndex(i, Smi::FromInt(env->translation_index()));
925 data->SetArgumentsStackHeight(i, 849 data->SetArgumentsStackHeight(i,
926 Smi::FromInt(env->arguments_stack_height())); 850 Smi::FromInt(env->arguments_stack_height()));
927 data->SetPc(i, Smi::FromInt(env->pc_offset())); 851 data->SetPc(i, Smi::FromInt(env->pc_offset()));
928 } 852 }
929 code->set_deoptimization_data(*data); 853 code->set_deoptimization_data(*data);
930 } 854 }
931 855
932 856
933 int LCodeGen::DefineDeoptimizationLiteral(Handle<Object> literal) {
934 int result = deoptimization_literals_.length();
935 for (int i = 0; i < deoptimization_literals_.length(); ++i) {
936 if (deoptimization_literals_[i].is_identical_to(literal)) return i;
937 }
938 deoptimization_literals_.Add(literal, zone());
939 return result;
940 }
941
942
943 void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() { 857 void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
944 DCHECK_EQ(0, deoptimization_literals_.length()); 858 DCHECK_EQ(0, deoptimization_literals_.length());
945 for (auto function : chunk()->inlined_functions()) { 859 for (auto function : chunk()->inlined_functions()) {
946 DefineDeoptimizationLiteral(function); 860 DefineDeoptimizationLiteral(function);
947 } 861 }
948 inlined_function_count_ = deoptimization_literals_.length(); 862 inlined_function_count_ = deoptimization_literals_.length();
949 } 863 }
950 864
951 865
952 void LCodeGen::RecordSafepointWithLazyDeopt( 866 void LCodeGen::RecordSafepointWithLazyDeopt(
(...skipping 5116 matching lines...) Expand 10 before | Expand all | Expand 10 after
6069 RecordSafepoint(Safepoint::kNoLazyDeopt); 5983 RecordSafepoint(Safepoint::kNoLazyDeopt);
6070 } 5984 }
6071 5985
6072 5986
6073 #undef __ 5987 #undef __
6074 5988
6075 } // namespace internal 5989 } // namespace internal
6076 } // namespace v8 5990 } // namespace v8
6077 5991
6078 #endif // V8_TARGET_ARCH_X64 5992 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x87/lithium-codegen-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698