OLD | NEW |
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 18 matching lines...) Expand all Loading... |
29 __ push(ebx); // return address | 29 __ push(ebx); // return address |
30 | 30 |
31 // Do tail-call to runtime routine. | 31 // Do tail-call to runtime routine. |
32 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | 32 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); |
33 } | 33 } |
34 | 34 |
35 | 35 |
36 #undef __ | 36 #undef __ |
37 #define __ ACCESS_MASM(masm()) | 37 #define __ ACCESS_MASM(masm()) |
38 | 38 |
39 Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types, | 39 Handle<Code> PropertyICCompiler::CompilePolymorphic(MapHandleList* maps, |
40 CodeHandleList* handlers, | 40 CodeHandleList* handlers, |
41 Handle<Name> name, | 41 Handle<Name> name, |
42 Code::StubType type, | 42 Code::StubType type, |
43 IcCheckType check) { | 43 IcCheckType check) { |
44 Label miss; | 44 Label miss; |
45 | 45 |
46 if (check == PROPERTY && | 46 if (check == PROPERTY && |
47 (kind() == Code::KEYED_STORE_IC || kind() == Code::KEYED_LOAD_IC)) { | 47 (kind() == Code::KEYED_STORE_IC || kind() == Code::KEYED_LOAD_IC)) { |
48 // In case we are compiling an IC for dictionary loads or stores, just | 48 // In case we are compiling an IC for dictionary loads or stores, just |
49 // check whether the name is unique. | 49 // check whether the name is unique. |
50 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { | 50 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { |
51 // Keyed loads with dictionaries shouldn't be here, they go generic. | 51 // Keyed loads with dictionaries shouldn't be here, they go generic. |
52 // The DCHECK is to protect assumptions when --vector-ics is on. | 52 // The DCHECK is to protect assumptions when --vector-ics is on. |
53 DCHECK(kind() != Code::KEYED_LOAD_IC); | 53 DCHECK(kind() != Code::KEYED_LOAD_IC); |
54 Register tmp = scratch1(); | 54 Register tmp = scratch1(); |
55 __ JumpIfSmi(this->name(), &miss); | 55 __ JumpIfSmi(this->name(), &miss); |
56 __ mov(tmp, FieldOperand(this->name(), HeapObject::kMapOffset)); | 56 __ mov(tmp, FieldOperand(this->name(), HeapObject::kMapOffset)); |
57 __ movzx_b(tmp, FieldOperand(tmp, Map::kInstanceTypeOffset)); | 57 __ movzx_b(tmp, FieldOperand(tmp, Map::kInstanceTypeOffset)); |
58 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); | 58 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); |
59 } else { | 59 } else { |
60 __ cmp(this->name(), Immediate(name)); | 60 __ cmp(this->name(), Immediate(name)); |
61 __ j(not_equal, &miss); | 61 __ j(not_equal, &miss); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 Label number_case; | 65 Label number_case; |
66 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; | 66 Label* smi_target = IncludesNumberMap(maps) ? &number_case : &miss; |
67 __ JumpIfSmi(receiver(), smi_target); | 67 __ JumpIfSmi(receiver(), smi_target); |
68 | 68 |
69 // Polymorphic keyed stores may use the map register | 69 // Polymorphic keyed stores may use the map register |
70 Register map_reg = scratch1(); | 70 Register map_reg = scratch1(); |
71 DCHECK(kind() != Code::KEYED_STORE_IC || | 71 DCHECK(kind() != Code::KEYED_STORE_IC || |
72 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); | 72 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); |
73 __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); | 73 __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); |
74 int receiver_count = types->length(); | 74 int receiver_count = maps->length(); |
75 int number_of_handled_maps = 0; | 75 int number_of_handled_maps = 0; |
76 for (int current = 0; current < receiver_count; ++current) { | 76 for (int current = 0; current < receiver_count; ++current) { |
77 Handle<HeapType> type = types->at(current); | 77 Handle<Map> map = maps->at(current); |
78 Handle<Map> map = IC::TypeToMap(*type, isolate()); | |
79 if (!map->is_deprecated()) { | 78 if (!map->is_deprecated()) { |
80 number_of_handled_maps++; | 79 number_of_handled_maps++; |
81 Handle<WeakCell> cell = Map::WeakCellForMap(map); | 80 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
82 __ CmpWeakValue(map_reg, cell, scratch2()); | 81 __ CmpWeakValue(map_reg, cell, scratch2()); |
83 if (type->Is(HeapType::Number())) { | 82 if (map->instance_type() == HEAP_NUMBER_TYPE) { |
84 DCHECK(!number_case.is_unused()); | 83 DCHECK(!number_case.is_unused()); |
85 __ bind(&number_case); | 84 __ bind(&number_case); |
86 } | 85 } |
87 __ j(equal, handlers->at(current)); | 86 __ j(equal, handlers->at(current)); |
88 } | 87 } |
89 } | 88 } |
90 DCHECK(number_of_handled_maps != 0); | 89 DCHECK(number_of_handled_maps != 0); |
91 | 90 |
92 __ bind(&miss); | 91 __ bind(&miss); |
93 TailCallBuiltin(masm(), MissBuiltin(kind())); | 92 TailCallBuiltin(masm(), MissBuiltin(kind())); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // Return the generated code. | 125 // Return the generated code. |
127 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 126 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
128 } | 127 } |
129 | 128 |
130 | 129 |
131 #undef __ | 130 #undef __ |
132 } | 131 } |
133 } // namespace v8::internal | 132 } // namespace v8::internal |
134 | 133 |
135 #endif // V8_TARGET_ARCH_X87 | 134 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |