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

Side by Side Diff: src/x64/lithium-x64.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/x64/lithium-x64.h ('k') | src/x64/macro-assembler-x64.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 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/hydrogen-osr.h" 9 #include "src/hydrogen-osr.h"
10 #include "src/lithium-inl.h" 10 #include "src/lithium-inl.h"
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 940 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
941 instr = AssignPointerMap(instr); 941 instr = AssignPointerMap(instr);
942 } 942 }
943 if (FLAG_stress_environments && !instr->HasEnvironment()) { 943 if (FLAG_stress_environments && !instr->HasEnvironment()) {
944 instr = AssignEnvironment(instr); 944 instr = AssignEnvironment(instr);
945 } 945 }
946 chunk_->AddInstruction(instr, current_block_); 946 chunk_->AddInstruction(instr, current_block_);
947 947
948 if (instr->IsCall()) { 948 if (instr->IsCall()) {
949 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; 949 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
950 LInstruction* instruction_needing_environment = NULL;
951 if (hydrogen_val->HasObservableSideEffects()) { 950 if (hydrogen_val->HasObservableSideEffects()) {
952 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); 951 HSimulate* sim = HSimulate::cast(hydrogen_val->next());
953 instruction_needing_environment = instr;
954 sim->ReplayEnvironment(current_block_->last_environment()); 952 sim->ReplayEnvironment(current_block_->last_environment());
955 hydrogen_value_for_lazy_bailout = sim; 953 hydrogen_value_for_lazy_bailout = sim;
956 } 954 }
957 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); 955 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
958 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); 956 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
959 chunk_->AddInstruction(bailout, current_block_); 957 chunk_->AddInstruction(bailout, current_block_);
960 if (instruction_needing_environment != NULL) {
961 // Store the lazy deopt environment with the instruction if needed.
962 // Right now it is only used for LInstanceOfKnownGlobal.
963 instruction_needing_environment->
964 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
965 }
966 } 958 }
967 } 959 }
968 960
969 961
970 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 962 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
971 return new(zone()) LGoto(instr->FirstSuccessor()); 963 return new(zone()) LGoto(instr->FirstSuccessor());
972 } 964 }
973 965
974 966
975 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { 967 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 } 1001 }
1010 1002
1011 1003
1012 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1004 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1013 info()->MarkAsRequiresFrame(); 1005 info()->MarkAsRequiresFrame();
1014 return DefineAsRegister(new(zone()) LArgumentsElements); 1006 return DefineAsRegister(new(zone()) LArgumentsElements);
1015 } 1007 }
1016 1008
1017 1009
1018 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1010 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1019 LOperand* left = UseFixed(instr->left(), rax); 1011 LOperand* left =
1020 LOperand* right = UseFixed(instr->right(), rdx); 1012 UseFixed(instr->left(), InstanceOfDescriptor::LeftRegister());
1013 LOperand* right =
1014 UseFixed(instr->right(), InstanceOfDescriptor::RightRegister());
1021 LOperand* context = UseFixed(instr->context(), rsi); 1015 LOperand* context = UseFixed(instr->context(), rsi);
1022 LInstanceOf* result = new(zone()) LInstanceOf(context, left, right); 1016 LInstanceOf* result = new (zone()) LInstanceOf(context, left, right);
1023 return MarkAsCall(DefineFixed(result, rax), instr); 1017 return MarkAsCall(DefineFixed(result, rax), instr);
1024 } 1018 }
1025 1019
1026 1020
1027 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( 1021 LInstruction* LChunkBuilder::DoHasInPrototypeChainAndBranch(
1028 HInstanceOfKnownGlobal* instr) { 1022 HHasInPrototypeChainAndBranch* instr) {
1029 LInstanceOfKnownGlobal* result = 1023 LOperand* object = UseRegister(instr->object());
1030 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->context(), rsi), 1024 LOperand* prototype = UseRegister(instr->prototype());
1031 UseFixed(instr->left(), rax), 1025 return new (zone()) LHasInPrototypeChainAndBranch(object, prototype);
1032 FixedTemp(rdi));
1033 return MarkAsCall(DefineFixed(result, rax), instr);
1034 } 1026 }
1035 1027
1036 1028
1037 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { 1029 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1038 LOperand* receiver = UseRegister(instr->receiver()); 1030 LOperand* receiver = UseRegister(instr->receiver());
1039 LOperand* function = UseRegisterAtStart(instr->function()); 1031 LOperand* function = UseRegisterAtStart(instr->function());
1040 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); 1032 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function);
1041 return AssignEnvironment(DefineSameAsFirst(result)); 1033 return AssignEnvironment(DefineSameAsFirst(result));
1042 } 1034 }
1043 1035
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 LAllocateBlockContext* result = 2753 LAllocateBlockContext* result =
2762 new(zone()) LAllocateBlockContext(context, function); 2754 new(zone()) LAllocateBlockContext(context, function);
2763 return MarkAsCall(DefineFixed(result, rsi), instr); 2755 return MarkAsCall(DefineFixed(result, rsi), instr);
2764 } 2756 }
2765 2757
2766 2758
2767 } // namespace internal 2759 } // namespace internal
2768 } // namespace v8 2760 } // namespace v8
2769 2761
2770 #endif // V8_TARGET_ARCH_X64 2762 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698