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

Side by Side Diff: src/arm/lithium-arm.cc

Issue 1304633002: Correctify instanceof and make it optimizable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Add MIPS/MIPS64 ports. Created 5 years, 4 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/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.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 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 <sstream> 5 #include <sstream>
6 6
7 #include "src/arm/lithium-codegen-arm.h" 7 #include "src/arm/lithium-codegen-arm.h"
8 #include "src/hydrogen-osr.h" 8 #include "src/hydrogen-osr.h"
9 #include "src/lithium-inl.h" 9 #include "src/lithium-inl.h"
10 10
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 916 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
917 instr = AssignPointerMap(instr); 917 instr = AssignPointerMap(instr);
918 } 918 }
919 if (FLAG_stress_environments && !instr->HasEnvironment()) { 919 if (FLAG_stress_environments && !instr->HasEnvironment()) {
920 instr = AssignEnvironment(instr); 920 instr = AssignEnvironment(instr);
921 } 921 }
922 chunk_->AddInstruction(instr, current_block_); 922 chunk_->AddInstruction(instr, current_block_);
923 923
924 if (instr->IsCall()) { 924 if (instr->IsCall()) {
925 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; 925 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
926 LInstruction* instruction_needing_environment = NULL;
927 if (hydrogen_val->HasObservableSideEffects()) { 926 if (hydrogen_val->HasObservableSideEffects()) {
928 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); 927 HSimulate* sim = HSimulate::cast(hydrogen_val->next());
929 instruction_needing_environment = instr;
930 sim->ReplayEnvironment(current_block_->last_environment()); 928 sim->ReplayEnvironment(current_block_->last_environment());
931 hydrogen_value_for_lazy_bailout = sim; 929 hydrogen_value_for_lazy_bailout = sim;
932 } 930 }
933 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); 931 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
934 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); 932 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
935 chunk_->AddInstruction(bailout, current_block_); 933 chunk_->AddInstruction(bailout, current_block_);
936 if (instruction_needing_environment != NULL) {
937 // Store the lazy deopt environment with the instruction if needed.
938 // Right now it is only used for LInstanceOfKnownGlobal.
939 instruction_needing_environment->
940 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
941 }
942 } 934 }
943 } 935 }
944 936
945 937
946 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 938 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
947 return new(zone()) LGoto(instr->FirstSuccessor()); 939 return new(zone()) LGoto(instr->FirstSuccessor());
948 } 940 }
949 941
950 942
951 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 943 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 } 979 }
988 980
989 981
990 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 982 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
991 info()->MarkAsRequiresFrame(); 983 info()->MarkAsRequiresFrame();
992 return DefineAsRegister(new(zone()) LArgumentsElements); 984 return DefineAsRegister(new(zone()) LArgumentsElements);
993 } 985 }
994 986
995 987
996 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 988 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
989 LOperand* left =
990 UseFixed(instr->left(), InstanceOfDescriptor::LeftRegister());
991 LOperand* right =
992 UseFixed(instr->right(), InstanceOfDescriptor::RightRegister());
997 LOperand* context = UseFixed(instr->context(), cp); 993 LOperand* context = UseFixed(instr->context(), cp);
998 LInstanceOf* result = 994 LInstanceOf* result = new (zone()) LInstanceOf(context, left, right);
999 new(zone()) LInstanceOf(context, UseFixed(instr->left(), r0),
1000 UseFixed(instr->right(), r1));
1001 return MarkAsCall(DefineFixed(result, r0), instr); 995 return MarkAsCall(DefineFixed(result, r0), instr);
1002 } 996 }
1003 997
1004 998
1005 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( 999 LInstruction* LChunkBuilder::DoHasInPrototypeChainAndBranch(
1006 HInstanceOfKnownGlobal* instr) { 1000 HHasInPrototypeChainAndBranch* instr) {
1007 LInstanceOfKnownGlobal* result = 1001 LOperand* object = UseRegister(instr->object());
1008 new(zone()) LInstanceOfKnownGlobal( 1002 LOperand* prototype = UseRegister(instr->prototype());
1009 UseFixed(instr->context(), cp), 1003 return new (zone()) LHasInPrototypeChainAndBranch(object, prototype);
1010 UseFixed(instr->left(), r0),
1011 FixedTemp(r4));
1012 return MarkAsCall(DefineFixed(result, r0), instr);
1013 } 1004 }
1014 1005
1015 1006
1016 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { 1007 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1017 LOperand* receiver = UseRegisterAtStart(instr->receiver()); 1008 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1018 LOperand* function = UseRegisterAtStart(instr->function()); 1009 LOperand* function = UseRegisterAtStart(instr->function());
1019 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); 1010 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function);
1020 return AssignEnvironment(DefineAsRegister(result)); 1011 return AssignEnvironment(DefineAsRegister(result));
1021 } 1012 }
1022 1013
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 HAllocateBlockContext* instr) { 2707 HAllocateBlockContext* instr) {
2717 LOperand* context = UseFixed(instr->context(), cp); 2708 LOperand* context = UseFixed(instr->context(), cp);
2718 LOperand* function = UseRegisterAtStart(instr->function()); 2709 LOperand* function = UseRegisterAtStart(instr->function());
2719 LAllocateBlockContext* result = 2710 LAllocateBlockContext* result =
2720 new(zone()) LAllocateBlockContext(context, function); 2711 new(zone()) LAllocateBlockContext(context, function);
2721 return MarkAsCall(DefineFixed(result, cp), instr); 2712 return MarkAsCall(DefineFixed(result, cp), instr);
2722 } 2713 }
2723 2714
2724 } // namespace internal 2715 } // namespace internal
2725 } // namespace v8 2716 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698