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

Side by Side Diff: src/ia32/lithium-ia32.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/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.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_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/hydrogen-osr.h" 9 #include "src/hydrogen-osr.h"
10 #include "src/ia32/lithium-codegen-ia32.h" 10 #include "src/ia32/lithium-codegen-ia32.h"
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 957 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
958 instr = AssignPointerMap(instr); 958 instr = AssignPointerMap(instr);
959 } 959 }
960 if (FLAG_stress_environments && !instr->HasEnvironment()) { 960 if (FLAG_stress_environments && !instr->HasEnvironment()) {
961 instr = AssignEnvironment(instr); 961 instr = AssignEnvironment(instr);
962 } 962 }
963 chunk_->AddInstruction(instr, current_block_); 963 chunk_->AddInstruction(instr, current_block_);
964 964
965 if (instr->IsCall()) { 965 if (instr->IsCall()) {
966 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; 966 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
967 LInstruction* instruction_needing_environment = NULL;
968 if (hydrogen_val->HasObservableSideEffects()) { 967 if (hydrogen_val->HasObservableSideEffects()) {
969 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); 968 HSimulate* sim = HSimulate::cast(hydrogen_val->next());
970 instruction_needing_environment = instr;
971 sim->ReplayEnvironment(current_block_->last_environment()); 969 sim->ReplayEnvironment(current_block_->last_environment());
972 hydrogen_value_for_lazy_bailout = sim; 970 hydrogen_value_for_lazy_bailout = sim;
973 } 971 }
974 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); 972 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
975 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); 973 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
976 chunk_->AddInstruction(bailout, current_block_); 974 chunk_->AddInstruction(bailout, current_block_);
977 if (instruction_needing_environment != NULL) {
978 // Store the lazy deopt environment with the instruction if needed.
979 // Right now it is only used for LInstanceOfKnownGlobal.
980 instruction_needing_environment->
981 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
982 }
983 } 975 }
984 } 976 }
985 977
986 978
987 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 979 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
988 return new(zone()) LGoto(instr->FirstSuccessor()); 980 return new(zone()) LGoto(instr->FirstSuccessor());
989 } 981 }
990 982
991 983
992 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 984 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 } 1019 }
1028 1020
1029 1021
1030 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1022 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1031 info()->MarkAsRequiresFrame(); 1023 info()->MarkAsRequiresFrame();
1032 return DefineAsRegister(new(zone()) LArgumentsElements); 1024 return DefineAsRegister(new(zone()) LArgumentsElements);
1033 } 1025 }
1034 1026
1035 1027
1036 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1028 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1037 LOperand* left = UseFixed(instr->left(), InstanceofStub::left()); 1029 LOperand* left =
1038 LOperand* right = UseFixed(instr->right(), InstanceofStub::right()); 1030 UseFixed(instr->left(), InstanceOfDescriptor::LeftRegister());
1031 LOperand* right =
1032 UseFixed(instr->right(), InstanceOfDescriptor::RightRegister());
1039 LOperand* context = UseFixed(instr->context(), esi); 1033 LOperand* context = UseFixed(instr->context(), esi);
1040 LInstanceOf* result = new(zone()) LInstanceOf(context, left, right); 1034 LInstanceOf* result = new (zone()) LInstanceOf(context, left, right);
1041 return MarkAsCall(DefineFixed(result, eax), instr); 1035 return MarkAsCall(DefineFixed(result, eax), instr);
1042 } 1036 }
1043 1037
1044 1038
1045 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( 1039 LInstruction* LChunkBuilder::DoHasInPrototypeChainAndBranch(
1046 HInstanceOfKnownGlobal* instr) { 1040 HHasInPrototypeChainAndBranch* instr) {
1047 LInstanceOfKnownGlobal* result = 1041 LOperand* object = UseRegister(instr->object());
1048 new(zone()) LInstanceOfKnownGlobal( 1042 LOperand* prototype = UseRegister(instr->prototype());
1049 UseFixed(instr->context(), esi), 1043 LOperand* temp = TempRegister();
1050 UseFixed(instr->left(), InstanceofStub::left()), 1044 return new (zone()) LHasInPrototypeChainAndBranch(object, prototype, temp);
1051 FixedTemp(edi));
1052 return MarkAsCall(DefineFixed(result, eax), instr);
1053 } 1045 }
1054 1046
1055 1047
1056 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { 1048 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1057 LOperand* receiver = UseRegister(instr->receiver()); 1049 LOperand* receiver = UseRegister(instr->receiver());
1058 LOperand* function = UseRegister(instr->function()); 1050 LOperand* function = UseRegister(instr->function());
1059 LOperand* temp = TempRegister(); 1051 LOperand* temp = TempRegister();
1060 LWrapReceiver* result = 1052 LWrapReceiver* result =
1061 new(zone()) LWrapReceiver(receiver, function, temp); 1053 new(zone()) LWrapReceiver(receiver, function, temp);
1062 return AssignEnvironment(DefineSameAsFirst(result)); 1054 return AssignEnvironment(DefineSameAsFirst(result));
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 LAllocateBlockContext* result = 2768 LAllocateBlockContext* result =
2777 new(zone()) LAllocateBlockContext(context, function); 2769 new(zone()) LAllocateBlockContext(context, function);
2778 return MarkAsCall(DefineFixed(result, esi), instr); 2770 return MarkAsCall(DefineFixed(result, esi), instr);
2779 } 2771 }
2780 2772
2781 2773
2782 } // namespace internal 2774 } // namespace internal
2783 } // namespace v8 2775 } // namespace v8
2784 2776
2785 #endif // V8_TARGET_ARCH_IA32 2777 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698