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

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

Issue 11365221: Allow property indexes to refer to slots inside the object header. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 309
310 // Load a fast property out of a holder object (src). In-object properties 310 // Load a fast property out of a holder object (src). In-object properties
311 // are loaded directly otherwise the property is loaded from the properties 311 // are loaded directly otherwise the property is loaded from the properties
312 // fixed array. 312 // fixed array.
313 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, 313 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
314 Register dst, 314 Register dst,
315 Register src, 315 Register src,
316 Handle<JSObject> holder, 316 Handle<JSObject> holder,
317 int index) { 317 PropertyIndex index) {
318 // Adjust for the number of properties stored in the holder. 318 if (index.IsHeaderIndex()) {
319 index -= holder->map()->inobject_properties(); 319 int offset = index.HeaderIndex() * kPointerSize;
320 if (index < 0) {
321 // Get the property straight out of the holder.
322 int offset = holder->map()->instance_size() + (index * kPointerSize);
323 __ lw(dst, FieldMemOperand(src, offset)); 320 __ lw(dst, FieldMemOperand(src, offset));
324 } else { 321 } else {
325 // Calculate the offset into the properties array. 322 // Adjust for the number of properties stored in the holder.
326 int offset = index * kPointerSize + FixedArray::kHeaderSize; 323 int slot = index.FieldIndex() - holder->map()->inobject_properties();
327 __ lw(dst, FieldMemOperand(src, JSObject::kPropertiesOffset)); 324 if (slot < 0) {
328 __ lw(dst, FieldMemOperand(dst, offset)); 325 // Get the property straight out of the holder.
326 int offset = holder->map()->instance_size() + (slot * kPointerSize);
327 __ lw(dst, FieldMemOperand(src, offset));
328 } else {
329 // Calculate the offset into the properties array.
330 int offset = slot * kPointerSize + FixedArray::kHeaderSize;
331 __ lw(dst, FieldMemOperand(src, JSObject::kPropertiesOffset));
332 __ lw(dst, FieldMemOperand(dst, offset));
333 }
329 } 334 }
330 } 335 }
331 336
332 337
333 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm, 338 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
334 Register receiver, 339 Register receiver,
335 Register scratch, 340 Register scratch,
336 Label* miss_label) { 341 Label* miss_label) {
337 // Check that the receiver isn't a smi. 342 // Check that the receiver isn't a smi.
338 __ JumpIfSmi(receiver, miss_label); 343 __ JumpIfSmi(receiver, miss_label);
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 return reg; 1198 return reg;
1194 } 1199 }
1195 1200
1196 1201
1197 void StubCompiler::GenerateLoadField(Handle<JSObject> object, 1202 void StubCompiler::GenerateLoadField(Handle<JSObject> object,
1198 Handle<JSObject> holder, 1203 Handle<JSObject> holder,
1199 Register receiver, 1204 Register receiver,
1200 Register scratch1, 1205 Register scratch1,
1201 Register scratch2, 1206 Register scratch2,
1202 Register scratch3, 1207 Register scratch3,
1203 int index, 1208 PropertyIndex index,
1204 Handle<String> name, 1209 Handle<String> name,
1205 Label* miss) { 1210 Label* miss) {
1206 // Check that the receiver isn't a smi. 1211 // Check that the receiver isn't a smi.
1207 __ JumpIfSmi(receiver, miss); 1212 __ JumpIfSmi(receiver, miss);
1208 1213
1209 // Check that the maps haven't changed. 1214 // Check that the maps haven't changed.
1210 Register reg = CheckPrototypes( 1215 Register reg = CheckPrototypes(
1211 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); 1216 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1212 GenerateFastPropertyLoad(masm(), v0, reg, holder, index); 1217 GenerateFastPropertyLoad(masm(), v0, reg, holder, index);
1213 __ Ret(); 1218 __ Ret();
(...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after
4841 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4846 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4842 } 4847 }
4843 } 4848 }
4844 4849
4845 4850
4846 #undef __ 4851 #undef __
4847 4852
4848 } } // namespace v8::internal 4853 } } // namespace v8::internal
4849 4854
4850 #endif // V8_TARGET_ARCH_MIPS 4855 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/json-stringifier.h ('k') | src/objects.cc » ('j') | src/property.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698