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

Side by Side Diff: src/ic/x87/ic-compiler-x87.cc

Issue 771033003: Revert of Use weak cells in map checks in polymorphic ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/ic/x64/ic-compiler-x64.cc ('k') | src/mips/macro-assembler-mips.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 "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/ic/ic.h" 9 #include "src/ic/ic.h"
10 #include "src/ic/ic-compiler.h" 10 #include "src/ic/ic-compiler.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DCHECK(kind() != Code::KEYED_STORE_IC || 68 DCHECK(kind() != Code::KEYED_STORE_IC ||
69 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); 69 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister()));
70 __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); 70 __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset));
71 int receiver_count = types->length(); 71 int receiver_count = types->length();
72 int number_of_handled_maps = 0; 72 int number_of_handled_maps = 0;
73 for (int current = 0; current < receiver_count; ++current) { 73 for (int current = 0; current < receiver_count; ++current) {
74 Handle<HeapType> type = types->at(current); 74 Handle<HeapType> type = types->at(current);
75 Handle<Map> map = IC::TypeToMap(*type, isolate()); 75 Handle<Map> map = IC::TypeToMap(*type, isolate());
76 if (!map->is_deprecated()) { 76 if (!map->is_deprecated()) {
77 number_of_handled_maps++; 77 number_of_handled_maps++;
78 Handle<WeakCell> cell = Map::WeakCellForMap(map); 78 __ cmp(map_reg, map);
79 __ CmpWeakValue(map_reg, cell, scratch2());
80 if (type->Is(HeapType::Number())) { 79 if (type->Is(HeapType::Number())) {
81 DCHECK(!number_case.is_unused()); 80 DCHECK(!number_case.is_unused());
82 __ bind(&number_case); 81 __ bind(&number_case);
83 } 82 }
84 __ j(equal, handlers->at(current)); 83 __ j(equal, handlers->at(current));
85 } 84 }
86 } 85 }
87 DCHECK(number_of_handled_maps != 0); 86 DCHECK(number_of_handled_maps != 0);
88 87
89 __ bind(&miss); 88 __ bind(&miss);
90 TailCallBuiltin(masm(), MissBuiltin(kind())); 89 TailCallBuiltin(masm(), MissBuiltin(kind()));
91 90
92 // Return the generated code. 91 // Return the generated code.
93 InlineCacheState state = 92 InlineCacheState state =
94 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; 93 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC;
95 return GetCode(kind(), type, name, state); 94 return GetCode(kind(), type, name, state);
96 } 95 }
97 96
98 97
99 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( 98 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
100 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, 99 MapHandleList* receiver_maps, CodeHandleList* handler_stubs,
101 MapHandleList* transitioned_maps) { 100 MapHandleList* transitioned_maps) {
102 Label miss; 101 Label miss;
103 __ JumpIfSmi(receiver(), &miss, Label::kNear); 102 __ JumpIfSmi(receiver(), &miss, Label::kNear);
104 Register map_reg = scratch1(); 103 __ mov(scratch1(), FieldOperand(receiver(), HeapObject::kMapOffset));
105 __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset));
106 for (int i = 0; i < receiver_maps->length(); ++i) { 104 for (int i = 0; i < receiver_maps->length(); ++i) {
107 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_maps->at(i)); 105 __ cmp(scratch1(), receiver_maps->at(i));
108 __ CmpWeakValue(map_reg, cell, scratch2());
109 if (transitioned_maps->at(i).is_null()) { 106 if (transitioned_maps->at(i).is_null()) {
110 __ j(equal, handler_stubs->at(i)); 107 __ j(equal, handler_stubs->at(i));
111 } else { 108 } else {
112 Label next_map; 109 Label next_map;
113 __ j(not_equal, &next_map, Label::kNear); 110 __ j(not_equal, &next_map, Label::kNear);
114 Handle<WeakCell> cell = Map::WeakCellForMap(transitioned_maps->at(i)); 111 __ mov(transition_map(), Immediate(transitioned_maps->at(i)));
115 __ LoadWeakValue(transition_map(), cell, &miss);
116 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); 112 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET);
117 __ bind(&next_map); 113 __ bind(&next_map);
118 } 114 }
119 } 115 }
120 __ bind(&miss); 116 __ bind(&miss);
121 TailCallBuiltin(masm(), MissBuiltin(kind())); 117 TailCallBuiltin(masm(), MissBuiltin(kind()));
122 118
123 // Return the generated code. 119 // Return the generated code.
124 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); 120 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
125 } 121 }
126 122
127 123
128 #undef __ 124 #undef __
129 } 125 }
130 } // namespace v8::internal 126 } // namespace v8::internal
131 127
132 #endif // V8_TARGET_ARCH_X87 128 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/ic/x64/ic-compiler-x64.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698