Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 } | 313 } |
| 314 | 314 |
| 315 | 315 |
| 316 bool LCodeGen::IsTaggedConstant(LConstantOperand* op) const { | 316 bool LCodeGen::IsTaggedConstant(LConstantOperand* op) const { |
| 317 return op->IsConstantOperand() && | 317 return op->IsConstantOperand() && |
| 318 chunk_->LookupLiteralRepresentation(op).IsTagged(); | 318 chunk_->LookupLiteralRepresentation(op).IsTagged(); |
| 319 } | 319 } |
| 320 | 320 |
| 321 | 321 |
| 322 int LCodeGen::ToInteger32(LConstantOperand* op) const { | 322 int LCodeGen::ToInteger32(LConstantOperand* op) const { |
| 323 Handle<Object> value = chunk_->LookupLiteral(op); | 323 HConstant* constant = chunk_->LookupLiteral(op); |
| 324 ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32()); | 324 ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32()); |
| 325 ASSERT(static_cast<double>(static_cast<int32_t>(value->Number())) == | 325 ASSERT(constant->HasInteger32Value()); |
| 326 value->Number()); | 326 return constant->Integer32Value(); |
| 327 return static_cast<int32_t>(value->Number()); | |
| 328 } | 327 } |
| 329 | 328 |
| 330 | 329 |
| 331 double LCodeGen::ToDouble(LConstantOperand* op) const { | 330 double LCodeGen::ToDouble(LConstantOperand* op) const { |
| 332 Handle<Object> value = chunk_->LookupLiteral(op); | 331 HConstant* value = chunk_->LookupLiteral(op); |
| 333 return value->Number(); | 332 ASSERT(value->HasDoubleValue()); |
| 333 return value->DoubleValue(); | |
| 334 } | 334 } |
| 335 | 335 |
| 336 | 336 |
| 337 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 337 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
| 338 Handle<Object> literal = chunk_->LookupLiteral(op); | 338 HConstant* constant = chunk_->LookupLiteral(op); |
| 339 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); | 339 ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged()); |
| 340 return literal; | 340 return constant->handle(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 | 343 |
| 344 Operand LCodeGen::ToOperand(LOperand* op) const { | 344 Operand LCodeGen::ToOperand(LOperand* op) const { |
| 345 // Does not handle registers. In X64 assembler, plain registers are not | 345 // Does not handle registers. In X64 assembler, plain registers are not |
| 346 // representable as an Operand. | 346 // representable as an Operand. |
| 347 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); | 347 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 348 int index = op->index(); | 348 int index = op->index(); |
| 349 if (index >= 0) { | 349 if (index >= 0) { |
| 350 // Local or spill slot. Skip the frame pointer, function, and | 350 // Local or spill slot. Skip the frame pointer, function, and |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 Register reg = ToRegister(op); | 435 Register reg = ToRegister(op); |
| 436 if (is_tagged) { | 436 if (is_tagged) { |
| 437 translation->StoreRegister(reg); | 437 translation->StoreRegister(reg); |
| 438 } else { | 438 } else { |
| 439 translation->StoreInt32Register(reg); | 439 translation->StoreInt32Register(reg); |
| 440 } | 440 } |
| 441 } else if (op->IsDoubleRegister()) { | 441 } else if (op->IsDoubleRegister()) { |
| 442 XMMRegister reg = ToDoubleRegister(op); | 442 XMMRegister reg = ToDoubleRegister(op); |
| 443 translation->StoreDoubleRegister(reg); | 443 translation->StoreDoubleRegister(reg); |
| 444 } else if (op->IsConstantOperand()) { | 444 } else if (op->IsConstantOperand()) { |
| 445 Handle<Object> literal = chunk()->LookupLiteral(LConstantOperand::cast(op)); | 445 HConstant* literal = chunk()->LookupLiteral(LConstantOperand::cast(op)); |
|
Michael Starzinger
2012/07/09 09:57:09
Better rename that local variable to "constant".
sanjoy
2012/07/09 13:47:37
Done. Also renamed LookupLiteral to LookupConstan
| |
| 446 int src_index = DefineDeoptimizationLiteral(literal); | 446 int src_index = DefineDeoptimizationLiteral(literal->handle()); |
| 447 translation->StoreLiteral(src_index); | 447 translation->StoreLiteral(src_index); |
| 448 } else { | 448 } else { |
| 449 UNREACHABLE(); | 449 UNREACHABLE(); |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 void LCodeGen::CallCodeGeneric(Handle<Code> code, | 454 void LCodeGen::CallCodeGeneric(Handle<Code> code, |
| 455 RelocInfo::Mode mode, | 455 RelocInfo::Mode mode, |
| 456 LInstruction* instr, | 456 LInstruction* instr, |
| (...skipping 4591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5048 FixedArray::kHeaderSize - kPointerSize)); | 5048 FixedArray::kHeaderSize - kPointerSize)); |
| 5049 __ bind(&done); | 5049 __ bind(&done); |
| 5050 } | 5050 } |
| 5051 | 5051 |
| 5052 | 5052 |
| 5053 #undef __ | 5053 #undef __ |
| 5054 | 5054 |
| 5055 } } // namespace v8::internal | 5055 } } // namespace v8::internal |
| 5056 | 5056 |
| 5057 #endif // V8_TARGET_ARCH_X64 | 5057 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |