js/src/jit/shared/Lowering-shared-inl.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef jit_shared_Lowering_shared_inl_h
michael@0 8 #define jit_shared_Lowering_shared_inl_h
michael@0 9
michael@0 10 #include "jit/shared/Lowering-shared.h"
michael@0 11
michael@0 12 #include "jit/MIR.h"
michael@0 13 #include "jit/MIRGenerator.h"
michael@0 14
michael@0 15 namespace js {
michael@0 16 namespace jit {
michael@0 17
michael@0 18 bool
michael@0 19 LIRGeneratorShared::emitAtUses(MInstruction *mir)
michael@0 20 {
michael@0 21 JS_ASSERT(mir->canEmitAtUses());
michael@0 22 mir->setEmittedAtUses();
michael@0 23 mir->setVirtualRegister(0);
michael@0 24 return true;
michael@0 25 }
michael@0 26
michael@0 27 LUse
michael@0 28 LIRGeneratorShared::use(MDefinition *mir, LUse policy)
michael@0 29 {
michael@0 30 // It is illegal to call use() on an instruction with two defs.
michael@0 31 #if BOX_PIECES > 1
michael@0 32 JS_ASSERT(mir->type() != MIRType_Value);
michael@0 33 #endif
michael@0 34 if (!ensureDefined(mir))
michael@0 35 return policy;
michael@0 36 policy.setVirtualRegister(mir->virtualRegister());
michael@0 37 return policy;
michael@0 38 }
michael@0 39
michael@0 40 template <size_t X, size_t Y> bool
michael@0 41 LIRGeneratorShared::define(LInstructionHelper<1, X, Y> *lir, MDefinition *mir, const LDefinition &def)
michael@0 42 {
michael@0 43 // Call instructions should use defineReturn.
michael@0 44 JS_ASSERT(!lir->isCall());
michael@0 45
michael@0 46 uint32_t vreg = getVirtualRegister();
michael@0 47 if (vreg >= MAX_VIRTUAL_REGISTERS)
michael@0 48 return false;
michael@0 49
michael@0 50 // Assign the definition and a virtual register. Then, propagate this
michael@0 51 // virtual register to the MIR, so we can map MIR to LIR during lowering.
michael@0 52 lir->setDef(0, def);
michael@0 53 lir->getDef(0)->setVirtualRegister(vreg);
michael@0 54 lir->setMir(mir);
michael@0 55 mir->setVirtualRegister(vreg);
michael@0 56 return add(lir);
michael@0 57 }
michael@0 58
michael@0 59 template <size_t X, size_t Y> bool
michael@0 60 LIRGeneratorShared::define(LInstructionHelper<1, X, Y> *lir, MDefinition *mir, LDefinition::Policy policy)
michael@0 61 {
michael@0 62 LDefinition::Type type = LDefinition::TypeFrom(mir->type());
michael@0 63 return define(lir, mir, LDefinition(type, policy));
michael@0 64 }
michael@0 65
michael@0 66 template <size_t X, size_t Y> bool
michael@0 67 LIRGeneratorShared::defineFixed(LInstructionHelper<1, X, Y> *lir, MDefinition *mir, const LAllocation &output)
michael@0 68 {
michael@0 69 LDefinition::Type type = LDefinition::TypeFrom(mir->type());
michael@0 70
michael@0 71 LDefinition def(type, LDefinition::PRESET);
michael@0 72 def.setOutput(output);
michael@0 73
michael@0 74 // Add an LNop to avoid regalloc problems if the next op uses this value
michael@0 75 // with a fixed or at-start policy.
michael@0 76 if (!define(lir, mir, def))
michael@0 77 return false;
michael@0 78
michael@0 79 if (gen->optimizationInfo().registerAllocator() == RegisterAllocator_LSRA) {
michael@0 80 if (!add(new(alloc()) LNop))
michael@0 81 return false;
michael@0 82 }
michael@0 83
michael@0 84 return true;
michael@0 85 }
michael@0 86
michael@0 87 template <size_t Ops, size_t Temps> bool
michael@0 88 LIRGeneratorShared::defineReuseInput(LInstructionHelper<1, Ops, Temps> *lir, MDefinition *mir, uint32_t operand)
michael@0 89 {
michael@0 90 // The input should be used at the start of the instruction, to avoid moves.
michael@0 91 JS_ASSERT(lir->getOperand(operand)->toUse()->usedAtStart());
michael@0 92
michael@0 93 LDefinition::Type type = LDefinition::TypeFrom(mir->type());
michael@0 94
michael@0 95 LDefinition def(type, LDefinition::MUST_REUSE_INPUT);
michael@0 96 def.setReusedInput(operand);
michael@0 97
michael@0 98 return define(lir, mir, def);
michael@0 99 }
michael@0 100
michael@0 101 template <size_t Ops, size_t Temps> bool
michael@0 102 LIRGeneratorShared::defineBox(LInstructionHelper<BOX_PIECES, Ops, Temps> *lir, MDefinition *mir,
michael@0 103 LDefinition::Policy policy)
michael@0 104 {
michael@0 105 // Call instructions should use defineReturn.
michael@0 106 JS_ASSERT(!lir->isCall());
michael@0 107
michael@0 108 uint32_t vreg = getVirtualRegister();
michael@0 109 if (vreg >= MAX_VIRTUAL_REGISTERS)
michael@0 110 return false;
michael@0 111
michael@0 112 #if defined(JS_NUNBOX32)
michael@0 113 lir->setDef(0, LDefinition(vreg + VREG_TYPE_OFFSET, LDefinition::TYPE, policy));
michael@0 114 lir->setDef(1, LDefinition(vreg + VREG_DATA_OFFSET, LDefinition::PAYLOAD, policy));
michael@0 115 if (getVirtualRegister() >= MAX_VIRTUAL_REGISTERS)
michael@0 116 return false;
michael@0 117 #elif defined(JS_PUNBOX64)
michael@0 118 lir->setDef(0, LDefinition(vreg, LDefinition::BOX, policy));
michael@0 119 #endif
michael@0 120 lir->setMir(mir);
michael@0 121
michael@0 122 mir->setVirtualRegister(vreg);
michael@0 123 return add(lir);
michael@0 124 }
michael@0 125
michael@0 126 bool
michael@0 127 LIRGeneratorShared::defineReturn(LInstruction *lir, MDefinition *mir)
michael@0 128 {
michael@0 129 lir->setMir(mir);
michael@0 130
michael@0 131 JS_ASSERT(lir->isCall());
michael@0 132
michael@0 133 uint32_t vreg = getVirtualRegister();
michael@0 134 if (vreg >= MAX_VIRTUAL_REGISTERS)
michael@0 135 return false;
michael@0 136
michael@0 137 switch (mir->type()) {
michael@0 138 case MIRType_Value:
michael@0 139 #if defined(JS_NUNBOX32)
michael@0 140 lir->setDef(TYPE_INDEX, LDefinition(vreg + VREG_TYPE_OFFSET, LDefinition::TYPE,
michael@0 141 LGeneralReg(JSReturnReg_Type)));
michael@0 142 lir->setDef(PAYLOAD_INDEX, LDefinition(vreg + VREG_DATA_OFFSET, LDefinition::PAYLOAD,
michael@0 143 LGeneralReg(JSReturnReg_Data)));
michael@0 144
michael@0 145 if (getVirtualRegister() >= MAX_VIRTUAL_REGISTERS)
michael@0 146 return false;
michael@0 147 #elif defined(JS_PUNBOX64)
michael@0 148 lir->setDef(0, LDefinition(vreg, LDefinition::BOX, LGeneralReg(JSReturnReg)));
michael@0 149 #endif
michael@0 150 break;
michael@0 151 case MIRType_Float32:
michael@0 152 lir->setDef(0, LDefinition(vreg, LDefinition::FLOAT32, LFloatReg(ReturnFloatReg)));
michael@0 153 break;
michael@0 154 case MIRType_Double:
michael@0 155 lir->setDef(0, LDefinition(vreg, LDefinition::DOUBLE, LFloatReg(ReturnFloatReg)));
michael@0 156 break;
michael@0 157 default:
michael@0 158 LDefinition::Type type = LDefinition::TypeFrom(mir->type());
michael@0 159 JS_ASSERT(type != LDefinition::DOUBLE && type != LDefinition::FLOAT32);
michael@0 160 lir->setDef(0, LDefinition(vreg, type, LGeneralReg(ReturnReg)));
michael@0 161 break;
michael@0 162 }
michael@0 163
michael@0 164 mir->setVirtualRegister(vreg);
michael@0 165 if (!add(lir))
michael@0 166 return false;
michael@0 167
michael@0 168 if (gen->optimizationInfo().registerAllocator() == RegisterAllocator_LSRA) {
michael@0 169 if (!add(new(alloc()) LNop))
michael@0 170 return false;
michael@0 171 }
michael@0 172
michael@0 173 return true;
michael@0 174 }
michael@0 175
michael@0 176 // In LIR, we treat booleans and integers as the same low-level type (INTEGER).
michael@0 177 // When snapshotting, we recover the actual JS type from MIR. This function
michael@0 178 // checks that when making redefinitions, we don't accidentally coerce two
michael@0 179 // incompatible types.
michael@0 180 static inline bool
michael@0 181 IsCompatibleLIRCoercion(MIRType to, MIRType from)
michael@0 182 {
michael@0 183 if (to == from)
michael@0 184 return true;
michael@0 185 if ((to == MIRType_Int32 || to == MIRType_Boolean) &&
michael@0 186 (from == MIRType_Int32 || from == MIRType_Boolean)) {
michael@0 187 return true;
michael@0 188 }
michael@0 189 return false;
michael@0 190 }
michael@0 191
michael@0 192 bool
michael@0 193 LIRGeneratorShared::redefine(MDefinition *def, MDefinition *as)
michael@0 194 {
michael@0 195 JS_ASSERT(IsCompatibleLIRCoercion(def->type(), as->type()));
michael@0 196
michael@0 197 // Try to emit MIR marked as emitted-at-uses at, well, uses. For
michael@0 198 // snapshotting reasons we delay the MIRTypes match, or when we are
michael@0 199 // coercing between bool and int32 constants.
michael@0 200 if (as->isEmittedAtUses() &&
michael@0 201 (def->type() == as->type() ||
michael@0 202 (as->isConstant() &&
michael@0 203 (def->type() == MIRType_Int32 || def->type() == MIRType_Boolean) &&
michael@0 204 (as->type() == MIRType_Int32 || as->type() == MIRType_Boolean))))
michael@0 205 {
michael@0 206 MDefinition *replacement;
michael@0 207 if (def->type() != as->type()) {
michael@0 208 Value v = as->toConstant()->value();
michael@0 209 if (as->type() == MIRType_Int32)
michael@0 210 replacement = MConstant::New(alloc(), BooleanValue(v.toInt32()));
michael@0 211 else
michael@0 212 replacement = MConstant::New(alloc(), Int32Value(v.toBoolean()));
michael@0 213 if (!emitAtUses(replacement->toInstruction()))
michael@0 214 return false;
michael@0 215 } else {
michael@0 216 replacement = as;
michael@0 217 }
michael@0 218 def->replaceAllUsesWith(replacement);
michael@0 219 return true;
michael@0 220 }
michael@0 221
michael@0 222 if (!ensureDefined(as))
michael@0 223 return false;
michael@0 224 def->setVirtualRegister(as->virtualRegister());
michael@0 225 return true;
michael@0 226 }
michael@0 227
michael@0 228 bool
michael@0 229 LIRGeneratorShared::defineAs(LInstruction *outLir, MDefinition *outMir, MDefinition *inMir)
michael@0 230 {
michael@0 231 uint32_t vreg = inMir->virtualRegister();
michael@0 232 LDefinition::Policy policy = LDefinition::PASSTHROUGH;
michael@0 233
michael@0 234 if (outMir->type() == MIRType_Value) {
michael@0 235 #ifdef JS_NUNBOX32
michael@0 236 outLir->setDef(TYPE_INDEX,
michael@0 237 LDefinition(vreg + VREG_TYPE_OFFSET, LDefinition::TYPE, policy));
michael@0 238 outLir->setDef(PAYLOAD_INDEX,
michael@0 239 LDefinition(vreg + VREG_DATA_OFFSET, LDefinition::PAYLOAD, policy));
michael@0 240 #elif JS_PUNBOX64
michael@0 241 outLir->setDef(0, LDefinition(vreg, LDefinition::BOX, policy));
michael@0 242 #else
michael@0 243 # error "Unexpected boxing type"
michael@0 244 #endif
michael@0 245 } else {
michael@0 246 outLir->setDef(0, LDefinition(vreg, LDefinition::TypeFrom(inMir->type()), policy));
michael@0 247 }
michael@0 248 outLir->setMir(outMir);
michael@0 249 return redefine(outMir, inMir);
michael@0 250 }
michael@0 251
michael@0 252 bool
michael@0 253 LIRGeneratorShared::ensureDefined(MDefinition *mir)
michael@0 254 {
michael@0 255 if (mir->isEmittedAtUses()) {
michael@0 256 if (!mir->toInstruction()->accept(this))
michael@0 257 return false;
michael@0 258 JS_ASSERT(mir->isLowered());
michael@0 259 }
michael@0 260 return true;
michael@0 261 }
michael@0 262
michael@0 263 LUse
michael@0 264 LIRGeneratorShared::useRegister(MDefinition *mir)
michael@0 265 {
michael@0 266 return use(mir, LUse(LUse::REGISTER));
michael@0 267 }
michael@0 268
michael@0 269 LUse
michael@0 270 LIRGeneratorShared::useRegisterAtStart(MDefinition *mir)
michael@0 271 {
michael@0 272 return use(mir, LUse(LUse::REGISTER, true));
michael@0 273 }
michael@0 274
michael@0 275 LUse
michael@0 276 LIRGeneratorShared::use(MDefinition *mir)
michael@0 277 {
michael@0 278 return use(mir, LUse(LUse::ANY));
michael@0 279 }
michael@0 280
michael@0 281 LUse
michael@0 282 LIRGeneratorShared::useAtStart(MDefinition *mir)
michael@0 283 {
michael@0 284 return use(mir, LUse(LUse::ANY, true));
michael@0 285 }
michael@0 286
michael@0 287 LAllocation
michael@0 288 LIRGeneratorShared::useOrConstant(MDefinition *mir)
michael@0 289 {
michael@0 290 if (mir->isConstant())
michael@0 291 return LAllocation(mir->toConstant()->vp());
michael@0 292 return use(mir);
michael@0 293 }
michael@0 294
michael@0 295 LAllocation
michael@0 296 LIRGeneratorShared::useRegisterOrConstant(MDefinition *mir)
michael@0 297 {
michael@0 298 if (mir->isConstant())
michael@0 299 return LAllocation(mir->toConstant()->vp());
michael@0 300 return useRegister(mir);
michael@0 301 }
michael@0 302
michael@0 303 LAllocation
michael@0 304 LIRGeneratorShared::useRegisterOrConstantAtStart(MDefinition *mir)
michael@0 305 {
michael@0 306 if (mir->isConstant())
michael@0 307 return LAllocation(mir->toConstant()->vp());
michael@0 308 return useRegisterAtStart(mir);
michael@0 309 }
michael@0 310
michael@0 311 LAllocation
michael@0 312 LIRGeneratorShared::useRegisterOrNonNegativeConstantAtStart(MDefinition *mir)
michael@0 313 {
michael@0 314 if (mir->isConstant() && mir->toConstant()->value().toInt32() >= 0)
michael@0 315 return LAllocation(mir->toConstant()->vp());
michael@0 316 return useRegisterAtStart(mir);
michael@0 317 }
michael@0 318
michael@0 319 LAllocation
michael@0 320 LIRGeneratorShared::useRegisterOrNonDoubleConstant(MDefinition *mir)
michael@0 321 {
michael@0 322 if (mir->isConstant() && mir->type() != MIRType_Double && mir->type() != MIRType_Float32)
michael@0 323 return LAllocation(mir->toConstant()->vp());
michael@0 324 return useRegister(mir);
michael@0 325 }
michael@0 326
michael@0 327 #if defined(JS_CODEGEN_ARM)
michael@0 328 LAllocation
michael@0 329 LIRGeneratorShared::useAnyOrConstant(MDefinition *mir)
michael@0 330 {
michael@0 331 return useRegisterOrConstant(mir);
michael@0 332 }
michael@0 333 LAllocation
michael@0 334 LIRGeneratorShared::useStorable(MDefinition *mir)
michael@0 335 {
michael@0 336 return useRegister(mir);
michael@0 337 }
michael@0 338 LAllocation
michael@0 339 LIRGeneratorShared::useStorableAtStart(MDefinition *mir)
michael@0 340 {
michael@0 341 return useRegisterAtStart(mir);
michael@0 342 }
michael@0 343
michael@0 344 LAllocation
michael@0 345 LIRGeneratorShared::useAny(MDefinition *mir)
michael@0 346 {
michael@0 347 return useRegister(mir);
michael@0 348 }
michael@0 349 #else
michael@0 350 LAllocation
michael@0 351 LIRGeneratorShared::useAnyOrConstant(MDefinition *mir)
michael@0 352 {
michael@0 353 return useOrConstant(mir);
michael@0 354 }
michael@0 355
michael@0 356 LAllocation
michael@0 357 LIRGeneratorShared::useAny(MDefinition *mir)
michael@0 358 {
michael@0 359 return use(mir);
michael@0 360 }
michael@0 361 LAllocation
michael@0 362 LIRGeneratorShared::useStorable(MDefinition *mir)
michael@0 363 {
michael@0 364 return useRegisterOrConstant(mir);
michael@0 365 }
michael@0 366 LAllocation
michael@0 367 LIRGeneratorShared::useStorableAtStart(MDefinition *mir)
michael@0 368 {
michael@0 369 return useRegisterOrConstantAtStart(mir);
michael@0 370 }
michael@0 371
michael@0 372 #endif
michael@0 373
michael@0 374 LAllocation
michael@0 375 LIRGeneratorShared::useKeepaliveOrConstant(MDefinition *mir)
michael@0 376 {
michael@0 377 if (mir->isConstant())
michael@0 378 return LAllocation(mir->toConstant()->vp());
michael@0 379 return use(mir, LUse(LUse::KEEPALIVE));
michael@0 380 }
michael@0 381
michael@0 382 LUse
michael@0 383 LIRGeneratorShared::useFixed(MDefinition *mir, Register reg)
michael@0 384 {
michael@0 385 return use(mir, LUse(reg));
michael@0 386 }
michael@0 387
michael@0 388 LUse
michael@0 389 LIRGeneratorShared::useFixedAtStart(MDefinition *mir, Register reg)
michael@0 390 {
michael@0 391 return use(mir, LUse(reg, true));
michael@0 392 }
michael@0 393
michael@0 394 LUse
michael@0 395 LIRGeneratorShared::useFixed(MDefinition *mir, FloatRegister reg)
michael@0 396 {
michael@0 397 return use(mir, LUse(reg));
michael@0 398 }
michael@0 399
michael@0 400 LUse
michael@0 401 LIRGeneratorShared::useFixed(MDefinition *mir, AnyRegister reg)
michael@0 402 {
michael@0 403 return reg.isFloat() ? use(mir, reg.fpu()) : use(mir, reg.gpr());
michael@0 404 }
michael@0 405
michael@0 406 LDefinition
michael@0 407 LIRGeneratorShared::temp(LDefinition::Type type, LDefinition::Policy policy)
michael@0 408 {
michael@0 409 uint32_t vreg = getVirtualRegister();
michael@0 410 if (vreg >= MAX_VIRTUAL_REGISTERS) {
michael@0 411 gen->abort("max virtual registers");
michael@0 412 return LDefinition();
michael@0 413 }
michael@0 414 return LDefinition(vreg, type, policy);
michael@0 415 }
michael@0 416
michael@0 417 LDefinition
michael@0 418 LIRGeneratorShared::tempFixed(Register reg)
michael@0 419 {
michael@0 420 LDefinition t = temp(LDefinition::GENERAL);
michael@0 421 t.setOutput(LGeneralReg(reg));
michael@0 422 return t;
michael@0 423 }
michael@0 424
michael@0 425 LDefinition
michael@0 426 LIRGeneratorShared::tempFloat32()
michael@0 427 {
michael@0 428 return temp(LDefinition::FLOAT32);
michael@0 429 }
michael@0 430
michael@0 431 LDefinition
michael@0 432 LIRGeneratorShared::tempDouble()
michael@0 433 {
michael@0 434 return temp(LDefinition::DOUBLE);
michael@0 435 }
michael@0 436
michael@0 437 LDefinition
michael@0 438 LIRGeneratorShared::tempCopy(MDefinition *input, uint32_t reusedInput)
michael@0 439 {
michael@0 440 JS_ASSERT(input->virtualRegister());
michael@0 441 LDefinition t = temp(LDefinition::TypeFrom(input->type()), LDefinition::MUST_REUSE_INPUT);
michael@0 442 t.setReusedInput(reusedInput);
michael@0 443 return t;
michael@0 444 }
michael@0 445
michael@0 446 template <typename T> void
michael@0 447 LIRGeneratorShared::annotate(T *ins)
michael@0 448 {
michael@0 449 ins->setId(lirGraph_.getInstructionId());
michael@0 450 }
michael@0 451
michael@0 452 template <typename T> bool
michael@0 453 LIRGeneratorShared::add(T *ins, MInstruction *mir)
michael@0 454 {
michael@0 455 JS_ASSERT(!ins->isPhi());
michael@0 456 current->add(ins);
michael@0 457 if (mir) {
michael@0 458 JS_ASSERT(current == mir->block()->lir());
michael@0 459 ins->setMir(mir);
michael@0 460 }
michael@0 461 annotate(ins);
michael@0 462 return true;
michael@0 463 }
michael@0 464
michael@0 465 #ifdef JS_NUNBOX32
michael@0 466 // Returns the virtual register of a js::Value-defining instruction. This is
michael@0 467 // abstracted because MBox is a special value-returning instruction that
michael@0 468 // redefines its input payload if its input is not constant. Therefore, it is
michael@0 469 // illegal to request a box's payload by adding VREG_DATA_OFFSET to its raw id.
michael@0 470 static inline uint32_t
michael@0 471 VirtualRegisterOfPayload(MDefinition *mir)
michael@0 472 {
michael@0 473 if (mir->isBox()) {
michael@0 474 MDefinition *inner = mir->toBox()->getOperand(0);
michael@0 475 if (!inner->isConstant() && inner->type() != MIRType_Double && inner->type() != MIRType_Float32)
michael@0 476 return inner->virtualRegister();
michael@0 477 }
michael@0 478 if (mir->isTypeBarrier())
michael@0 479 return VirtualRegisterOfPayload(mir->getOperand(0));
michael@0 480 return mir->virtualRegister() + VREG_DATA_OFFSET;
michael@0 481 }
michael@0 482
michael@0 483 // Note: always call ensureDefined before calling useType/usePayload,
michael@0 484 // so that emitted-at-use operands are handled correctly.
michael@0 485 LUse
michael@0 486 LIRGeneratorShared::useType(MDefinition *mir, LUse::Policy policy)
michael@0 487 {
michael@0 488 JS_ASSERT(mir->type() == MIRType_Value);
michael@0 489
michael@0 490 return LUse(mir->virtualRegister() + VREG_TYPE_OFFSET, policy);
michael@0 491 }
michael@0 492
michael@0 493 LUse
michael@0 494 LIRGeneratorShared::usePayload(MDefinition *mir, LUse::Policy policy)
michael@0 495 {
michael@0 496 JS_ASSERT(mir->type() == MIRType_Value);
michael@0 497
michael@0 498 return LUse(VirtualRegisterOfPayload(mir), policy);
michael@0 499 }
michael@0 500
michael@0 501 LUse
michael@0 502 LIRGeneratorShared::usePayloadAtStart(MDefinition *mir, LUse::Policy policy)
michael@0 503 {
michael@0 504 JS_ASSERT(mir->type() == MIRType_Value);
michael@0 505
michael@0 506 return LUse(VirtualRegisterOfPayload(mir), policy, true);
michael@0 507 }
michael@0 508
michael@0 509 LUse
michael@0 510 LIRGeneratorShared::usePayloadInRegisterAtStart(MDefinition *mir)
michael@0 511 {
michael@0 512 return usePayloadAtStart(mir, LUse::REGISTER);
michael@0 513 }
michael@0 514
michael@0 515 bool
michael@0 516 LIRGeneratorShared::fillBoxUses(LInstruction *lir, size_t n, MDefinition *mir)
michael@0 517 {
michael@0 518 if (!ensureDefined(mir))
michael@0 519 return false;
michael@0 520 lir->getOperand(n)->toUse()->setVirtualRegister(mir->virtualRegister() + VREG_TYPE_OFFSET);
michael@0 521 lir->getOperand(n + 1)->toUse()->setVirtualRegister(VirtualRegisterOfPayload(mir));
michael@0 522 return true;
michael@0 523 }
michael@0 524 #endif
michael@0 525
michael@0 526 } // namespace jit
michael@0 527 } // namespace js
michael@0 528
michael@0 529 #endif /* jit_shared_Lowering_shared_inl_h */

mercurial