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

Side by Side Diff: src/ic/x64/ic-compiler-x64.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/mips64/ic-compiler-mips64.cc ('k') | src/ic/x87/ic-compiler-x87.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_X64 7 #if V8_TARGET_ARCH_X64
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 24 matching lines...) Expand all
35 35
36 36
37 #undef __ 37 #undef __
38 #define __ ACCESS_MASM(masm()) 38 #define __ ACCESS_MASM(masm())
39 39
40 40
41 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( 41 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
42 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, 42 MapHandleList* receiver_maps, CodeHandleList* handler_stubs,
43 MapHandleList* transitioned_maps) { 43 MapHandleList* transitioned_maps) {
44 Label miss; 44 Label miss;
45 __ JumpIfSmi(receiver(), &miss); 45 __ JumpIfSmi(receiver(), &miss, Label::kNear);
46 46
47 Register map_reg = scratch1(); 47 __ movp(scratch1(), FieldOperand(receiver(), HeapObject::kMapOffset));
48 __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset));
49 int receiver_count = receiver_maps->length(); 48 int receiver_count = receiver_maps->length();
50 for (int i = 0; i < receiver_count; ++i) { 49 for (int i = 0; i < receiver_count; ++i) {
51 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_maps->at(i));
52 // Check map and tail call if there's a match 50 // Check map and tail call if there's a match
53 __ CmpWeakValue(map_reg, cell, scratch2()); 51 __ Cmp(scratch1(), receiver_maps->at(i));
54 if (transitioned_maps->at(i).is_null()) { 52 if (transitioned_maps->at(i).is_null()) {
55 __ j(equal, handler_stubs->at(i), RelocInfo::CODE_TARGET); 53 __ j(equal, handler_stubs->at(i), RelocInfo::CODE_TARGET);
56 } else { 54 } else {
57 Label next_map; 55 Label next_map;
58 __ j(not_equal, &next_map, Label::kNear); 56 __ j(not_equal, &next_map, Label::kNear);
59 Handle<WeakCell> cell = Map::WeakCellForMap(transitioned_maps->at(i)); 57 __ Move(transition_map(), transitioned_maps->at(i),
60 __ LoadWeakValue(transition_map(), cell, &miss); 58 RelocInfo::EMBEDDED_OBJECT);
61 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); 59 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET);
62 __ bind(&next_map); 60 __ bind(&next_map);
63 } 61 }
64 } 62 }
65 63
66 __ bind(&miss); 64 __ bind(&miss);
67 65
68 TailCallBuiltin(masm(), MissBuiltin(kind())); 66 TailCallBuiltin(masm(), MissBuiltin(kind()));
69 67
70 // Return the generated code. 68 // Return the generated code.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 DCHECK(kind() != Code::KEYED_STORE_IC || 102 DCHECK(kind() != Code::KEYED_STORE_IC ||
105 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); 103 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister()));
106 __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); 104 __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset));
107 int receiver_count = types->length(); 105 int receiver_count = types->length();
108 int number_of_handled_maps = 0; 106 int number_of_handled_maps = 0;
109 for (int current = 0; current < receiver_count; ++current) { 107 for (int current = 0; current < receiver_count; ++current) {
110 Handle<HeapType> type = types->at(current); 108 Handle<HeapType> type = types->at(current);
111 Handle<Map> map = IC::TypeToMap(*type, isolate()); 109 Handle<Map> map = IC::TypeToMap(*type, isolate());
112 if (!map->is_deprecated()) { 110 if (!map->is_deprecated()) {
113 number_of_handled_maps++; 111 number_of_handled_maps++;
114 Handle<WeakCell> cell = Map::WeakCellForMap(map);
115 // Check map and tail call if there's a match 112 // Check map and tail call if there's a match
116 __ CmpWeakValue(map_reg, cell, scratch2()); 113 __ Cmp(map_reg, map);
117 if (type->Is(HeapType::Number())) { 114 if (type->Is(HeapType::Number())) {
118 DCHECK(!number_case.is_unused()); 115 DCHECK(!number_case.is_unused());
119 __ bind(&number_case); 116 __ bind(&number_case);
120 } 117 }
121 __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); 118 __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET);
122 } 119 }
123 } 120 }
124 DCHECK(number_of_handled_maps > 0); 121 DCHECK(number_of_handled_maps > 0);
125 122
126 __ bind(&miss); 123 __ bind(&miss);
127 TailCallBuiltin(masm(), MissBuiltin(kind())); 124 TailCallBuiltin(masm(), MissBuiltin(kind()));
128 125
129 // Return the generated code. 126 // Return the generated code.
130 InlineCacheState state = 127 InlineCacheState state =
131 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; 128 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC;
132 return GetCode(kind(), type, name, state); 129 return GetCode(kind(), type, name, state);
133 } 130 }
134 131
135 132
136 #undef __ 133 #undef __
137 } 134 }
138 } // namespace v8::internal 135 } // namespace v8::internal
139 136
140 #endif // V8_TARGET_ARCH_X64 137 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/mips64/ic-compiler-mips64.cc ('k') | src/ic/x87/ic-compiler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698