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

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

Issue 792543003: Reland remaining parts 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/arm64/ic-compiler-arm64.cc ('k') | src/ic/mips/ic-compiler-mips.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_IA32 7 #if V8_TARGET_ARCH_IA32
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 __ cmp(map_reg, map); 78 Handle<WeakCell> cell = Map::WeakCellForMap(map);
79 __ CmpWeakValue(map_reg, cell, scratch2());
79 if (type->Is(HeapType::Number())) { 80 if (type->Is(HeapType::Number())) {
80 DCHECK(!number_case.is_unused()); 81 DCHECK(!number_case.is_unused());
81 __ bind(&number_case); 82 __ bind(&number_case);
82 } 83 }
83 __ j(equal, handlers->at(current)); 84 __ j(equal, handlers->at(current));
84 } 85 }
85 } 86 }
86 DCHECK(number_of_handled_maps != 0); 87 DCHECK(number_of_handled_maps != 0);
87 88
88 __ bind(&miss); 89 __ bind(&miss);
89 TailCallBuiltin(masm(), MissBuiltin(kind())); 90 TailCallBuiltin(masm(), MissBuiltin(kind()));
90 91
91 // Return the generated code. 92 // Return the generated code.
92 InlineCacheState state = 93 InlineCacheState state =
93 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; 94 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC;
94 return GetCode(kind(), type, name, state); 95 return GetCode(kind(), type, name, state);
95 } 96 }
96 97
97 98
98 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( 99 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
99 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, 100 MapHandleList* receiver_maps, CodeHandleList* handler_stubs,
100 MapHandleList* transitioned_maps) { 101 MapHandleList* transitioned_maps) {
101 Label miss; 102 Label miss;
102 __ JumpIfSmi(receiver(), &miss, Label::kNear); 103 __ JumpIfSmi(receiver(), &miss);
103 __ mov(scratch1(), FieldOperand(receiver(), HeapObject::kMapOffset)); 104 Register map_reg = scratch1();
105 __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset));
104 for (int i = 0; i < receiver_maps->length(); ++i) { 106 for (int i = 0; i < receiver_maps->length(); ++i) {
105 __ cmp(scratch1(), receiver_maps->at(i)); 107 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_maps->at(i));
108 __ CmpWeakValue(map_reg, cell, scratch2());
106 if (transitioned_maps->at(i).is_null()) { 109 if (transitioned_maps->at(i).is_null()) {
107 __ j(equal, handler_stubs->at(i)); 110 __ j(equal, handler_stubs->at(i));
108 } else { 111 } else {
109 Label next_map; 112 Label next_map;
110 __ j(not_equal, &next_map, Label::kNear); 113 __ j(not_equal, &next_map, Label::kNear);
111 __ mov(transition_map(), Immediate(transitioned_maps->at(i))); 114 Handle<WeakCell> cell = Map::WeakCellForMap(transitioned_maps->at(i));
115 __ LoadWeakValue(transition_map(), cell, &miss);
112 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); 116 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET);
113 __ bind(&next_map); 117 __ bind(&next_map);
114 } 118 }
115 } 119 }
116 __ bind(&miss); 120 __ bind(&miss);
117 TailCallBuiltin(masm(), MissBuiltin(kind())); 121 TailCallBuiltin(masm(), MissBuiltin(kind()));
118 122
119 // Return the generated code. 123 // Return the generated code.
120 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); 124 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
121 } 125 }
122 126
123 127
124 #undef __ 128 #undef __
125 } 129 }
126 } // namespace v8::internal 130 } // namespace v8::internal
127 131
128 #endif // V8_TARGET_ARCH_IA32 132 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ic/arm64/ic-compiler-arm64.cc ('k') | src/ic/mips/ic-compiler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698