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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 66723020: Merged r17459, r17462, r17474 into 3.21 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.21
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/mips/stub-cache-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); 130 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag));
131 __ jmp(offset); 131 __ jmp(offset);
132 132
133 // Pop at miss. 133 // Pop at miss.
134 __ bind(&miss); 134 __ bind(&miss);
135 __ pop(offset); 135 __ pop(offset);
136 } 136 }
137 } 137 }
138 138
139 139
140 // Helper function used to check that the dictionary doesn't contain 140 void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
141 // the property. This function may return false negatives, so miss_label 141 Label* miss_label,
142 // must always call a backup property check that is complete. 142 Register receiver,
143 // This function is safe to call if the receiver has fast properties. 143 Handle<Name> name,
144 // Name must be unique and receiver must be a heap object. 144 Register scratch0,
145 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, 145 Register scratch1) {
146 Label* miss_label,
147 Register receiver,
148 Handle<Name> name,
149 Register r0,
150 Register r1) {
151 ASSERT(name->IsUniqueName()); 146 ASSERT(name->IsUniqueName());
147 ASSERT(!receiver.is(scratch0));
152 Counters* counters = masm->isolate()->counters(); 148 Counters* counters = masm->isolate()->counters();
153 __ IncrementCounter(counters->negative_lookups(), 1); 149 __ IncrementCounter(counters->negative_lookups(), 1);
154 __ IncrementCounter(counters->negative_lookups_miss(), 1); 150 __ IncrementCounter(counters->negative_lookups_miss(), 1);
155 151
156 __ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset)); 152 __ mov(scratch0, FieldOperand(receiver, HeapObject::kMapOffset));
157 153
158 const int kInterceptorOrAccessCheckNeededMask = 154 const int kInterceptorOrAccessCheckNeededMask =
159 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 155 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
160 156
161 // Bail out if the receiver has a named interceptor or requires access checks. 157 // Bail out if the receiver has a named interceptor or requires access checks.
162 __ test_b(FieldOperand(r0, Map::kBitFieldOffset), 158 __ test_b(FieldOperand(scratch0, Map::kBitFieldOffset),
163 kInterceptorOrAccessCheckNeededMask); 159 kInterceptorOrAccessCheckNeededMask);
164 __ j(not_zero, miss_label); 160 __ j(not_zero, miss_label);
165 161
166 // Check that receiver is a JSObject. 162 // Check that receiver is a JSObject.
167 __ CmpInstanceType(r0, FIRST_SPEC_OBJECT_TYPE); 163 __ CmpInstanceType(scratch0, FIRST_SPEC_OBJECT_TYPE);
168 __ j(below, miss_label); 164 __ j(below, miss_label);
169 165
170 // Load properties array. 166 // Load properties array.
171 Register properties = r0; 167 Register properties = scratch0;
172 __ mov(properties, FieldOperand(receiver, JSObject::kPropertiesOffset)); 168 __ mov(properties, FieldOperand(receiver, JSObject::kPropertiesOffset));
173 169
174 // Check that the properties array is a dictionary. 170 // Check that the properties array is a dictionary.
175 __ cmp(FieldOperand(properties, HeapObject::kMapOffset), 171 __ cmp(FieldOperand(properties, HeapObject::kMapOffset),
176 Immediate(masm->isolate()->factory()->hash_table_map())); 172 Immediate(masm->isolate()->factory()->hash_table_map()));
177 __ j(not_equal, miss_label); 173 __ j(not_equal, miss_label);
178 174
179 Label done; 175 Label done;
180 NameDictionaryLookupStub::GenerateNegativeLookup(masm, 176 NameDictionaryLookupStub::GenerateNegativeLookup(masm,
181 miss_label, 177 miss_label,
182 &done, 178 &done,
183 properties, 179 properties,
184 name, 180 name,
185 r1); 181 scratch1);
186 __ bind(&done); 182 __ bind(&done);
187 __ DecrementCounter(counters->negative_lookups_miss(), 1); 183 __ DecrementCounter(counters->negative_lookups_miss(), 1);
188 } 184 }
189 185
190 186
191 void StubCache::GenerateProbe(MacroAssembler* masm, 187 void StubCache::GenerateProbe(MacroAssembler* masm,
192 Code::Flags flags, 188 Code::Flags flags,
193 Register receiver, 189 Register receiver,
194 Register name, 190 Register name,
195 Register scratch, 191 Register scratch,
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 if (!label->is_unused()) { 778 if (!label->is_unused()) {
783 __ bind(label); 779 __ bind(label);
784 __ mov(this->name(), Immediate(name)); 780 __ mov(this->name(), Immediate(name));
785 } 781 }
786 } 782 }
787 783
788 784
789 // Generate code to check that a global property cell is empty. Create 785 // Generate code to check that a global property cell is empty. Create
790 // the property cell at compilation time if no cell exists for the 786 // the property cell at compilation time if no cell exists for the
791 // property. 787 // property.
792 static void GenerateCheckPropertyCell(MacroAssembler* masm, 788 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
793 Handle<GlobalObject> global, 789 Handle<JSGlobalObject> global,
794 Handle<Name> name, 790 Handle<Name> name,
795 Register scratch, 791 Register scratch,
796 Label* miss) { 792 Label* miss) {
797 Handle<PropertyCell> cell = 793 Handle<PropertyCell> cell =
798 GlobalObject::EnsurePropertyCell(global, name); 794 JSGlobalObject::EnsurePropertyCell(global, name);
799 ASSERT(cell->value()->IsTheHole()); 795 ASSERT(cell->value()->IsTheHole());
800 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); 796 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value();
801 if (Serializer::enabled()) { 797 if (Serializer::enabled()) {
802 __ mov(scratch, Immediate(cell)); 798 __ mov(scratch, Immediate(cell));
803 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), 799 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
804 Immediate(the_hole)); 800 Immediate(the_hole));
805 } else { 801 } else {
806 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); 802 __ cmp(Operand::ForCell(cell), Immediate(the_hole));
807 } 803 }
808 __ j(not_equal, miss); 804 __ j(not_equal, miss);
809 } 805 }
810 806
811 807
812 void BaseStoreStubCompiler::GenerateNegativeHolderLookup( 808 void BaseStoreStubCompiler::GenerateNegativeHolderLookup(
813 MacroAssembler* masm, 809 MacroAssembler* masm,
814 Handle<JSObject> holder, 810 Handle<JSObject> holder,
815 Register holder_reg, 811 Register holder_reg,
816 Handle<Name> name, 812 Handle<Name> name,
817 Label* miss) { 813 Label* miss) {
818 if (holder->IsJSGlobalObject()) { 814 if (holder->IsJSGlobalObject()) {
819 GenerateCheckPropertyCell( 815 GenerateCheckPropertyCell(
820 masm, Handle<GlobalObject>::cast(holder), name, scratch1(), miss); 816 masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
821 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { 817 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
822 GenerateDictionaryNegativeLookup( 818 GenerateDictionaryNegativeLookup(
823 masm, miss, holder_reg, name, scratch1(), scratch2()); 819 masm, miss, holder_reg, name, scratch1(), scratch2());
824 } 820 }
825 } 821 }
826 822
827 823
828 // Receiver_reg is preserved on jumps to miss_label, but may be destroyed if 824 // Receiver_reg is preserved on jumps to miss_label, but may be destroyed if
829 // store is successful. 825 // store is successful.
830 void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, 826 void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 smi_check); 1108 smi_check);
1113 } 1109 }
1114 } 1110 }
1115 1111
1116 // Return the value (register eax). 1112 // Return the value (register eax).
1117 ASSERT(value_reg.is(eax)); 1113 ASSERT(value_reg.is(eax));
1118 __ ret(0); 1114 __ ret(0);
1119 } 1115 }
1120 1116
1121 1117
1122 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1118 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1123 // from object to (but not including) holder. 1119 Handle<JSObject> object,
1124 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1120 Handle<JSObject> holder,
1125 Handle<JSObject> object, 1121 Handle<Name> name,
1126 Handle<JSObject> holder, 1122 Register scratch,
1127 Handle<Name> name, 1123 Label* miss) {
1128 Register scratch,
1129 Label* miss) {
1130 Handle<JSObject> current = object; 1124 Handle<JSObject> current = object;
1131 while (!current.is_identical_to(holder)) { 1125 while (!current.is_identical_to(holder)) {
1132 if (current->IsGlobalObject()) { 1126 if (current->IsJSGlobalObject()) {
1133 GenerateCheckPropertyCell(masm, 1127 GenerateCheckPropertyCell(masm,
1134 Handle<GlobalObject>::cast(current), 1128 Handle<JSGlobalObject>::cast(current),
1135 name, 1129 name,
1136 scratch, 1130 scratch,
1137 miss); 1131 miss);
1138 } 1132 }
1139 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1133 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
1140 } 1134 }
1141 } 1135 }
1142 1136
1143 1137
1144 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { 1138 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 } 1338 }
1345 __ cmp(scratch3(), callback); 1339 __ cmp(scratch3(), callback);
1346 __ j(not_equal, &miss); 1340 __ j(not_equal, &miss);
1347 } 1341 }
1348 1342
1349 HandlerFrontendFooter(name, success, &miss); 1343 HandlerFrontendFooter(name, success, &miss);
1350 return reg; 1344 return reg;
1351 } 1345 }
1352 1346
1353 1347
1354 void BaseLoadStubCompiler::NonexistentHandlerFrontend(
1355 Handle<JSObject> object,
1356 Handle<JSObject> last,
1357 Handle<Name> name,
1358 Label* success,
1359 Handle<GlobalObject> global) {
1360 Label miss;
1361
1362 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1363
1364 // If the last object in the prototype chain is a global object,
1365 // check that the global property cell is empty.
1366 if (!global.is_null()) {
1367 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
1368 }
1369
1370 HandlerFrontendFooter(name, success, &miss);
1371 }
1372
1373
1374 void BaseLoadStubCompiler::GenerateLoadField(Register reg, 1348 void BaseLoadStubCompiler::GenerateLoadField(Register reg,
1375 Handle<JSObject> holder, 1349 Handle<JSObject> holder,
1376 PropertyIndex field, 1350 PropertyIndex field,
1377 Representation representation) { 1351 Representation representation) {
1378 if (!reg.is(receiver())) __ mov(receiver(), reg); 1352 if (!reg.is(receiver())) __ mov(receiver(), reg);
1379 if (kind() == Code::LOAD_IC) { 1353 if (kind() == Code::LOAD_IC) {
1380 LoadFieldStub stub(field.is_inobject(holder), 1354 LoadFieldStub stub(field.is_inobject(holder),
1381 field.translate(holder), 1355 field.translate(holder),
1382 representation); 1356 representation);
1383 GenerateTailCall(masm(), stub.GetCode(isolate())); 1357 GenerateTailCall(masm(), stub.GetCode(isolate()));
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 // Return the generated code. 3013 // Return the generated code.
3040 return GetICCode( 3014 return GetICCode(
3041 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); 3015 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
3042 } 3016 }
3043 3017
3044 3018
3045 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( 3019 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
3046 Handle<JSObject> object, 3020 Handle<JSObject> object,
3047 Handle<JSObject> last, 3021 Handle<JSObject> last,
3048 Handle<Name> name, 3022 Handle<Name> name,
3049 Handle<GlobalObject> global) { 3023 Handle<JSGlobalObject> global) {
3050 Label success; 3024 Label success;
3051 3025
3052 NonexistentHandlerFrontend(object, last, name, &success, global); 3026 NonexistentHandlerFrontend(object, last, name, &success, global);
3053 3027
3054 __ bind(&success); 3028 __ bind(&success);
3055 // Return undefined if maps of the full prototype chain are still the 3029 // Return undefined if maps of the full prototype chain are still the
3056 // same and no global property with this name contains a value. 3030 // same and no global property with this name contains a value.
3057 __ mov(eax, isolate()->factory()->undefined_value()); 3031 __ mov(eax, isolate()->factory()->undefined_value());
3058 __ ret(0); 3032 __ ret(0);
3059 3033
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 // ----------------------------------- 3242 // -----------------------------------
3269 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3243 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3270 } 3244 }
3271 3245
3272 3246
3273 #undef __ 3247 #undef __
3274 3248
3275 } } // namespace v8::internal 3249 } } // namespace v8::internal
3276 3250
3277 #endif // V8_TARGET_ARCH_IA32 3251 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698