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

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 10914025: MIPS: Use a special EnumLength field to indicate number of valid enum cache values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | no next file » | 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 5295 matching lines...) Expand 10 before | Expand all | Expand 10 after
5306 &fail, 5306 &fail,
5307 DONT_DO_SMI_CHECK); 5307 DONT_DO_SMI_CHECK);
5308 lw(descriptors, FieldMemOperand(temp, TransitionArray::kDescriptorsOffset)); 5308 lw(descriptors, FieldMemOperand(temp, TransitionArray::kDescriptorsOffset));
5309 jmp(&ok); 5309 jmp(&ok);
5310 bind(&fail); 5310 bind(&fail);
5311 LoadRoot(descriptors, Heap::kEmptyDescriptorArrayRootIndex); 5311 LoadRoot(descriptors, Heap::kEmptyDescriptorArrayRootIndex);
5312 bind(&ok); 5312 bind(&ok);
5313 } 5313 }
5314 5314
5315 5315
5316 void MacroAssembler::EnumLength(Register dst, Register map) {
5317 STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
5318 lw(dst, FieldMemOperand(map, Map::kBitField3Offset));
5319 And(dst, dst, Operand(Smi::FromInt(Map::EnumLengthBits::kMask)));
5320 }
5321
5322
5316 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { 5323 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) {
5317 Label next;
5318 // Preload a couple of values used in the loop.
5319 Register empty_fixed_array_value = t2; 5324 Register empty_fixed_array_value = t2;
5320 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); 5325 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex);
5321 mov(a1, a0); 5326 Label next, start;
5327 mov(a2, a0);
5328
5329 // Check if the enum length field is properly initialized, indicating that
5330 // there is an enum cache.
5331 lw(a1, FieldMemOperand(a2, HeapObject::kMapOffset));
5332
5333 EnumLength(a3, a1);
5334 Branch(call_runtime, eq, a3, Operand(Smi::FromInt(Map::kInvalidEnumCache)));
5335
5336 jmp(&start);
5337
5322 bind(&next); 5338 bind(&next);
5339 lw(a1, FieldMemOperand(a2, HeapObject::kMapOffset));
5323 5340
5324 // Check that there are no elements. Register a1 contains the 5341 // For all objects but the receiver, check that the cache is empty.
5325 // current JS object we've reached through the prototype chain. 5342 EnumLength(a3, a1);
5326 lw(a2, FieldMemOperand(a1, JSObject::kElementsOffset)); 5343 Branch(call_runtime, ne, a3, Operand(Smi::FromInt(0)));
5344
5345 bind(&start);
5346
5347 // Check that there are no elements. Register r2 contains the current JS
5348 // object we've reached through the prototype chain.
5349 lw(a2, FieldMemOperand(a2, JSObject::kElementsOffset));
5327 Branch(call_runtime, ne, a2, Operand(empty_fixed_array_value)); 5350 Branch(call_runtime, ne, a2, Operand(empty_fixed_array_value));
5328 5351
5329 // Check that instance descriptors are not empty so that we can 5352 lw(a2, FieldMemOperand(a1, Map::kPrototypeOffset));
5330 // check for an enum cache. Leave the map in a2 for the subsequent 5353 Branch(&next, ne, a2, Operand(null_value));
5331 // prototype load.
5332 lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset));
5333 lw(a3, FieldMemOperand(a2, Map::kTransitionsOrBackPointerOffset));
5334
5335 CheckMap(a3,
5336 t3,
5337 isolate()->factory()->fixed_array_map(),
5338 call_runtime,
5339 DONT_DO_SMI_CHECK);
5340
5341 LoadRoot(t3, Heap::kEmptyDescriptorArrayRootIndex);
5342 lw(a3, FieldMemOperand(a3, TransitionArray::kDescriptorsOffset));
5343 Branch(call_runtime, eq, a3, Operand(t3));
5344
5345 // Check that there is an enum cache in the non-empty instance
5346 // descriptors (a3). This is the case if the next enumeration
5347 // index field does not contain a smi.
5348 lw(a3, FieldMemOperand(a3, DescriptorArray::kEnumCacheOffset));
5349 JumpIfSmi(a3, call_runtime);
5350
5351 // For all objects but the receiver, check that the cache is empty.
5352 Label check_prototype;
5353 Branch(&check_prototype, eq, a1, Operand(a0));
5354 lw(a3, FieldMemOperand(a3, DescriptorArray::kEnumCacheBridgeCacheOffset));
5355 Branch(call_runtime, ne, a3, Operand(empty_fixed_array_value));
5356
5357 // Load the prototype from the map and loop if non-null.
5358 bind(&check_prototype);
5359 lw(a1, FieldMemOperand(a2, Map::kPrototypeOffset));
5360 Branch(&next, ne, a1, Operand(null_value));
5361 } 5354 }
5362 5355
5363 5356
5364 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) { 5357 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
5365 ASSERT(!output_reg.is(input_reg)); 5358 ASSERT(!output_reg.is(input_reg));
5366 Label done; 5359 Label done;
5367 li(output_reg, Operand(255)); 5360 li(output_reg, Operand(255));
5368 // Normal branch: nop in delay slot. 5361 // Normal branch: nop in delay slot.
5369 Branch(&done, gt, input_reg, Operand(output_reg)); 5362 Branch(&done, gt, input_reg, Operand(output_reg));
5370 // Use delay slot in this branch. 5363 // Use delay slot in this branch.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
5465 opcode == BGTZL); 5458 opcode == BGTZL);
5466 opcode = (cond == eq) ? BEQ : BNE; 5459 opcode = (cond == eq) ? BEQ : BNE;
5467 instr = (instr & ~kOpcodeMask) | opcode; 5460 instr = (instr & ~kOpcodeMask) | opcode;
5468 masm_.emit(instr); 5461 masm_.emit(instr);
5469 } 5462 }
5470 5463
5471 5464
5472 } } // namespace v8::internal 5465 } } // namespace v8::internal
5473 5466
5474 #endif // V8_TARGET_ARCH_MIPS 5467 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698