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

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

Issue 901083004: Contribution of PowerPC port (continuation of 422063005) - PPC dir update (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Contribution of PowerPC port (continuation of 422063005) - PPC dir update -comments and rebase Created 5 years, 10 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/ic/ppc/handler-compiler-ppc.cc ('k') | src/ic/ppc/ic-ppc.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_PPC 7 #if V8_TARGET_ARCH_PPC
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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 #define __ ACCESS_MASM(masm) 15 #define __ ACCESS_MASM(masm)
16 16
17 17
18 void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm, 18 void PropertyICCompiler::GenerateRuntimeSetProperty(
19 StrictMode strict_mode) { 19 MacroAssembler* masm, LanguageMode language_mode) {
20 __ mov(r0, Operand(Smi::FromInt(language_mode)));
20 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), 21 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
21 StoreDescriptor::ValueRegister()); 22 StoreDescriptor::ValueRegister(), r0);
22
23 __ mov(r0, Operand(Smi::FromInt(strict_mode)));
24 __ Push(r0);
25 23
26 // Do tail-call to runtime routine. 24 // Do tail-call to runtime routine.
27 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); 25 __ TailCallRuntime(Runtime::kSetProperty, 4, 1);
28 } 26 }
29 27
30 28
31 #undef __ 29 #undef __
32 #define __ ACCESS_MASM(masm()) 30 #define __ ACCESS_MASM(masm())
33 31
34 32
35 Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types, 33 Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types,
36 CodeHandleList* handlers, 34 CodeHandleList* handlers,
37 Handle<Name> name, 35 Handle<Name> name,
38 Code::StubType type, 36 Code::StubType type,
39 IcCheckType check) { 37 IcCheckType check) {
40 Label miss; 38 Label miss;
41 39
42 if (check == PROPERTY && 40 if (check == PROPERTY &&
43 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { 41 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) {
44 // In case we are compiling an IC for dictionary loads and stores, just 42 // In case we are compiling an IC for dictionary loads or stores, just
45 // check whether the name is unique. 43 // check whether the name is unique.
46 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { 44 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) {
45 // Keyed loads with dictionaries shouldn't be here, they go generic.
46 // The DCHECK is to protect assumptions when --vector-ics is on.
47 DCHECK(kind() != Code::KEYED_LOAD_IC);
47 Register tmp = scratch1(); 48 Register tmp = scratch1();
48 __ JumpIfSmi(this->name(), &miss); 49 __ JumpIfSmi(this->name(), &miss);
49 __ LoadP(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset)); 50 __ LoadP(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset));
50 __ lbz(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset)); 51 __ lbz(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset));
51 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); 52 __ JumpIfNotUniqueNameInstanceType(tmp, &miss);
52 } else { 53 } else {
53 __ Cmpi(this->name(), Operand(name), r0); 54 __ Cmpi(this->name(), Operand(name), r0);
54 __ bne(&miss); 55 __ bne(&miss);
55 } 56 }
56 } 57 }
57 58
58 Label number_case; 59 Label number_case;
59 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; 60 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss;
60 __ JumpIfSmi(receiver(), smi_target); 61 __ JumpIfSmi(receiver(), smi_target);
61 62
62 // Polymorphic keyed stores may use the map register 63 // Polymorphic keyed stores may use the map register
63 Register map_reg = scratch1(); 64 Register map_reg = scratch1();
64 DCHECK(kind() != Code::KEYED_STORE_IC || 65 DCHECK(kind() != Code::KEYED_STORE_IC ||
65 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); 66 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister()));
66 67
67 int receiver_count = types->length(); 68 int receiver_count = types->length();
68 int number_of_handled_maps = 0; 69 int number_of_handled_maps = 0;
69 __ LoadP(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); 70 __ LoadP(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset));
70 for (int current = 0; current < receiver_count; ++current) { 71 for (int current = 0; current < receiver_count; ++current) {
71 Handle<HeapType> type = types->at(current); 72 Handle<HeapType> type = types->at(current);
72 Handle<Map> map = IC::TypeToMap(*type, isolate()); 73 Handle<Map> map = IC::TypeToMap(*type, isolate());
73 if (!map->is_deprecated()) { 74 if (!map->is_deprecated()) {
74 number_of_handled_maps++; 75 number_of_handled_maps++;
75 __ mov(ip, Operand(map)); 76 Handle<WeakCell> cell = Map::WeakCellForMap(map);
76 __ cmp(map_reg, ip); 77 __ CmpWeakValue(map_reg, cell, scratch2());
77 if (type->Is(HeapType::Number())) { 78 if (type->Is(HeapType::Number())) {
78 DCHECK(!number_case.is_unused()); 79 DCHECK(!number_case.is_unused());
79 __ bind(&number_case); 80 __ bind(&number_case);
80 } 81 }
81 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq); 82 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq);
82 } 83 }
83 } 84 }
84 DCHECK(number_of_handled_maps != 0); 85 DCHECK(number_of_handled_maps != 0);
85 86
86 __ bind(&miss); 87 __ bind(&miss);
87 TailCallBuiltin(masm(), MissBuiltin(kind())); 88 TailCallBuiltin(masm(), MissBuiltin(kind()));
88 89
89 // Return the generated code. 90 // Return the generated code.
90 InlineCacheState state = 91 InlineCacheState state =
91 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; 92 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC;
92 return GetCode(kind(), type, name, state); 93 return GetCode(kind(), type, name, state);
93 } 94 }
94 95
95 96
96 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( 97 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
97 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, 98 MapHandleList* receiver_maps, CodeHandleList* handler_stubs,
98 MapHandleList* transitioned_maps) { 99 MapHandleList* transitioned_maps) {
99 Label miss; 100 Label miss;
100 __ JumpIfSmi(receiver(), &miss); 101 __ JumpIfSmi(receiver(), &miss);
101 102
102 int receiver_count = receiver_maps->length(); 103 int receiver_count = receiver_maps->length();
103 __ LoadP(scratch1(), FieldMemOperand(receiver(), HeapObject::kMapOffset)); 104 Register map_reg = scratch1();
105 __ LoadP(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset));
104 for (int i = 0; i < receiver_count; ++i) { 106 for (int i = 0; i < receiver_count; ++i) {
105 __ mov(ip, Operand(receiver_maps->at(i))); 107 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_maps->at(i));
106 __ cmp(scratch1(), ip); 108 __ CmpWeakValue(map_reg, cell, scratch2());
107 if (transitioned_maps->at(i).is_null()) { 109 if (transitioned_maps->at(i).is_null()) {
108 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, eq); 110 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, eq);
109 } else { 111 } else {
110 Label next_map; 112 Label next_map;
111 __ bne(&next_map); 113 __ bne(&next_map);
112 __ mov(transition_map(), Operand(transitioned_maps->at(i))); 114 Handle<WeakCell> cell = Map::WeakCellForMap(transitioned_maps->at(i));
115 __ LoadWeakValue(transition_map(), cell, &miss);
113 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, al); 116 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, al);
114 __ bind(&next_map); 117 __ bind(&next_map);
115 } 118 }
116 } 119 }
117 120
118 __ bind(&miss); 121 __ bind(&miss);
119 TailCallBuiltin(masm(), MissBuiltin(kind())); 122 TailCallBuiltin(masm(), MissBuiltin(kind()));
120 123
121 // Return the generated code. 124 // Return the generated code.
122 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); 125 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
123 } 126 }
124 127
125 128
126 #undef __ 129 #undef __
127 } 130 }
128 } // namespace v8::internal 131 } // namespace v8::internal
129 132
130 #endif // V8_TARGET_ARCH_PPC 133 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ic/ppc/handler-compiler-ppc.cc ('k') | src/ic/ppc/ic-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698